Added inductors to the list of devices for which the toolkit can

call a device generator for an ideal component in a netlist.
This commit is contained in:
R. Timothy Edwards 2026-03-17 11:42:16 -04:00
parent 8f95efc257
commit a9673e45ae
1 changed files with 14 additions and 9 deletions

View File

@ -13,7 +13,8 @@
# March 4, 2026
# Changed to make use of new "units" command
# March 26, 2026
# Added behavior to handle ideal capacitor and resistor devices
# Added behavior to handle ideal devices (resistor, capacitor,
# inductor)
#--------------------------------------------------------------
# Sets up the environment for a toolkit. The toolkit must
# supply a namespace that is the "library name". For each
@ -284,11 +285,12 @@ proc magic::generate_layout_add {subname subpins complist library} {
# NOTE: This routine deals with subcircuit calls and devices
# with models. There are two exceptions, for toolkits which
# wish to implement a way to generate unmodeled capacitors or
# resistors based on value; for example, metal interdigitated
# capacitors. For those exceptions, the device value is recast
# as a parameter called "value", and the device is given a model
# "capacitor" or "resistor", respectively.
# wish to implement a way to generate unmodeled capacitors,
# resistors, or inductors based on value; for example, metal
# interdigitated capacitors. For those exceptions, the device
# value is recast as a parameter called "value", and the device
# is given a model "capacitor", "resistor", or "inductor",
# respectively.
# Parse SPICE line into pins, device name, and parameters. Make
# sure parameters incorporate quoted expressions as {} or ''.
@ -333,7 +335,7 @@ proc magic::generate_layout_add {subname subpins complist library} {
set pinlist [lrange $pinlist 0 end-1]
# Ideal device check: "devtype" will start with a digit.
# The instname will begin with "c" or "r".
# The instname will begin with "c", "r", or "l".
if {[regexp {^([0-9\.]+.*)} $devtype pval]} {
set comptype [string tolower [string range $instname 0 0]]
@ -343,6 +345,9 @@ proc magic::generate_layout_add {subname subpins complist library} {
} elseif {$comptype == "r"} {
lappend paramlist [list value $pval]
set devtype resistor
} elseif {$comptype == "l"} {
lappend paramlist [list value $pval]
set devtype inductor
}
}
@ -520,7 +525,7 @@ proc magic::netlist_to_layout {netfile library} {
set subname [lindex $ftokens 1]
set subpins [lrange $ftokens 2 end]
set insub true
} elseif {[regexp -nocase {^[xmcrdq]([^ \t]+)[ \t](.*)$} $line \
} elseif {[regexp -nocase {^[xmcrldq]([^ \t]+)[ \t](.*)$} $line \
valid instname rest]} {
lappend toplist $line
} elseif {[regexp -nocase {^[ivbe]([^ \t]+)[ \t](.*)$} $line \
@ -535,7 +540,7 @@ proc magic::netlist_to_layout {netfile library} {
set subname ""
set subpins ""
set complist {}
} elseif {[regexp -nocase {^[xmcrdq]([^ \t]+)[ \t](.*)$} $line \
} elseif {[regexp -nocase {^[xmcrldq]([^ \t]+)[ \t](.*)$} $line \
valid instname rest]} {
lappend complist $line
} elseif {[regexp -nocase {^[ivbe]([^ \t]+)[ \t](.*)$} $line \