google / bigspicy

Apache License 2.0
38 stars 10 forks source link

Failure when spice netlist has a disconnected pin #23

Closed antonblanchard closed 2 years ago

antonblanchard commented 2 years ago

When trying to import some sky130 gate level verilog, bigspicy fails with:

NotImplementedError: Is this supposed to be a disconnection?

The problem is a tie cell, in which a disconnected pin is expected (both LO and HI are rarely used together). A verilog test case:

module test (
  VGND,
  VPWR,
  hi
);
  input VGND;
  input VPWR;
  output hi;

  sky130_fd_sc_hd__conb_1 const_hi (
    .HI(hi),
    .VGND(VGND),
    .VNB(VGND),
    .VPB(VPWR),
    .VPWR(VPWR));

endmodule

And the spice:

.subckt sky130_fd_sc_hd__conb_1 VGND VNB VPB VPWR HI LO
R0 VGND LO sky130_fd_pr__res_generic_po w=480000u l=45000u
R1 HI VPWR sky130_fd_pr__res_generic_po w=480000u l=45000u
.ends

run with:

./bigspicy.py --import --verilog test.v --top test --spice_header test.spice --dump_spice test_out.spice
growly commented 2 years ago

I fixed it one way. Let's see how robust this is. Turns None Signals into new floating nets so that instantiations can proceed and Spice can be happy:

** SPICE netlist generated by bigspicy.py at Tue Sep  6 02:39:55 2022 UTC
.SUBCKT test
+ VGND VPWR hi
** [instance const_hi of sky130_fd_sc_hd__conb_1, params={} connections=['VGND: [connection const_hi/VGND =>[signal: VGND w=1]]', 'VNB: [connection const_hi/VNB =>[signal: VGND w=1]]', 'VPB: [connection const_hi/VPB =>[signal: VPWR w=1]]', 'VPWR: [connection const_hi/VPWR =>[signal: VPWR w=1]]', 'HI: [connection const_hi/HI =>[signal: hi w=1]]']]
const_hi VGND VGND VPWR VPWR hi no_conn_0 sky130_fd_sc_hd__conb_1 
.ENDS