Stefan Schippers
11/04/2022, 1:48 PMtcleval(...) is xschem specific, so do not look into other manuals.
in the example above value is assigned to something that contains a tcl variable SKYWATER_MODELS.
The double backslash escapes $ so it will not have any special meaning to xschem. This is however not needed anymore and a value=.lib $SKYWATER_MODELS/sky130.lib.spice tt will work fine too.
The @ character replaces value with the instance attribute: .lib $SKYWATER_MODELS/sky130.lib.spice tt, however this resulting string is then passed (due to the tcleval(....) wrapper) to tcl so the variable will be substituted. At the end you get something like:
.lib /usr/local/share/pdk/sky130A/libs.tech/ngspice/sky130.lib.spice tt
This is necessary since ngspice does not understand environment variables in netlists.
This works because in sky130 there is a tcl variable set in the xschemrc file:
set SKYWATER_MODELS ${PDK_ROOT}/${PDK}/libs.tech/ngspice
where PDK_ROOT is set to /usr/local/share/pdk and PDK is set to sky130A (or sky130B)
The whole point here is to avoid using absolute paths in xschem since if this is done porting a schematic on a differet computer will likely not work as installation paths for pdks and libraries are system specific.