Stefan Schippers

11/06/2020, 1:25 AM
@User I managed to do this by setting a global tcl var in my xschemrc:
set SKYWATER_MODELS ~/projects/foundry/skywater-pdk/libraries/sky130_fd_pr_ngspice/latest
then you can reference this var in your code element as in this example:
.include \$::SKYWATER_MODELS\/cells/nfet_01v8/sky130_fd_pr__nfet_01v8__tt.corner.spice
some considerations: • the $ character is escaped since it is also used within xschem for (circuit) variable expansion. • the :: means global scope in tcl • the slash after MODELS is also escaped since in xschem slash is not a separator as in many types of netlists slashes are used as net name identifiers (Don't blame me for that! ) • to edit press 'q' and select the 'value' attribute in 'Edit attrs', or (better) press 'Shift-q', this brings up your favorite editor to edit the value attribute. After doing the netlist the path is expanded:
.include ~/projects/foundry/skywater-pdk/libraries/sky130_fd_pr_ngspice/latest/cells/nfet_01v8/sky130_fd_pr__nfet_01v8__tt.corner.spice
I decided to include this variable expansion in xschem since ngspice does not use any environmental variables in .include/.lib lines (and there is no plan to do that afaik). Examples in the xschem_sky130 repo use this variable expansion.