-
Notifications
You must be signed in to change notification settings - Fork 20
Use an existing spice text file for a subcircuit
StefanSchippers edited this page Jan 8, 2024
·
2 revisions
If you have for example the following definition in a file, say symbol_include.cir
:
* example of a subcircuit contained in a file
.subckt symbol_include Z VCC VSS
+ A B C W=10 L=1
...
...
.ends
You can use this file to get the spice netlist port order:
In the following testbench:
the symbol is defined as follows:
When netlisting the testbench the port order (the @pinlist in the format
string)
of the x1
instance call will match the order in the file symbol_include.cir
:
** sch_path: /home/schippes/.xschem/xschem_library/symbol_include/tb_symbol_include.sch
**.subckt tb_symbol_include XZ XVSS XVCC XC XB XA
*.opin XZ
*.ipin XVSS
*.ipin XVCC
*.ipin XC
*.ipin XB
*.ipin XA
x1 XZ XVCC XVSS XA XB XC symbol_include
**.ends
* expanding symbol: symbol_include.sym # of pins=6
** sym_path: /home/schippes/.xschem/xschem_library/symbol_include/symbol_include.sym
.include symbol_include.cir
.end
A final note, the spice_sym_def
does not necessarily need to use a .include line. You can directly define the subcircuit:
spice_sym_def="
.subckt symbol_include Z VCC VSS
+ A B C
...
...
.ends
"