Tim Edwards
10/11/2021, 8:51 PMcode_shown.sym
box needs to be updated to reflect the fact that xschem can use variable names for the PDK path. It should be .lib \\$::SKYWATER_MODELS\\/sky130.lib.spice tt
and the include line for the standard cell library should be similar.Christoph Maier
10/11/2021, 10:13 PMsky130.lib.spice
and sky130_fd_sc_hvl.spice
versions to choose from.
What's the intended path, after OpenLane make native-full-pdk
?
Can you make your implicit assumptions where (i.e. at what level in the file hierarchy) SKYWATER_MODELS
and SKYWATER_STDCELLS
are supposed to point explicit?
Are the escape character and variable substitution rules identical in code_shown.sym
and code.sym
?
I stil have "File not found" problems where there shouldn't be any.Christoph Maier
10/11/2021, 10:44 PMcode_shown.sym
includes the line (which isnt' shown in the schematic): format="tcleval( @value )"
, without which the substitutions won't work, no matter how the backslash character needs to be escaped (which is also an undocumented implicit assumption).
It seems that I'm getting there, but this interplay of undocumented implicit assumptions at different levels of abstraction from the actual silicon that matters leads to the question:
What does it take to implement an analog design on mpw3 that avoids these abstraction layers altogether, i.e., that treats anything in the caravan frame except the dedicated analog I/O pads, which is susceptible to undocumented mutual side effects of a deep stack of abstraction layers, as dead silicon?Tim Edwards
10/12/2021, 12:55 AMSKYWATER_MODELS
and SKYWATER_STDCELLS
are defined in xschemrc
which after an open_pdks installation can be found in libs.tech/xschem/
. The problem is what to do with the xschemrc
file; a symbolic link to it would be hard-coded to the open_pdks install path, and copying it to the local directory would just mean that the definitions in it are hard-coded to the open_pdks install path. The best solution, which is being used by some tools like magic
and openlane
is to assume an environment variable PDKROOT
or PDKPATH
(PDKROOT
is defined as the directory level above PDKPATH
), but not to assume that it is defined; to set those environment variables by default to the local installation of the PDK, but to always allow them to be overridden by the OS environment. So that to work with anybody else's project imported into your own local environment, all you need to do is to export PDKPATH=
. Given that SPICE netlists are not design-level files, ngspice shouldn't have to follow this methodology, but xschem should. Since xschemrc
is just Tcl, I guess it just needs a more sophisticated way of setting SKYWATER_MODELS
and SKYWATER_STDCELLS
that is like the one used in sky130A.magicrc
, which would be
if {[catch {set PDKPATH $env(PDKPATH)}]} {
set PDKPATH "/usr/share/pdk/sky130A"
}
set SKYWATER_MODELS $PDKPATH/libs.tech/ngspice
set SKYWATER_STDCELLS $PDKPATH/libs.ref/sky130_fd_sc_hd/spice
where the hard-coded /usr/share/pdk/sky130A
in the above is generated by open_pdks at install time. That way, no matter how a project is set up, it should work if you do export PDKPATH=
to point to your local install of the PDK.
I need to make this change both in open_pdks and in caravel_user_project_analog.Tim Edwards
10/12/2021, 1:47 AMPDKPATH
defined in the environment if sky130A is installed somewhere other than /usr/share/pdk/sky130A
. I still need to correct the open_pdks repository, but since the caravel user project has its own copy of xschemrc
, it wouldn't be affected by that.yrrapt
10/12/2021, 6:15 AMChristoph Maier
10/12/2021, 7:22 PMStefan Schippers
10/15/2021, 2:22 AMStefan Schippers
10/15/2021, 3:34 AMcode.sym
block (or code_shown.sym
, they are equivalent, latter one shows the value
string in schematic), this has a value attribute that is dumped verbatim to the netlist. Xschem components can have any number of attribute=value
assignments, for example a code block has a name
attribute (just a unique ID in the design) and a value
attribute. You can edit the whole attribute string, however note that some special characters must be escaped , like in:
name=s1 value=".control
.tran 1n 100n
plot v(\"data[4]\")
.endc"
the quotes in the plot line must be escaped to avoid interpreting them as a close quote of the value attribute.
However you can set the Edit Attr
selector to '`value`' in the edit attributes dialog and you will be editing the part inside the quotes of the value attribute. if you write quotes xschem will do the escaping automatically.
In the picture you see an example. Why is the $ character escaped? because $ is used internally by xshem to do parameter substitution. If a component has a foo=bar
attribute and the symbol has $foo
in the format
attribute (format specifies what goes in the netlist) the $foo
becomes bar
. However if format
string contains \$foo
then netlist will contain $foo
. Moreover in the picture the component redefines `format`: the symbol default is format=@value
, meaning the value
attribute goes directly in the netlist. The redefinition specifies tcleval(@value )
so before putting value
in the netlist the whole string is evaluated by the tcl interpreter. So if $foo
is encountered it is replaced with the value of the foo
tcl global variable.
you have seen xschem has 2 substitution characters, $ and @.
$foo
expands to bar
if instance has a foo=bar
attribute or just foo
if no such attribute assignment is found. @foo
expands to bar
if instance assigns it to bar
or the empty string if no such assignment exists.
When a code.sym
block has the right attributes set and the final netlist has the right .lib /.include statements for ngspice to find spice models, you should just copy/paste this instance in all designs you work with.
This is a bit of xschem internals to understand how the assignments in the dialog shown in picture work. In this case the SKYWATER_MODELS
global tcl variable is expanded by tcl. This variable is set in the xschemrc init file, typically.
As a result of all this mechanisms if user A creates a schematic and sends this schematic to user B (together with all custom symbols and sub-schematics if any) User B should be able to simulate the design without any changes, provided he sets the correct paths in his xschemrc
file.Christoph Maier
10/17/2021, 2:20 PMChristoph Maier
10/17/2021, 2:32 PMStefan Schippers
10/17/2021, 10:27 PMChristoph Maier
10/17/2021, 10:32 PMuser_analog_proj_example.mag
and example_por.mag
in caravel_user_proj_analog/mag
.
On schematic level (no corner or Monte Carlo analyses yet), xschem
and ngspice
already play nicely with each other, so @Stefan Schippers, you're already a part of the solution, not the problem 😉Stefan Schippers
10/17/2021, 10:38 PMChristoph Maier
10/17/2021, 10:43 PM