From eda5f506f38325e805ab850a93bccb40314befa3 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 6 Oct 2023 19:38:53 -0400 Subject: [PATCH] Made another change to the netlist-to-layout procedure so that it better supports re-entrant use, especially for the use case where the import was abandoned before saving, or the generated cells were not saved (which is easy to do, because the top level cell is always written out to disk, but the rest of the cells will only be written when "writeall" is executed). The new code detects input cells that did not have any layout file (has flag "not-found" after loading) and deletes them and their instances so that they can be regenerated from scratch. --- tcltk/toolkit.tcl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tcltk/toolkit.tcl b/tcltk/toolkit.tcl index 72db64cb..d5663fa1 100644 --- a/tcltk/toolkit.tcl +++ b/tcltk/toolkit.tcl @@ -172,8 +172,27 @@ proc magic::create_new_pin {pinname portnum {layer m1}} { proc magic::generate_layout_add {subname subpins complist library} { global PDKNAMESPACE - # Create a new subcircuit + # Create a new subcircuit. load $subname -quiet + + # In the case where subcells of circuit "subname" do not exist, + # delete the placeholders so that they can be regenerated. + + set children [cellname list children $subname] + foreach child $children { + set flags [cellname flags $child] + foreach flag $flags { + if {$flag == "not-found"} { + set insts [cellname list instances $child] + foreach inst $insts { + select cell $inst + delete + } + cellname delete $child + } + } + } + box 0 0 0 0 # Generate pins