I'm trying to extract spice from a GDS file (Tiny ...
# magic
u
I'm trying to extract spice from a GDS file (Tiny Tapeout ROM) and simulate it in NG Spice to dump the ROM contents. This is how I'm extracting the spice: https://github.com/TinyTapeout/tt06-rom-spice-sim/blob/master/extract_spice.sh
m
@Uri Shaked the extracted spice might have the subckt ports in a different order. Can you share the port order on your extracted spice netlist? There are ways to fix this using
readspice <schematic_netlist>
after reading gds but before extracting. Make sure the top level your extracting has the same name as a subckt in the schematic netlist.
u
Sure:
Copy code
.subckt tt_um_chip_rom VGND VPWR clk ena rst_n ui_in[0] ui_in[1] ui_in[2] ui_in[3]
+ ui_in[4] ui_in[5] ui_in[6] ui_in[7] uio_in[0] uio_in[1] uio_in[2] uio_in[3] uio_in[4]
+ uio_in[5] uio_in[6] uio_in[7] uio_oe[0] uio_oe[1] uio_oe[2] uio_oe[3] uio_oe[4]
+ uio_oe[5] uio_oe[6] uio_oe[7] uio_out[0] uio_out[1] uio_out[2] uio_out[3] uio_out[4]
+ uio_out[5] uio_out[6] uio_out[7] uo_out[0] uo_out[1] uo_out[2] uo_out[3] uo_out[4]
+ uo_out[5] uo_out[6] uo_out[7]
Here's the full extracted spice: https://github.com/urish/tt06-rom-spice-sim/blob/master/tt_um_chip_rom.spice
I wrote the testbench based on the extracted space, so the port order should be matching. But it's never a bad idea to double check...
Oh well, I see that I flipped VGND and VPWR... rookie mistake πŸ™‚ Luckily there was no magic smoke coming out
πŸ˜† 1
good tip about
readspice
, I added it to my script
πŸ‘ 1
got it to work! after running the simulation, I'm running a python script to process all the addr / data signals and the assemble back the ROM into a binary file: https://github.com/TinyTapeout/tt06-rom-spice-sim/blob/main/rom_dump.py and the result:
Copy code
uri@JONI:~/p/tt06-rom-spice-sim$ hd rom.bin
00000000  78 78 3f 7d 00 00 00 00  6d 39 6f 7f 7d 7f 71 6f  |xx?}....m9o.}.qo|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  73 68 75 74 74 6c 65 3d  74 74 30 36 0a 72 65 70  |shuttle=tt06.rep|
00000030  6f 3d 54 69 6e 79 54 61  70 65 6f 75 74 2f 74 69  |o=TinyTapeout/ti|
00000040  6e 79 74 61 70 65 6f 75  74 2d 30 36 0a 63 6f 6d  |<http://nytapeout-06.com|nytapeout-06.com>|
00000050  6d 69 74 3d 35 63 39 38  36 38 66 39 0a 00 00 00  |mit=5c9868f9....|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000080
πŸŽ‰ 1
Thanks for helping out with this πŸ™‚
πŸ‘ 1
t
@Uri Shaked: FYI, in
Copy code
load tt_um_chip_rom
select cell tt_um_chip_rom
the 2nd line is an error (although doesn't have any impact here).
select cell
should be followed by an argument that is an instance name, not a cell name. If you want the "topmost cell in the window" instance, which is what I think you intended here, then use
select top cell
.
βœ… 2
u
Thanks, that makes sense!
Initially, I wanted to load the combined .gds file into magic and export only tt_um_chip_rom
but I later switch to klayout as it loads the final design much faster and also supports OAS, so I can extract the ROM from the final post-tapeout OAS file and run it through the simulation to dump the content