Hello everyone. I'm facing some issues when trying...
# xyce
m
Hello everyone. I'm facing some issues when trying to simulate a minimal sky130 design with Xyce, and I would highly appreciate your help. I started with a minimal example shown below. With just X2 and X3, Xyce runs through without errors. However, once I add the parameterized transistors X2 and X3 (copied from
sky130_ef_sc_hd__decap_12
), Xyce fails and reports unrecognized symbols. SPICE file:
Copy code
XyceDemo
.lib /home/user/.volare/sky130A/libs.tech/ngspice/sky130.lib.spice tt
Xinv Y A VPWR VGND VGND VPWR inverter

.subckt inverter Y A NWELL VSUBS VGND VPWR
X0 VPWR VGND VPWR NWELL sky130_fd_pr__pfet_01v8_hvt ad=4.524e+11p pd=4.52e+06u as=0p ps=0u w=870000u l=4.73e+06u
X1 VGND VPWR VGND VSUBS sky130_fd_pr__nfet_01v8 ad=2.86e+11p pd=3.24e+06u as=0p ps=0u w=550000u l=4.73e+06u
X2 Y A VPWR NWELL sky130_fd_pr__pfet_01v8 w=1e+06u l=150000u
X3 Y A VGND VSUBS sky130_fd_pr__nfet_01v8 w=650000u l=150000u
.ends

Vgnd VGND 0 0
Vdd VPWR VGND 1.8
Vin A VGND pulse(0 1.8 1p 10p 10p 1n 2n)
.tran 10e-12 2e-09 0e-00
.end
Error:
Copy code
Netlist error in file
 /home/user/.volare/sky130A/libs.tech/ngspice/corners/../../../libs.ref/sky130_fd_pr/spice/sky130_fd_pr__nfet_01v8__tt.pm3.spice
 at or near line 31
 Parameter AS for device MSKY130_FD_PR__NFET_01V8 contains unrecognized
 symbol: AS
Netlist error in file
 /home/user/.volare/sky130A/libs.tech/ngspice/corners/../../../libs.ref/sky130_fd_pr/spice/sky130_fd_pr__nfet_01v8__tt.pm3.spice
 at or near line 31
 Parameter AD for device MSKY130_FD_PR__NFET_01V8 contains unrecognized
 symbol: AD
...
Lines 28-34 in `.../sky130_fd_pr/spice/sky130_fd_pr__nfet_01v8__tt.pm3.spice`:
Copy code
.subckt  sky130_fd_pr__nfet_01v8 d g s b
+ 
.param  l = 1 w = 1 nf = 1.0 ad = 0 as = 0 pd = 0 ps = 0 nrd = 0 nrs = 0 sa = 0 sb = 0 sd = 0 mult = 1
msky130_fd_pr__nfet_01v8 d g s b sky130_fd_pr__nfet_01v8__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}
.model sky130_fd_pr__nfet_01v8__model.0 nmos
* Model Flag Parameters
+ lmin = 2.0e-05 lmax = 0.0001 wmin = 7.0e-06 wmax = 0.0001
It looks as if the first occurrence of an explicit parameter overwrites the default ones that can then not be found for any subsequent instantiation. When I instantiate X2 and X3 before X0 and X1 it works.
t
@Eric Keiter: Any comment on this? I haven't seen it before because xschem and magic both produce netlists where every device has an explicit list of AD, AS, PD, PS. But I would agree with Meinhard's observation of the Xyce bug. The order of subcircuits in a netlist should not affect the outcome.
e
@Meinhard Kissich and @Tim Edwards. I am looking this over now; I am not sure (yet) what is going on. I’ll report back once I’ve figure out something coherent to say. I agree the order shouldn’t matter.
I have reproduced the behavior that you describe. Each of the 4 subcircuit invocations (X0, X1, X2, X3) will run OK by themselves. But some combinations will not. That does seem to be a bug, but I’m not sure yet why it is happening. We have a LOT of subciruit tests in our regression suite, so it is always a little surprising at this point when an issue like this happens. But, I’ll dig into it.
@Meinhard Kissich and @Tim Edwards I was stuck in meetings yesterday but have time today to work on this. I’ve managed to reproduce the problem in an even simpler circuit that doesn’t involve the Skywater PDK files. I am pretty sure I know what is going on, so I hope to get this fixed soon. If curious, here is my very simple example:
Simple example demonstrating subcircuit parameter error Xtest 1 0 testSubckt * error happens if the X3 line specifies any parameters, such as “bogus” .subckt testSubckt A B X1 A B sub1 bogus=2.0 rvalue=1.0 X3 A B sub1 bogus=3.0 .ends .subckt sub1 A B .param rvalue=10.0 bogus=1.0 R A B {rvalue} .ends Vtest 1 0 1.0 .op .end
m
@Eric Keiter and @Tim Edwards, thank you for taking the time to reproduce the issue and investigate it. I highly appreciate it and will follow along.
e
I think I have found the problem. During the resolution of subcircuits, there are containers of parameters associated with the subcircuit definition, and there are also containers of parameters associated with the specific subcircuit instance. In one spot in the parser, I got these two mixed up. So, when a parameter got resolved, it should have been deleted from the “instance” container, but instead it got deleted from the “definition” container. Anyway, the nice thing is, this is very easy to fix. I am surprised this did not come up before now.
t
Good to know it's an easy fix!
m
Great, that's good to hear. I'm looking forward to testing it on my design, and I'll watch GitHub. Thanks again.
e
I think I have fixed the issue, and I have pushed my fix to our internal repository. We synchronize with the public github repo roughly every 3 weeks. The most recent synch was on Monday, so we’re a little over 2 weeks away from the next one.
If you need it earlier than that I could probably post a patch here, as the changes are all in one function. But it is probably cleaner to wait for the next synchronization.
1