Hi there, I have extracted my layout of a constant...
# analog-design
j
Hi there, I have extracted my layout of a constant-gm current source and am trying to perform post-extraction simulations. However, I keep running into this error when I try running the simulation. Any advice would be greatly appreciated. Thank you. Attached are photos of the project wrapper and the testbench itself.
t
The ngspice output says that the device has W=0 and L=0. Can you check what's in the netlist? How did you do the extraction?
j
@Tim Edwards We dug through old slack posts and we flattened the design prior to extraction. Here is the extracted netlist.
Now, the simulations are at least running. But the current and voltage at my pins are 0.
Here's a photo of my updated testbench.
Here's our wrapper schematic and testbench files.
t
I also need
user_analog_project_wrapper.sym
. You are matching the pin order in both the extracted layout and the schematic?
j
@Tim Edwards here's the symbol file.
t
The port order doesn't match between the symbol and the extracted netlist.
j
@Tim Edwards is the user_analog_project_wrapper.spice mismatched with the user_analog_project_wrapper.sch's generated spice list?
t
The schematic symbol will output ports in the order they are given in the symbol file. Magic will output ports according to the way they are numbered.
j
We're slightly confused. We did the layout in the caravan wrapper and instantiated our constant-gm circuit into this wrapper (aka the pad ring). Do we have to label the pads on the pad rings as ports?
I apologize once again for this inconvenience but we new to this/Magic.
We made sure to LVS (it was LVS clean).
t
Each extraction tool has to know what order to arrange the ports in. Xschem does this by the order that the signal names appear in the symbol file. Magic does this by port ordering. The original port ordering for the analog project wrapper is in the caravel_user_project_analog repository, in the file
mag/user_analog_project_wrapper.mag
. These two files (the .mag and .sym) have to agree on the port order. If you don't want to redo ~700 lines, there's a simpler way to do it, which is to read the SPICE file from xschem into magic using
File->Import SPICE
the command
readspice <netlist>
while you are editing the layout. That will cause magic to renumber all of the ports to match the SPICE file.
LVS does not check if the ports are in the same order, only if both netlists have the same number of ports of the same name, and all the ports have a 1:1 match between the two netlists.
j
Will importing the spice into Magic override/delete layout? In other words, does this mean we need to restart layout by first importing spice?
t
No, when reading SPICE into an existing layout, it will only affect the port numbering.
j
So just to make sure that I understand fully. I take the spice file from the user_analog_project_wrapper.sch file and import that into my MAGIC user_analog_project_wrapper.mag layout?
t
Yes, if you export the netlist with a subcircuit wrapper. Otherwise, I think you can just load the top level netlist, because it has the subcircuit definition for
user_analog_project_wrapper
.
I need to correct one thing I said, though. It's not the
File->Import SPICE
that you want. It's just the
readspice
command from the command line.
j
ok, thank you so much. We will give it a go right now.
t
I corrected my instructions above.
I would suggest saving a backup of the layout, just in case something goes wrong. It shouldn't, but better safe than sorry.
j
@Tim Edwards should we flatten the top cell first before reading the spice?
t
No, you just want to be editing
user_analog_project_wrapper
, because that's the one that needs to be annotated.
🌍 1
If you were flattening to do the full R-C extraction, then you could run
readspice
on the flattened layout, as long as you had deleted the original cell and renamed the flattened cell to same name as the original, so the subcircuit names still match.
But the port order of the layout will be retained when flattening, so it doesn't matter if you do the annotation before or afterward.
j
@Tim Edwards we followed the steps above but are still not getting any simulations results. Below is the modified Magic-produced spice file.
Below, is the Xschem produced spice file for the project wrapper + my constant-gm circuit.
The netlists seem to line up in terms of the pins but to no avail.
My testbench is still failing to show anything.
t
Well, I'm sure that was an improvement in some sense. I'll take a look at what might still be going on.
j
Thanks once again @Tim Edwards
t
Add the line
.option RSHUNT=1E20
to your
extracted_const_gm_test_022523.spice
netlist. There are "singular matrix" warnings that come from magic's tendency to write out capacitors that are floating, which ngspice does not like.
t
I have another question after reading this. When you said ".mag and .sym have to agree on port order" do you mean to take the symbol net list from and read that into magic or take the netlist of the symbol's underlying schematic?
🌍 1
j
@Tim Edwards we have added that line to the testbench file. Did that do the trick on your end or was it simply a fix to one of multiple possible issues (since we still don't see any results/waveforms).
t
@Jon Ho: If I change from an "op" analysis to a "tran" analysis, I get additional singular matrix errors which are not due to floating nodes, so there are probably additional issues to be uncovered.
j
Noted @Tim Edwards. We included that statement you mentioned and ran the operating point analysis and probed the io_analog[1] voltage, which is the NMOS mirroring node in our current source and are still reading 0.0000e00 V (in simulation, we have it around 0.7-0.8V).
t
Try running with the simple extracted layout with parasitic capacitances but not parasitic resistances to see if the issue is coming from
extresist
.
🌍 1
s
I am a bit late here, however spice netlist port ordering of xschem symbols can be defined in three ways: 1. the order the pins are created in the symbol. This order can be changed afterward if needed. 2. pins ordering in the symbol is defined by a
sim_pinnumber
attribute attached to pins. this sim_pinnumber is used as a sort key when producing the netlist (lowest first). 3. In the symbol global attributes explicitly specify the order of pins. Usualy the format attrinute (the netlist rule) is:
format="@name @pinlist @symname"
, however you can use something like: `format="@name @@GND @@TRIG @@OUT @@RESETB @@CTRL @@THRES @@DIS @@VCC @symname`", that is replacing @pinlist with the explicit order of pins. The relevant man page is here.
🌍 1
t
@Stefan Schippers: How does that work with vectors? We're dealing with nearly 700 pins on the user project wrapper, so I was looking for the solution that doesn't require typing in 700 pin names.
πŸ˜‚ 1
@Jon Ho: I think the SPICE netlist annotation didn't work right. I tried lining up the subcircuit ports between the subcircuit and the instance, by matching up the vector sizes, and while it looked okay for a while, the instance put the three 128 bit vectors for the logic analyzer together, while in the extracted netlist, the third logic analyzer vector is much further down the list of pins.
j
We noticed that too. The read spice command doesn't really work in Magic. We had manually edit the location of VDDA1 and VSSA1.
t
It has worked reliably in other cases. Can you please post the GDS of the layout (or point me to a repository location) so I can figure out why the annotation fails?
j
Here's our entire set of files that @Thomas Figura and I have been trying to run post-extraction sims today. @Tim Edwards
s
@Tim Edwards in xschem vectored ports are named as
DATA[31:0],
which expands as
DATA[31],DATA[30], ...., DATA[0]
, or
DATA[31..0]
expanding to
DATA31,DATA30,...,DATA0
vectored ports in xschem symbols are handled like a single pin. in spice netlist these pins are unrolled to individual bits. This is not necessary for VHDL and Verilog netlist backends.
🌍 1
t
@Stefan Schippers: So they could do
format=@name @@vector1 @@vector2 @@vector3 ...  @symname
? In that case it might not be too painful for them to just edit the symbol to match what's in the layout port definition.
s
@Tim Edwards yes, exactly. A valid ordering for above array symbol is:
format="@name @@vss @@LDWL[511:0] @@LDBL[255:0] @symname"
I just did a live test to ensure it does fine.
@Tim Edwards what I believe can't be done right now is to break a vectored port into pieces and puts something else in between in the netlist, like:
Xarr vss LDWL[511] LDWL[510] LDBL[255] LDBL[254] LDWL[509] ....
t
@Stefan Schippers: That's not a problem here. All of the vector components are contiguous in the layout definition. They only need to be in the right order.
πŸ‘ 1
@Jon Ho (@Stefan Schippers): I generated the user_analog_project_wrapper netlist alone from xschem, and compared it against the output from magic after annotation, and they are the same. But they don't match up with the signal list in the instance of user_analog_project_wrapper that is in
extracted_const_gm_test_022523
.
j
@Tim Edwards indeed, that seems strange. We simply instantiated the user_analog_project_wrapper into our testbench. The symbol was the one provided on the Caravan github page.
I noticed that as well. I see that the nets in the netlist from the testbench are like net1, net2... etc etc. I do not really see any of the io/noESD/gpio pins I've come to expect. Unless those internal nets are supposed to be hidden in the testbench (hierarchy?).
s
@Tim Edwards since a port ordering mismatch is a recurring issue when doing LVS matching, are there some action I can/should take to make designers life easier less frustrating?
t
I think we need a symbol for the user_analog_project_wrapper that has the pin order explicitly stated and matching what is in the layout.
I think I can do this relatively quickly.
πŸ‘ 1
s
If you give me the netlist and (if you have it) an existing symbol I will add that to xschem_sky130
t
The symbol exists in the
caravel_user_project_analog
repository, which is where Jon got it from. Seems to be my fault for not making sure that the pin list of the xschem symbol matches the layout port numbering.
Ha, I lied. I seem to have implemented the auto-numbering of ports in magic with a straight ASCII sort, not a natural sort, which means that the arrays are all out of order. Ugh.
Still, can't take all day to do. Mostly just a lot of cut and paste.
t
I don't think that can work because of my use of ASCII sort (which I definitely need to fix).
s
If you are using tcl
lsort
consider the
-dictionary
option to fix numbered vectors
t
I think that routine is C-coded, though.
s
Copy code
tclsh8.6 [~] lsort {a5 a12 a6 a14}
a12 a14 a5 a6
tclsh8.6 [~] lsort -dictionary {a5 a12 a6 a14}
a5 a6 a12 a14
t
@Jon Ho: Use this version of
user_analog_project_wrapper.spice
to annotate the magic layout. Otherwise, do it just like you did before. I found that the pins are ordered differently in the .sch and .sym files, and that seems to produce a different subcircuit port order depending on whether you netlist the project as the top level or the wrapper as the top level. I changed the order of lines in the sym file to match the sch file, and I could then get it to netlist with the same pin order. I will go patch up the repository itself, but I think this should get you going.
j
Will do! Giving it a shot right now.
@Tim Edwards it seems to have worked! The currents seem too low on our end (we designed for 17uA in simulation) but that's almost guaranteed to be our own fault since we likely have large IR drops between the pads and our circuit.
Thanks once again @Tim Edwards and @Stefan for the support! We greatly appreciate it!
t
You're welcome!
j
@Tim Edwards was the update for the port ordering pushed to Github? From the git history/actions, I didn't see any updates.
t
I have not gotten around to it yet, but thanks for the reminder!