Updated the SPICE import routine in the toolkit so that it will
correctly handle subcircuits that are used before they are defined, and will determine whether the imported spice does or does not contain a top level, and either return to the top level or any top level cell found in the netlist.
This commit is contained in:
parent
d09b0e8c51
commit
5352a23577
|
|
@ -375,7 +375,30 @@ proc magic::netlist_to_layout {netfile library} {
|
|||
|
||||
set ignorekeys {.global .ic .option .end}
|
||||
|
||||
# Parse the file
|
||||
# Parse the file once and find all subcircuits being defined, to
|
||||
# catch any issues with subcircuits being used before they are
|
||||
# defined.
|
||||
set allsubs {}
|
||||
foreach line $fdata {
|
||||
set ftokens [split $line]
|
||||
set keyword [string tolower [lindex $ftokens 0]]
|
||||
if {$keyword == ".subckt"} {
|
||||
set subname [lindex $ftokens 1]
|
||||
lappend allsubs $subname
|
||||
}
|
||||
}
|
||||
# Generate list of pre-existing top level cells
|
||||
set existing [cellname list top]
|
||||
# Pre-generate placeholders for all subcircuits.
|
||||
set curtop [cellname list self]
|
||||
|
||||
foreach subckt $allsubs {
|
||||
puts stdout "Test: pre-generating subcircuit $subckt"
|
||||
load $subckt -silent
|
||||
}
|
||||
load $curtop
|
||||
|
||||
# Parse the file and process all lines
|
||||
foreach line $fdata {
|
||||
if {$incmd} {
|
||||
if {[regexp -nocase {^[ \t]*\.endc} $line]} {
|
||||
|
|
@ -421,7 +444,20 @@ proc magic::netlist_to_layout {netfile library} {
|
|||
|
||||
# Add in any top-level components (not in subcircuits)
|
||||
if {[llength $toplist] > 0} {
|
||||
# Make sure the top level cell is loaded before adding top-level
|
||||
# components.
|
||||
load $curtop
|
||||
magic::generate_layout_add $topname "" $toplist $library
|
||||
} else {
|
||||
# There was no top level, so load the first new top cell that
|
||||
# was generated by the import.
|
||||
set allcells [cellname list top]
|
||||
foreach cell $allcells {
|
||||
if {[lsearch $existing $cell] < 0} {
|
||||
load $cell
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# resumeall
|
||||
|
|
|
|||
Loading…
Reference in New Issue