Hi <@U01819B63HP>, Xschem is not writing the `X` o...
# xschem
a
Hi @Stefan Schippers, Xschem is not writing the
X
on the devices when extracting a netlist for lvs. In the example, the
lvs.sh
script uses netgen to perform it but fails. When `sed`is used to add the
X
on schematic netlist, netgen works. I've found that to perform lvs with magic the netlist extracted by xschem should use X prefix, while klayout don't. Can magic be configured in a way to avoid using X prefix?
s
If multiple LVS tools (Netgen and Klayout) need different netlists another netlisting rule can be added to the symbols. Currently gf180mcu symbols have a
format
attribute that defines the spice netlist for simulation and (when needed) a
lvs_format
for Layout vs Schematic checking (for example avoiding some parameters and the X prefix). The LVS netlist option in xschem Simuation menu does two things: • set a tcl
lvs_netlist
variable to true. This will uncomment the toplevel
.subckt
and .
ends
lines (for simulation these top subckt wrapper lines must be commented). • do the command
xschem set format lvs_format
. This instructs the xschem netlister to use the
lvs_format
attribute in the symbols (if existing) for LVS checking. Nothing prevents from adding a
netgen_format
and do a
set format netgen_format
before doing the netlist for netgen. Recommended solution Another (better) clever option is to add
@spiceprefix
in front of the
lvs_format
definition of all gf180mcu symbols. Xschem has the option
Simulation->LVS->Use spiceprefix
attribute to enable or not this prefix.
t
It's possible to write an extraction style for magic that outputs the SPICE component types instead of subcircuits, but I don't like doing so because (1) such a netlist is not simulatable, and (2) it's another set of correspondences which needs to be maintained and debugged.
a
Hi Stefan, I don't think that the problem is on the symbols because they have the spiceprefix=X on the definition. When
set lvs_netlist 1
is used, the X dissapears and I don't know why.
Copy code
$ rm nmos5f_prefix.spice
$ xschem --rcfile xschemrc -r --netlist --no_x --quit \
        --netlist_path . \
        --netlist_filename nmos5f_prefix.spice \
        --preinit 'set lvs_netlist 0' \
        nmos5f.sch
$ cat nmos5f_prefix.spice

** sch_path: /workspaces/ic-makefile/samples/nmos5f/spiceprefix-not-working/nmos5f.sch
**.subckt nmos5f D S G
*.iopin D
*.iopin S
*.iopin G
XM2 D G S S nfet_03v3 L=0.7u W=5u nf=1 ad='int((nf+1)/2) * W/nf * 0.18u' as='int((nf+2)/2) * W/nf * 0.18u' pd='2*int((nf+1)/2) * (W/nf + 0.18u)'
+ ps='2*int((nf+2)/2) * (W/nf + 0.18u)' nrd='0.18u / W' nrs='0.18u / W' sa=0 sb=0 sd=0 m=1
**.ends
.end

-----

$ rm nmos5f_prefix.spice
$ xschem --rcfile xschemrc -r --netlist --no_x --quit \
        --netlist_path . \
        --netlist_filename nmos5f_prefix.spice \
        --preinit 'set lvs_netlist 1' \
        nmos5f.sch
# cat nmos5f_prefix.spice
** sch_path: /workspaces/ic-makefile/samples/nmos5f/spiceprefix-not-working/nmos5f.sch
.subckt nmos5f D S G
*.PININFO D:B S:B G:B
M2 D G S S nfet_03v3 L=0.7u W=5u nf=1 m=1
.ends
.end
s
thanks @Tim Edwards I think this makes sense and I believe the best 'fit all' option is to add
@spiceprefix
in front of the
lvs_format
attribute (as it is for regular spice sim
format
) so it can be enabled or disabled simply by the LVS submenu. @aquiles viza the gf180mcu MOS symbols do have the
@spiceprefix
on the
format
attribute but not on the
lvs_format
. I added the
@spiceprefix
in image above to verify it works.
Copy code
type=nmos
format="@spiceprefix@name @pinlist @model L=@L W=@W
+ nf=@nf ad=@ad as=@as pd=@pd ps=@ps
+ nrd=@nrd nrs=@nrs sa=@sa sb=@sb sd=@sd
+ m=@m"
lvs_format="@name @pinlist @model L=@L W=@W nf=@nf m=@m"
template="name=M1
L=0.28u
W=0.22u
nf=1
m=1
ad=\\"'int((nf+1)/2) * W/nf * 0.18u'\\"
pd=\\"'2*int((nf+1)/2) * (W/nf + 0.18u)'\\"
as=\\"'int((nf+2)/2) * W/nf * 0.18u'\\"
ps=\\"'2*int((nf+2)/2) * (W/nf + 0.18u)'\\"
nrd=\\"'0.18u / W'\\" nrs=\\"'0.18u / W'\\"
sa=0 sb=0 sd=0
model=nfet_03v3
spiceprefix=X
a
I've tested with xschem 3.4.4 and 3.4.5 and both have different behaviours. The first output was from xschem 3.4.5, The following is from xschem 3.4.4
Copy code
$ rm nmos5f_prefix.spice
$ xschem --rcfile xschemrc -r --netlist --no_x --quit \
        --netlist_path . \
        --netlist_filename nmos5f_prefix.spice \
        --preinit 'set lvs_netlist 0' \
        nmos5f.sch
$ cat nmos5f_prefix.spice

** sch_path: /workspaces/ic-makefile/samples/nmos5f/spiceprefix-not-working/nmos5f.sch
**.subckt nmos5f D S G
*.iopin D
*.iopin S
*.iopin G
XM2 D G S S nfet_03v3 L=0.7u W=5u nf=1 ad='int((nf+1)/2) * W/nf * 0.18u' as='int((nf+2)/2) * W/nf * 0.18u'
+ pd='2*int((nf+1)/2) * (W/nf + 0.18u)' ps='2*int((nf+2)/2) * (W/nf + 0.18u)' nrd='0.18u / W' nrs='0.18u / W'
+ sa=0 sb=0 sd=0 m=1
**.ends
.end

--------

$ rm nmos5f_prefix.spice
$ xschem --rcfile xschemrc -r --netlist --no_x --quit \
        --netlist_path . \
        --netlist_filename nmos5f_prefix.spice \
        --preinit 'set lvs_netlist 1' \
        nmos5f.sch
$ cat nmos5f_prefix.spice

** sch_path: /workspaces/ic-makefile/samples/nmos5f/spiceprefix-not-working/nmos5f.sch
.subckt nmos5f D S G
*.PININFO D:B S:B G:B
XM2 D G S S nfet_03v3 L=0.7u W=5u nf=1 ad='int((nf+1)/2) * W/nf * 0.18u' as='int((nf+2)/2) * W/nf * 0.18u'
+ pd='2*int((nf+1)/2) * (W/nf + 0.18u)' ps='2*int((nf+2)/2) * (W/nf + 0.18u)' nrd='0.18u / W' nrs='0.18u / W'
+ sa=0 sb=0 sd=0 m=1
.ends
.end
This was the expected behaviour. But I think is right to be more explicit adding the lvs_format attribute.