Modified the magic device generator to properly handle the "nf" parameter on MOSFET devices when converting from a netlist to layout. Corrected the netgen setup to ignore both "nf" and "mult" as netlist parameters, as well as other non-critical parameters that may or may not appear in both the schematic and layout- extracted netlists.
diff --git a/sky130/magic/sky130.tcl b/sky130/magic/sky130.tcl index 684aee5..bf66b4f 100644 --- a/sky130/magic/sky130.tcl +++ b/sky130/magic/sky130.tcl
@@ -3564,17 +3564,28 @@ dict set pdkparams [string tolower $key] $value } m { - # M value in an expression like '1*1' convert to - # M and NF - if {[regexp {\'([0-9]+)\*([0-9]+)\'} $value valid m nf]} { - dict set pdkparams [string tolower $key] $m - dict set pdkparams nf $nf - } else { - dict set pdkparams [string tolower $key] $value - } + dict set pdkparams [string tolower $key] $value + } + nf { + # Adjustment ot W will be handled below + dict set pdkparams [string tolower $key] $value } } } + + # Magic does not understand "nf" as a parameter, but expands to + # "nf" number of devices connected horizontally. The "w" value + # must be divided down accordingly, as the "nf" parameter implies + # that the total width "w" is divided into "nf" fingers. + + catch { + set w [dict get $pdkparams w] + set nf [dict get $pdkparams nf] + if {$nf > 1} { + dict set pdkparams w [expr $w / $nf] + } + } + return $pdkparams }
diff --git a/sky130/netgen/sky130_setup.tcl b/sky130/netgen/sky130_setup.tcl index debf009..66d40ee 100644 --- a/sky130/netgen/sky130_setup.tcl +++ b/sky130/netgen/sky130_setup.tcl
@@ -40,7 +40,7 @@ property "-circuit1 $dev" parallel {value par} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } if {[lsearch $cells2 $dev] >= 0} { permute "-circuit2 $dev" 1 2 @@ -53,7 +53,7 @@ property "-circuit1 $dev" parallel {value par} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } } @@ -78,7 +78,7 @@ property "-circuit1 $dev" parallel {value par} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } if {[lsearch $cells2 $dev] >= 0} { permute "-circuit2 $dev" 1 2 @@ -91,7 +91,7 @@ property "-circuit1 $dev" parallel {value par} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } } @@ -111,7 +111,7 @@ property "-circuit1 $dev" parallel {w add} property "-circuit1 $dev" tolerance {w 0.01} {l 0.01} # Ignore these properties - property "-circuit2 $dev" delete as ad ps pd + property "-circuit2 $dev" delete as ad ps pd mult sa sb sd } if {[lsearch $cells2 $dev] >= 0} { permute "-circuit2 $dev" 1 3 @@ -120,7 +120,7 @@ property "-circuit1 $dev" parallel {w add} property "-circuit2 $dev" tolerance {w 0.01} {l 0.01} # Ignore these properties - property "-circuit2 $dev" delete as ad ps pd + property "-circuit2 $dev" delete as ad ps pd mult sa sb sd } } @@ -138,7 +138,7 @@ property "-circuit1 $dev" parallel {value add} property "-circuit1 $dev" tolerance {area 0.02} # Ignore these properties - property "-circuit2 $dev" delete perim + property "-circuit2 $dev" delete mult perim } if {[lsearch $cells2 $dev] >= 0} { property "-circuit2 $dev" parallel enable @@ -146,7 +146,7 @@ property "-circuit1 $dev" parallel {value add} property "-circuit2 $dev" tolerance {area 0.02} # Ignore these properties - property "-circuit2 $dev" delete perim + property "-circuit2 $dev" delete mult perim } } @@ -164,7 +164,7 @@ property "-circuit1 $dev" parallel {value add} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete perim + property "-circuit2 $dev" delete mult perim } if {[lsearch $cells2 $dev] >= 0} { property "-circuit1 $dev" parallel enable @@ -172,7 +172,7 @@ property "-circuit1 $dev" parallel {value add} property "-circuit1 $dev" tolerance {l 0.01} {w 0.01} # Ignore these properties - # property "-circuit2 $dev" delete perim + property "-circuit2 $dev" delete mult perim } } @@ -211,12 +211,12 @@ if {[lsearch $cells1 $dev] >= 0} { property "-circuit1 $dev" parallel enable # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } if {[lsearch $cells2 $dev] >= 0} { property "-circuit2 $dev" parallel enable # Ignore these properties - # property "-circuit2 $dev" delete + property "-circuit2 $dev" delete mult } }