Added hooks to the Tcl code in magic for schematic-to-layout conversion, adding an "Import SPICE" menu item to the magic setup when the PDK is installed. Only lightly tested, and needs some additional development.
diff --git a/VERSION b/VERSION index 4cf8fd6..82d042d 100644 --- a/VERSION +++ b/VERSION
@@ -1 +1 @@ -1.0.137 +1.0.138
diff --git a/common/netlist_to_layout.py b/common/netlist_to_layout.py index 0130340..f371cbb 100755 --- a/common/netlist_to_layout.py +++ b/common/netlist_to_layout.py
@@ -217,7 +217,7 @@ print('writeall force', file=ofile) print('quit -noprompt', file=ofile) -def parse_layout(topname, lines, ofile): +def parse_layout(topname, lines, library, ofile): global debugmode subrex = re.compile('.subckt[ \t]+(.*)$', re.IGNORECASE) @@ -356,7 +356,7 @@ with open(scriptpath, 'w') as ofile: generate_layout_start(library, ofile) - parse_layout(topname, spicelines, ofile) + parse_layout(topname, spicelines, library, ofile) generate_layout_end(ofile) myenv = os.environ.copy()
diff --git a/sky130/magic/sky130.tcl b/sky130/magic/sky130.tcl index a653c4b..3833c01 100644 --- a/sky130/magic/sky130.tcl +++ b/sky130/magic/sky130.tcl
@@ -29,24 +29,7 @@ # Set options specific to this PDK set Opts(hidelocked) 1 -set Opts(hidespecial) 1 - -# Create new "tool" proc that doesn't have the netlist tool. -proc magic::nexttool {} { - global Opts - - # Don't attempt to switch tools while a selection drag is active - if {$Opts(motion) == {}} { - switch $Opts(tool) { - box { magic::tool wiring } - wiring { magic::tool pick } - default { magic::tool box } - } - } -} - -# This shoule be part of sitedef. . . -macro space magic::nexttool +set Opts(hidespecial) 0 # Wrap the closewrapper procedure so that closing the last # window is equivalent to quitting. @@ -215,8 +198,13 @@ magic::add_toolkit_command $layoutframe "vpp 4.4x4.6 m1-m2 l1 shield" \ "magic::gencell sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_l1shield" pdk2 + # Additional DRC style for routing only---add this to the DRC menu ${layoutframe}.titlebar.mbuttons.drc.toolmenu add command -label "DRC Routing" -command {drc style drc(routing)} + # Add SPICE import function to File menu + ${layoutframe}.titlebar.mbuttons.file.toolmenu insert 4 command -label "Import SPICE" -command {sky130::importspice} + ${layoutframe}.titlebar.mbuttons.file.toolmenu insert 4 separator + # Add command entry window by default if enabled if {[info exists Opts(cmdentry)]} { set Winopts(${framename},cmdentry) $Opts(cmdentry) @@ -229,6 +217,22 @@ } #---------------------------------------------------------------- +# Menu callback function to read a SPICE netlist and generate an +# initial layout using the SKYWATER TECHNAME gencells. +#---------------------------------------------------------------- + +proc sky130::importspice {} { + global CAD_ROOT + + set Layoutfilename [ tk_getOpenFile -filetypes \ + {{SPICE {.spice .spc .spi .ckt .cir .sp \ + {.spice .spc .spi .ckt .cir .sp}}} {"All files" {*}}}] + if {$Layoutfilename != ""} { + magic::netlist_to_layout $Layoutfilename sky130 + } +} + +#---------------------------------------------------------------- proc sky130::mcon_draw {{dir default}} { set w [magic::i2u [box width]]