<@U01819B63HP>: I was asked today how to export a...
# xschem
t
@Stefan Schippers: I was asked today how to export a graph---just the graph---from xschem. I found a roundabout way to do it, but it's a bit of a hack. I found that the graph will load from any raw file that has the same name as the schematic. So I created a new empty schematic named, say, "graph_test", placed just a single graph in it, copied the raw file to "graph_test.raw", loaded the data, configured the graph to what I wanted, and exported it. Did I miss some more direct way to do that? If there isn't a more direct way to do it, could you please add such a method? How about the ability to title the graph? (The ultimate export would be a dump of all the data into a python script that then configures itself to the contents of the graph using matplotlib, but that's probably asking way too much. . .).
s
@Tim Edwards if using scripts the command in xschem to load a raw file is:
xschem raw_read [file] [sim]
file
is the (binary) raw file
sim
is the analysis to load (ac | tran | dc | ..) if
sim
is unspecified then load the first dataset found. If multiple datasets of the same analysis follow xschem will load them all as multiple runs. A simple procedure can be created to generate a graph in an empty schematic:
Copy code
# procedure to create a graph in an empty xschem window and display waveforms
proc create_graph {rawfile node {analysis tran} {color {4 5 6 7 8 9 10 11 12 13 14}}} {
  # clear window if not already empty
  xschem clear force
  # clear loaded raw file if any
  xschem raw_clear
  # set current layer to graph layer (grey, layer 2)
  xschem set rectcolor 2
  # create a 300x400 rectangle
  xschem rect 0 -300 400 0
  # make it a graph
  xschem setprop rect 2 0 flags graph
  # read a simulation raw file
  xschem raw_read $rawfile $analysis
  # add nodes to display
  xschem setprop rect 2 0 node $node
  # set node colors
  xschem setprop rect 2 0 color $color
  # make xschem display full the graph rectangle
  xschem zoom_full
  # full zoom graph data on x axis
  xschem setprop rect 2 0 fullxzoom
  # full zoom graph data on y axis
  xschem setprop rect 2 0 fullyzoom
  # clear modified flag so we can quit without xschem asking to save changed file.
  xschem set_modify 0
}
Calling it in following way:
create_graph .xschem/simulations/solar_panel.raw {led panel}
does the job. A title can be created by placing a text object. I need to add some helper commands make it easy to do from scripts. (yes , it's a bit embarassing it's not already there!). It is easy then to export as a png image or pdf page from CLI commands.
t
@Stefan Schippers: Very nice helper procedure. It does more or less what I was doing manually, except that this is all automatic and doesn't run up against the behavior that the rawfile and schematic have to have the same name. Thanks for the detailed explanation!
s
@Tim Edwards These questions help me to make the program better. For example there was no CLI command to add text objects (my fault) it is now fixed. I tried also to generate the pdf,
xschem print pdf_full plot.pdf
or the png:
xschem print png plot.png
and works fine. thanks to your comment also added the new
xschem create_text
command for placing titles / text objects in general
m
Hi guys, I am wondering if this "ultimate export" is in-fact possible. Is it possible to export the data from xschem and plot it in python for further (i.e. FFT) processing? I notice that the gaw external viewer can only export images of the graphs, so I am wondering if it is possible to extract the curves directly from the .raw simulation files. Thanks!
b
c
@Boris Murmann how bad is the dependency hell when installing your Little Helper? Stuff like
Copy code
==> WARNING: A newer version of conda exists. <==
    current version: 23.11.0
    latest version: 24.3.0

Please update conda by running

    $ conda update -n base -c conda-forge conda
indicate to me that someone suggests to solve a problem that involves some O(10⁶ bits) of information with libraries and dependencies that suck O(10⁹ bits) of information onto your local storage, with all the hidden state and side effects in these dependencies. Even though a friendly colleague gave me the helpful advice: "Don't look at the restaurant's kitchen,

into a woman's past

, or into an EDA software company's internal code. No design flow is perfect. The database is dark and full of terrors."
I strongly warn against software engineer's attitute „there's an app for that“, because with a software engineering mindset, you are encouraged, even coerced, to ignore that nearly everything that matters is a side effect and, to paraphrase Steve Bannon, flood your code base with unforeseen bugs and side effects. Case in point: You might find a really cozy tenured spot in a place others go for expensive, CO₂-producing vacations, only to find that

it's next to impossible to get any decent beer

there.
🤣 1
s
@Matthew Siyu Chen using xschem to export data from a raw file is certainly not the best option (wtf? a schematic tool do do data processing?), however it is possible. I often use it since it is very fast and I do not need to install a truckload of other stuff. Given this small get_raw_data TCL procedure you can read a raw file and export in a CSV file:
Copy code
xschem -x -q --command '
source scripts/get_raw_data.tcl
write_data \
[get_raw_data $netlist_dir/tb_bandgap_opamp.raw tran {time out diffout_n} 11] \
data.csv
'
this writes nodes
time
(the X axis),
out
and
diffout_n
into a
data.csv
file, extracting info from a `tran`sient simulation in
tb_bandgap_opamp.raw
.
get_raw_data
does the data extraction job, while
write_data
(a xschem available procedure) writes the result into the specified file. The data.csv looks like:
Copy code
time,out,diffout_n
1e-11,0.1182831,0.4711588
1.036514e-11,0.11327989,0.46848608
1.109542e-11,0.10285642,0.46093548
1.2555979e-11,0.083816773,0.44480401
...
...
and can be processed for example with a spreadsheet (not the best option, expecially if you have 1million points, but just to show the process), see image. The good point is that data extraction is extremely fast. the raw file in the example above is 620MBytes (spice binary format) and the whole process to generate
data.csv
takes 1.4 seconds on a laptop All cpu intensive functions in xschem are done in C, while TCL does only the command dispatching.
💡 1
❤️ 1
c
@Stefan Schippers, I like the I do not need to install a truckload of other stuff part very much. That said, if I wanted not only to have graphs with logarithmic axes (for a version where I'm cheating on the x axis, see https://github.com/tatzelbrumm/sky130_cm_ip__biasgen/blob/main/xschem/nfet_g5v0d10v5_gmtest.sch), but visualize noise with the graphs for each individual noise source on a log-log scale in xschem, what would need to be added to • xschem? • xschem documentation?? • user knowledge where to find existing documentation??? At the moment, I still have trouble with logarithmic axes, especially when I want to change their scales.
m
@Stefan Schippers Thank you for the description and for uploading the .tcl file. However, I am running into an issue where the generated .csv file is empty, with only the net titles in the first row. The rest of the rows are empty. What does the
11
signify in the second-to-last line? I am trying a variety of net numbers, net labels, and equations to see if there would be any output in the csv file. I am able to plot all of these in gaw, but the script or commands don't seem to be working. Do you see an issue here? Thanks
c
If I want to try out the script and have sky130A installed through https://github.com/rtimothyedwards/open_pdks, • where would I find https://github.com/StefanSchippers/xschem_sky130/blob/main/scripts/get_raw_data.tcl in my existing installation? • if it's not included, how do I download the script(s) without messing up my existing (still rather precarious) configuration??
s
@Matthew Siyu Chen 11 is the dataset number, this is needed if you run multiple simulations (my example had 100 transient mismatch runs) . dont give this parameter if you have just one simulation run or give 0 (first and only dataset).
@Christoph Maier I uploaded the
get_raw_data.tcl
script today so it will propagate downstream if you update / reinstall the open_pdks. Just copy the file to .../share/pdk/sky130A/libs.tech/xschem/scripts/
c
@Stefan Schippers, given that pretty much everyone but core developers get distracted by the perennial "Does it make Business Sense?" competitive pressure, and you, according to your interview, play _hors compétition_, let's tread really carefully here to avoid different sky130 installations messing each other up. This may look tl;dr, but it's sort of a root cause analysis why you get flooded with discussion forum questions about seeming trivialities (i.e., configuration inconsistencies and undocumented interference of script grammars in different design tools sitting on top of each other), so it might pay off in the not-so-far term to go through this carefully. I started installing bits and pieces of the sky130 design flow in 2021, based on "helpful" information from different sources in different discussion groups. Anyone but core developers have strong incentive to ignore the obvious consequence that documentation-by-discussion-forum leads to an inconsistent mess (and a never ending flood of basic configuration questions keeping the core developers busy and distracted from more important stuff, like, a consistent documentation that makes discussion forums unnecessary). So, the sky130 repository I'm actually using at the moment is
Copy code
~/EDA/OpenLane$ cat pdks/open_pdks/.git/config 
[remote "origin"]
	url = <https://github.com/rtimothyedwards/open_pdks>
	fetch = +refs/heads/*:refs/remotes/origin/*
There's a (probably not related) git repository two steps up in the directory hierarchy:
Copy code
~/EDA/OpenLane$ cat .git/config
[remote "origin"]
	url = <https://github.com/The-OpenROAD-Project/OpenLane.git>
	fetch = +refs/heads/*:refs/remotes/origin/*
Copy code
~/EDA/OpenLane$ cat .gitmodules 
[submodule "designs/ci"]
	path = designs/ci
	url = <https://github.com/efabless/openlane-ci-designs>
and what seems to be a parallel installation
Copy code
~/EDA/OpenLane$ cat pdks/skywater-pdk/.git/config 
[remote "origin"]
	url = <https://github.com/google/skywater-pdk>
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main
[submodule "libraries/sky130_fd_io/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_io/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_io/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_io/v0.1.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_io/v0.2.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_io/v0.2.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_io.git>
[submodule "libraries/sky130_fd_pr/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.0.9"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.10.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.10.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.11.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.12.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.12.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.13.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.20.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_pr/v0.20.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_pr.git>
[submodule "libraries/sky130_fd_sc_hd/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hd.git>
[submodule "libraries/sky130_fd_sc_hd/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hd.git>
[submodule "libraries/sky130_fd_sc_hd/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hd.git>
[submodule "libraries/sky130_fd_sc_hdll/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hdll.git>
[submodule "libraries/sky130_fd_sc_hdll/v0.1.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hdll.git>
[submodule "libraries/sky130_fd_sc_hdll/v0.1.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hdll.git>
[submodule "libraries/sky130_fd_sc_hs/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hs.git>
[submodule "libraries/sky130_fd_sc_hs/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hs.git>
[submodule "libraries/sky130_fd_sc_hs/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hs.git>
[submodule "libraries/sky130_fd_sc_hvl/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hvl.git>
[submodule "libraries/sky130_fd_sc_hvl/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hvl.git>
[submodule "libraries/sky130_fd_sc_hvl/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hvl.git>
[submodule "libraries/sky130_fd_sc_hvl/v0.0.3"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_hvl.git>
[submodule "libraries/sky130_fd_sc_lp/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_lp.git>
[submodule "libraries/sky130_fd_sc_lp/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_lp.git>
[submodule "libraries/sky130_fd_sc_lp/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_lp.git>
[submodule "libraries/sky130_fd_sc_ls/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ls.git>
[submodule "libraries/sky130_fd_sc_ls/v0.1.0"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ls.git>
[submodule "libraries/sky130_fd_sc_ls/v0.1.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ls.git>
[submodule "libraries/sky130_fd_sc_ms/latest"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ms.git>
[submodule "libraries/sky130_fd_sc_ms/v0.0.1"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ms.git>
[submodule "libraries/sky130_fd_sc_ms/v0.0.2"]
	active = true
	url = <https://github.com/google/skywater-pdk-libs-sky130_fd_sc_ms.git>
[submodule "third_party/make-env"]
	active = true
	url = <https://github.com/SymbiFlow/make-env.git>
Now I do find something that looks like your repository
Copy code
~/EDA/OpenLane$ cat pdks/open_pdks/sources/xschem_sky130/.git/config
[remote "origin"]
	url = <https://github.com/StefanSchippers/xschem_sky130>
	fetch = +refs/heads/main:refs/remotes/origin/main
[branch "main"]
	remote = origin
	merge = refs/heads/main
… but how (from where, exactly) do I git pull your repository with the script, so that I don't mess up my PDK installation[s] even further?
s
@Christoph Maier I usually install xschem, ngspice, magic and open_pdks, in this order. I install all with --prefix=$HOME, since I don't want to mess up the system in /usr/local and also have all the tools if I switch the root filesystem for whatever reason. Not needing root privileges for installation is another bonus point. open_pdks will itself pull skywater-pdk, xschem-sky130 and all other needed repositories. I do not use openlane, because I know it is a gigantic package with lot of pythonware, so unless I need to do actual digital designs I prefer to skip that. For open_pdks my configure line is this:
./configure --enable-gf180mcu-pdk --enable-sky130-pdk --prefix=$HOME
then
make
and
make install
❤️ 1
@Christoph Maier I also don't use prepackaged containers, because if something goes wrong the problem is doubled. In addition to the tools themselves you need to investigate the container-packager decisions, In my experience this is more difficult than understanding how the individual tools work.
❤️ 1
c
@Stefan Schippers, thanks! For now, I followed Tim Edwards's installation, and he puts his stuff into
/usr/local/share/
, so while I still have a non-zero chance to get a design in time for the April tapeout, I won't rock that boat. If I really need to export waveforms from SPICE, I probably need to look up the Child's Play (7.7, page 232) I did back in 2000. Somehow, I got ASCII data vectors out of macspice3f4 and imported them into Mathematica.
👀 1
@Stefan Schippers, minor technical nitpick: The problem with different inconsistently documented not-quite-compatible tools doesn't just double, but increases with the number of possibilities of side effects due to incompatible views on reality between individual tools, i.e., the factorial of the number of tools used ! [Ironically, the company using the definition of the factorial for advertisement is the root cause of everything becoming exponentially more difficult]