From 8f95efc25785774788c8a434c33355c3dcc6a94e Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Tue, 17 Mar 2026 11:32:53 -0400 Subject: [PATCH] Added a feature to the toolkit scripts for generated devices to allow ideal devices in an input netlist to be mapped to automatically generated cells. This works if the PDK toolkit defines a device called either "capacitor" or "resistor". The device must be defined such that it can determine sane parameters for the drawn device from only a value given in the netlist (capacitance in farads, or resistance in ohms). --- VERSION | 2 +- tcltk/toolkit.tcl | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 22af1b01..a57ad58b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.623 +8.3.624 diff --git a/tcltk/toolkit.tcl b/tcltk/toolkit.tcl index c8bf8777..c14d8579 100644 --- a/tcltk/toolkit.tcl +++ b/tcltk/toolkit.tcl @@ -12,6 +12,8 @@ # Added spice-to-layout procedure # March 4, 2026 # Changed to make use of new "units" command +# March 26, 2026 +# Added behavior to handle ideal capacitor and resistor devices #-------------------------------------------------------------- # Sets up the environment for a toolkit. The toolkit must # supply a namespace that is the "library name". For each @@ -281,8 +283,12 @@ proc magic::generate_layout_add {subname subpins complist library} { set paramlist {} # NOTE: This routine deals with subcircuit calls and devices - # with models. It needs to determine when a device is instantiated - # without a model, and ignore such 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. # Parse SPICE line into pins, device name, and parameters. Make # sure parameters incorporate quoted expressions as {} or ''. @@ -326,6 +332,20 @@ proc magic::generate_layout_add {subname subpins complist library} { set devtype [lindex $pinlist end] set pinlist [lrange $pinlist 0 end-1] + # Ideal device check: "devtype" will start with a digit. + # The instname will begin with "c" or "r". + + if {[regexp {^([0-9\.]+.*)} $devtype pval]} { + set comptype [string tolower [string range $instname 0 0]] + if {$comptype == "c"} { + lappend paramlist [list value $pval] + set devtype capacitor + } elseif {$comptype == "r"} { + lappend paramlist [list value $pval] + set devtype resistor + } + } + set mult 1 foreach param $paramlist { set parmname [lindex $param 0]