Closed wulffern closed 9 months ago
I would want to be very careful with changes to the code around the bplane
code. I will see if I can reproduce the problem from your repo.
@wulffern : I can't duplicate the issue because the design repository is incomplete; there are multiple cell layouts missing.
@RTimothyEdwards yup, the PLL consists of multiple libraries. The full set of libraries for the PLL are
git clone https://github.com/wulffern/sun_pll_sky130nm
git clone https://github.com/wulffern/sun_tr_sky130nm
git clone https://github.com/wulffern/sun_trb_sky130nm
git clone https://github.com/wulffern/sun_sar9b_sky130nm
git clone https://github.com/wulffern/tech_sky130B
git clone https://github.com/wulffern/cpdk
cd sun_pll_sky130nm/work/
magic ../design/SUN_PLL_SKY130NM/SUN_PLL.mag &
When I then run the TCL, as shown below
wulff@work$ cat SUN_PLL_spi.tcl
set VDD AVDD
set GND AVSS
set SUB BULKN
load ../design/SUN_PLL_SKY130NM/SUN_PLL.mag
extract all
ext2spice lvs
ext2spice -o SUN_PLL.spi
quit
wulff@work$ magic -noconsole -dnull SUN_PLL_spi.tcl
...
Extracting cut_M1M4_2x1 into ../design/SUN_PLL_SKY130NM/cut_M1M4_2x1.ext:
Extracting cut_M1M4_1x2 into ../design/SUN_PLL_SKY130NM/cut_M1M4_1x2.ext:
Extracting SUN_PLL_LPF into ../design/SUN_PLL_SKY130NM/SUN_PLL_LPF.ext:
Segmentation fault: 11
And via LLDB
Extracting SUN_PLL_LPF into ../design/SUN_PLL_SKY130NM/SUN_PLL_LPF.ext:
Process 17073 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00000001011bccd6 tclmagic.dylib`bpBinArraySizeIt(bbox=error: summary string parsing error, elements=0x0000600000349dc1, dxp=0x00007ff7bfefdca4, dyp=0x00007ff7bfefdca0, maxDXp=0x00007ff7bfefdc9c, maxDYp=0x00007ff7bfefdc98, numBinsp=0x00007ff7bfefdc94, countp=0x00007ff7bfefdc90) at bpBins.c:297:16
294 //continue;
295 //}
296
-> 297 int ew = GEO_WIDTH(&e->e_rect);
298 int eh = GEO_HEIGHT(&e->e_rect);
299
300 maxEX = MAX(maxEX,ew);
Target 0: (magicexec) stopped.
(lldb)
It could of course be something with my magic files
Thank you for the detailed setup for duplicating the problem, which I can do. Interestingly, I can extract from interactive magic on the command line, but running in batch with the above instructions causes an immediate segfault. I will investigate.
Thanks for looking into it. Found one more piece of info.
If I open the cell with magic ../design/SUN_PLL_SKY130NM/SUN_PLL.mag &
and immediately do extract all
, then it crashes
However, if I open, draw a box around the cells, expand all cells with hotkey x, wait for the DRC to finish, then extract all
, it works fine.
And the even weirder thing that I found was that if I add the equivalent commands that make it work into the script, that is, select top cell
and expand
after the load
command, then it still segfaults when running in batch.
And another weird thing is that I can run the script directly on SUN_PLL_LPF.mag and it works fine, even though that was the cell it was working on when it crashed. I may have to put this one on the back burner for a bit. I don't think I can solve it without running a debugger on the working and non-working methods and figuring out where they diverge. Your solution is a workaround but the real source of the problem is somewhere else.
Found another workaround.
If I replace extract all
with just extract
, then first time it crashes, but second, and later times, it runs fine.
If I delete all *.ext files, and run, then it crashes the first time.
"extract" as opposed to "extract all" is an incremental extraction, so after the first run, it will not attempt to extract any cell for which a .ext exists and is more recent than the layout.
[Actually, I am finding that the SUN_PLL cell does not extract correctly even when magic doesn't crash (i.e., when subcells are expanded before extracting). The output is incomplete, and a warning is issued during "ext2spice".] Okay, never mind, that was the file produced when it crashed.
@wulffern : Finally had time to look into this, and I ended up patching the code to circumvent the issue in much the same way you did, which is pretty much what I suggested originally except that I wanted to make sure I understood the code surrounding the issue. Thank you for providing the example!
I experience a segmentation fault when I try to netlist a layout.
I run
On my design, and magic segfaults. I think it happens because somehow magic is trying to check the size of a empty cell, although I'm not sure, but the segfault happens in bpBins.c at
I've fixed it with
https://github.com/wulffern/magic/commit/68b89ab774014c8e58459adebd0c4da8c1fb8bd7