Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1 | ### |
| 2 | ### Source file sky130.tcl |
| 3 | ### Process this file with the preprocessor script |
| 4 | ### |
| 5 | #----------------------------------------------------- |
| 6 | # Magic/TCL design kit for SKYWATER TECHNAME |
| 7 | #----------------------------------------------------- |
| 8 | # Tim Edwards |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 9 | # Revision 1 ALPHA 9/10/2020 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 10 | #----------------------------------------------------- |
| 11 | |
| 12 | set TECHPATH STAGING_PATH |
| 13 | if [catch {set PDKPATH}] {set PDKPATH ${TECHPATH}/TECHNAME} |
| 14 | set PDKNAME TECHNAME |
| 15 | # "sky130" is the namespace used for all devices |
| 16 | set PDKNAMESPACE sky130 |
| 17 | puts stdout "Loading TECHNAME Device Generator Menu ..." |
| 18 | |
| 19 | # Initialize toolkit menus to the wrapper window |
| 20 | |
| 21 | global Opts |
| 22 | namespace eval sky130 {} |
| 23 | |
| 24 | # Set the window callback |
| 25 | if [catch {set Opts(callback)}] {set Opts(callback) ""} |
| 26 | set Opts(callback) [subst {sky130::addtechmenu \$framename; $Opts(callback)}] |
| 27 | |
| 28 | # if {![info exists Opts(cmdentry)]} {set Opts(cmdentry) 1} |
| 29 | |
| 30 | # Set options specific to this PDK |
| 31 | set Opts(hidelocked) 1 |
Tim Edwards | 708a942 | 2021-03-09 22:07:22 -0500 | [diff] [blame] | 32 | set Opts(hidespecial) 0 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 33 | |
| 34 | # Wrap the closewrapper procedure so that closing the last |
| 35 | # window is equivalent to quitting. |
| 36 | if {[info commands closewrapper] == "closewrapper"} { |
| 37 | rename closewrapper closewrapperonly |
| 38 | proc closewrapper { framename } { |
| 39 | if {[llength [windownames all]] <= 1} { |
| 40 | magic::quit |
| 41 | } else { |
| 42 | closewrapperonly $framename |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | # Remove maze router layers from the toolbar by locking them |
| 48 | tech lock fence,magnet,rotate |
| 49 | |
| 50 | namespace eval sky130 { |
| 51 | namespace path {::tcl::mathop ::tcl::mathfunc} |
| 52 | |
| 53 | set ruleset [dict create] |
| 54 | |
| 55 | # Process DRC rules (magic style) |
| 56 | |
| 57 | dict set ruleset poly_surround 0.08 ;# Poly surrounds contact |
| 58 | dict set ruleset diff_surround 0.06 ;# Diffusion surrounds contact |
| 59 | dict set ruleset gate_to_diffcont 0.145 ;# Gate to diffusion contact center |
| 60 | dict set ruleset gate_to_polycont 0.275 ;# Gate to poly contact center |
| 61 | dict set ruleset gate_extension 0.13 ;# Poly extension beyond gate |
| 62 | dict set ruleset diff_extension 0.29 ;# Diffusion extension beyond gate |
| 63 | dict set ruleset contact_size 0.17 ;# Minimum contact size |
| 64 | dict set ruleset via_size 0.17 ;# Minimum via size |
| 65 | dict set ruleset metal_surround 0.08 ;# Local interconnect overlaps contact |
| 66 | dict set ruleset sub_surround 0.18 ;# Sub/well surrounds diffusion |
| 67 | dict set ruleset diff_spacing 0.28 ;# Diffusion spacing rule |
| 68 | dict set ruleset poly_spacing 0.21 ;# Poly spacing rule |
| 69 | dict set ruleset diff_poly_space 0.075 ;# Diffusion to poly spacing rule |
| 70 | dict set ruleset diff_gate_space 0.20 ;# Diffusion to gate poly spacing rule |
| 71 | dict set ruleset metal_spacing 0.23 ;# Local interconnect spacing rule |
| 72 | dict set ruleset mmetal_spacing 0.14 ;# Metal spacing rule (above local interconnect) |
| 73 | dict set ruleset res_to_cont 0.20 ;# resistor to contact center |
| 74 | dict set ruleset res_diff_space 0.20 ;# resistor to guard ring |
| 75 | } |
| 76 | |
| 77 | #----------------------------------------------------- |
| 78 | # magic::addtechmenu |
| 79 | #----------------------------------------------------- |
| 80 | |
| 81 | proc sky130::addtechmenu {framename} { |
| 82 | global Winopts Opts |
| 83 | |
| 84 | # Check for difference between magic 8.1.125 and earlier, and 8.1.126 and later |
| 85 | if {[catch {${framename}.titlebar cget -height}]} { |
| 86 | set layoutframe ${framename}.pane.top |
| 87 | } else { |
| 88 | set layoutframe ${framename} |
| 89 | } |
| 90 | |
| 91 | # List of devices is long. Divide into two sections for active and passive deivces |
| 92 | magic::add_toolkit_menu $layoutframe "Devices 1" pdk1 |
| 93 | |
| 94 | magic::add_toolkit_command $layoutframe "nmos (MOSFET)" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 95 | "magic::gencell sky130::sky130_fd_pr__nfet_01v8" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 96 | magic::add_toolkit_command $layoutframe "pmos (MOSFET)" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 97 | "magic::gencell sky130::sky130_fd_pr__pfet_01v8" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 98 | |
| 99 | magic::add_toolkit_separator $layoutframe pdk1 |
| 100 | magic::add_toolkit_command $layoutframe "n-diode" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 101 | "magic::gencell sky130::sky130_fd_pr__diode_pw2nd_05v5" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 102 | magic::add_toolkit_command $layoutframe "p-diode" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 103 | "magic::gencell sky130::sky130_fd_pr__diode_pd2nw_05v5" pdk1 |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 104 | magic::add_toolkit_command $layoutframe "photodiode" \ |
| 105 | "magic::gencell sky130::sky130_fd_pr__photodiode" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 106 | |
| 107 | magic::add_toolkit_separator $layoutframe pdk1 |
| 108 | magic::add_toolkit_command $layoutframe "MOS varactor" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 109 | "magic::gencell sky130::sky130_fd_pr__cap_var_lvt" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 110 | magic::add_toolkit_separator $layoutframe pdk1 |
| 111 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 112 | magic::add_toolkit_command $layoutframe "NPN 1.0 x 1.0" \ |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 113 | "magic::gencell sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00" pdk1 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 114 | magic::add_toolkit_command $layoutframe "NPN 1.0 x 2.0" \ |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 115 | "magic::gencell sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00" pdk1 |
Tim Edwards | 7e29496 | 2021-05-04 20:33:17 -0400 | [diff] [blame] | 116 | magic::add_toolkit_command $layoutframe "PNP 0.68 x 0.68" \ |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 117 | "magic::gencell sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68" pdk1 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 118 | magic::add_toolkit_command $layoutframe "PNP 3.4 x 3.4" \ |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 119 | "magic::gencell sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 120 | |
| 121 | magic::add_toolkit_separator $layoutframe pdk1 |
| 122 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 123 | magic::add_toolkit_command $layoutframe "inductor 1" \ |
| 124 | "magic::gencell sky130::sky130_fd_pr__rf_test_coil1" pdk1 |
| 125 | magic::add_toolkit_command $layoutframe "inductor 2" \ |
| 126 | "magic::gencell sky130::sky130_fd_pr__rf_test_coil2" pdk1 |
| 127 | magic::add_toolkit_command $layoutframe "inductor 3" \ |
| 128 | "magic::gencell sky130::sky130_fd_pr__rf_test_coil3" pdk1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 129 | |
| 130 | magic::add_toolkit_separator $layoutframe pdk1 |
| 131 | |
| 132 | magic::add_toolkit_command $layoutframe "substrate contact (1.8V)" \ |
| 133 | "sky130::subconn_draw" pdk1 |
| 134 | magic::add_toolkit_command $layoutframe "substrate contact (5.0V)" \ |
| 135 | "sky130::mvsubconn_draw" pdk1 |
| 136 | magic::add_toolkit_command $layoutframe "deep n-well region" \ |
| 137 | "sky130::deep_nwell_draw" pdk1 |
| 138 | magic::add_toolkit_command $layoutframe "mcon" \ |
| 139 | "sky130::mcon_draw" pdk1 |
| 140 | magic::add_toolkit_command $layoutframe "via1" \ |
| 141 | "sky130::via1_draw" pdk1 |
| 142 | magic::add_toolkit_command $layoutframe "via2" \ |
| 143 | "sky130::via2_draw" pdk1 |
| 144 | #ifdef METAL5 |
| 145 | magic::add_toolkit_command $layoutframe "via3" \ |
| 146 | "sky130::via3_draw" pdk1 |
| 147 | magic::add_toolkit_command $layoutframe "via4" \ |
| 148 | "sky130::via4_draw" pdk1 |
| 149 | #endif (METAL5) |
| 150 | |
| 151 | |
| 152 | magic::add_toolkit_menu $layoutframe "Devices 2" pdk2 |
| 153 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 154 | magic::add_toolkit_command $layoutframe "n-diff resistor (1.8V) - 120 Ohm/sq" \ |
| 155 | "magic::gencell sky130::sky130_fd_pr__res_generic_nd" pdk2 |
| 156 | magic::add_toolkit_command $layoutframe "p-diff resistor (1.8V) - 197 Ohm/sq" \ |
| 157 | "magic::gencell sky130::sky130_fd_pr__res_generic_pd" pdk2 |
| 158 | magic::add_toolkit_command $layoutframe "n-diff resistor (5.0V) - 114 Ohm/sq" \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 159 | "magic::gencell sky130::sky130_fd_pr__res_generic_nd__hv" pdk2 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 160 | magic::add_toolkit_command $layoutframe "p-diff resistor (5.0V) - 191 Ohm/sq" \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 161 | "magic::gencell sky130::sky130_fd_pr__res_generic_pd__hv" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 162 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 163 | magic::add_toolkit_command $layoutframe "poly resistor - 48.2 Ohm/sq" \ |
| 164 | "magic::gencell sky130::sky130_fd_pr__res_generic_po" pdk2 |
| 165 | magic::add_toolkit_command $layoutframe "poly resistor - 319.8 Ohm/sq" \ |
| 166 | "magic::gencell sky130::sky130_fd_pr__res_high_po_0p35" pdk2 |
| 167 | magic::add_toolkit_command $layoutframe "poly resistor - 2000 Ohm/sq" \ |
| 168 | "magic::gencell sky130::sky130_fd_pr__res_xhigh_po_0p35" pdk2 |
| 169 | magic::add_toolkit_command $layoutframe "p-well resistor - 3050 Ohm/sq" \ |
| 170 | "magic::gencell sky130::sky130_fd_pr__res_iso_pw" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 171 | magic::add_toolkit_separator $layoutframe pdk2 |
| 172 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 173 | magic::add_toolkit_command $layoutframe "l1 metal resistor - 12.2 Ohm/sq" \ |
| 174 | "magic::gencell sky130::sky130_fd_pr__res_generic_l1" pdk2 |
| 175 | magic::add_toolkit_command $layoutframe "m1 metal resistor - 125 mOhm/sq" \ |
| 176 | "magic::gencell sky130::sky130_fd_pr__res_generic_m1" pdk2 |
| 177 | magic::add_toolkit_command $layoutframe "m2 metal resistor - 125 mOhm/sq" \ |
| 178 | "magic::gencell sky130::sky130_fd_pr__res_generic_m2" pdk2 |
| 179 | magic::add_toolkit_command $layoutframe "m3 metal resistor - 47 mOhm/sq" \ |
| 180 | "magic::gencell sky130::sky130_fd_pr__res_generic_m3" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 181 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 182 | magic::add_toolkit_command $layoutframe "m4 metal resistor - 47 mOhm/sq" \ |
| 183 | "magic::gencell sky130::sky130_fd_pr__res_generic_m4" pdk2 |
| 184 | magic::add_toolkit_command $layoutframe "m5 metal resistor - 29 mOhm/sq" \ |
| 185 | "magic::gencell sky130::sky130_fd_pr__res_generic_m5" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 186 | #endif (METAL5) |
| 187 | |
| 188 | #ifdef MIM |
Tim Edwards | 15463bc | 2021-05-12 21:33:31 -0400 | [diff] [blame] | 189 | magic::add_toolkit_command $layoutframe "MiM cap - 2fF/um^2 (metal3)" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 190 | "magic::gencell sky130::sky130_fd_pr__cap_mim_m3_1" pdk2 |
Tim Edwards | 15463bc | 2021-05-12 21:33:31 -0400 | [diff] [blame] | 191 | magic::add_toolkit_command $layoutframe "MiM cap - 2fF/um^2 (metal4)" \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 192 | "magic::gencell sky130::sky130_fd_pr__cap_mim_m3_2" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 193 | #endif (MIM) |
| 194 | magic::add_toolkit_separator $layoutframe pdk2 |
| 195 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 196 | magic::add_toolkit_command $layoutframe "vpp 11.5x11.7 m1-m4, li/m5 shield" \ |
| 197 | "magic::gencell sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5" pdk2 |
| 198 | magic::add_toolkit_command $layoutframe "vpp 11.5x11.7 m1-m2" \ |
| 199 | "magic::gencell sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield" pdk2 |
| 200 | magic::add_toolkit_command $layoutframe "vpp 8.6x7.8 m1-m2 l1 shield" \ |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 201 | "magic::gencell sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1" pdk2 |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 202 | magic::add_toolkit_command $layoutframe "vpp 4.4x4.6 m1-m2 l1 shield" \ |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 203 | "magic::gencell sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1" pdk2 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 204 | |
Tim Edwards | 708a942 | 2021-03-09 22:07:22 -0500 | [diff] [blame] | 205 | # Additional DRC style for routing only---add this to the DRC menu |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 206 | ${layoutframe}.titlebar.mbuttons.drc.toolmenu add command -label "DRC Routing" -command {drc style drc(routing)} |
| 207 | |
Tim Edwards | 708a942 | 2021-03-09 22:07:22 -0500 | [diff] [blame] | 208 | # Add SPICE import function to File menu |
| 209 | ${layoutframe}.titlebar.mbuttons.file.toolmenu insert 4 command -label "Import SPICE" -command {sky130::importspice} |
| 210 | ${layoutframe}.titlebar.mbuttons.file.toolmenu insert 4 separator |
| 211 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 212 | # Add command entry window by default if enabled |
| 213 | if {[info exists Opts(cmdentry)]} { |
| 214 | set Winopts(${framename},cmdentry) $Opts(cmdentry) |
| 215 | } else { |
| 216 | set Winopts(${framename},cmdentry) 0 |
| 217 | } |
| 218 | if {$Winopts(${framename},cmdentry) == 1} { |
| 219 | addcommandentry $framename |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | #---------------------------------------------------------------- |
Tim Edwards | 708a942 | 2021-03-09 22:07:22 -0500 | [diff] [blame] | 224 | # Menu callback function to read a SPICE netlist and generate an |
| 225 | # initial layout using the SKYWATER TECHNAME gencells. |
| 226 | #---------------------------------------------------------------- |
| 227 | |
| 228 | proc sky130::importspice {} { |
| 229 | global CAD_ROOT |
| 230 | |
| 231 | set Layoutfilename [ tk_getOpenFile -filetypes \ |
| 232 | {{SPICE {.spice .spc .spi .ckt .cir .sp \ |
| 233 | {.spice .spc .spi .ckt .cir .sp}}} {"All files" {*}}}] |
| 234 | if {$Layoutfilename != ""} { |
| 235 | magic::netlist_to_layout $Layoutfilename sky130 |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | #---------------------------------------------------------------- |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 240 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 241 | proc sky130::mcon_draw {{dir default}} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 242 | set w [magic::i2u [box width]] |
| 243 | set h [magic::i2u [box height]] |
| 244 | if {$w < 0.17} { |
| 245 | puts stderr "Mcon width must be at least 0.17um" |
| 246 | return |
| 247 | } |
| 248 | if {$h < 0.17} { |
| 249 | puts stderr "Mcon height must be at least 0.17um" |
| 250 | return |
| 251 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 252 | suspendall |
Tim Edwards | 0b1a873 | 2020-12-30 15:15:08 -0500 | [diff] [blame] | 253 | paint mcon |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 254 | pushbox |
| 255 | if {($w < $h) || ($dir == "vert")} { |
| 256 | box grow e 0.03um |
| 257 | box grow w 0.03um |
| 258 | box grow n 0.06um |
| 259 | box grow s 0.06um |
| 260 | paint m1 |
| 261 | } else { |
| 262 | box grow n 0.03um |
| 263 | box grow s 0.03um |
| 264 | box grow e 0.06um |
| 265 | box grow w 0.06um |
| 266 | paint m1 |
| 267 | } |
| 268 | popbox |
| 269 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | proc sky130::via1_draw {} { |
| 273 | set w [magic::i2u [box width]] |
| 274 | set h [magic::i2u [box height]] |
| 275 | if {$w < 0.26} { |
| 276 | puts stderr "Via1 width must be at least 0.26um" |
| 277 | return |
| 278 | } |
| 279 | if {$h < 0.26} { |
| 280 | puts stderr "Via1 height must be at least 0.26um" |
| 281 | return |
| 282 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 283 | suspendall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 284 | paint via1 |
| 285 | box grow n 0.05um |
| 286 | box grow s 0.05um |
| 287 | paint m2 |
| 288 | box grow n -0.05um |
| 289 | box grow s -0.05um |
| 290 | box grow e 0.05um |
| 291 | box grow w 0.05um |
| 292 | paint m1 |
| 293 | box grow e -0.05um |
| 294 | box grow w -0.05um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 295 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | proc sky130::via2_draw {} { |
| 299 | set w [magic::i2u [box width]] |
| 300 | set h [magic::i2u [box height]] |
| 301 | if {$w < 0.28} { |
| 302 | puts stderr "Via2 width must be at least 0.28um" |
| 303 | return |
| 304 | } |
| 305 | if {$h < 0.28} { |
| 306 | puts stderr "Via2 height must be at least 0.28um" |
| 307 | return |
| 308 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 309 | suspendall |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 310 | pushbox |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 311 | paint via2 |
| 312 | box grow n 0.05um |
| 313 | box grow s 0.05um |
| 314 | paint m2 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 315 | popbox |
| 316 | pushbox |
| 317 | box grow n 0.025um |
| 318 | box grow s 0.025um |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 319 | box grow e 0.05um |
| 320 | box grow w 0.05um |
| 321 | paint m3 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 322 | popbox |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 323 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | #ifdef METAL5 |
| 327 | proc sky130::via3_draw {} { |
| 328 | set w [magic::i2u [box width]] |
| 329 | set h [magic::i2u [box height]] |
| 330 | if {$w < 0.32} { |
| 331 | puts stderr "Via3 width must be at least 0.32um" |
| 332 | return |
| 333 | } |
| 334 | if {$h < 0.32} { |
| 335 | puts stderr "Via3 height must be at least 0.32um" |
| 336 | return |
| 337 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 338 | suspendall |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 339 | pushbox |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 340 | paint via3 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 341 | box grow n 0.005um |
| 342 | box grow s 0.005um |
| 343 | box grow e 0.005um |
| 344 | box grow w 0.005um |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 345 | paint m4 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 346 | popbox |
| 347 | pushbox |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 348 | box grow e 0.05um |
| 349 | box grow w 0.05um |
| 350 | paint m3 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 351 | popbox |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 352 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | proc sky130::via4_draw {} { |
| 356 | set w [magic::i2u [box width]] |
| 357 | set h [magic::i2u [box height]] |
| 358 | if {$w < 1.18} { |
| 359 | puts stderr "Via3 width must be at least 1.18um" |
| 360 | return |
| 361 | } |
| 362 | if {$h < 1.18} { |
| 363 | puts stderr "Via3 height must be at least 1.18um" |
| 364 | return |
| 365 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 366 | suspendall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 367 | paint via4 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 368 | pushbox |
| 369 | box grow n 0.12um |
| 370 | box grow s 0.12um |
| 371 | box grow e 0.12um |
| 372 | box grow w 0.12um |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 373 | paint m5 |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 374 | popbox |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 375 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 376 | } |
| 377 | #endif (METAL5) |
| 378 | |
| 379 | proc sky130::subconn_draw {} { |
| 380 | set w [magic::i2u [box width]] |
| 381 | set h [magic::i2u [box height]] |
| 382 | if {$w < 0.17} { |
| 383 | puts stderr "Substrate tap width must be at least 0.17um" |
| 384 | return |
| 385 | } |
| 386 | if {$h < 0.17} { |
| 387 | puts stderr "Substrate tap height must be at least 0.17um" |
| 388 | return |
| 389 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 390 | suspendall |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 391 | paint psc |
| 392 | pushbox |
| 393 | if {$w > $h} { |
| 394 | box grow e 0.08um |
| 395 | box grow w 0.08um |
| 396 | paint li |
| 397 | box grow e 0.04um |
| 398 | box grow w 0.04um |
| 399 | } else { |
| 400 | box grow n 0.08um |
| 401 | box grow s 0.08um |
| 402 | paint li |
| 403 | box grow n 0.04um |
| 404 | box grow s 0.04um |
| 405 | } |
| 406 | paint psd |
| 407 | popbox |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 408 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | #---------------------------------------------------------------- |
| 412 | |
| 413 | proc sky130::mvsubconn_draw {} { |
| 414 | set w [magic::i2u [box width]] |
| 415 | set h [magic::i2u [box height]] |
| 416 | if {$w < 0.17} { |
| 417 | puts stderr "Substrate tap width must be at least 0.17um" |
| 418 | return |
| 419 | } |
| 420 | if {$h < 0.17} { |
| 421 | puts stderr "Substrate tap height must be at least 0.17um" |
| 422 | return |
| 423 | } |
Tim Edwards | 8ebc774 | 2020-11-22 11:41:28 -0500 | [diff] [blame] | 424 | suspendall |
Tim Edwards | b427e3b | 2020-11-22 15:28:54 -0500 | [diff] [blame] | 425 | paint mvpsc |
| 426 | pushbox |
| 427 | if {$w > $h} { |
| 428 | box grow e 0.08um |
| 429 | box grow w 0.08um |
| 430 | paint li |
| 431 | box grow e 0.04um |
| 432 | box grow w 0.04um |
| 433 | } else { |
| 434 | box grow n 0.08um |
| 435 | box grow s 0.08um |
| 436 | paint li |
| 437 | box grow n 0.04um |
| 438 | box grow s 0.04um |
| 439 | } |
| 440 | paint mvpsd |
| 441 | popbox |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 442 | resumeall |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 443 | } |
| 444 | |
| 445 | #---------------------------------------------------------------- |
| 446 | |
| 447 | proc sky130::deep_nwell_draw {} { |
| 448 | set w [magic::i2u [box width]] |
| 449 | set h [magic::i2u [box height]] |
| 450 | if {$w < 3.0} { |
| 451 | puts stderr "Deep-nwell region width must be at least 3.0um" |
| 452 | return |
| 453 | } |
| 454 | if {$h < 3.0} { |
| 455 | puts stderr "Deep-nwell region height must be at least 3.0um" |
| 456 | return |
| 457 | } |
| 458 | suspendall |
| 459 | tech unlock * |
| 460 | paint dnwell |
| 461 | pushbox |
| 462 | pushbox |
| 463 | box grow c 0.4um |
| 464 | paint nwell |
| 465 | box grow c -1.43um |
| 466 | erase nwell |
| 467 | popbox |
| 468 | box grow c 0.03um |
| 469 | |
| 470 | pushbox |
| 471 | box width 0 |
| 472 | box grow c 0.085um |
| 473 | paint li |
| 474 | pushbox |
| 475 | box grow n -0.3um |
| 476 | box grow s -0.3um |
| 477 | paint nsc |
| 478 | popbox |
| 479 | box grow c 0.1um |
| 480 | paint nsd |
| 481 | popbox |
| 482 | |
| 483 | pushbox |
| 484 | box height 0 |
| 485 | box grow c 0.085um |
| 486 | paint li |
| 487 | pushbox |
| 488 | box grow e -0.3um |
| 489 | box grow w -0.3um |
| 490 | paint nsc |
| 491 | popbox |
| 492 | box grow c 0.1um |
| 493 | paint nsd |
| 494 | popbox |
| 495 | |
| 496 | pushbox |
| 497 | box move n [box height]i |
| 498 | box height 0 |
| 499 | box grow c 0.085um |
| 500 | paint li |
| 501 | pushbox |
| 502 | box grow e -0.3um |
| 503 | box grow w -0.3um |
| 504 | paint nsc |
| 505 | popbox |
| 506 | box grow c 0.1um |
| 507 | paint nsd |
| 508 | popbox |
| 509 | |
| 510 | pushbox |
| 511 | box move e [box width]i |
| 512 | box width 0 |
| 513 | box grow c 0.085um |
| 514 | paint li |
| 515 | pushbox |
| 516 | box grow n -0.3um |
| 517 | box grow s -0.3um |
| 518 | paint nsc |
| 519 | box grow c 0.1um |
| 520 | paint nsd |
| 521 | popbox |
| 522 | |
| 523 | popbox |
| 524 | tech revert |
| 525 | resumeall |
| 526 | } |
| 527 | |
| 528 | #---------------------------------------------------------------- |
| 529 | |
| 530 | proc sky130::res_recalc {field parameters} { |
| 531 | set snake 0 |
| 532 | set sterm 0.0 |
| 533 | set caplen 0 |
| 534 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 535 | foreach key [dict keys $parameters] { |
| 536 | set $key [dict get $parameters $key] |
| 537 | } |
| 538 | set val [magic::spice2float $val] |
| 539 | set l [magic::spice2float $l] |
| 540 | set w [magic::spice2float $w] |
| 541 | |
| 542 | if {$snake == 0} { |
| 543 | # Straight resistor calculation |
| 544 | switch $field { |
| 545 | val { set l [expr ($val * ($w - $dw) - (2 * $term)) / $rho] |
| 546 | set w [expr ((2 * $term + $l * $rho) / $val) + $dw] |
| 547 | } |
| 548 | w { set val [expr (2 * $term + $l * $rho) / ($w - $dw)] |
| 549 | set l [expr ($val * ($w - $dw) - (2 * $term)) / $rho] |
| 550 | } |
| 551 | l { set val [expr (2 * $term + $l * $rho) / ($w - $dw)] |
| 552 | set w [expr ((2 * $term + $l * $rho) / $val) + $dw] |
| 553 | } |
| 554 | } |
| 555 | } else { |
| 556 | set term [expr $term + $sterm] |
| 557 | # Snake resistor calculation |
| 558 | switch $field { |
| 559 | val { set l [expr (($val - $rho * ($nx - 1)) * ($w - $dw) \ |
| 560 | - (2 * $term) - ($rho * $caplen * ($nx - 1))) \ |
| 561 | / ($rho * $nx)] |
| 562 | |
| 563 | set w [expr ((2 * $term + $l * $rho * $nx \ |
| 564 | + $caplen * $rho * ($nx - 1)) \ |
| 565 | / ($val - $rho * ($nx - 1))) + $dw] |
| 566 | } |
| 567 | w { set val [expr $rho * ($nx - 1) + ((2 * $term) \ |
| 568 | + ($rho * $l * $nx) + ($rho * $caplen * ($nx - 1))) \ |
| 569 | / ($w - $dw)] |
| 570 | |
| 571 | set l [expr (($val - $rho * ($nx - 1)) * ($w - $dw) \ |
| 572 | - (2 * $term) - ($rho * $caplen * ($nx - 1))) \ |
| 573 | / ($rho * $nx)] |
| 574 | } |
| 575 | l { set val [expr $rho * ($nx - 1) + ((2 * $term) \ |
| 576 | + ($rho * $l * $nx) + ($rho * $caplen * ($nx - 1))) \ |
| 577 | / ($w - $dw)] |
| 578 | |
| 579 | set w [expr ((2 * $term + $l * $rho * $nx \ |
| 580 | + $caplen * $rho * ($nx - 1)) \ |
| 581 | / ($val - $rho * ($nx - 1))) + $dw] |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | set val [magic::3digitpastdecimal $val] |
| 587 | set w [magic::3digitpastdecimal $w] |
| 588 | set l [magic::3digitpastdecimal $l] |
| 589 | |
| 590 | dict set parameters val $val |
| 591 | dict set parameters w $w |
| 592 | dict set parameters l $l |
| 593 | |
| 594 | return $parameters |
| 595 | } |
| 596 | |
| 597 | #---------------------------------------------------------------- |
| 598 | # Drawn diode routines |
| 599 | #---------------------------------------------------------------- |
| 600 | |
| 601 | proc sky130::diode_recalc {field parameters} { |
| 602 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 603 | foreach key [dict keys $parameters] { |
| 604 | set $key [dict get $parameters $key] |
| 605 | } |
| 606 | switch $field { |
| 607 | area { puts stdout "area changed" } |
| 608 | peri { puts stdout "perimeter changed" } |
| 609 | w { puts stdout "width changed" } |
| 610 | l { puts stdout "length changed" } |
| 611 | } |
| 612 | dict set parameters area $area |
| 613 | dict set parameters peri $peri |
| 614 | dict set parameters w $w |
| 615 | dict set parameters l $l |
| 616 | } |
| 617 | |
| 618 | #---------------------------------------------------------------- |
| 619 | # diode: Conversion from SPICE netlist parameters to toolkit |
| 620 | #---------------------------------------------------------------- |
| 621 | |
| 622 | proc sky130::diode_convert {parameters} { |
| 623 | set pdkparams [dict create] |
| 624 | dict for {key value} $parameters { |
| 625 | switch -nocase $key { |
| 626 | l - |
| 627 | w - |
| 628 | peri { |
| 629 | # Length, width, and perimeter are converted to units of microns |
| 630 | set value [magic::spice2float $value] |
| 631 | # set value [expr $value * 1e6] |
| 632 | set value [magic::3digitpastdecimal $value] |
| 633 | dict set pdkparams [string tolower $key] $value |
| 634 | } |
| 635 | area { |
| 636 | # area also converted to units of microns |
| 637 | set value [magic::spice2float $value] |
| 638 | # set value [expr $value * 1e12] |
| 639 | set value [magic::3digitpastdecimal $value] |
| 640 | dict set pdkparams [string tolower $key] $value |
| 641 | } |
| 642 | m { |
| 643 | # Convert m to ny |
| 644 | dict set pdkparams ny $value |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | return $pdkparams |
| 649 | } |
| 650 | |
| 651 | #---------------------------------------------------------------- |
| 652 | # diode: Interactively specifies the fixed layout parameters |
| 653 | #---------------------------------------------------------------- |
| 654 | |
| 655 | proc sky130::diode_dialog {device parameters} { |
| 656 | # Editable fields: w, l, area, perim, nx, ny |
| 657 | |
| 658 | magic::add_entry area "Area (um^2)" $parameters |
| 659 | magic::add_entry peri "Perimeter (um)" $parameters |
| 660 | sky130::compute_aptot $parameters |
| 661 | magic::add_message atot "Total area (um^2)" $parameters |
| 662 | magic::add_message ptot "Total perimeter (um)" $parameters |
| 663 | magic::add_entry l "Length (um)" $parameters |
| 664 | magic::add_entry w "Width (um)" $parameters |
| 665 | magic::add_entry nx "X Repeat" $parameters |
| 666 | magic::add_entry ny "Y Repeat" $parameters |
| 667 | |
| 668 | if {[dict exists $parameters compatible]} { |
| 669 | set sellist [dict get $parameters compatible] |
| 670 | magic::add_selectlist gencell "Device type" $sellist $parameters $device |
| 671 | } |
| 672 | |
| 673 | if {[dict exists $parameters doverlap]} { |
| 674 | magic::add_checkbox doverlap "Overlap at end contact" $parameters |
| 675 | } |
| 676 | if {[dict exists $parameters elc]} { |
| 677 | magic::add_checkbox elc "Add left end contact" $parameters |
| 678 | } |
| 679 | if {[dict exists $parameters erc]} { |
| 680 | magic::add_checkbox erc "Add right end contact" $parameters |
| 681 | } |
| 682 | if {[dict exists $parameters etc]} { |
| 683 | magic::add_checkbox etc "Add top end contact" $parameters |
| 684 | } |
| 685 | if {[dict exists $parameters ebc]} { |
| 686 | magic::add_checkbox ebc "Add bottom end contact" $parameters |
| 687 | } |
| 688 | |
| 689 | if {[dict exists $parameters guard]} { |
| 690 | magic::add_checkbox full_metal "Full metal guard ring" $parameters |
| 691 | } |
| 692 | if {[dict exists $parameters glc]} { |
| 693 | magic::add_checkbox glc "Add left guard ring contact" $parameters |
| 694 | } |
| 695 | if {[dict exists $parameters grc]} { |
| 696 | magic::add_checkbox grc "Add right guard ring contact" $parameters |
| 697 | } |
| 698 | if {[dict exists $parameters gtc]} { |
| 699 | magic::add_checkbox gtc "Add top guard ring contact" $parameters |
| 700 | } |
| 701 | if {[dict exists $parameters gbc]} { |
| 702 | magic::add_checkbox gbc "Add bottom guard ring contact" $parameters |
| 703 | } |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 704 | if {[dict exists $parameters viagb]} { |
| 705 | magic::add_entry viagb "Bottom guard ring via coverage \[+/-\](%)" $parameters |
| 706 | } |
| 707 | if {[dict exists $parameters viagt]} { |
| 708 | magic::add_entry viagt "Top guard ring via coverage \[+/-\](%)" $parameters |
| 709 | } |
| 710 | if {[dict exists $parameters viagr]} { |
| 711 | magic::add_entry viagr "Right guard ring via coverage \[+/-\](%)" $parameters |
| 712 | } |
| 713 | if {[dict exists $parameters viagl]} { |
| 714 | magic::add_entry viagl "Left guard ring via coverage \[+/-\](%)" $parameters |
| 715 | } |
| 716 | |
| 717 | if {[dict exists $parameters vias]} { |
| 718 | magic::add_checkbox vias "Add vias over contacts" $parameters |
| 719 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 720 | |
| 721 | magic::add_dependency sky130::diode_recalc $device sky130 l w area peri |
| 722 | |
| 723 | # magic::add_checkbox dummy "Add dummy" $parameters |
| 724 | } |
| 725 | |
| 726 | #---------------------------------------------------------------- |
| 727 | # Diode total area and perimeter computation |
| 728 | #---------------------------------------------------------------- |
| 729 | |
| 730 | proc sky130::compute_aptot {parameters} { |
| 731 | foreach key [dict keys $parameters] { |
| 732 | set $key [dict get $parameters $key] |
| 733 | } |
| 734 | set area [magic::spice2float $area] |
| 735 | set area [magic::3digitpastdecimal $area] |
| 736 | set peri [magic::spice2float $peri] |
| 737 | set peri [magic::3digitpastdecimal $peri] |
| 738 | |
| 739 | # Compute total area |
| 740 | catch {set magic::atot_val [expr ($area * $nx * $ny)]} |
| 741 | # Compute total perimeter |
| 742 | catch {set magic::ptot_val [expr ($peri * $nx * $ny)]} |
| 743 | } |
| 744 | |
| 745 | #---------------------------------------------------------------- |
| 746 | # diode: Check device parameters for out-of-bounds values |
| 747 | #---------------------------------------------------------------- |
| 748 | |
| 749 | proc sky130::diode_check {parameters} { |
| 750 | |
Tim Edwards | 2b75891 | 2021-05-20 16:01:18 -0400 | [diff] [blame] | 751 | set guard 0 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 752 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 753 | foreach key [dict keys $parameters] { |
| 754 | set $key [dict get $parameters $key] |
| 755 | } |
| 756 | |
| 757 | # Normalize distance units to microns |
| 758 | set l [magic::spice2float $l] |
| 759 | set l [magic::3digitpastdecimal $l] |
| 760 | set w [magic::spice2float $w] |
| 761 | set w [magic::3digitpastdecimal $w] |
| 762 | |
| 763 | set area [magic::spice2float $area] |
| 764 | set area [magic::3digitpastdecimal $area] |
| 765 | set peri [magic::spice2float $peri] |
| 766 | set peri [magic::3digitpastdecimal $peri] |
| 767 | |
| 768 | if {$l == 0} { |
| 769 | # Calculate L from W and area |
| 770 | set l [expr ($area / $w)] |
| 771 | dict set parameters l [magic::float2spice $l] |
| 772 | } elseif {$w == 0} { |
| 773 | # Calculate W from L and area |
| 774 | set w [expr ($area / $l)] |
| 775 | dict set parameters w [magic::float2spice $w] |
| 776 | } |
| 777 | if {$w < $wmin} { |
| 778 | puts stderr "Diode width must be >= $wmin" |
| 779 | dict set parameters w $wmin |
| 780 | } |
| 781 | if {$l < $lmin} { |
| 782 | puts stderr "Diode length must be >= $lmin" |
| 783 | dict set parameters l $lmin |
| 784 | } |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 785 | |
| 786 | # Check via coverage for syntax |
| 787 | if {$guard == 1} { |
| 788 | if {[catch {expr abs($viagb)}]} { |
| 789 | puts stderr "Guard ring bottom via coverage must be numeric!" |
| 790 | dict set parameters viagb 0 |
| 791 | } elseif {[expr abs($viagb)] > 100} { |
| 792 | puts stderr "Guard ring bottom via coverage can't be more than 100%" |
| 793 | dict set parameters viagb 100 |
| 794 | } |
| 795 | if {[catch {expr abs($viagt)}]} { |
| 796 | puts stderr "Guard ring top via coverage must be numeric!" |
| 797 | dict set parameters viagt 0 |
| 798 | } elseif {[expr abs($viagt)] > 100} { |
| 799 | puts stderr "Guard ring top via coverage can't be more than 100%" |
| 800 | dict set parameters viagt 100 |
| 801 | } |
| 802 | if {[catch {expr abs($viagr)}]} { |
| 803 | puts stderr "Guard ring right via coverage must be numeric!" |
| 804 | dict set parameters viagr 0 |
| 805 | } elseif {[expr abs($viagr)] > 100} { |
| 806 | puts stderr "Guard ring right via coverage can't be more than 100%" |
| 807 | dict set parameters viagr 100 |
| 808 | } |
| 809 | if {[catch {expr abs($viagl)}]} { |
| 810 | puts stderr "Guard ring left via coverage must be numeric!" |
| 811 | dict set parameters viagl 0 |
| 812 | } elseif {[expr abs($viagl)] > 100} { |
| 813 | puts stderr "Guard ring left via coverage can't be more than 100%" |
| 814 | dict set parameters viagl 100 |
| 815 | } |
| 816 | } |
| 817 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 818 | # Calculate area and perimeter from L and W |
| 819 | set area [expr ($l * $w)] |
| 820 | dict set parameters area [magic::float2spice $area] |
| 821 | set peri [expr (2 * ($l + $w))] |
| 822 | dict set parameters peri [magic::float2spice $peri] |
| 823 | sky130::compute_aptot $parameters |
| 824 | |
| 825 | return $parameters |
| 826 | } |
| 827 | |
| 828 | #------------------------------------------------------------------ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 829 | # NOTE: sky130_fd_pr__diode_pw2nd_05v5_lvt, |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 830 | # sky130_fd_pr__diode_pw2nd_05v5_nvt, sky130_fd_pr__diode_pd2nw_05v5_lvt, |
| 831 | # and sky130_fd_pr__diode_pd2nw_11v0 are all considered parasitic diodes. |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 832 | # They may be generated by invoking the build procedure on the |
| 833 | # command line. To enable them in the PDK, add them to the |
| 834 | # appropriate compatible {} list. |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 835 | #------------------------------------------------------------------ |
| 836 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 837 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 838 | return {w 0.45 l 0.45 area 0.2025 peri 1.8 \ |
| 839 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 840 | elc 1 erc 1 etc 1 ebc 1 doverlap 0 \ |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 841 | compatible {sky130_fd_pr__diode_pw2nd_05v5 sky130_fd_pr__diode_pw2nd_05v5_lvt \ |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 842 | sky130_fd_pr__diode_pw2nd_05v5_nvt sky130_fd_pr__diode_pw2nd_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 843 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 844 | } |
| 845 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 846 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_lvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 847 | return {w 0.45 l 0.45 area 0.2025 peri 1.8 \ |
| 848 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 849 | elc 1 erc 1 etc 1 ebc 1 doverlap 0 \ |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 850 | compatible {sky130_fd_pr__diode_pw2nd_05v5 sky130_fd_pr__diode_pw2nd_05v5_lvt \ |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 851 | sky130_fd_pr__diode_pw2nd_05v5_nvt sky130_fd_pr__diode_pw2nd_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 852 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 853 | } |
| 854 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 855 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_nvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 856 | return {w 0.45 l 0.45 area 0.2024 peri 1.8 \ |
| 857 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 858 | elc 1 erc 1 etc 1 ebc 1 doverlap 0 \ |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 859 | compatible {sky130_fd_pr__diode_pw2nd_05v5 sky130_fd_pr__diode_pw2nd_05v5_lvt \ |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 860 | sky130_fd_pr__diode_pw2nd_05v5_nvt sky130_fd_pr__diode_pw2nd_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 861 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 862 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 863 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 864 | proc sky130::sky130_fd_pr__diode_pw2nd_11v0_defaults {} { |
| 865 | return {w 0.45 l 0.45 area 0.2024 peri 1.8 \ |
| 866 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 867 | elc 1 erc 1 etc 1 ebc 1 doverlap 0 \ |
| 868 | compatible {sky130_fd_pr__diode_pw2nd_05v5 sky130_fd_pr__diode_pw2nd_05v5_lvt \ |
| 869 | sky130_fd_pr__diode_pw2nd_05v5_nvt sky130_fd_pr__diode_pw2nd_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 870 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 871 | } |
| 872 | |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 873 | proc sky130::sky130_fd_pr__photodiode_defaults {} { |
| 874 | return {nx 1 ny 1 deltax 0 deltay 0 xstep 8.0 ystep 8.0} |
| 875 | } |
| 876 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 877 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_defaults {} { |
| 878 | return {w 0.45 l 0.45 area 0.2025 peri 1.8 \ |
| 879 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 880 | elc 1 erc 1 etc 1 ebc 1 \ |
| 881 | glc 1 grc 1 gtc 1 gbc 1 doverlap 0 \ |
| 882 | compatible {sky130_fd_pr__diode_pd2nw_05v5 sky130_fd_pr__diode_pd2nw_05v5_lvt \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 883 | sky130_fd_pr__diode_pd2nw_05v5_hvt sky130_fd_pr__diode_pd2nw_11v0} \ |
| 884 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 885 | } |
| 886 | |
| 887 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_lvt_defaults {} { |
| 888 | return {w 0.45 l 0.45 area 0.2025 peri 1.8 \ |
| 889 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 890 | elc 1 erc 1 etc 1 ebc 1 \ |
| 891 | glc 1 grc 1 gtc 1 gbc 1 doverlap 0 \ |
| 892 | compatible {sky130_fd_pr__diode_pd2nw_05v5 sky130_fd_pr__diode_pd2nw_05v5_lvt \ |
| 893 | sky130_fd_pr__diode_pd2nw_05v5_hvt sky130_fd_pr__diode_pd2nw_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 894 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_hvt_defaults {} { |
| 898 | return {w 0.45 l 0.45 area 0.2025 peri 1.8 \ |
| 899 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 900 | elc 1 erc 1 etc 1 ebc 1 \ |
| 901 | glc 1 grc 1 gtc 1 gbc 1 doverlap 0 \ |
| 902 | compatible {sky130_fd_pr__diode_pd2nw_05v5 sky130_fd_pr__diode_pd2nw_05v5_lvt \ |
| 903 | sky130_fd_pr__diode_pd2nw_05v5_hvt sky130_fd_pr__diode_pd2nw_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 904 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 905 | } |
| 906 | |
| 907 | |
| 908 | proc sky130::sky130_fd_pr__diode_pd2nw_11v0_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 909 | return {w 0.45 l 0.45 area 0.2024 peri 1.8 \ |
| 910 | nx 1 ny 1 dummy 0 lmin 0.45 wmin 0.45 \ |
| 911 | elc 1 erc 1 etc 1 ebc 1 \ |
| 912 | glc 1 grc 1 gtc 1 gbc 1 doverlap 0 \ |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 913 | compatible {sky130_fd_pr__diode_pd2nw_05v5 sky130_fd_pr__diode_pd2nw_05v5_lvt \ |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 914 | sky130_fd_pr__diode_pd2nw_05v5_hvt sky130_fd_pr__diode_pd2nw_11v0} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 915 | full_metal 1 vias 1 viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | #---------------------------------------------------------------- |
| 919 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 920 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 921 | return [sky130::diode_convert $parameters] |
| 922 | } |
| 923 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 924 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_lvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 925 | return [sky130::diode_convert $parameters] |
| 926 | } |
| 927 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 928 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_nvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 929 | return [sky130::diode_convert $parameters] |
| 930 | } |
| 931 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 932 | proc sky130::sky130_fd_pr__diode_pw2nd_11v0_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 933 | return [sky130::diode_convert $parameters] |
| 934 | } |
| 935 | |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 936 | proc sky130::sky130_fd_pr__photodiode_convert {parameters} { |
| 937 | return [sky130::fixed_convert $parameters] |
| 938 | } |
| 939 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 940 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 941 | return [sky130::diode_convert $parameters] |
| 942 | } |
| 943 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 944 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_lvt_convert {parameters} { |
| 945 | return [sky130::diode_convert $parameters] |
| 946 | } |
| 947 | |
| 948 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_hvt_convert {parameters} { |
| 949 | return [sky130::diode_convert $parameters] |
| 950 | } |
| 951 | |
| 952 | proc sky130::sky130_fd_pr__diode_pd2nw_11v0_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 953 | return [sky130::diode_convert $parameters] |
| 954 | } |
| 955 | |
| 956 | #---------------------------------------------------------------- |
| 957 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 958 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_dialog {parameters} { |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 959 | sky130::diode_dialog sky130_fd_pr__diode_pw2nd_05v5 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 960 | } |
| 961 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 962 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_lvt_dialog {parameters} { |
| 963 | sky130::diode_dialog sky130_fd_pr__diode_pw2nd_05v5_lvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 964 | } |
| 965 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 966 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_nvt_dialog {parameters} { |
| 967 | sky130::diode_dialog sky130_fd_pr__diode_pw2nd_05v5_nvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 968 | } |
| 969 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 970 | proc sky130::sky130_fd_pr__diode_pw2nd_11v0_dialog {parameters} { |
| 971 | sky130::diode_dialog sky130_fd_pr__diode_pw2nd_11v0 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 972 | } |
| 973 | |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 974 | proc sky130::sky130_fd_pr__photodiode_dialog {parameters} { |
| 975 | sky130::fixed_dialog $parameters |
| 976 | } |
| 977 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 978 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_dialog {parameters} { |
| 979 | sky130::diode_dialog sky130_fd_pr__diode_pd2nw_05v5 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 980 | } |
| 981 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 982 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_lvt_dialog {parameters} { |
| 983 | sky130::diode_dialog sky130_fd_pr__diode_pd2nw_05v5_lvt $parameters |
| 984 | } |
| 985 | |
| 986 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_hvt_dialog {parameters} { |
| 987 | sky130::diode_dialog sky130_fd_pr__diode_pd2nw_05v5_hvt $parameters |
| 988 | } |
| 989 | |
| 990 | proc sky130::sky130_fd_pr__diode_pd2nw_11v0_dialog {parameters} { |
| 991 | sky130::diode_dialog sky130_fd_pr__diode_pd2nw_11v0 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | #---------------------------------------------------------------- |
| 995 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 996 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 997 | sky130::diode_check $parameters |
| 998 | } |
| 999 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1000 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_lvt_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1001 | sky130::diode_check $parameters |
| 1002 | } |
| 1003 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1004 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_nvt_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1005 | sky130::diode_check $parameters |
| 1006 | } |
| 1007 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1008 | proc sky130::sky130_fd_pr__diode_pw2nd_11v0_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1009 | sky130::diode_check $parameters |
| 1010 | } |
| 1011 | |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 1012 | proc sky130::sky130_fd_pr__photodiode_check {parameters} { |
| 1013 | sky130::fixed_check $parameters |
| 1014 | } |
| 1015 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1016 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1017 | sky130::diode_check $parameters |
| 1018 | } |
| 1019 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1020 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_lvt_check {parameters} { |
| 1021 | sky130::diode_check $parameters |
| 1022 | } |
| 1023 | |
| 1024 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_hvt_check {parameters} { |
| 1025 | sky130::diode_check $parameters |
| 1026 | } |
| 1027 | |
| 1028 | proc sky130::sky130_fd_pr__diode_pd2nw_11v0_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1029 | sky130::diode_check $parameters |
| 1030 | } |
| 1031 | |
| 1032 | #---------------------------------------------------------------- |
| 1033 | # Diode: Draw a single device |
| 1034 | #---------------------------------------------------------------- |
| 1035 | |
| 1036 | proc sky130::diode_device {parameters} { |
| 1037 | # Epsilon for avoiding round-off errors |
| 1038 | set eps 0.0005 |
| 1039 | |
| 1040 | # Set local default values if they are not in parameters |
| 1041 | set dev_surround 0 |
| 1042 | set dev_sub_type "" |
| 1043 | |
| 1044 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1045 | foreach key [dict keys $parameters] { |
| 1046 | set $key [dict get $parameters $key] |
| 1047 | } |
| 1048 | |
| 1049 | # If there is no end_sub_surround, set it to sub_surround |
| 1050 | if {![dict exists $parameters end_sub_surround]} { |
| 1051 | set end_sub_surround $sub_surround |
| 1052 | } |
| 1053 | |
| 1054 | # Draw the device |
| 1055 | pushbox |
| 1056 | box size 0 0 |
| 1057 | |
| 1058 | set hw [/ $w 2.0] |
| 1059 | set hl [/ $l 2.0] |
| 1060 | |
| 1061 | # Calculate ring size (measured to contact center) |
| 1062 | set gx [+ $w [* 2.0 [+ $dev_spacing $dev_surround]] $contact_size] |
| 1063 | set gy [+ $l [* 2.0 [+ $dev_spacing $dev_surround]] $contact_size] |
| 1064 | |
| 1065 | # Draw the ring first, because diode may occupy well/substrate plane |
| 1066 | set guardparams $parameters |
| 1067 | dict set guardparams plus_diff_type $end_type |
| 1068 | dict set guardparams plus_contact_type $end_contact_type |
| 1069 | dict set guardparams diff_surround $end_surround |
| 1070 | dict set guardparams sub_type $end_sub_type |
| 1071 | dict set guardparams sub_surround $sub_surround |
| 1072 | dict set guardparams guard_sub_surround $end_sub_surround |
| 1073 | dict set guardparams glc $elc |
| 1074 | dict set guardparams grc $erc |
| 1075 | dict set guardparams gtc $etc |
| 1076 | dict set guardparams gbc $ebc |
| 1077 | set cext [sky130::guard_ring $gx $gy $guardparams] |
| 1078 | |
| 1079 | pushbox |
| 1080 | box grow n ${hl}um |
| 1081 | box grow s ${hl}um |
| 1082 | box grow e ${hw}um |
| 1083 | box grow w ${hw}um |
| 1084 | paint ${dev_type} |
| 1085 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 1086 | |
| 1087 | if {$dev_sub_type != ""} { |
| 1088 | box grow n ${sub_surround}um |
| 1089 | box grow s ${sub_surround}um |
| 1090 | box grow e ${sub_surround}um |
| 1091 | box grow w ${sub_surround}um |
| 1092 | paint ${dev_sub_type} |
| 1093 | } |
| 1094 | popbox |
| 1095 | |
| 1096 | if {${w} < ${l}} { |
| 1097 | set orient vert |
| 1098 | } else { |
| 1099 | set orient horz |
| 1100 | } |
| 1101 | |
| 1102 | # Reduce width by surround amount |
| 1103 | set w [- $w [* ${dev_surround} 2.0]] |
| 1104 | set l [- $l [* ${dev_surround} 2.0]] |
| 1105 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 1106 | # Draw via over contact first |
| 1107 | if {$vias != 0} { |
| 1108 | pushbox |
| 1109 | set ch $l |
| 1110 | if {$ch < $via_size} {set ch $via_size} |
| 1111 | set cw $w |
| 1112 | if {$cw < $via_size} {set cw $via_size} |
| 1113 | box grow n [/ $ch 2]um |
| 1114 | box grow s [/ $ch 2]um |
| 1115 | box grow w [/ $cw 2]um |
| 1116 | box grow e [/ $cw 2]um |
| 1117 | sky130::mcon_draw |
| 1118 | popbox |
| 1119 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1120 | set cext [sky130::unionbox $cext [sky130::draw_contact ${w} ${l} \ |
| 1121 | ${dev_surround} ${metal_surround} ${contact_size} \ |
| 1122 | ${dev_type} ${dev_contact_type} li ${orient}]] |
| 1123 | |
| 1124 | popbox |
| 1125 | return $cext |
| 1126 | } |
| 1127 | |
| 1128 | #---------------------------------------------------------------- |
| 1129 | # Diode: Draw the tiled device |
| 1130 | #---------------------------------------------------------------- |
| 1131 | |
| 1132 | proc sky130::diode_draw {parameters} { |
| 1133 | tech unlock * |
| 1134 | |
| 1135 | # Set defaults if they are not in parameters |
| 1136 | set doverlap 0 ;# overlap diodes at contacts |
| 1137 | set guard 0 ;# draw a guard ring |
| 1138 | set prohibit_overlap false ;# don't prohibit overlaps |
| 1139 | |
| 1140 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1141 | foreach key [dict keys $parameters] { |
| 1142 | set $key [dict get $parameters $key] |
| 1143 | } |
| 1144 | |
| 1145 | # Normalize distance units to microns |
| 1146 | set w [magic::spice2float $w] |
| 1147 | set l [magic::spice2float $l] |
| 1148 | |
| 1149 | pushbox |
| 1150 | box values 0 0 0 0 |
| 1151 | |
| 1152 | # Determine the base device dimensions by drawing one device |
| 1153 | # while all layers are locked (nothing drawn). This allows the |
| 1154 | # base drawing routine to do complicated geometry without having |
| 1155 | # to duplicate it here with calculations. |
| 1156 | |
| 1157 | tech lock * |
| 1158 | set bbox [sky130::diode_device $parameters] |
| 1159 | # puts stdout "Diagnostic: Device bounding box e $bbox (um)" |
| 1160 | tech unlock * |
| 1161 | |
| 1162 | set fw [- [lindex $bbox 2] [lindex $bbox 0]] |
| 1163 | set fh [- [lindex $bbox 3] [lindex $bbox 1]] |
| 1164 | set lw [+ [lindex $bbox 2] [lindex $bbox 0]] |
| 1165 | set lh [+ [lindex $bbox 3] [lindex $bbox 1]] |
| 1166 | |
| 1167 | # If prohibit_overlap is true, then end overlapping is prohibited when |
| 1168 | # nx or ny is > 1 to prevent DRC errors (typically from well spacing rule) |
| 1169 | if {$prohibit_overlap == true} { |
| 1170 | if {($nx > 1) || ($ny > 1)} { |
| 1171 | set doverlap 0 |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | # Determine tile width and height (depends on overlap) |
| 1176 | |
| 1177 | if {$doverlap == 0} { |
| 1178 | set dx [+ $fw $end_spacing] |
| 1179 | set dy [+ $fh $end_spacing] |
| 1180 | } else { |
| 1181 | # overlap contact |
| 1182 | set dx [- $fw [+ [* 2.0 $sub_surround] [* 2.0 $end_surround] $contact_size]] |
| 1183 | set dy [- $fh [+ [* 2.0 $sub_surround] [* 2.0 $end_surround] $contact_size]] |
| 1184 | } |
| 1185 | |
| 1186 | # Determine core width and height |
| 1187 | set corex [+ [* [- $nx 1] $dx] $fw] |
| 1188 | set corey [+ [* [- $ny 1] $dy] $fh] |
| 1189 | set corellx [/ [+ [- $corex $fw] $lw] 2.0] |
| 1190 | set corelly [/ [+ [- $corey $fh] $lh] 2.0] |
| 1191 | |
| 1192 | if {$guard != 0} { |
| 1193 | # Calculate guard ring size (measured to contact center) |
| 1194 | set gx [+ $corex [* 2.0 [+ $diff_spacing $diff_surround]] $contact_size] |
| 1195 | set gy [+ $corey [* 2.0 [+ $diff_spacing $diff_surround]] $contact_size] |
| 1196 | |
| 1197 | # Draw the guard ring first, because diode may occupy well/substrate plane |
| 1198 | sky130::guard_ring $gx $gy $parameters |
| 1199 | } |
| 1200 | |
| 1201 | pushbox |
| 1202 | box move w ${corellx}um |
| 1203 | box move s ${corelly}um |
| 1204 | if {($nx > 1) || ($ny > 1)} { |
| 1205 | pushbox |
| 1206 | set hfw [/ $fw 2.0] |
| 1207 | set hfh [/ $fh 2.0] |
| 1208 | box move w ${hfw}um |
| 1209 | box move s ${hfh}um |
| 1210 | box size ${corex}um ${corey}um |
| 1211 | paint $end_sub_type |
| 1212 | popbox |
| 1213 | } |
| 1214 | for {set xp 0} {$xp < $nx} {incr xp} { |
| 1215 | pushbox |
| 1216 | for {set yp 0} {$yp < $ny} {incr yp} { |
| 1217 | sky130::diode_device $parameters |
| 1218 | box move n ${dy}um |
| 1219 | } |
| 1220 | popbox |
| 1221 | box move e ${dx}um |
| 1222 | } |
| 1223 | popbox |
| 1224 | popbox |
| 1225 | |
| 1226 | tech revert |
| 1227 | } |
| 1228 | |
| 1229 | #---------------------------------------------------------------- |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 1230 | # Photodiode: Draw a single device |
| 1231 | #---------------------------------------------------------------- |
| 1232 | |
| 1233 | proc sky130::photodiode_device {parameters} { |
| 1234 | |
| 1235 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1236 | foreach key [dict keys $parameters] { |
| 1237 | set $key [dict get $parameters $key] |
| 1238 | } |
| 1239 | |
| 1240 | # Draw the device |
| 1241 | pushbox |
| 1242 | box size 0 0 |
| 1243 | |
| 1244 | # Device has ntap fixed width of 0.41 x 0.41 |
| 1245 | # Surrounded by nwell 0.84 x 0.84 |
| 1246 | # Surrounded by deep nwell 3.0 x 3.0 |
| 1247 | |
| 1248 | pushbox |
| 1249 | box grow c 0.205um |
| 1250 | paint nsd |
| 1251 | popbox |
| 1252 | pushbox |
| 1253 | box grow c 0.42um |
| 1254 | paint nwell |
| 1255 | popbox |
| 1256 | pushbox |
| 1257 | box grow c 1.5um |
| 1258 | paint photo |
| 1259 | |
| 1260 | set cext [sky130::getbox] |
| 1261 | |
| 1262 | popbox |
| 1263 | |
| 1264 | # Only enough space for one contact |
| 1265 | set w ${contact_size} |
| 1266 | set l ${contact_size} |
| 1267 | |
| 1268 | set cext [sky130::unionbox $cext [sky130::draw_contact ${w} ${l} \ |
| 1269 | 0 ${metal_surround} ${contact_size} \ |
| 1270 | nsd nsc li horz]] |
| 1271 | |
| 1272 | popbox |
| 1273 | return $cext |
| 1274 | } |
| 1275 | |
| 1276 | #---------------------------------------------------------------- |
| 1277 | |
| 1278 | proc sky130::photodiode_draw {parameters} { |
| 1279 | |
| 1280 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1281 | foreach key [dict keys $parameters] { |
| 1282 | set $key [dict get $parameters $key] |
| 1283 | } |
| 1284 | |
| 1285 | pushbox |
| 1286 | box values 0 0 0 0 |
| 1287 | |
| 1288 | # Determine the base device dimensions by drawing one device |
| 1289 | # while all layers are locked (nothing drawn). This allows the |
| 1290 | # base drawing routine to do complicated geometry without having |
| 1291 | # to duplicate it here with calculations. |
| 1292 | |
| 1293 | tech lock * |
| 1294 | set bbox [sky130::photodiode_device $parameters] |
| 1295 | # puts stdout "Diagnostic: Device bounding box e $bbox (um)" |
| 1296 | tech unlock * |
| 1297 | |
| 1298 | set fw [- [lindex $bbox 2] [lindex $bbox 0]] |
| 1299 | set fh [- [lindex $bbox 3] [lindex $bbox 1]] |
| 1300 | set lw [+ [lindex $bbox 2] [lindex $bbox 0]] |
| 1301 | set lh [+ [lindex $bbox 3] [lindex $bbox 1]] |
| 1302 | |
| 1303 | # Determine tile width and height |
| 1304 | |
| 1305 | set dx [+ $fw $end_spacing] |
| 1306 | set dy [+ $fh $end_spacing] |
| 1307 | |
| 1308 | # Determine core width and height |
| 1309 | set corex [+ [* [- $nx 1] $dx] $fw] |
| 1310 | set corey [+ [* [- $ny 1] $dy] $fh] |
| 1311 | set corellx [/ [+ [- $corex $fw] $lw] 2.0] |
| 1312 | set corelly [/ [+ [- $corey $fh] $lh] 2.0] |
| 1313 | |
| 1314 | # Calculate guard ring size (measured to contact center) |
| 1315 | # Spacing between photodiode (deep nwell) and deep nwell (other) is 5.3um |
| 1316 | set gx [+ $corex 15.965] |
| 1317 | set gy [+ $corey 15.965] |
| 1318 | |
| 1319 | pushbox |
| 1320 | |
| 1321 | # The deep nwell is offset 0.315 from the nwell ring center to get the |
| 1322 | # right overlap. The deep nwell ring has a minimum width of 3um. |
| 1323 | set hgx [/ $gx 2.0] |
| 1324 | set hgy [/ $gy 2.0] |
| 1325 | set dwx [+ $hgx 0.315] |
| 1326 | set dwy [+ $hgy 0.315] |
| 1327 | box grow e ${dwx}um |
| 1328 | box grow w ${dwx}um |
| 1329 | box grow n ${dwy}um |
| 1330 | box grow s ${dwy}um |
| 1331 | paint dnwell |
| 1332 | box grow e -3.0um |
| 1333 | box grow w -3.0um |
| 1334 | box grow n -3.0um |
| 1335 | box grow s -3.0um |
| 1336 | erase dnwell |
| 1337 | |
| 1338 | popbox |
| 1339 | |
| 1340 | # Draw the guard ring first. 0.63 is the amount nwell surrounds contact; |
| 1341 | # 0.63 * 2 + 0.17 = total nwell width 1.43um, needed to cover dnwell edge. |
| 1342 | set newdict [dict create \ |
| 1343 | sub_type space \ |
| 1344 | guard_sub_type nwell \ |
| 1345 | guard_sub_surround 0.63 \ |
| 1346 | plus_diff_type nsd \ |
| 1347 | plus_contact_type nsc \ |
| 1348 | ] |
| 1349 | set guarddict [dict merge $parameters $newdict] |
| 1350 | sky130::guard_ring $gx $gy $guarddict |
| 1351 | |
| 1352 | # Draw outside P-ring and generated the 2nd ring |
| 1353 | set gx [+ $gx [* 2.0 [+ 0.56 $diff_spacing $diff_surround]] $contact_size] |
| 1354 | set gy [+ $gy [* 2.0 [+ 0.56 $diff_spacing $diff_surround]] $contact_size] |
| 1355 | sky130::guard_ring $gx $gy $parameters |
| 1356 | |
| 1357 | pushbox |
| 1358 | box move w ${corellx}um |
| 1359 | box move s ${corelly}um |
| 1360 | |
| 1361 | for {set xp 0} {$xp < $nx} {incr xp} { |
| 1362 | pushbox |
| 1363 | for {set yp 0} {$yp < $ny} {incr yp} { |
| 1364 | sky130::photodiode_device $parameters |
| 1365 | box move n ${dy}um |
| 1366 | } |
| 1367 | popbox |
| 1368 | box move e ${dx}um |
| 1369 | } |
| 1370 | popbox |
| 1371 | popbox |
| 1372 | |
| 1373 | tech revert |
| 1374 | } |
| 1375 | |
| 1376 | #---------------------------------------------------------------- |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1377 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1378 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1379 | |
| 1380 | # Set a local variable for each rule in ruleset |
| 1381 | foreach key [dict keys $sky130::ruleset] { |
| 1382 | set $key [dict get $sky130::ruleset $key] |
| 1383 | } |
| 1384 | |
| 1385 | set newdict [dict create \ |
| 1386 | dev_type ndiode \ |
| 1387 | dev_contact_type ndic \ |
| 1388 | end_type psd \ |
| 1389 | end_contact_type psc \ |
| 1390 | end_sub_type psub \ |
| 1391 | dev_spacing ${diff_spacing} \ |
| 1392 | dev_surround ${diff_surround} \ |
| 1393 | end_spacing ${diff_spacing} \ |
| 1394 | end_surround 0 \ |
| 1395 | ] |
| 1396 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1397 | return [sky130::diode_draw $drawdict] |
| 1398 | } |
| 1399 | |
| 1400 | #---------------------------------------------------------------- |
| 1401 | # NOTE: Use ppd instead of psd so that there is additional |
| 1402 | # diffusion around the contact, allowing more space for the |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1403 | # implant (likewise sky130_fd_pr__diode_pd2nw_05v5_lvt and |
| 1404 | # sky130_fd_pr__diode_pd2nw_11v0). |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1405 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1406 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_lvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1407 | |
| 1408 | # Set a local variable for each rule in ruleset |
| 1409 | foreach key [dict keys $sky130::ruleset] { |
| 1410 | set $key [dict get $sky130::ruleset $key] |
| 1411 | } |
| 1412 | |
| 1413 | set newdict [dict create \ |
| 1414 | dev_type ndiodelvt \ |
| 1415 | dev_contact_type ndilvtc \ |
| 1416 | end_type ppd \ |
| 1417 | end_contact_type psc \ |
| 1418 | end_sub_type psub \ |
| 1419 | dev_spacing ${diff_spacing} \ |
| 1420 | dev_surround ${diff_surround} \ |
| 1421 | end_spacing ${diff_spacing} \ |
| 1422 | end_surround ${diff_surround} \ |
| 1423 | ] |
| 1424 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1425 | return [sky130::diode_draw $drawdict] |
| 1426 | } |
| 1427 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1428 | proc sky130::sky130_fd_pr__diode_pw2nd_05v5_nvt_draw {parameters} { |
| 1429 | |
| 1430 | # Set a local variable for each rule in ruleset |
| 1431 | foreach key [dict keys $sky130::ruleset] { |
| 1432 | set $key [dict get $sky130::ruleset $key] |
| 1433 | } |
| 1434 | |
| 1435 | set newdict [dict create \ |
| 1436 | dev_type nndiode \ |
| 1437 | dev_contact_type nndic \ |
| 1438 | end_type mvpsd \ |
| 1439 | end_contact_type mvpsc \ |
| 1440 | end_sub_type psub \ |
| 1441 | dev_spacing 0.37 \ |
| 1442 | dev_surround ${diff_surround} \ |
| 1443 | end_spacing 0.30 \ |
| 1444 | end_surround ${diff_surround} \ |
| 1445 | ] |
| 1446 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1447 | return [sky130::diode_draw $drawdict] |
| 1448 | } |
| 1449 | |
| 1450 | proc sky130::sky130_fd_pr__diode_pw2nd_11v0_draw {parameters} { |
| 1451 | |
| 1452 | # Set a local variable for each rule in ruleset |
| 1453 | foreach key [dict keys $sky130::ruleset] { |
| 1454 | set $key [dict get $sky130::ruleset $key] |
| 1455 | } |
| 1456 | |
| 1457 | set newdict [dict create \ |
| 1458 | dev_type mvndiode \ |
| 1459 | dev_contact_type mvndic \ |
| 1460 | end_type mvpsd \ |
| 1461 | end_contact_type mvpsc \ |
| 1462 | end_sub_type psub \ |
| 1463 | diff_spacing 0.37 \ |
| 1464 | dev_spacing 0.39 \ |
| 1465 | dev_surround ${diff_surround} \ |
| 1466 | end_spacing 0.36 \ |
| 1467 | end_surround ${diff_surround} \ |
| 1468 | ] |
| 1469 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1470 | return [sky130::diode_draw $drawdict] |
| 1471 | } |
| 1472 | |
| 1473 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1474 | #---------------------------------------------------------------- |
| 1475 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1476 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1477 | |
| 1478 | # Set a local variable for each rule in ruleset |
| 1479 | foreach key [dict keys $sky130::ruleset] { |
| 1480 | set $key [dict get $sky130::ruleset $key] |
| 1481 | } |
| 1482 | |
| 1483 | set newdict [dict create \ |
| 1484 | dev_type pdiode \ |
| 1485 | guard 1 \ |
| 1486 | dev_contact_type pdic \ |
| 1487 | end_type nsd \ |
| 1488 | end_contact_type nsc \ |
| 1489 | end_sub_type nwell \ |
| 1490 | plus_diff_type psd \ |
| 1491 | plus_contact_type psc \ |
| 1492 | sub_type psub \ |
| 1493 | dev_spacing ${diff_spacing} \ |
| 1494 | dev_surround ${diff_surround} \ |
| 1495 | end_spacing ${diff_spacing} \ |
| 1496 | end_surround 0 \ |
| 1497 | ] |
| 1498 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1499 | return [sky130::diode_draw $drawdict] |
| 1500 | } |
| 1501 | |
| 1502 | #---------------------------------------------------------------- |
| 1503 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1504 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_lvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1505 | |
| 1506 | # Set a local variable for each rule in ruleset |
| 1507 | foreach key [dict keys $sky130::ruleset] { |
| 1508 | set $key [dict get $sky130::ruleset $key] |
| 1509 | } |
| 1510 | |
| 1511 | set newdict [dict create \ |
| 1512 | dev_type pdiodelvt \ |
| 1513 | guard 1 \ |
| 1514 | dev_contact_type pdilvtc \ |
| 1515 | end_type nnd \ |
| 1516 | end_contact_type nsc \ |
| 1517 | end_sub_type nwell \ |
| 1518 | plus_diff_type psd \ |
| 1519 | plus_contact_type psc \ |
| 1520 | sub_type psub \ |
| 1521 | dev_spacing ${diff_spacing} \ |
| 1522 | dev_surround ${diff_surround} \ |
| 1523 | end_spacing ${diff_spacing} \ |
| 1524 | end_surround ${diff_surround} \ |
| 1525 | ] |
| 1526 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1527 | return [sky130::diode_draw $drawdict] |
| 1528 | } |
| 1529 | |
| 1530 | #---------------------------------------------------------------- |
| 1531 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1532 | proc sky130::sky130_fd_pr__diode_pd2nw_05v5_hvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1533 | |
| 1534 | # Set a local variable for each rule in ruleset |
| 1535 | foreach key [dict keys $sky130::ruleset] { |
| 1536 | set $key [dict get $sky130::ruleset $key] |
| 1537 | } |
| 1538 | |
| 1539 | set newdict [dict create \ |
| 1540 | dev_type pdiodehvt \ |
| 1541 | guard 1 \ |
| 1542 | dev_contact_type pdihvtc \ |
| 1543 | end_type nnd \ |
| 1544 | end_contact_type nsc \ |
| 1545 | end_sub_type nwell \ |
| 1546 | plus_diff_type psd \ |
| 1547 | plus_contact_type psc \ |
| 1548 | sub_type psub \ |
| 1549 | dev_spacing ${diff_spacing} \ |
| 1550 | dev_surround ${diff_surround} \ |
| 1551 | end_spacing ${diff_spacing} \ |
| 1552 | end_surround ${diff_surround} \ |
| 1553 | ] |
| 1554 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1555 | return [sky130::diode_draw $drawdict] |
| 1556 | } |
| 1557 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1558 | |
| 1559 | #---------------------------------------------------------------- |
| 1560 | |
Tim Edwards | be6f120 | 2020-10-29 10:37:46 -0400 | [diff] [blame] | 1561 | proc sky130::sky130_fd_pr__diode_pd2nw_11v0_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1562 | |
| 1563 | # Set a local variable for each rule in ruleset |
| 1564 | foreach key [dict keys $sky130::ruleset] { |
| 1565 | set $key [dict get $sky130::ruleset $key] |
| 1566 | } |
| 1567 | |
| 1568 | set newdict [dict create \ |
| 1569 | guard 1 \ |
| 1570 | dev_type mvpdiode \ |
| 1571 | dev_contact_type mvpdic \ |
| 1572 | end_type mvnsd \ |
| 1573 | end_contact_type mvnsc \ |
| 1574 | end_sub_type nwell \ |
| 1575 | plus_diff_type mvpsd \ |
| 1576 | plus_contact_type mvpsc \ |
| 1577 | sub_type psub \ |
| 1578 | diff_spacing 0.58 \ |
| 1579 | dev_spacing 0.37 \ |
| 1580 | dev_surround ${diff_surround} \ |
| 1581 | end_spacing 0.30 \ |
| 1582 | end_sub_surround 0.33 \ |
| 1583 | end_surround ${diff_surround} \ |
| 1584 | ] |
| 1585 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1586 | return [sky130::diode_draw $drawdict] |
| 1587 | } |
| 1588 | |
| 1589 | #---------------------------------------------------------------- |
Tim Edwards | c2787e8 | 2021-11-17 15:27:23 -0500 | [diff] [blame] | 1590 | # The photodiode has its own drawing routine, so |
| 1591 | #---------------------------------------------------------------- |
| 1592 | |
| 1593 | proc sky130::sky130_fd_pr__photodiode_draw {parameters} { |
| 1594 | # Set a local variable for each rule in ruleset |
| 1595 | foreach key [dict keys $sky130::ruleset] { |
| 1596 | set $key [dict get $sky130::ruleset $key] |
| 1597 | } |
| 1598 | |
| 1599 | set newdict [dict create \ |
| 1600 | guard 1 \ |
| 1601 | sub_type space \ |
| 1602 | end_spacing 5.0 \ |
| 1603 | end_surround 1.0 \ |
| 1604 | sub_spacing 5.3 \ |
| 1605 | guard_sub_type pwell \ |
| 1606 | guard_sub_surround 0.18 \ |
| 1607 | plus_diff_type psd \ |
| 1608 | plus_contact_type psc \ |
| 1609 | ] |
| 1610 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 1611 | return [sky130::photodiode_draw $drawdict] |
| 1612 | } |
| 1613 | |
| 1614 | #---------------------------------------------------------------- |
Tim Edwards | 27348db | 2020-10-28 22:49:29 -0400 | [diff] [blame] | 1615 | # Drawn capacitor routines |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1616 | # NOTE: Work in progress. These values need to be corrected. |
| 1617 | #---------------------------------------------------------------- |
| 1618 | |
| 1619 | #ifdef MIM |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1620 | proc sky130::sky130_fd_pr__cap_mim_m3_1_defaults {} { |
Tim Edwards | 15463bc | 2021-05-12 21:33:31 -0400 | [diff] [blame] | 1621 | return {w 2.00 l 2.00 val 8.0 carea 2.00 cperi 0.19 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1622 | nx 1 ny 1 dummy 0 square 0 lmin 2.00 wmin 2.00 \ |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1623 | lmax 30.0 wmax 30.0 dc 0 bconnect 1 tconnect 1 \ |
| 1624 | ccov 100} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1625 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1626 | proc sky130::sky130_fd_pr__cap_mim_m3_2_defaults {} { |
Tim Edwards | 15463bc | 2021-05-12 21:33:31 -0400 | [diff] [blame] | 1627 | return {w 2.00 l 2.00 val 8.0 carea 2.00 cperi 0.19 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1628 | nx 1 ny 1 dummy 0 square 0 lmin 2.00 wmin 2.00 \ |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1629 | lmax 30.0 wmax 30.0 dc 0 bconnect 1 tconnect 1 \ |
| 1630 | ccov 100} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1631 | } |
| 1632 | #endif (MIM) |
| 1633 | |
| 1634 | |
| 1635 | #---------------------------------------------------------------- |
| 1636 | # Recalculate capacitor values from GUI entries. |
| 1637 | # Recomputes W/L and Value as long as 2 of them are present |
| 1638 | # (To be completed) |
| 1639 | #---------------------------------------------------------------- |
| 1640 | |
| 1641 | proc sky130::cap_recalc {field parameters} { |
| 1642 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1643 | foreach key [dict keys $parameters] { |
| 1644 | set $key [dict get $parameters $key] |
| 1645 | } |
| 1646 | switch $field { |
| 1647 | val { puts stdout "value changed" } |
| 1648 | w { puts stdout "width changed" } |
| 1649 | l { puts stdout "length changed" } |
| 1650 | } |
| 1651 | dict set parameters val $val |
| 1652 | dict set parameters w $w |
| 1653 | dict set parameters l $l |
| 1654 | } |
| 1655 | |
| 1656 | #---------------------------------------------------------------- |
| 1657 | # Capacitor defaults: |
| 1658 | #---------------------------------------------------------------- |
| 1659 | # w Width of drawn cap |
| 1660 | # l Length of drawn cap |
| 1661 | # nx Number of devices in X |
| 1662 | # ny Number of devices in Y |
| 1663 | # val Default cap value |
| 1664 | # carea Area |
| 1665 | # cperi Perimeter |
| 1666 | # dummy Add dummy cap |
| 1667 | # square Make square capacitor |
| 1668 | # |
| 1669 | # (not user-editable) |
| 1670 | # |
| 1671 | # wmin Minimum allowed width |
| 1672 | # lmin Minimum allowed length |
| 1673 | # dc Area to remove to calculated area |
| 1674 | #---------------------------------------------------------------- |
| 1675 | |
| 1676 | #---------------------------------------------------------------- |
| 1677 | # capacitor: Conversion from SPICE netlist parameters to toolkit |
| 1678 | #---------------------------------------------------------------- |
| 1679 | |
| 1680 | proc sky130::cap_convert {parameters} { |
| 1681 | set pdkparams [dict create] |
| 1682 | dict for {key value} $parameters { |
| 1683 | switch -nocase $key { |
| 1684 | l - |
| 1685 | w { |
| 1686 | # Length and width are converted to units of microns |
| 1687 | set value [magic::spice2float $value] |
| 1688 | # set value [expr $value * 1e6] |
| 1689 | set value [magic::3digitpastdecimal $value] |
| 1690 | dict set pdkparams [string tolower $key] $value |
| 1691 | } |
| 1692 | m { |
| 1693 | # Convert m to ny |
| 1694 | dict set pdkparams ny $value |
| 1695 | } |
| 1696 | } |
| 1697 | } |
| 1698 | return $pdkparams |
| 1699 | } |
| 1700 | |
| 1701 | #ifdef MIM |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1702 | proc sky130::sky130_fd_pr__cap_mim_m3_1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1703 | return [cap_convert $parameters] |
| 1704 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1705 | proc sky130::sky130_fd_pr__cap_mim_m3_2_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1706 | return [cap_convert $parameters] |
| 1707 | } |
| 1708 | #endif (MIM) |
| 1709 | |
| 1710 | #---------------------------------------------------------------- |
| 1711 | # capacitor: Interactively specifies the fixed layout parameters |
| 1712 | #---------------------------------------------------------------- |
| 1713 | |
| 1714 | proc sky130::cap_dialog {device parameters} { |
| 1715 | # Editable fields: w, l, nx, ny, val |
| 1716 | # Checked fields: square, dummy |
| 1717 | |
| 1718 | magic::add_entry val "Value (fF)" $parameters |
| 1719 | sky130::compute_ctot $parameters |
| 1720 | magic::add_message ctot "Total capacitance (pF)" $parameters |
| 1721 | magic::add_entry l "Length (um)" $parameters |
| 1722 | magic::add_entry w "Width (um)" $parameters |
| 1723 | magic::add_entry nx "X Repeat" $parameters |
| 1724 | magic::add_entry ny "Y Repeat" $parameters |
| 1725 | |
| 1726 | if {[dict exists $parameters square]} { |
| 1727 | magic::add_checkbox square "Square capacitor" $parameters |
| 1728 | } |
| 1729 | if {[dict exists $parameters bconnect]} { |
| 1730 | magic::add_checkbox bconnect "Connect bottom plates in array" $parameters |
| 1731 | } |
| 1732 | if {[dict exists $parameters tconnect]} { |
| 1733 | magic::add_checkbox tconnect "Connect top plates in array" $parameters |
| 1734 | } |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1735 | if {[dict exists $parameters ccov]} { |
| 1736 | magic::add_entry ccov "Capacitor contact coverage \[+/-\](%)" $parameters |
| 1737 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1738 | if {[dict exists $parameters guard]} { |
| 1739 | magic::add_checkbox guard "Add guard ring" $parameters |
| 1740 | } |
| 1741 | |
| 1742 | magic::add_dependency sky130::cap_recalc $device sky130 l w val |
| 1743 | |
| 1744 | # magic::add_checkbox dummy "Add dummy" $parameters |
| 1745 | } |
| 1746 | |
| 1747 | #ifdef MIM |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1748 | proc sky130::sky130_fd_pr__cap_mim_m3_1_dialog {parameters} { |
| 1749 | sky130::cap_dialog sky130_fd_pr__cap_mim_m3_1 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1750 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 1751 | proc sky130::sky130_fd_pr__cap_mim_m3_2_dialog {parameters} { |
| 1752 | sky130::cap_dialog sky130_fd_pr__cap_mim_m3_2 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1753 | } |
| 1754 | #endif (MIM) |
| 1755 | |
| 1756 | #---------------------------------------------------------------- |
| 1757 | # Capacitor total capacitance computation |
| 1758 | #---------------------------------------------------------------- |
| 1759 | |
| 1760 | proc sky130::compute_ctot {parameters} { |
| 1761 | foreach key [dict keys $parameters] { |
| 1762 | set $key [dict get $parameters $key] |
| 1763 | } |
| 1764 | set val [magic::spice2float $val] |
| 1765 | set val [magic::3digitpastdecimal $val] |
| 1766 | |
| 1767 | # Compute total capacitance (and convert fF to pF) |
| 1768 | catch {set magic::ctot_val [expr (0.001 * $val * $nx * $ny)]} |
| 1769 | } |
| 1770 | |
| 1771 | #---------------------------------------------------------------- |
| 1772 | # Capacitor: Draw a single device |
| 1773 | #---------------------------------------------------------------- |
| 1774 | |
| 1775 | proc sky130::cap_device {parameters} { |
| 1776 | # Epsilon for avoiding round-off errors |
| 1777 | set eps 0.0005 |
| 1778 | |
| 1779 | # Set local default values if they are not in parameters |
| 1780 | set cap_surround 0 |
| 1781 | set bot_surround 0 |
| 1782 | set top_surround 0 |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1783 | set end_spacing 0 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1784 | set bconnect 0 ;# bottom plates are connected in array |
| 1785 | set cap_spacing 0 ;# cap spacing in array |
| 1786 | set top_metal_space 0 ;# top metal spacing (if larger than cap spacing) |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1787 | set top_metal_width 0 ;# top metal minimum width |
| 1788 | set contact_size 0 ;# cap contact minimum size |
| 1789 | set ccov 100 ;# amount of contact coverage |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1790 | |
| 1791 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1792 | foreach key [dict keys $parameters] { |
| 1793 | set $key [dict get $parameters $key] |
| 1794 | } |
| 1795 | |
| 1796 | if {![dict exists $parameters top_metal_space]} { |
| 1797 | set top_metal_space $metal_spacing |
| 1798 | } |
| 1799 | |
| 1800 | # Draw the device |
| 1801 | pushbox |
| 1802 | box size 0 0 |
| 1803 | |
| 1804 | pushbox |
| 1805 | set hw [/ $w 2.0] |
| 1806 | set hl [/ $l 2.0] |
| 1807 | box grow e ${hw}um |
| 1808 | box grow w ${hw}um |
| 1809 | box grow n ${hl}um |
| 1810 | box grow s ${hl}um |
| 1811 | paint ${cap_type} |
| 1812 | pushbox |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1813 | |
| 1814 | # Find contact width if ccov is other than 100 |
| 1815 | set cmaxw [- $w [* $cap_surround 2]] |
| 1816 | set cw [* $cmaxw [/ [expr abs($ccov)] 100.0]] |
| 1817 | # Contact width must meet minimum |
| 1818 | if {$cw < $contact_size} {set cw $contact_size} |
| 1819 | if {$cw < $top_metal_width} {set cw $top_metal_width} |
| 1820 | # Difference between maximum contact width and actual contact width |
| 1821 | set cdif [- $cmaxw $cw] |
| 1822 | |
| 1823 | # Reduce the box to the maximum contact area |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1824 | box grow n -${cap_surround}um |
| 1825 | box grow s -${cap_surround}um |
| 1826 | box grow e -${cap_surround}um |
| 1827 | box grow w -${cap_surround}um |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1828 | |
| 1829 | set anchor [string index $ccov 0] |
| 1830 | if {$anchor == "+"} { |
| 1831 | box grow e -${cdif}um |
| 1832 | } elseif {$anchor == "-"} { |
| 1833 | box grow w -${cdif}um |
| 1834 | } else { |
| 1835 | set cdif [/ ${cdif} 2] |
| 1836 | box grow w -${cdif}um |
| 1837 | box grow e -${cdif}um |
| 1838 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1839 | paint ${cap_contact_type} |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1840 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1841 | pushbox |
| 1842 | box grow n ${top_surround}um |
| 1843 | box grow s ${top_surround}um |
| 1844 | box grow e ${top_surround}um |
| 1845 | box grow w ${top_surround}um |
| 1846 | paint ${top_type} |
| 1847 | set cext [sky130::getbox] |
| 1848 | popbox |
| 1849 | popbox |
| 1850 | pushbox |
| 1851 | box grow n ${bot_surround}um |
| 1852 | box grow s ${bot_surround}um |
| 1853 | box grow e ${bot_surround}um |
| 1854 | box grow w ${bot_surround}um |
| 1855 | |
| 1856 | paint ${bot_type} |
| 1857 | # Create boundary using properties |
| 1858 | property FIXED_BBOX [box values] |
| 1859 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 1860 | |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1861 | # Calculate the distance from the top metal on the cap contact |
| 1862 | # to the top metal on the end contact. |
| 1863 | set top_met_sep [+ $end_spacing [- $cdif $top_surround]] |
| 1864 | |
| 1865 | # Diagnostic! |
| 1866 | puts stdout "cdif = $cdif" |
| 1867 | puts stdout "top_met_sep = $top_met_sep" |
| 1868 | |
| 1869 | # Increase end spacing if top metal spacing rule is not met |
| 1870 | set loc_end_spacing $end_spacing |
| 1871 | if {$top_met_sep < $top_metal_space} { |
| 1872 | set loc_end_spacing [+ $loc_end_spacing [- $top_metal_space $top_met_sep]] |
| 1873 | } |
| 1874 | # Diagnostic! |
| 1875 | puts stdout "loc_end_spacing = $loc_end_spacing" |
| 1876 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1877 | # Extend bottom metal under contact to right |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1878 | box grow e ${loc_end_spacing}um |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1879 | set chw [/ ${contact_size} 2.0] |
| 1880 | box grow e ${chw}um |
| 1881 | box grow e ${end_surround}um |
| 1882 | paint ${bot_type} |
| 1883 | |
| 1884 | popbox |
| 1885 | popbox |
| 1886 | |
| 1887 | # Draw contact to right. Reduce contact extent if devices are not |
| 1888 | # wired together and the top metal spacing rule limits the distance |
| 1889 | set lcont $l |
| 1890 | if {($bconnect == 0) && ($ny > 1)} { |
| 1891 | if {$cap_spacing < $top_metal_space} { |
| 1892 | set cspace [- $top_metal_space $cap_spacing] |
| 1893 | set lcont [- $l $cspace] |
| 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | pushbox |
| 1898 | box move e ${hw}um |
| 1899 | box move e ${bot_surround}um |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 1900 | box move e ${loc_end_spacing}um |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 1901 | set cl [- [+ ${lcont} [* ${bot_surround} 2.0]] [* ${end_surround} 2.0]] |
| 1902 | set cl [- ${cl} ${metal_surround}] ;# see below |
| 1903 | set cext [sky130::unionbox $cext [sky130::draw_contact 0 ${cl} \ |
| 1904 | ${end_surround} ${metal_surround} ${contact_size} \ |
| 1905 | ${bot_type} ${top_contact_type} ${top_type} full]] |
| 1906 | popbox |
| 1907 | popbox |
| 1908 | |
| 1909 | return $cext |
| 1910 | |
| 1911 | # cl shrinks top and bottom to accomodate larger bottom metal |
| 1912 | # surround rule for contacts near a MiM cap. This should be its |
| 1913 | # own variable, but metal_surround is sufficient. |
| 1914 | } |
| 1915 | |
| 1916 | #---------------------------------------------------------------- |
| 1917 | # Metal plate sandwich capacitor: Draw a single device |
| 1918 | #---------------------------------------------------------------- |
| 1919 | |
| 1920 | proc sky130::sandwich_cap_device {parameters} { |
| 1921 | |
| 1922 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 1923 | foreach key [dict keys $parameters] { |
| 1924 | set $key [dict get $parameters $key] |
| 1925 | } |
| 1926 | |
| 1927 | pushbox |
| 1928 | box size 0 0 |
| 1929 | |
| 1930 | set hw [/ $w 2.0] |
| 1931 | set hl [/ $l 2.0] |
| 1932 | |
| 1933 | set cw [- [* $hw [/ 2.0 3]] [* $cont_surround 2.0]] |
| 1934 | set cl [- [* $hl [/ 2.0 3]] [* $cont_surround 2.0]] |
| 1935 | |
| 1936 | # plate capacitor defines layers p0, p1, etc. |
| 1937 | for {set i 0} {$i < 20} {incr i} { |
| 1938 | if {[catch {set layer [subst \$p${i}_type]}]} {break} ;# no more layers defined |
| 1939 | pushbox |
| 1940 | box grow e ${hw}um |
| 1941 | box grow w ${hw}um |
| 1942 | box grow n ${hl}um |
| 1943 | box grow s ${hl}um |
| 1944 | if {![catch {set shrink [subst \$p${i}_shrink]}]} { |
| 1945 | box grow e -${shrink}um |
| 1946 | box grow w -${shrink}um |
| 1947 | box grow n -${shrink}um |
| 1948 | box grow s -${shrink}um |
| 1949 | set cutout_spacing [+ [* ${shrink} 2.0] [/ $via_size 2.0] $cont_surround] |
| 1950 | } else { |
| 1951 | set cutout_spacing 0 |
| 1952 | } |
| 1953 | |
| 1954 | paint ${layer} |
| 1955 | |
| 1956 | if {$i == 1} { |
| 1957 | # Note that cap_type geometry is coincident with p1_type. |
| 1958 | # Typically, this will define a layer that outputs as both |
| 1959 | # poly and a capacitor definition layer. |
| 1960 | if {[dict exists $parameters cap_type]} { |
| 1961 | paint $cap_type |
| 1962 | } |
| 1963 | } |
| 1964 | popbox |
| 1965 | |
| 1966 | # Even layers connect at corners, odd layers connect at sides. |
| 1967 | # Even layers cut out the sides, odd layers cut out the corners. |
| 1968 | # Layer zero has no side contacts or cutout. |
| 1969 | |
| 1970 | if {[% $i 2] == 0} { |
| 1971 | set cornercmd paint |
| 1972 | set cornersize $cutout_spacing |
| 1973 | set sidecmd erase |
| 1974 | set nssidelong [+ $cutout_spacing [/ $hw 3.0]] |
| 1975 | set ewsidelong [+ $cutout_spacing [/ $hl 3.0]] |
| 1976 | set sideshort $cutout_spacing |
| 1977 | } else { |
| 1978 | set cornercmd erase |
| 1979 | set cornersize $cutout_spacing |
| 1980 | set sidecmd paint |
| 1981 | set nssidelong [/ $hw 3.0] |
| 1982 | set ewsidelong [/ $hl 3.0] |
| 1983 | set sideshort $cutout_spacing |
| 1984 | } |
| 1985 | |
| 1986 | if {$i > 0} { |
| 1987 | pushbox |
| 1988 | box move e ${hw}um |
| 1989 | box grow n ${ewsidelong}um |
| 1990 | box grow s ${ewsidelong}um |
| 1991 | box grow w ${sideshort}um |
| 1992 | ${sidecmd} ${layer} |
| 1993 | popbox |
| 1994 | pushbox |
| 1995 | box move n ${hl}um |
| 1996 | box grow e ${nssidelong}um |
| 1997 | box grow w ${nssidelong}um |
| 1998 | box grow s ${sideshort}um |
| 1999 | ${sidecmd} ${layer} |
| 2000 | popbox |
| 2001 | pushbox |
| 2002 | box move w ${hw}um |
| 2003 | box grow n ${ewsidelong}um |
| 2004 | box grow s ${ewsidelong}um |
| 2005 | box grow e ${sideshort}um |
| 2006 | ${sidecmd} ${layer} |
| 2007 | popbox |
| 2008 | pushbox |
| 2009 | box move s ${hl}um |
| 2010 | box grow e ${nssidelong}um |
| 2011 | box grow w ${nssidelong}um |
| 2012 | box grow n ${sideshort}um |
| 2013 | ${sidecmd} ${layer} |
| 2014 | popbox |
| 2015 | |
| 2016 | pushbox |
| 2017 | box move n ${hl}um |
| 2018 | box move e ${hw}um |
| 2019 | box grow s ${cornersize}um |
| 2020 | box grow w ${cornersize}um |
| 2021 | ${cornercmd} ${layer} |
| 2022 | popbox |
| 2023 | pushbox |
| 2024 | box move n ${hl}um |
| 2025 | box move w ${hw}um |
| 2026 | box grow s ${cornersize}um |
| 2027 | box grow e ${cornersize}um |
| 2028 | ${cornercmd} ${layer} |
| 2029 | popbox |
| 2030 | pushbox |
| 2031 | box move s ${hl}um |
| 2032 | box move e ${hw}um |
| 2033 | box grow n ${cornersize}um |
| 2034 | box grow w ${cornersize}um |
| 2035 | ${cornercmd} ${layer} |
| 2036 | popbox |
| 2037 | pushbox |
| 2038 | box move s ${hl}um |
| 2039 | box move w ${hw}um |
| 2040 | box grow n ${cornersize}um |
| 2041 | box grow e ${cornersize}um |
| 2042 | ${cornercmd} ${layer} |
| 2043 | popbox |
| 2044 | } |
| 2045 | } |
| 2046 | |
| 2047 | # Draw contacts after all layers have been drawn, so that erasing |
| 2048 | # layers does not affect the contacts. |
| 2049 | |
| 2050 | for {set i 0} {$i < 20} {incr i} { |
| 2051 | if {![catch {set contact [subst \$p${i}_contact_type]}]} { |
| 2052 | set layer [subst \$p${i}_type] |
| 2053 | set j [+ $i 1] |
| 2054 | set toplayer [subst \$p${j}_type] |
| 2055 | |
| 2056 | # Draw corner contacts |
| 2057 | pushbox |
| 2058 | box move e ${hw}um |
| 2059 | box move n ${hl}um |
| 2060 | sky130::draw_contact 0 0 \ |
| 2061 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2062 | ${layer} ${contact} ${toplayer} full |
| 2063 | popbox |
| 2064 | pushbox |
| 2065 | box move w ${hw}um |
| 2066 | box move n ${hl}um |
| 2067 | sky130::draw_contact 0 0 \ |
| 2068 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2069 | ${layer} ${contact} ${toplayer} full |
| 2070 | popbox |
| 2071 | pushbox |
| 2072 | box move e ${hw}um |
| 2073 | box move s ${hl}um |
| 2074 | sky130::draw_contact 0 0 \ |
| 2075 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2076 | ${layer} ${contact} ${toplayer} full |
| 2077 | popbox |
| 2078 | pushbox |
| 2079 | box move w ${hw}um |
| 2080 | box move s ${hl}um |
| 2081 | sky130::draw_contact 0 0 \ |
| 2082 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2083 | ${layer} ${contact} ${toplayer} full |
| 2084 | popbox |
| 2085 | |
| 2086 | # Draw side contacts (except on poly) |
| 2087 | if {$i > 0} { |
| 2088 | pushbox |
| 2089 | box move w ${hw}um |
| 2090 | sky130::draw_contact 0 ${cl} \ |
| 2091 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2092 | ${layer} ${contact} ${toplayer} full |
| 2093 | popbox |
| 2094 | pushbox |
| 2095 | box move e ${hw}um |
| 2096 | sky130::draw_contact 0 ${cl} \ |
| 2097 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2098 | ${layer} ${contact} ${toplayer} full |
| 2099 | popbox |
| 2100 | pushbox |
| 2101 | box move n ${hl}um |
| 2102 | sky130::draw_contact ${cw} 0 \ |
| 2103 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2104 | ${layer} ${contact} ${toplayer} full |
| 2105 | popbox |
| 2106 | pushbox |
| 2107 | box move s ${hl}um |
| 2108 | sky130::draw_contact ${cw} 0 \ |
| 2109 | ${cont_surround} ${cont_surround} ${via_size} \ |
| 2110 | ${layer} ${contact} ${toplayer} full |
| 2111 | popbox |
| 2112 | } |
| 2113 | } else { |
| 2114 | break |
| 2115 | } |
| 2116 | } |
| 2117 | |
| 2118 | popbox |
| 2119 | # Bounding box is the same as the device length and width |
| 2120 | set cext [list -$hw -$hl $hw $hl] |
| 2121 | return $cext |
| 2122 | } |
| 2123 | |
| 2124 | #---------------------------------------------------------------- |
| 2125 | # Capacitor: Draw the tiled device |
| 2126 | #---------------------------------------------------------------- |
| 2127 | |
| 2128 | proc sky130::cap_draw {parameters} { |
| 2129 | tech unlock * |
| 2130 | set savesnap [snap] |
| 2131 | snap internal |
| 2132 | |
| 2133 | # Set defaults if they are not in parameters |
| 2134 | set coverlap 0 ;# overlap capacitors at contacts |
| 2135 | set guard 0 ;# draw a guard ring |
| 2136 | set sandwich 0 ;# this is not a plate sandwich capacitor |
| 2137 | set cap_spacing 0 ;# abutted caps if spacing is zero |
| 2138 | set cap_diff_spacing 0 |
| 2139 | set wide_cap_spacing 0 ;# additional spacing for wide metal rule |
| 2140 | set wide_cap_width 0 |
| 2141 | set end_spacing 0 |
| 2142 | set end_surround 0 |
| 2143 | set bot_surround 0 |
| 2144 | set top_metal_width 0 |
| 2145 | set bconnect 0 ;# connect bottom plates in array |
| 2146 | set tconnect 0 ;# connect top plates in array |
| 2147 | set top_type "" |
| 2148 | |
| 2149 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 2150 | foreach key [dict keys $parameters] { |
| 2151 | set $key [dict get $parameters $key] |
| 2152 | } |
| 2153 | |
| 2154 | # Normalize distance units to microns |
| 2155 | set w [magic::spice2float $w] |
| 2156 | set l [magic::spice2float $l] |
| 2157 | |
| 2158 | pushbox |
| 2159 | box values 0 0 0 0 |
| 2160 | |
| 2161 | # Determine the base device dimensions by drawing one device |
| 2162 | # while all layers are locked (nothing drawn). This allows the |
| 2163 | # base drawing routine to do complicated geometry without having |
| 2164 | # to duplicate it here with calculations. |
| 2165 | |
| 2166 | tech lock * |
| 2167 | if {$sandwich == 1} { |
| 2168 | set bbox [sky130::sandwich_cap_device $parameters] |
| 2169 | } else { |
| 2170 | set bbox [sky130::cap_device $parameters] |
| 2171 | } |
| 2172 | # puts stdout "Diagnostic: Device bounding box e $bbox (um)" |
| 2173 | tech unlock * |
| 2174 | |
| 2175 | set fw [- [lindex $bbox 2] [lindex $bbox 0]] |
| 2176 | set fh [- [lindex $bbox 3] [lindex $bbox 1]] |
| 2177 | set lw [+ [lindex $bbox 2] [lindex $bbox 0]] |
| 2178 | set lh [+ [lindex $bbox 3] [lindex $bbox 1]] |
| 2179 | |
| 2180 | set dwide 0 |
| 2181 | if {($fw >= $wide_cap_width) && ($fh >= $wide_cap_width)} { |
| 2182 | set dwide $wide_cap_spacing |
| 2183 | } |
| 2184 | |
| 2185 | # Determine tile width and height (depends on overlap) |
| 2186 | if {$coverlap == 0} { |
| 2187 | set dy [+ $fh $cap_spacing $dwide] |
| 2188 | } else { |
| 2189 | # overlap at end contact |
| 2190 | set dy [- $fh [+ $end_surround $end_surround $contact_size]] |
| 2191 | } |
| 2192 | # Contact is placed on right so spacing is determined by end_spacing. |
| 2193 | set dx [+ $fw $end_spacing $dwide] |
| 2194 | |
| 2195 | # Determine core width and height |
| 2196 | set corex [+ [* [- $nx 1] $dx] $fw] |
| 2197 | set corey [+ [* [- $ny 1] $dy] $fh] |
| 2198 | set corellx [/ [+ [- $corex $fw] $lw] 2.0] |
| 2199 | set corelly [/ [+ [- $corey $fh] $lh] 2.0] |
| 2200 | |
| 2201 | if {$guard != 0} { |
| 2202 | # Calculate guard ring size (measured to contact center) |
| 2203 | set gx [+ $corex [* 2.0 [+ $cap_diff_spacing $diff_surround]] $contact_size] |
| 2204 | set gy [+ $corey [* 2.0 [+ $end_spacing $diff_surround]] $contact_size] |
| 2205 | |
| 2206 | # Draw the guard ring first. |
| 2207 | sky130::guard_ring $gx $gy $parameters |
| 2208 | } |
| 2209 | |
| 2210 | set twidth [+ ${contact_size} ${end_surround} ${end_surround}] |
| 2211 | if {${twidth} < ${top_metal_width}} { |
| 2212 | set twidth ${top_metal_width} |
| 2213 | } |
| 2214 | set hmw [/ $twidth 2.0] |
| 2215 | set hdy [/ $dy 2.0] |
| 2216 | set cdx [+ [/ ${w} 2.0] ${bot_surround} ${end_spacing}] |
| 2217 | |
| 2218 | pushbox |
| 2219 | box move w ${corellx}um |
| 2220 | box move s ${corelly}um |
| 2221 | for {set xp 0} {$xp < $nx} {incr xp} { |
| 2222 | pushbox |
| 2223 | for {set yp 0} {$yp < $ny} {incr yp} { |
| 2224 | if {$sandwich == 1} { |
| 2225 | sky130::sandwich_cap_device $parameters |
| 2226 | } else { |
| 2227 | sky130::cap_device $parameters |
| 2228 | } |
| 2229 | if {$ny > 1} { |
| 2230 | pushbox |
| 2231 | box grow e ${hmw}um |
| 2232 | box grow w ${hmw}um |
| 2233 | box grow n ${hdy}um |
| 2234 | box grow s ${hdy}um |
| 2235 | if {($top_type != "") && ($tconnect == 1)} { |
| 2236 | paint ${top_type} |
| 2237 | } |
| 2238 | if {($top_type != "") && ($bconnect == 1)} { |
| 2239 | box move e ${cdx}um |
| 2240 | paint ${top_type} |
| 2241 | } |
| 2242 | popbox |
| 2243 | } |
| 2244 | box move n ${dy}um |
| 2245 | } |
| 2246 | popbox |
| 2247 | box move e ${dx}um |
| 2248 | } |
| 2249 | popbox |
| 2250 | popbox |
| 2251 | |
| 2252 | snap $savesnap |
| 2253 | tech revert |
| 2254 | } |
| 2255 | |
| 2256 | #---------------------------------------------------------------- |
| 2257 | |
| 2258 | #ifdef MIM |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2259 | proc sky130::sky130_fd_pr__cap_mim_m3_1_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2260 | set newdict [dict create \ |
| 2261 | top_type m4 \ |
| 2262 | top_contact_type via3 \ |
| 2263 | cap_type mimcap \ |
| 2264 | cap_contact_type mimcc \ |
| 2265 | bot_type m3 \ |
| 2266 | bot_surround 0.5 \ |
| 2267 | cap_spacing 0.5 \ |
| 2268 | cap_surround 0.2 \ |
| 2269 | top_surround 0.005 \ |
| 2270 | end_surround 0.1 \ |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 2271 | end_spacing 0.1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2272 | contact_size 0.32 \ |
| 2273 | metal_surround 0.08 \ |
| 2274 | ] |
| 2275 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 2276 | return [sky130::cap_draw $drawdict] |
| 2277 | } |
| 2278 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2279 | proc sky130::sky130_fd_pr__cap_mim_m3_2_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2280 | set newdict [dict create \ |
| 2281 | top_type m5 \ |
| 2282 | top_contact_type via4 \ |
| 2283 | cap_type mimcap2 \ |
| 2284 | cap_contact_type mim2cc \ |
| 2285 | bot_type m4 \ |
| 2286 | bot_surround 0.5 \ |
| 2287 | cap_spacing 0.5 \ |
| 2288 | cap_surround 0.2 \ |
| 2289 | top_surround 0.12 \ |
| 2290 | end_surround 0.1 \ |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 2291 | end_spacing 0.1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2292 | contact_size 1.18 \ |
| 2293 | metal_surround 0.21 \ |
| 2294 | top_metal_width 1.6 \ |
| 2295 | top_metal_space 1.7 \ |
| 2296 | ] |
| 2297 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 2298 | return [sky130::cap_draw $drawdict] |
| 2299 | } |
| 2300 | |
| 2301 | #endif (MIM) |
| 2302 | |
| 2303 | #---------------------------------------------------------------- |
| 2304 | # capacitor: Check device parameters for out-of-bounds values |
| 2305 | #---------------------------------------------------------------- |
| 2306 | |
| 2307 | proc sky130::cap_check {parameters} { |
| 2308 | # In case wmax and/or lmax are undefined |
| 2309 | set lmax 0 |
| 2310 | set wmax 0 |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 2311 | set ccov 100 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2312 | |
| 2313 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 2314 | foreach key [dict keys $parameters] { |
| 2315 | set $key [dict get $parameters $key] |
| 2316 | } |
| 2317 | |
| 2318 | # Normalize distance units to microns |
| 2319 | set l [magic::spice2float $l] |
| 2320 | set l [magic::3digitpastdecimal $l] |
| 2321 | set w [magic::spice2float $w] |
| 2322 | set w [magic::3digitpastdecimal $w] |
| 2323 | |
| 2324 | set val [magic::spice2float $val] |
| 2325 | set carea [magic::spice2float $carea] |
| 2326 | set cperi [magic::spice2float $cperi] |
| 2327 | set dc [magic::spice2float $dc] |
| 2328 | |
| 2329 | if {$square == 1} { |
| 2330 | # Calculate L and W from value |
| 2331 | set a $carea |
| 2332 | set b [expr $cperi * 4] |
| 2333 | set c [expr -4 * $dc - $val] |
| 2334 | set l [expr ((-$b + sqrt($b * $b - (4 * $a * $c))) / (2 * $a))] |
| 2335 | dict set parameters l [magic::float2spice $l] |
| 2336 | set w $l |
| 2337 | dict set parameters w [magic::float2spice $w] |
| 2338 | } elseif {$l == 0} { |
| 2339 | # Calculate L from W and value |
| 2340 | set l [expr (($val + 4 * $dc - 2 * $w * $cperi) / ($w * $carea + 2 * $cperi))] |
| 2341 | dict set parameters l [magic::float2spice $l] |
| 2342 | } elseif {$w == 0} { |
| 2343 | # Calculate W from L and value |
| 2344 | set w [expr (($val + 4 * $dc - 2 * $l * $cperi) / ($l * $carea + 2 * $cperi))] |
| 2345 | dict set parameters w [magic::float2spice $w] |
| 2346 | } |
| 2347 | if {$w < $wmin} { |
| 2348 | puts stderr "Capacitor width must be >= $wmin" |
| 2349 | dict set parameters w $wmin |
| 2350 | set w $wmin |
| 2351 | } |
| 2352 | if {$l < $lmin} { |
| 2353 | puts stderr "Capacitor length must be >= $lmin" |
| 2354 | dict set parameters l $lmin |
| 2355 | set l $lmin |
| 2356 | } |
| 2357 | if {($wmax > 0) && ($w > $wmax)} { |
| 2358 | puts stderr "Capacitor width must be <= $wmax" |
| 2359 | dict set parameters w $wmax |
| 2360 | set w $wmax |
| 2361 | } |
| 2362 | if {($lmax > 0) && ($l > $lmax)} { |
| 2363 | puts stderr "Capacitor length must be <= $lmax" |
| 2364 | dict set parameters l $lmax |
| 2365 | set l $lmax |
| 2366 | } |
Tim Edwards | 3c1dd9a | 2020-11-27 13:49:58 -0500 | [diff] [blame] | 2367 | if {[catch {expr abs($ccov)}]} { |
| 2368 | puts stderr "Capacitor contact coverage must be numeric!" |
| 2369 | dict set parameters ccov 100 |
| 2370 | } elseif {[expr abs($ccov)] > 100} { |
| 2371 | puts stderr "Capaitor contact coverage can't be more than 100%" |
| 2372 | dict set parameters ccov 100 |
| 2373 | } |
| 2374 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2375 | # Calculate value from L and W |
| 2376 | set cval [expr ($l * $w * $carea + 2 * ($l + $w) * $cperi - 4 * $dc)] |
| 2377 | dict set parameters val [magic::float2spice $cval] |
| 2378 | sky130::compute_ctot $parameters |
| 2379 | |
| 2380 | return $parameters |
| 2381 | } |
| 2382 | |
| 2383 | #ifdef MIM |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2384 | proc sky130::sky130_fd_pr__cap_mim_m3_1_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2385 | return [sky130::cap_check $parameters] |
| 2386 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2387 | proc sky130::sky130_fd_pr__cap_mim_m3_2_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2388 | return [sky130::cap_check $parameters] |
| 2389 | } |
| 2390 | #endif (MIM) |
| 2391 | |
| 2392 | #---------------------------------------------------------------- |
| 2393 | # Drawn resistors |
| 2394 | #---------------------------------------------------------------- |
| 2395 | |
| 2396 | #---------------------------------------------------------------- |
| 2397 | # Resistor defaults: |
| 2398 | #---------------------------------------------------------------- |
| 2399 | # User editable values: |
| 2400 | # |
| 2401 | # val Resistor value in ohms |
| 2402 | # w Width |
| 2403 | # l Length |
| 2404 | # t Number of turns |
| 2405 | # m Number devices in Y |
| 2406 | # nx Number devices in X |
| 2407 | # snake Use snake geometry (if not present, snake geometry not allowed) |
| 2408 | # dummy Flag to mark addition of dummy resistor |
| 2409 | # |
| 2410 | # Non-user editable values: |
| 2411 | # |
| 2412 | # wmin Minimum allowed width |
| 2413 | # lmin Minimum allowed length |
| 2414 | # rho Resistance in ohms per square |
| 2415 | # dw Delta width |
| 2416 | # term Resistance per terminal |
| 2417 | # sterm Additional resistance per terminal for snake geometry |
| 2418 | #---------------------------------------------------------------- |
| 2419 | |
| 2420 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2421 | # sky130_fd_pr__res_iso_pw: Specify all user-editable default values and those |
| 2422 | # needed by sky130_fd_pr__res_iso_pw_check |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2423 | # NOTE: Work in progress. These values need to be corrected. |
| 2424 | #---------------------------------------------------------------- |
| 2425 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2426 | proc sky130::sky130_fd_pr__res_iso_pw_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2427 | return {w 2.650 l 26.50 m 1 nx 1 wmin 2.650 lmin 26.50 \ |
| 2428 | rho 975 val 4875 dummy 0 dw 0.25 term 1.0 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2429 | guard 1 endcov 100 full_metal 1 vias 1 \ |
| 2430 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2431 | } |
| 2432 | |
| 2433 | #---------------------------------------------------------------- |
| 2434 | # rpp1: Specify all user-editable default values and those |
| 2435 | # needed by rp1_check |
| 2436 | #---------------------------------------------------------------- |
| 2437 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2438 | proc sky130::sky130_fd_pr__res_generic_po_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2439 | return {w 0.330 l 1.650 m 1 nx 1 wmin 0.330 lmin 1.650 \ |
| 2440 | rho 48.2 val 241 dummy 0 dw 0.0 term 0.0 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2441 | sterm 0.0 caplen 0.4 snake 0 guard 1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2442 | glc 1 grc 1 gtc 1 gbc 1 roverlap 0 endcov 100 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2443 | full_metal 1 hv_guard 0 n_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2444 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2445 | } |
| 2446 | |
| 2447 | # "term" is rho * 0.06, the distance between xpc edge and CONT. |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2448 | proc sky130::sky130_fd_pr__res_high_po_0p35_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2449 | return {w 0.350 l 0.50 m 1 nx 1 wmin 0.350 lmin 0.50 \ |
| 2450 | rho 319.8 val 456.857 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2451 | sterm 0.0 caplen 0 guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2452 | compatible {sky130_fd_pr__res_high_po_0p35 \ |
| 2453 | sky130_fd_pr__res_high_po_0p69 sky130_fd_pr__res_high_po_1p41 \ |
| 2454 | sky130_fd_pr__res_high_po_2p85 sky130_fd_pr__res_high_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2455 | full_metal 1 wmax 0.350 vias 1 n_guard 0 hv_guard 0 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2456 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2457 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2458 | proc sky130::sky130_fd_pr__res_high_po_0p69_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2459 | return {w 0.690 l 1.00 m 1 nx 1 wmin 0.690 lmin 0.50 \ |
| 2460 | rho 319.8 val 463.480 dummy 0 dw 0.0 term 19.188 \ |
| 2461 | sterm 0.0 caplen 0 guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2462 | compatible {sky130_fd_pr__res_high_po_0p35 \ |
| 2463 | sky130_fd_pr__res_high_po_0p69 sky130_fd_pr__res_high_po_1p41 \ |
| 2464 | sky130_fd_pr__res_high_po_2p85 sky130_fd_pr__res_high_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2465 | full_metal 1 wmax 0.690 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2466 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2467 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2468 | proc sky130::sky130_fd_pr__res_high_po_1p41_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2469 | return {w 1.410 l 2.00 m 1 nx 1 wmin 1.410 lmin 0.50 \ |
| 2470 | rho 319.8 val 453.620 dummy 0 dw 0.0 term 19.188 \ |
| 2471 | sterm 0.0 caplen 0 guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2472 | compatible {sky130_fd_pr__res_high_po_0p35 \ |
| 2473 | sky130_fd_pr__res_high_po_0p69 sky130_fd_pr__res_high_po_1p41 \ |
| 2474 | sky130_fd_pr__res_high_po_2p85 sky130_fd_pr__res_high_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2475 | full_metal 1 wmax 1.410 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2476 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2477 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2478 | proc sky130::sky130_fd_pr__res_high_po_2p85_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2479 | return {w 2.850 l 3.00 m 1 nx 1 wmin 2.850 lmin 0.50 \ |
| 2480 | rho 319.8 val 336.630 dummy 0 dw 0.0 term 19.188 \ |
| 2481 | sterm 0.0 caplen 0 guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2482 | compatible {sky130_fd_pr__res_high_po_0p35 \ |
| 2483 | sky130_fd_pr__res_high_po_0p69 sky130_fd_pr__res_high_po_1p41 \ |
| 2484 | sky130_fd_pr__res_high_po_2p85 sky130_fd_pr__res_high_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2485 | full_metal 1 wmax 2.850 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2486 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2487 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2488 | proc sky130::sky130_fd_pr__res_high_po_5p73_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2489 | return {w 5.730 l 6.00 m 1 nx 1 wmin 5.730 lmin 0.50 \ |
| 2490 | rho 319.8 val 334.870 dummy 0 dw 0.0 term 19.188 \ |
| 2491 | sterm 0.0 caplen 0 guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2492 | compatible {sky130_fd_pr__res_high_po_0p35 \ |
| 2493 | sky130_fd_pr__res_high_po_0p69 sky130_fd_pr__res_high_po_1p41 \ |
| 2494 | sky130_fd_pr__res_high_po_2p85 sky130_fd_pr__res_high_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2495 | full_metal 1 wmax 5.730 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2496 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2497 | } |
| 2498 | |
| 2499 | # "term" is rho * 0.06, the distance between xpc edge and CONT. |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2500 | proc sky130::sky130_fd_pr__res_xhigh_po_0p35_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2501 | return {w 0.350 l 0.50 m 1 nx 1 wmin 0.350 lmin 0.50 \ |
Tim Edwards | 19e1983 | 2021-04-12 16:23:09 -0400 | [diff] [blame] | 2502 | rho 2000 val 2875.143 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2503 | sterm 0.0 caplen 0 wmax 0.350 \ |
| 2504 | guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2505 | compatible {sky130_fd_pr__res_xhigh_po_0p35 \ |
| 2506 | sky130_fd_pr__res_xhigh_po_0p69 sky130_fd_pr__res_xhigh_po_1p41 \ |
| 2507 | sky130_fd_pr__res_xhigh_po_2p85 sky130_fd_pr__res_xhigh_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2508 | full_metal 1 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2509 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2510 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2511 | proc sky130::sky130_fd_pr__res_xhigh_po_0p69_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2512 | return {w 0.690 l 1.00 m 1 nx 1 wmin 0.690 lmin 0.50 \ |
Tim Edwards | 19e1983 | 2021-04-12 16:23:09 -0400 | [diff] [blame] | 2513 | rho 2000 val 2898.600 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2514 | sterm 0.0 caplen 0 wmax 0.690 \ |
| 2515 | guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2516 | compatible {sky130_fd_pr__res_xhigh_po_0p35 \ |
| 2517 | sky130_fd_pr__res_xhigh_po_0p69 sky130_fd_pr__res_xhigh_po_1p41 \ |
| 2518 | sky130_fd_pr__res_xhigh_po_2p85 sky130_fd_pr__res_xhigh_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2519 | full_metal 1 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2520 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2521 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2522 | proc sky130::sky130_fd_pr__res_xhigh_po_1p41_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2523 | return {w 1.410 l 2.00 m 1 nx 1 wmin 1.410 lmin 0.50 \ |
Tim Edwards | 19e1983 | 2021-04-12 16:23:09 -0400 | [diff] [blame] | 2524 | rho 2000 val 2836.900 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2525 | sterm 0.0 caplen 0 wmax 1.410 \ |
| 2526 | guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2527 | compatible {sky130_fd_pr__res_xhigh_po_0p35 \ |
| 2528 | sky130_fd_pr__res_xhigh_po_0p69 sky130_fd_pr__res_xhigh_po_1p41 \ |
| 2529 | sky130_fd_pr__res_xhigh_po_2p85 sky130_fd_pr__res_xhigh_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2530 | full_metal 1 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2531 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2532 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2533 | proc sky130::sky130_fd_pr__res_xhigh_po_2p85_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2534 | return {w 2.850 l 3.00 m 1 nx 1 wmin 2.850 lmin 0.50 \ |
Tim Edwards | 19e1983 | 2021-04-12 16:23:09 -0400 | [diff] [blame] | 2535 | rho 2000 val 2105.300 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2536 | sterm 0.0 caplen 0 wmax 2.850 \ |
| 2537 | guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2538 | compatible {sky130_fd_pr__res_xhigh_po_0p35 \ |
| 2539 | sky130_fd_pr__res_xhigh_po_0p69 sky130_fd_pr__res_xhigh_po_1p41 \ |
| 2540 | sky130_fd_pr__res_xhigh_po_2p85 sky130_fd_pr__res_xhigh_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2541 | full_metal 1 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2542 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2543 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2544 | proc sky130::sky130_fd_pr__res_xhigh_po_5p73_defaults {} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2545 | return {w 5.730 l 6.00 m 1 nx 1 wmin 5.730 lmin 0.50 \ |
Tim Edwards | 19e1983 | 2021-04-12 16:23:09 -0400 | [diff] [blame] | 2546 | rho 2000 val 2094.200 dummy 0 dw 0.0 term 19.188 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2547 | sterm 0.0 caplen 0 wmax 5.730 \ |
| 2548 | guard 1 glc 1 grc 1 gtc 1 gbc 1 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2549 | compatible {sky130_fd_pr__res_xhigh_po_0p35 \ |
| 2550 | sky130_fd_pr__res_xhigh_po_0p69 sky130_fd_pr__res_xhigh_po_1p41 \ |
| 2551 | sky130_fd_pr__res_xhigh_po_2p85 sky130_fd_pr__res_xhigh_po_5p73} \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2552 | full_metal 1 n_guard 0 hv_guard 0 vias 1 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2553 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2554 | } |
| 2555 | |
| 2556 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2557 | # sky130_fd_pr__res_generic_nd: Specify all user-editable default values and those |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2558 | # needed by rdn_check |
| 2559 | #---------------------------------------------------------------- |
| 2560 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2561 | proc sky130::sky130_fd_pr__res_generic_nd_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2562 | return {w 0.420 l 2.100 m 1 nx 1 wmin 0.42 lmin 2.10 \ |
| 2563 | rho 120 val 600.0 dummy 0 dw 0.05 term 0.0 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2564 | sterm 0.0 caplen 0.4 snake 0 guard 1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2565 | glc 1 grc 1 gtc 1 gbc 1 roverlap 0 endcov 100 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2566 | full_metal 1 vias 1 \ |
| 2567 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2568 | } |
| 2569 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2570 | proc sky130::sky130_fd_pr__res_generic_nd__hv_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2571 | return {w 0.420 l 2.100 m 1 nx 1 wmin 0.42 lmin 2.10 \ |
| 2572 | rho 120 val 600.0 dummy 0 dw 0.02 term 0.0 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2573 | sterm 0.0 caplen 0.4 snake 0 guard 1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2574 | glc 1 grc 1 gtc 1 gbc 1 roverlap 0 endcov 100 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2575 | full_metal 1 vias 1 \ |
| 2576 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2577 | } |
| 2578 | |
| 2579 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2580 | # sky130_fd_pr__res_generic_pd: Specify all user-editable default values and those |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2581 | # needed by rdp_check |
| 2582 | #---------------------------------------------------------------- |
| 2583 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2584 | proc sky130::sky130_fd_pr__res_generic_pd_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2585 | return {w 0.420 l 2.100 m 1 nx 1 wmin 0.42 lmin 2.10 \ |
| 2586 | rho 197 val 985.0 dummy 0 dw 0.02 term 0.0 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2587 | sterm 0.0 caplen 0.60 snake 0 guard 1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2588 | glc 1 grc 1 gtc 1 gbc 1 roverlap 0 endcov 100 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2589 | full_metal 1 vias 1 \ |
| 2590 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2591 | } |
| 2592 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2593 | proc sky130::sky130_fd_pr__res_generic_pd__hv_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2594 | return {w 0.420 l 2.100 m 1 nx 1 wmin 0.42 lmin 2.10 \ |
| 2595 | rho 197 val 985.0 dummy 0 dw 0.02 term 0.0 \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2596 | sterm 0.0 caplen 0.60 snake 0 guard 1 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2597 | glc 1 grc 1 gtc 1 gbc 1 roverlap 0 endcov 100 \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2598 | full_metal 1 vias 1 \ |
| 2599 | viagb 0 viagt 0 viagl 0 viagr 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2600 | } |
| 2601 | |
| 2602 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2603 | # sky130_fd_pr__res_generic_l1: Specify all user-editable default values and those needed |
| 2604 | # by sky130_fd_pr__res_generic_l1_check |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2605 | #---------------------------------------------------------------- |
| 2606 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2607 | proc sky130::sky130_fd_pr__res_generic_l1_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2608 | return {w 0.170 l 0.170 m 1 nx 1 wmin 0.17 lmin 0.17 \ |
| 2609 | rho 12.8 val 12.8 dummy 0 dw 0.0 term 0.0 snake 0 \ |
| 2610 | roverlap 0} |
| 2611 | } |
| 2612 | |
| 2613 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2614 | # sky130_fd_pr__res_generic_m1: Specify all user-editable default values and those needed |
| 2615 | # by sky130_fd_pr__res_generic_m1_check |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2616 | #---------------------------------------------------------------- |
| 2617 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2618 | proc sky130::sky130_fd_pr__res_generic_m1_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2619 | return {w 0.140 l 0.140 m 1 nx 1 wmin 0.14 lmin 0.14 \ |
| 2620 | rho 0.125 val 0.125 dummy 0 dw 0.0 term 0.0 \ |
| 2621 | roverlap 0} |
| 2622 | } |
| 2623 | |
| 2624 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2625 | # sky130_fd_pr__res_generic_m2: Specify all user-editable default values and those needed |
| 2626 | # by sky130_fd_pr__res_generic_m2_check |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2627 | #---------------------------------------------------------------- |
| 2628 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2629 | proc sky130::sky130_fd_pr__res_generic_m2_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2630 | return {w 0.140 l 0.140 m 1 nx 1 wmin 0.14 lmin 0.14 \ |
| 2631 | rho 0.125 val 0.125 dummy 0 dw 0.0 term 0.0 \ |
| 2632 | roverlap 0} |
| 2633 | } |
| 2634 | |
| 2635 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2636 | # sky130_fd_pr__res_generic_m3: Specify all user-editable default values and those needed |
| 2637 | # by sky130_fd_pr__res_generic_m3_check |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2638 | #---------------------------------------------------------------- |
| 2639 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2640 | proc sky130::sky130_fd_pr__res_generic_m3_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2641 | return {w 0.300 l 0.300 m 1 nx 1 wmin 0.30 lmin 0.30 \ |
| 2642 | rho 0.047 val 0.047 dummy 0 dw 0.0 term 0.0 \ |
| 2643 | roverlap 0} |
| 2644 | } |
| 2645 | |
| 2646 | #---------------------------------------------------------------- |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2647 | # Additional entries for sky130_fd_pr__res_generic_m4 and sky130_fd_pr__res_generic_m5, depending on the |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2648 | # back-end metal stack. |
| 2649 | #---------------------------------------------------------------- |
| 2650 | |
| 2651 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2652 | proc sky130::sky130_fd_pr__res_generic_m4_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2653 | return {w 0.300 l 0.300 m 1 nx 1 wmin 0.30 lmin 0.30 \ |
| 2654 | rho 0.047 val 0.047 dummy 0 dw 0.0 term 0.0 \ |
| 2655 | roverlap 0} |
| 2656 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2657 | proc sky130::sky130_fd_pr__res_generic_m5_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2658 | return {w 1.600 l 1.600 m 1 nx 1 wmin 1.60 lmin 1.60 \ |
| 2659 | rho 0.029 val 0.029 dummy 0 dw 0.0 term 0.0 \ |
| 2660 | roverlap 0} |
| 2661 | } |
| 2662 | #endif (METAL5) |
| 2663 | |
| 2664 | #---------------------------------------------------------------- |
| 2665 | # resistor: Conversion from SPICE netlist parameters to toolkit |
| 2666 | #---------------------------------------------------------------- |
| 2667 | |
| 2668 | proc sky130::res_convert {parameters} { |
| 2669 | set pdkparams [dict create] |
| 2670 | dict for {key value} $parameters { |
| 2671 | switch -nocase $key { |
| 2672 | l - |
| 2673 | w { |
| 2674 | # Length and width are converted to units of microns |
| 2675 | set value [magic::spice2float $value] |
| 2676 | # set value [expr $value * 1e6] |
| 2677 | set value [magic::3digitpastdecimal $value] |
| 2678 | dict set pdkparams [string tolower $key] $value |
| 2679 | } |
| 2680 | } |
| 2681 | } |
| 2682 | return $pdkparams |
| 2683 | } |
| 2684 | |
| 2685 | #---------------------------------------------------------------- |
| 2686 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2687 | proc sky130::sky130_fd_pr__res_iso_pw_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2688 | return [sky130::res_convert $parameters] |
| 2689 | } |
| 2690 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2691 | proc sky130::sky130_fd_pr__res_generic_po_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2692 | return [sky130::res_convert $parameters] |
| 2693 | } |
| 2694 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2695 | proc sky130::sky130_fd_pr__res_high_po_0p35_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2696 | return [sky130::res_convert $parameters] |
| 2697 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2698 | proc sky130::sky130_fd_pr__res_high_po_0p69_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2699 | return [sky130::res_convert $parameters] |
| 2700 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2701 | proc sky130::sky130_fd_pr__res_high_po_1p41_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2702 | return [sky130::res_convert $parameters] |
| 2703 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2704 | proc sky130::sky130_fd_pr__res_high_po_2p85_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2705 | return [sky130::res_convert $parameters] |
| 2706 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2707 | proc sky130::sky130_fd_pr__res_high_po_5p73_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2708 | return [sky130::res_convert $parameters] |
| 2709 | } |
| 2710 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2711 | proc sky130::sky130_fd_pr__res_xhigh_po_0p35_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2712 | return [sky130::res_convert $parameters] |
| 2713 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2714 | proc sky130::sky130_fd_pr__res_xhigh_po_0p69_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2715 | return [sky130::res_convert $parameters] |
| 2716 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2717 | proc sky130::sky130_fd_pr__res_xhigh_po_1p41_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2718 | return [sky130::res_convert $parameters] |
| 2719 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2720 | proc sky130::sky130_fd_pr__res_xhigh_po_2p85_convert {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2721 | return [sky130::res_convert $parameters] |
| 2722 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2723 | proc sky130::sky130_fd_pr__res_xhigh_po_5p73_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2724 | return [sky130::res_convert $parameters] |
| 2725 | } |
| 2726 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2727 | proc sky130::sky130_fd_pr__res_generic_nd_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2728 | return [sky130::res_convert $parameters] |
| 2729 | } |
| 2730 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2731 | proc sky130::sky130_fd_pr__res_generic_pd_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2732 | return [sky130::res_convert $parameters] |
| 2733 | } |
| 2734 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2735 | proc sky130::sky130_fd_pr__res_generic_nd__hv_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2736 | return [sky130::res_convert $parameters] |
| 2737 | } |
| 2738 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2739 | proc sky130::sky130_fd_pr__res_generic_pd__hv_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2740 | return [sky130::res_convert $parameters] |
| 2741 | } |
| 2742 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2743 | proc sky130::sky130_fd_pr__res_generic_l1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2744 | return [sky130::res_convert $parameters] |
| 2745 | } |
| 2746 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2747 | proc sky130::sky130_fd_pr__res_generic_m1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2748 | return [sky130::res_convert $parameters] |
| 2749 | } |
| 2750 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2751 | proc sky130::sky130_fd_pr__res_generic_m2_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2752 | return [sky130::res_convert $parameters] |
| 2753 | } |
| 2754 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2755 | proc sky130::sky130_fd_pr__res_generic_m3_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2756 | return [sky130::res_convert $parameters] |
| 2757 | } |
| 2758 | |
| 2759 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2760 | proc sky130::sky130_fd_pr__res_generic_m4_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2761 | return [sky130::res_convert $parameters] |
| 2762 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2763 | proc sky130::sky130_fd_pr__res_generic_m5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2764 | return [sky130::res_convert $parameters] |
| 2765 | } |
| 2766 | #endif (METAL5) |
| 2767 | |
| 2768 | #---------------------------------------------------------------- |
| 2769 | # resistor: Interactively specifies the fixed layout parameters |
| 2770 | #---------------------------------------------------------------- |
| 2771 | |
| 2772 | proc sky130::res_dialog {device parameters} { |
| 2773 | # Editable fields: w, l, t, nx, m, val |
| 2774 | # Checked fields: |
| 2775 | |
| 2776 | magic::add_entry val "Value (ohms)" $parameters |
| 2777 | if {[dict exists $parameters snake]} { |
| 2778 | sky130::compute_ltot $parameters |
| 2779 | magic::add_message ltot "Total length (um)" $parameters |
| 2780 | } |
| 2781 | magic::add_entry l "Length (um)" $parameters |
| 2782 | magic::add_entry w "Width (um)" $parameters |
| 2783 | magic::add_entry nx "X Repeat" $parameters |
| 2784 | magic::add_entry m "Y Repeat" $parameters |
| 2785 | if {[dict exists $parameters endcov]} { |
| 2786 | magic::add_entry endcov "End contact coverage (%)" $parameters |
| 2787 | } |
| 2788 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2789 | if {[dict exists $parameters compatible]} { |
| 2790 | set sellist [dict get $parameters compatible] |
| 2791 | magic::add_selectlist gencell "Device type" $sellist $parameters $device |
| 2792 | } |
| 2793 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2794 | # magic::add_checkbox dummy "Add dummy" $parameters |
| 2795 | |
| 2796 | if {[dict exists $parameters snake]} { |
| 2797 | magic::add_checkbox snake "Use snake geometry" $parameters |
| 2798 | } |
| 2799 | if {[dict exists $parameters roverlap]} { |
| 2800 | if {[dict exists $parameters endcov]} { |
| 2801 | magic::add_checkbox roverlap "Overlap at end contact" $parameters |
| 2802 | } else { |
| 2803 | magic::add_checkbox roverlap "Overlap at ends" $parameters |
| 2804 | } |
| 2805 | } |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2806 | if {[dict exists $parameters guard]} { |
| 2807 | magic::add_checkbox guard "Add guard ring" $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2808 | |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 2809 | if {[dict exists $parameters hv_guard]} { |
| 2810 | magic::add_checkbox hv_guard "High-voltage guard ring" $parameters |
| 2811 | } |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2812 | if {[dict exists $parameters n_guard]} { |
| 2813 | magic::add_checkbox n_guard "N-well connected guard ring" $parameters |
| 2814 | } |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2815 | if {[dict exists $parameters full_metal]} { |
| 2816 | magic::add_checkbox full_metal "Full metal guard ring" $parameters |
| 2817 | } |
| 2818 | if {[dict exists $parameters glc]} { |
| 2819 | magic::add_checkbox glc "Add left guard ring contact" $parameters |
| 2820 | } |
| 2821 | if {[dict exists $parameters grc]} { |
| 2822 | magic::add_checkbox grc "Add right guard ring contact" $parameters |
| 2823 | } |
| 2824 | if {[dict exists $parameters gtc]} { |
| 2825 | magic::add_checkbox gtc "Add top guard ring contact" $parameters |
| 2826 | } |
| 2827 | if {[dict exists $parameters gbc]} { |
| 2828 | magic::add_checkbox gbc "Add bottom guard ring contact" $parameters |
| 2829 | } |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2830 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 2831 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2832 | magic::add_entry viagb "Bottom guard ring via coverage \[+/-\](%)" $parameters |
| 2833 | magic::add_entry viagt "Top guard ring via coverage \[+/-\](%)" $parameters |
| 2834 | magic::add_entry viagr "Right guard ring via coverage \[+/-\](%)" $parameters |
| 2835 | magic::add_entry viagl "Left guard ring via coverage \[+/-\](%)" $parameters |
| 2836 | } |
| 2837 | |
| 2838 | if {[dict exists $parameters vias]} { |
| 2839 | magic::add_checkbox vias "Add vias over contacts" $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2840 | } |
| 2841 | |
| 2842 | if {[dict exists $parameters snake]} { |
| 2843 | magic::add_dependency sky130::res_recalc $device sky130 l w val nx snake |
| 2844 | } else { |
| 2845 | magic::add_dependency sky130::res_recalc $device sky130 l w val nx |
| 2846 | } |
| 2847 | } |
| 2848 | |
| 2849 | #---------------------------------------------------------------- |
| 2850 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2851 | proc sky130::sky130_fd_pr__res_iso_pw_dialog {parameters} { |
| 2852 | sky130::res_dialog sky130_fd_pr__res_iso_pw $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2853 | } |
| 2854 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2855 | proc sky130::sky130_fd_pr__res_generic_po_dialog {parameters} { |
| 2856 | sky130::res_dialog sky130_fd_pr__res_generic_po $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2857 | } |
| 2858 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2859 | proc sky130::sky130_fd_pr__res_high_po_0p35_dialog {parameters} { |
| 2860 | sky130::res_dialog sky130_fd_pr__res_high_po_0p35 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2861 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2862 | proc sky130::sky130_fd_pr__res_high_po_0p69_dialog {parameters} { |
| 2863 | sky130::res_dialog sky130_fd_pr__res_high_po_0p69 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2864 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2865 | proc sky130::sky130_fd_pr__res_high_po_1p41_dialog {parameters} { |
| 2866 | sky130::res_dialog sky130_fd_pr__res_high_po_1p41 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2867 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2868 | proc sky130::sky130_fd_pr__res_high_po_2p85_dialog {parameters} { |
| 2869 | sky130::res_dialog sky130_fd_pr__res_high_po_2p85 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2870 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2871 | proc sky130::sky130_fd_pr__res_high_po_5p73_dialog {parameters} { |
| 2872 | sky130::res_dialog sky130_fd_pr__res_high_po_5p73 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2873 | } |
| 2874 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2875 | proc sky130::sky130_fd_pr__res_xhigh_po_0p35_dialog {parameters} { |
| 2876 | sky130::res_dialog sky130_fd_pr__res_xhigh_po_0p35 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2877 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2878 | proc sky130::sky130_fd_pr__res_xhigh_po_0p69_dialog {parameters} { |
| 2879 | sky130::res_dialog sky130_fd_pr__res_xhigh_po_0p69 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2880 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2881 | proc sky130::sky130_fd_pr__res_xhigh_po_1p41_dialog {parameters} { |
| 2882 | sky130::res_dialog sky130_fd_pr__res_xhigh_po_1p41 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2883 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2884 | proc sky130::sky130_fd_pr__res_xhigh_po_2p85_dialog {parameters} { |
| 2885 | sky130::res_dialog sky130_fd_pr__res_xhigh_po_2p85 $parameters |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2886 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2887 | proc sky130::sky130_fd_pr__res_xhigh_po_5p73_dialog {parameters} { |
| 2888 | sky130::res_dialog sky130_fd_pr__res_xhigh_po_5p73 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2889 | } |
| 2890 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2891 | proc sky130::sky130_fd_pr__res_generic_nd_dialog {parameters} { |
| 2892 | sky130::res_dialog sky130_fd_pr__res_generic_nd $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2893 | } |
| 2894 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2895 | proc sky130::sky130_fd_pr__res_generic_pd_dialog {parameters} { |
| 2896 | sky130::res_dialog sky130_fd_pr__res_generic_pd $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2897 | } |
| 2898 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2899 | proc sky130::sky130_fd_pr__res_generic_nd__hv_dialog {parameters} { |
| 2900 | sky130::res_dialog sky130_fd_pr__res_generic_nd__hv $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2901 | } |
| 2902 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2903 | proc sky130::sky130_fd_pr__res_generic_pd__hv_dialog {parameters} { |
| 2904 | sky130::res_dialog sky130_fd_pr__res_generic_pd__hv $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2905 | } |
| 2906 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2907 | proc sky130::sky130_fd_pr__res_generic_l1_dialog {parameters} { |
| 2908 | sky130::res_dialog sky130_fd_pr__res_generic_l1 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2909 | } |
| 2910 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2911 | proc sky130::sky130_fd_pr__res_generic_m1_dialog {parameters} { |
| 2912 | sky130::res_dialog sky130_fd_pr__res_generic_m1 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2913 | } |
| 2914 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2915 | proc sky130::sky130_fd_pr__res_generic_m2_dialog {parameters} { |
| 2916 | sky130::res_dialog sky130_fd_pr__res_generic_m2 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2917 | } |
| 2918 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2919 | proc sky130::sky130_fd_pr__res_generic_m3_dialog {parameters} { |
| 2920 | sky130::res_dialog sky130_fd_pr__res_generic_m3 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2921 | } |
| 2922 | |
| 2923 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2924 | proc sky130::sky130_fd_pr__res_generic_m4_dialog {parameters} { |
| 2925 | sky130::res_dialog sky130_fd_pr__res_generic_m4 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2926 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 2927 | proc sky130::sky130_fd_pr__res_generic_m5_dialog {parameters} { |
| 2928 | sky130::res_dialog sky130_fd_pr__res_generic_m5 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2929 | } |
| 2930 | #endif (METAL5) |
| 2931 | |
| 2932 | #---------------------------------------------------------------- |
| 2933 | # Resistor: Draw a single device in straight geometry |
| 2934 | #---------------------------------------------------------------- |
| 2935 | |
| 2936 | proc sky130::res_device {parameters} { |
| 2937 | # Epsilon for avoiding round-off errors |
| 2938 | set eps 0.0005 |
| 2939 | |
| 2940 | # Set local default values if they are not in parameters |
| 2941 | set endcov 0 ;# percent coverage of end contacts |
| 2942 | set roverlap 0 ;# overlap resistors at end contacts |
| 2943 | set well_res_overlap 0 ;# not a well resistor |
| 2944 | set end_contact_type "" ;# no contacts for metal resistors |
| 2945 | set end_overlap_cont 0 ;# additional end overlap on sides |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 2946 | set vias 0 ;# add vias over contacts |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2947 | set res_idtype none |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2948 | |
| 2949 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 2950 | foreach key [dict keys $parameters] { |
| 2951 | set $key [dict get $parameters $key] |
| 2952 | } |
| 2953 | |
| 2954 | if {![dict exists $parameters end_contact_size]} { |
| 2955 | set end_contact_size $contact_size |
| 2956 | } |
| 2957 | |
| 2958 | # Draw the resistor and endcaps |
| 2959 | pushbox |
| 2960 | box size 0 0 |
| 2961 | pushbox |
| 2962 | set hw [/ $w 2.0] |
| 2963 | set hl [/ $l 2.0] |
| 2964 | box grow n ${hl}um |
| 2965 | box grow s ${hl}um |
| 2966 | box grow e ${hw}um |
| 2967 | box grow w ${hw}um |
| 2968 | |
| 2969 | pushbox |
| 2970 | box grow n ${res_to_endcont}um |
| 2971 | box grow s ${res_to_endcont}um |
| 2972 | if {$well_res_overlap > 0} { |
| 2973 | set well_extend [+ ${well_res_overlap} [/ ${end_contact_size} 2.0] ${end_surround}] |
| 2974 | box grow n ${well_extend}um |
| 2975 | box grow s ${well_extend}um |
| 2976 | paint ${well_res_type} |
| 2977 | } else { |
| 2978 | paint ${end_type} |
| 2979 | } |
| 2980 | set cext [sky130::getbox] |
| 2981 | popbox |
| 2982 | |
| 2983 | if {$well_res_overlap > 0} { |
| 2984 | erase ${well_res_type} |
| 2985 | } else { |
| 2986 | erase ${end_type} |
| 2987 | } |
| 2988 | paint ${res_type} |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 2989 | if {"$res_idtype" != "none"} { |
| 2990 | box grow c 2 |
| 2991 | paint ${res_idtype} |
| 2992 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 2993 | popbox |
| 2994 | |
| 2995 | # Reduce contact sizes by (end type) surround so that |
| 2996 | # the contact area edges match the device type width. |
| 2997 | # (Minimum dimensions will be enforced by the contact drawing routine) |
| 2998 | set epl [- ${w} [* ${end_surround} 2]] ;# end contact width |
| 2999 | |
| 3000 | # Reduce end material size for well resistor types |
| 3001 | if {$well_res_overlap > 0} { |
| 3002 | set epl [- ${epl} [* ${well_res_overlap} 2]] |
| 3003 | } |
| 3004 | |
| 3005 | # Reduce by coverage percentage unless overlapping at contacts |
| 3006 | if {(${roverlap} == 0) && (${endcov} > 0)} { |
| 3007 | set cpl [* ${epl} [/ ${endcov} 100.0]] |
| 3008 | } else { |
| 3009 | set cpl $epl |
| 3010 | } |
| 3011 | |
| 3012 | # Ensure additional overlap of diffusion contact if required |
| 3013 | set dov [* ${end_overlap_cont} 2] |
| 3014 | if {[- ${epl} ${cpl}] < $dov} { |
| 3015 | set cpl [- ${epl} $dov] ;# additional end contact width |
| 3016 | } |
| 3017 | |
| 3018 | set hepl [+ [/ ${epl} 2.0] ${end_surround}] |
| 3019 | set hesz [/ ${end_contact_size} 2.0] |
| 3020 | |
| 3021 | # LV substrate diffusion types have a different surround requirement |
| 3022 | set lv_sub_types {"psd" "nsd"} |
| 3023 | if {[lsearch $lv_sub_types $end_type] < 0} { |
| 3024 | set hesz [+ ${hesz} ${end_surround}] |
| 3025 | } |
| 3026 | |
| 3027 | # Top end material & contact |
| 3028 | pushbox |
| 3029 | box move n ${hl}um |
| 3030 | box move n ${res_to_endcont}um |
| 3031 | |
| 3032 | pushbox |
| 3033 | box size 0 0 |
| 3034 | box grow n ${hesz}um |
| 3035 | box grow s ${hesz}um |
| 3036 | box grow e ${hepl}um |
| 3037 | box grow w ${hepl}um |
| 3038 | paint ${end_type} |
| 3039 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3040 | popbox |
| 3041 | |
| 3042 | if {${end_contact_type} != ""} { |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 3043 | # Draw via over contact first |
| 3044 | if {$vias != 0} { |
| 3045 | pushbox |
| 3046 | set ch $res_to_endcont |
| 3047 | if {$ch < $via_size} {set ch $via_size} |
| 3048 | set cw $epl |
| 3049 | if {$cw < $via_size} {set cw $via_size} |
| 3050 | box grow n [/ $via_size 2]um |
| 3051 | box grow s [- $ch [/ $via_size 2]]um |
| 3052 | box grow w [/ $cw 2]um |
| 3053 | box grow e [/ $cw 2]um |
| 3054 | sky130::mcon_draw |
| 3055 | popbox |
| 3056 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3057 | set cext [sky130::unionbox $cext [sky130::draw_contact ${cpl} 0 \ |
| 3058 | ${end_surround} ${metal_surround} ${end_contact_size} \ |
| 3059 | ${end_type} ${end_contact_type} li horz]] |
| 3060 | } |
| 3061 | popbox |
| 3062 | |
| 3063 | # Bottom end material & contact |
| 3064 | pushbox |
| 3065 | box move s ${hl}um |
| 3066 | box move s ${res_to_endcont}um |
| 3067 | |
| 3068 | pushbox |
| 3069 | box size 0 0 |
| 3070 | box grow n ${hesz}um |
| 3071 | box grow s ${hesz}um |
| 3072 | box grow e ${hepl}um |
| 3073 | box grow w ${hepl}um |
| 3074 | paint ${end_type} |
| 3075 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3076 | popbox |
| 3077 | |
| 3078 | if {${end_contact_type} != ""} { |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 3079 | # Draw via over contact first |
| 3080 | if {$vias != 0} { |
| 3081 | pushbox |
| 3082 | set ch $res_to_endcont |
| 3083 | if {$ch < $via_size} {set ch $via_size} |
| 3084 | set cw $epl |
| 3085 | if {$cw < $via_size} {set cw $via_size} |
| 3086 | box grow n [- $ch [/ $via_size 2]]um |
| 3087 | box grow s [/ $via_size 2]um |
| 3088 | box grow w [/ $cw 2]um |
| 3089 | box grow e [/ $cw 2]um |
| 3090 | sky130::mcon_draw |
| 3091 | popbox |
| 3092 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3093 | set cext [sky130::unionbox $cext [sky130::draw_contact ${cpl} 0 \ |
| 3094 | ${end_surround} ${metal_surround} ${end_contact_size} \ |
| 3095 | ${end_type} ${end_contact_type} li horz]] |
| 3096 | } |
| 3097 | popbox |
| 3098 | |
| 3099 | popbox |
| 3100 | return $cext |
| 3101 | } |
| 3102 | |
| 3103 | #---------------------------------------------------------------- |
| 3104 | # Resistor: Draw a single device in snake geometry |
| 3105 | #---------------------------------------------------------------- |
| 3106 | |
| 3107 | proc sky130::res_snake_device {nf parameters} { |
| 3108 | # nf is the number of fingers of the snake geometry |
| 3109 | |
| 3110 | # Epsilon for avoiding round-off errors |
| 3111 | set eps 0.0005 |
| 3112 | |
| 3113 | # Set local default values if they are not in parameters |
| 3114 | set endcov 100 ;# percent coverage of end contacts |
| 3115 | set well_res_overlap 0 ;# not a well resistor |
| 3116 | set end_contact_type "" ;# no contacts for metal resistors |
| 3117 | set mask_clearance 0 ;# additional length to clear mask |
| 3118 | |
| 3119 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 3120 | foreach key [dict keys $parameters] { |
| 3121 | set $key [dict get $parameters $key] |
| 3122 | } |
| 3123 | |
| 3124 | if {![dict exists $parameters end_contact_size]} { |
| 3125 | set end_contact_size $contact_size |
| 3126 | } |
| 3127 | |
| 3128 | # Compute half width and length |
| 3129 | set hw [/ $w 2.0] |
| 3130 | set hl [/ $l 2.0] |
| 3131 | |
| 3132 | # Reduce contact sizes by (end type) surround so that |
| 3133 | # the contact area edges match the device type width. |
| 3134 | # (Minimum dimensions will be enforced by the contact drawing routine) |
| 3135 | set epl [- ${w} [* ${end_surround} 2]] ;# end contact width |
| 3136 | |
| 3137 | # Reduce contact size for well resistor types |
| 3138 | if {$well_res_overlap > 0} { |
| 3139 | set epl [- ${epl} [* ${well_res_overlap} 2]] |
| 3140 | } |
| 3141 | |
| 3142 | # Reduce contact part of end by coverage percentage |
| 3143 | if {${endcov} > 0} { |
| 3144 | set cpl [* ${epl} [/ ${endcov} 100.0]] |
| 3145 | } else { |
| 3146 | set cpl $epl |
| 3147 | } |
| 3148 | |
| 3149 | set hepl [+ [/ ${epl} 2.0] ${end_surround}] |
| 3150 | set hesz [+ [/ ${end_contact_size} 2.0] ${end_surround}] |
| 3151 | |
| 3152 | pushbox |
| 3153 | box size 0 0 ;# Position is taken from caller |
| 3154 | |
| 3155 | # Front end contact (always bottom) |
| 3156 | pushbox |
| 3157 | box move s ${hl}um |
| 3158 | pushbox |
| 3159 | box move s ${mask_clearance}um |
| 3160 | box move s ${res_to_endcont}um |
| 3161 | |
| 3162 | pushbox |
| 3163 | box size 0 0 |
| 3164 | box grow n ${hesz}um |
| 3165 | box grow s ${hesz}um |
| 3166 | box grow e ${hepl}um |
| 3167 | box grow w ${hepl}um |
| 3168 | paint ${end_type} |
| 3169 | set cext [sky130::getbox] |
| 3170 | popbox |
| 3171 | |
| 3172 | if {${end_contact_type} != ""} { |
| 3173 | set cext [sky130::draw_contact ${cpl} 0 \ |
| 3174 | ${end_surround} ${metal_surround} ${end_contact_size} \ |
| 3175 | ${end_type} ${end_contact_type} li horz] |
| 3176 | } |
| 3177 | popbox |
| 3178 | |
| 3179 | # Draw portion between resistor end and contact. |
| 3180 | box grow e ${hw}um |
| 3181 | box grow w ${hw}um |
| 3182 | pushbox |
| 3183 | box grow s ${mask_clearance}um |
| 3184 | paint ${res_type} |
| 3185 | popbox |
| 3186 | box move s ${mask_clearance}um |
| 3187 | box grow s ${res_to_endcont}um |
| 3188 | if {$well_res_overlap > 0} { |
| 3189 | set well_extend [+ ${well_res_overlap} [/ ${end_contact_size} 2.0] ${end_surround}] |
| 3190 | box grow s ${well_extend}um |
| 3191 | paint ${well_res_type} |
| 3192 | } else { |
| 3193 | paint ${end_type} |
| 3194 | } |
| 3195 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3196 | popbox |
| 3197 | |
| 3198 | # Draw the resistor and endcaps |
| 3199 | pushbox |
| 3200 | box grow n ${hl}um |
| 3201 | box grow s ${hl}um |
| 3202 | box grow e ${hw}um |
| 3203 | box grow w ${hw}um |
| 3204 | |
| 3205 | # Capture these extents in the bounding box in case both contacts |
| 3206 | # are on one side. |
| 3207 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3208 | |
| 3209 | set deltax [+ ${res_spacing} ${w}] |
| 3210 | set deltay [- ${l} ${w}] |
| 3211 | for {set i 0} {$i < [- $nf 1]} {incr i} { |
| 3212 | paint ${res_type} |
| 3213 | pushbox |
| 3214 | if {[% $i 2] == 0} { |
| 3215 | box move n ${deltay}um |
| 3216 | } |
| 3217 | box height ${w}um |
| 3218 | box width ${deltax}um |
| 3219 | paint ${res_type} |
| 3220 | popbox |
| 3221 | box move e ${deltax}um |
| 3222 | } |
| 3223 | paint ${res_type} |
| 3224 | # Capture these extents in the bounding box |
| 3225 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3226 | popbox |
| 3227 | |
| 3228 | # Move box to last finger |
| 3229 | set lastf [* [- $nf 1] $deltax] |
| 3230 | box move e ${lastf}um |
| 3231 | |
| 3232 | # Back-end contact (top or bottom, depending if odd or even turns) |
| 3233 | pushbox |
| 3234 | |
| 3235 | if {[% $nf 2] == 1} { |
| 3236 | set dir n |
| 3237 | } else { |
| 3238 | set dir s |
| 3239 | } |
| 3240 | box move $dir ${hl}um |
| 3241 | pushbox |
| 3242 | box move $dir ${mask_clearance}um |
| 3243 | box move $dir ${res_to_endcont}um |
| 3244 | |
| 3245 | pushbox |
| 3246 | box size 0 0 |
| 3247 | box grow n ${hesz}um |
| 3248 | box grow s ${hesz}um |
| 3249 | box grow e ${hepl}um |
| 3250 | box grow w ${hepl}um |
| 3251 | paint ${end_type} |
| 3252 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 3253 | popbox |
| 3254 | |
| 3255 | if {${end_contact_type} != ""} { |
| 3256 | set cext [sky130::unionbox $cext [sky130::draw_contact ${cpl} 0 \ |
| 3257 | ${end_surround} ${metal_surround} ${end_contact_size} \ |
| 3258 | ${end_type} ${end_contact_type} li horz]] |
| 3259 | } |
| 3260 | popbox |
| 3261 | # Draw portion between resistor end and contact. |
| 3262 | box grow e ${hw}um |
| 3263 | box grow w ${hw}um |
| 3264 | pushbox |
| 3265 | box grow $dir ${mask_clearance}um |
| 3266 | paint ${res_type} |
| 3267 | popbox |
| 3268 | box move $dir ${mask_clearance}um |
| 3269 | box grow $dir ${res_to_endcont}um |
| 3270 | |
| 3271 | if {$well_res_overlap > 0} { |
| 3272 | set well_extend [+ ${well_res_overlap} [/ ${end_contact_size} 2.0] ${end_surround}] |
| 3273 | box grow $dir ${well_extend}um |
| 3274 | paint ${well_res_type} |
| 3275 | } else { |
| 3276 | paint ${end_type} |
| 3277 | } |
| 3278 | popbox |
| 3279 | |
| 3280 | popbox |
| 3281 | return $cext |
| 3282 | } |
| 3283 | |
| 3284 | #---------------------------------------------------------------- |
| 3285 | # Resistor: Draw the tiled device |
| 3286 | #---------------------------------------------------------------- |
| 3287 | |
| 3288 | proc sky130::res_draw {parameters} { |
| 3289 | tech unlock * |
| 3290 | set savesnap [snap] |
| 3291 | snap internal |
| 3292 | |
| 3293 | # Set defaults if they are not in parameters |
| 3294 | set snake 0 ;# some resistors don't allow snake geometry |
| 3295 | set roverlap 0 ;# overlap resistors at contacts |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3296 | set guard 0 ;# draw a guard ring |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3297 | set plus_diff_type nsd ;# guard ring diffusion type |
| 3298 | set overlap_compress 0 ;# special Y distance compression |
| 3299 | set well_res_overlap 0 ;# additional well extension behind contact |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3300 | set res_diff_spacing 0 ;# spacing from resistor to diffusion |
| 3301 | set res_idtype none |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3302 | |
| 3303 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 3304 | foreach key [dict keys $parameters] { |
| 3305 | set $key [dict get $parameters $key] |
| 3306 | } |
| 3307 | |
| 3308 | # For devices where inter-device space is smaller than device-to-guard ring |
| 3309 | if {![dict exists $parameters end_to_end_space]} { |
| 3310 | set end_to_end_space $end_spacing |
| 3311 | } |
| 3312 | |
| 3313 | if {![dict exists $parameters end_contact_size]} { |
| 3314 | set end_contact_size $contact_size |
| 3315 | } |
| 3316 | |
| 3317 | # Normalize distance units to microns |
| 3318 | set w [magic::spice2float $w] |
| 3319 | set l [magic::spice2float $l] |
| 3320 | |
| 3321 | pushbox |
| 3322 | box values 0 0 0 0 |
| 3323 | |
| 3324 | # Determine the base device dimensions by drawing one device |
| 3325 | # while all layers are locked (nothing drawn). This allows the |
| 3326 | # base drawing routine to do complicated geometry without having |
| 3327 | # to duplicate it here with calculations. |
| 3328 | |
| 3329 | tech lock * |
| 3330 | set nf $nx |
| 3331 | if {($snake == 1) && ($nx == 1)} {set snake 0} |
| 3332 | if {$snake == 1} { |
| 3333 | set bbox [sky130::res_snake_device $nf $parameters] |
| 3334 | set nx 1 |
| 3335 | } else { |
| 3336 | set bbox [sky130::res_device $parameters] |
| 3337 | } |
| 3338 | # puts stdout "Diagnostic: Device bounding box e $bbox (um)" |
| 3339 | tech unlock * |
| 3340 | |
| 3341 | set fw [- [lindex $bbox 2] [lindex $bbox 0]] |
| 3342 | set fh [- [lindex $bbox 3] [lindex $bbox 1]] |
| 3343 | set lw [+ [lindex $bbox 2] [lindex $bbox 0]] |
| 3344 | set lh [+ [lindex $bbox 3] [lindex $bbox 1]] |
| 3345 | |
| 3346 | # Determine tile width and height (depends on overlap) |
| 3347 | # Snake resistors cannot overlap. |
| 3348 | # However, snake resistors with an odd number of fingers can |
| 3349 | # compress the space if overlap_compress is defined |
| 3350 | |
| 3351 | if {($roverlap == 1) && ($snake == 1) && ([% $nf 2] == 1) && ($m > 1)} { |
| 3352 | set dy [- $fh $overlap_compress] |
| 3353 | } elseif {($roverlap == 0) || ($snake == 1)} { |
| 3354 | set dy [+ $fh $end_to_end_space] |
| 3355 | } else { |
| 3356 | # overlap poly |
| 3357 | set dy [- $fh [+ [* [+ $end_surround $well_res_overlap] 2.0] $end_contact_size]] |
| 3358 | } |
| 3359 | set dx [+ $fw $res_spacing] |
| 3360 | |
| 3361 | # Determine core width and height |
| 3362 | set corex [+ [* [- $nx 1] $dx] $fw] |
| 3363 | set corey [+ [* [- $m 1] $dy] $fh] |
| 3364 | set corellx [/ [+ [- $corex $fw] $lw] 2.0] |
| 3365 | set corelly [/ [+ [- $corey $fh] $lh] 2.0] |
| 3366 | |
| 3367 | set lv_sub_types {"psd" "nsd"} |
| 3368 | if {[lsearch $lv_sub_types $plus_diff_type] >= 0} { |
| 3369 | set guard_diff_surround 0 |
| 3370 | } else { |
| 3371 | set guard_diff_surround ${diff_surround} |
| 3372 | } |
| 3373 | |
| 3374 | if {$guard != 0} { |
| 3375 | # Calculate guard ring size (measured to contact center) |
| 3376 | set gx [+ $corex [* 2.0 [+ $res_diff_spacing $guard_diff_surround]] $contact_size] |
| 3377 | set gy [+ $corey [* 2.0 [+ $end_spacing $guard_diff_surround]] $contact_size] |
| 3378 | |
| 3379 | # Draw the guard ring first, because well resistors are on the substrate plane |
| 3380 | sky130::guard_ring $gx $gy $parameters |
| 3381 | } |
| 3382 | |
| 3383 | pushbox |
| 3384 | box move w ${corellx}um |
| 3385 | box move s ${corelly}um |
| 3386 | # puts "Device position at = [sky130::getbox]" |
| 3387 | for {set xp 0} {$xp < $nx} {incr xp} { |
| 3388 | pushbox |
| 3389 | for {set yp 0} {$yp < $m} {incr yp} { |
| 3390 | if {$snake == 1} { |
| 3391 | sky130::res_snake_device $nf $parameters |
| 3392 | } else { |
| 3393 | sky130::res_device $parameters |
| 3394 | } |
| 3395 | box move n ${dy}um |
| 3396 | } |
| 3397 | popbox |
| 3398 | box move e ${dx}um |
| 3399 | } |
| 3400 | popbox |
| 3401 | popbox |
| 3402 | |
| 3403 | snap $savesnap |
| 3404 | tech revert |
| 3405 | } |
| 3406 | |
| 3407 | #---------------------------------------------------------------- |
| 3408 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3409 | proc sky130::sky130_fd_pr__res_generic_po_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3410 | |
| 3411 | # Set a local variable for each rule in ruleset |
| 3412 | foreach key [dict keys $sky130::ruleset] { |
| 3413 | set $key [dict get $sky130::ruleset $key] |
| 3414 | } |
| 3415 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3416 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3417 | if {[dict exists $parameters hv_guard]} { |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3418 | set use_hv_guard [dict get $parameters hv_guard] |
| 3419 | } else { |
| 3420 | set use_hv_guard 0 |
| 3421 | } |
| 3422 | if {[dict exists $parameters n_guard]} { |
| 3423 | set use_n_guard [dict get $parameters n_guard] |
| 3424 | } else { |
| 3425 | set use_n_guard 0 |
| 3426 | } |
| 3427 | |
| 3428 | if {$use_hv_guard == 1} { |
| 3429 | if {$use_n_guard == 1} { |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3430 | set gdifftype mvnsd |
| 3431 | set gdiffcont mvnsc |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3432 | } else { |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3433 | set gdifftype mvpsd |
| 3434 | set gdiffcont mvpsc |
| 3435 | } |
| 3436 | set gsurround 0.33 |
| 3437 | } else { |
| 3438 | if {$use_n_guard == 1} { |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3439 | set gdifftype nsd |
| 3440 | set gdiffcont nsc |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3441 | } else { |
| 3442 | set gdifftype psd |
| 3443 | set gdiffcont psc |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3444 | } |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3445 | set gsurround $sub_surround |
| 3446 | } |
| 3447 | if {$use_n_guard == 1} { |
| 3448 | set gsubtype nwell |
| 3449 | } else { |
| 3450 | set gsubtype psub |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3451 | } |
| 3452 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3453 | set newdict [dict create \ |
| 3454 | res_type npres \ |
| 3455 | end_type poly \ |
| 3456 | end_contact_type pc \ |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3457 | plus_diff_type $gdifftype \ |
| 3458 | plus_contact_type $gdiffcont \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3459 | sub_type $gsubtype \ |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3460 | guard_sub_surround $gsurround \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3461 | end_surround $poly_surround \ |
| 3462 | end_spacing 0.48 \ |
| 3463 | end_to_end_space 0.52 \ |
| 3464 | res_to_endcont $res_to_cont \ |
| 3465 | res_spacing $poly_spacing \ |
| 3466 | res_diff_spacing 0.48 \ |
| 3467 | mask_clearance 0.52 \ |
| 3468 | overlap_compress 0.36 \ |
| 3469 | ] |
Tim Edwards | 8469aa6 | 2020-11-29 12:42:25 -0500 | [diff] [blame] | 3470 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3471 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3472 | return [sky130::res_draw $drawdict] |
| 3473 | } |
| 3474 | |
| 3475 | #---------------------------------------------------------------- |
| 3476 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3477 | proc sky130::sky130_fd_pr__res_high_po_0p35_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3478 | |
| 3479 | # Set a local variable for each rule in ruleset |
| 3480 | foreach key [dict keys $sky130::ruleset] { |
| 3481 | set $key [dict get $sky130::ruleset $key] |
| 3482 | } |
| 3483 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3484 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3485 | if {[dict exists $parameters hv_guard]} { |
| 3486 | set use_hv_guard [dict get $parameters hv_guard] |
| 3487 | } else { |
| 3488 | set use_hv_guard 0 |
| 3489 | } |
| 3490 | if {[dict exists $parameters n_guard]} { |
| 3491 | set use_n_guard [dict get $parameters n_guard] |
| 3492 | } else { |
| 3493 | set use_n_guard 0 |
| 3494 | } |
| 3495 | |
| 3496 | if {$use_hv_guard == 1} { |
| 3497 | if {$use_n_guard == 1} { |
| 3498 | set gdifftype mvnsd |
| 3499 | set gdiffcont mvnsc |
| 3500 | } else { |
| 3501 | set gdifftype mvpsd |
| 3502 | set gdiffcont mvpsc |
| 3503 | } |
| 3504 | set gsurround 0.33 |
| 3505 | } else { |
| 3506 | if {$use_n_guard == 1} { |
| 3507 | set gdifftype nsd |
| 3508 | set gdiffcont nsc |
| 3509 | } else { |
| 3510 | set gdifftype psd |
| 3511 | set gdiffcont psc |
| 3512 | } |
| 3513 | set gsurround $sub_surround |
| 3514 | } |
| 3515 | if {$use_n_guard == 1} { |
| 3516 | set gsubtype nwell |
| 3517 | set gresdiff_spacing 0.785 |
| 3518 | set gresdiff_end 0.525 |
| 3519 | } else { |
| 3520 | set gsubtype psub |
| 3521 | set gresdiff_spacing 0.48 |
| 3522 | set gresdiff_end 0.48 |
| 3523 | } |
| 3524 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3525 | set newdict [dict create \ |
| 3526 | res_type ppres \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3527 | res_idtype res0p35 \ |
| 3528 | end_type xpc \ |
| 3529 | end_contact_type xpc \ |
| 3530 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3531 | plus_diff_type $gdifftype \ |
| 3532 | plus_contact_type $gdiffcont \ |
| 3533 | sub_type $gsubtype \ |
| 3534 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3535 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3536 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3537 | end_to_end_space 0.52 \ |
| 3538 | end_contact_size 0.19 \ |
| 3539 | res_to_endcont 1.985 \ |
| 3540 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3541 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3542 | mask_clearance 0.52 \ |
| 3543 | overlap_compress 0.36 \ |
| 3544 | ] |
| 3545 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3546 | return [sky130::res_draw $drawdict] |
| 3547 | } |
| 3548 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3549 | proc sky130::sky130_fd_pr__res_high_po_0p69_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3550 | |
| 3551 | # Set a local variable for each rule in ruleset |
| 3552 | foreach key [dict keys $sky130::ruleset] { |
| 3553 | set $key [dict get $sky130::ruleset $key] |
| 3554 | } |
| 3555 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3556 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3557 | if {[dict exists $parameters hv_guard]} { |
| 3558 | set use_hv_guard [dict get $parameters hv_guard] |
| 3559 | } else { |
| 3560 | set use_hv_guard 0 |
| 3561 | } |
| 3562 | if {[dict exists $parameters n_guard]} { |
| 3563 | set use_n_guard [dict get $parameters n_guard] |
| 3564 | } else { |
| 3565 | set use_n_guard 0 |
| 3566 | } |
| 3567 | |
| 3568 | if {$use_hv_guard == 1} { |
| 3569 | if {$use_n_guard == 1} { |
| 3570 | set gdifftype mvnsd |
| 3571 | set gdiffcont mvnsc |
| 3572 | } else { |
| 3573 | set gdifftype mvpsd |
| 3574 | set gdiffcont mvpsc |
| 3575 | } |
| 3576 | set gsurround 0.33 |
| 3577 | } else { |
| 3578 | if {$use_n_guard == 1} { |
| 3579 | set gdifftype nsd |
| 3580 | set gdiffcont nsc |
| 3581 | } else { |
| 3582 | set gdifftype psd |
| 3583 | set gdiffcont psc |
| 3584 | } |
| 3585 | set gsurround $sub_surround |
| 3586 | } |
| 3587 | if {$use_n_guard == 1} { |
| 3588 | set gsubtype nwell |
| 3589 | set gresdiff_spacing 0.615 |
| 3590 | set gresdiff_end 0.525 |
| 3591 | } else { |
| 3592 | set gsubtype psub |
| 3593 | set gresdiff_spacing 0.48 |
| 3594 | set gresdiff_end 0.48 |
| 3595 | } |
| 3596 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3597 | set newdict [dict create \ |
| 3598 | res_type ppres \ |
| 3599 | res_idtype res0p69 \ |
| 3600 | end_type xpc \ |
| 3601 | end_contact_type xpc \ |
| 3602 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3603 | plus_diff_type $gdifftype \ |
| 3604 | plus_contact_type $gdiffcont \ |
| 3605 | sub_type $gsubtype \ |
| 3606 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3607 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3608 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3609 | end_to_end_space 0.52 \ |
| 3610 | end_contact_size 0.19 \ |
| 3611 | res_to_endcont 1.985 \ |
| 3612 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3613 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3614 | mask_clearance 0.52 \ |
| 3615 | overlap_compress 0.36 \ |
| 3616 | ] |
| 3617 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3618 | return [sky130::res_draw $drawdict] |
| 3619 | } |
| 3620 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3621 | proc sky130::sky130_fd_pr__res_high_po_1p41_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3622 | |
| 3623 | # Set a local variable for each rule in ruleset |
| 3624 | foreach key [dict keys $sky130::ruleset] { |
| 3625 | set $key [dict get $sky130::ruleset $key] |
| 3626 | } |
| 3627 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3628 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3629 | if {[dict exists $parameters hv_guard]} { |
| 3630 | set use_hv_guard [dict get $parameters hv_guard] |
| 3631 | } else { |
| 3632 | set use_hv_guard 0 |
| 3633 | } |
| 3634 | if {[dict exists $parameters n_guard]} { |
| 3635 | set use_n_guard [dict get $parameters n_guard] |
| 3636 | } else { |
| 3637 | set use_n_guard 0 |
| 3638 | } |
| 3639 | |
| 3640 | if {$use_hv_guard == 1} { |
| 3641 | if {$use_n_guard == 1} { |
| 3642 | set gdifftype mvnsd |
| 3643 | set gdiffcont mvnsc |
| 3644 | } else { |
| 3645 | set gdifftype mvpsd |
| 3646 | set gdiffcont mvpsc |
| 3647 | } |
| 3648 | set gsurround 0.33 |
| 3649 | } else { |
| 3650 | if {$use_n_guard == 1} { |
| 3651 | set gdifftype nsd |
| 3652 | set gdiffcont nsc |
| 3653 | } else { |
| 3654 | set gdifftype psd |
| 3655 | set gdiffcont psc |
| 3656 | } |
| 3657 | set gsurround $sub_surround |
| 3658 | } |
| 3659 | if {$use_n_guard == 1} { |
| 3660 | set gsubtype nwell |
| 3661 | set gresdiff_spacing 0.525 |
| 3662 | set gresdiff_end 0.525 |
| 3663 | } else { |
| 3664 | set gsubtype psub |
| 3665 | set gresdiff_spacing 0.48 |
| 3666 | set gresdiff_end 0.48 |
| 3667 | } |
| 3668 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3669 | set newdict [dict create \ |
| 3670 | res_type ppres \ |
| 3671 | res_idtype res1p41 \ |
| 3672 | end_type xpc \ |
| 3673 | end_contact_type xpc \ |
| 3674 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3675 | plus_diff_type $gdifftype \ |
| 3676 | plus_contact_type $gdiffcont \ |
| 3677 | sub_type $gsubtype \ |
| 3678 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3679 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3680 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3681 | end_to_end_space 0.52 \ |
| 3682 | end_contact_size 0.19 \ |
| 3683 | res_to_endcont 1.985 \ |
| 3684 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3685 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3686 | mask_clearance 0.52 \ |
| 3687 | overlap_compress 0.36 \ |
| 3688 | ] |
| 3689 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3690 | return [sky130::res_draw $drawdict] |
| 3691 | } |
| 3692 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3693 | proc sky130::sky130_fd_pr__res_high_po_2p85_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3694 | |
| 3695 | # Set a local variable for each rule in ruleset |
| 3696 | foreach key [dict keys $sky130::ruleset] { |
| 3697 | set $key [dict get $sky130::ruleset $key] |
| 3698 | } |
| 3699 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3700 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3701 | if {[dict exists $parameters hv_guard]} { |
| 3702 | set use_hv_guard [dict get $parameters hv_guard] |
| 3703 | } else { |
| 3704 | set use_hv_guard 0 |
| 3705 | } |
| 3706 | if {[dict exists $parameters n_guard]} { |
| 3707 | set use_n_guard [dict get $parameters n_guard] |
| 3708 | } else { |
| 3709 | set use_n_guard 0 |
| 3710 | } |
| 3711 | |
| 3712 | if {$use_hv_guard == 1} { |
| 3713 | if {$use_n_guard == 1} { |
| 3714 | set gdifftype mvnsd |
| 3715 | set gdiffcont mvnsc |
| 3716 | } else { |
| 3717 | set gdifftype mvpsd |
| 3718 | set gdiffcont mvpsc |
| 3719 | } |
| 3720 | set gsurround 0.33 |
| 3721 | } else { |
| 3722 | if {$use_n_guard == 1} { |
| 3723 | set gdifftype nsd |
| 3724 | set gdiffcont nsc |
| 3725 | } else { |
| 3726 | set gdifftype psd |
| 3727 | set gdiffcont psc |
| 3728 | } |
| 3729 | set gsurround $sub_surround |
| 3730 | } |
| 3731 | if {$use_n_guard == 1} { |
| 3732 | set gsubtype nwell |
| 3733 | set gresdiff_spacing 0.525 |
| 3734 | set gresdiff_end 0.525 |
| 3735 | } else { |
| 3736 | set gsubtype psub |
| 3737 | set gresdiff_spacing 0.48 |
| 3738 | set gresdiff_end 0.48 |
| 3739 | } |
| 3740 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3741 | set newdict [dict create \ |
| 3742 | res_type ppres \ |
| 3743 | res_idtype res2p85 \ |
| 3744 | end_type xpc \ |
| 3745 | end_contact_type xpc \ |
| 3746 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3747 | plus_diff_type $gdifftype \ |
| 3748 | plus_contact_type $gdiffcont \ |
| 3749 | sub_type $gsubtype \ |
| 3750 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3751 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3752 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3753 | end_to_end_space 0.52 \ |
| 3754 | end_contact_size 0.19 \ |
| 3755 | res_to_endcont 1.985 \ |
| 3756 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3757 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3758 | mask_clearance 0.52 \ |
| 3759 | overlap_compress 0.36 \ |
| 3760 | ] |
| 3761 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3762 | return [sky130::res_draw $drawdict] |
| 3763 | } |
| 3764 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3765 | proc sky130::sky130_fd_pr__res_high_po_5p73_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3766 | |
| 3767 | # Set a local variable for each rule in ruleset |
| 3768 | foreach key [dict keys $sky130::ruleset] { |
| 3769 | set $key [dict get $sky130::ruleset $key] |
| 3770 | } |
| 3771 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3772 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3773 | if {[dict exists $parameters hv_guard]} { |
| 3774 | set use_hv_guard [dict get $parameters hv_guard] |
| 3775 | } else { |
| 3776 | set use_hv_guard 0 |
| 3777 | } |
| 3778 | if {[dict exists $parameters n_guard]} { |
| 3779 | set use_n_guard [dict get $parameters n_guard] |
| 3780 | } else { |
| 3781 | set use_n_guard 0 |
| 3782 | } |
| 3783 | |
| 3784 | if {$use_hv_guard == 1} { |
| 3785 | if {$use_n_guard == 1} { |
| 3786 | set gdifftype mvnsd |
| 3787 | set gdiffcont mvnsc |
| 3788 | } else { |
| 3789 | set gdifftype mvpsd |
| 3790 | set gdiffcont mvpsc |
| 3791 | } |
| 3792 | set gsurround 0.33 |
| 3793 | } else { |
| 3794 | if {$use_n_guard == 1} { |
| 3795 | set gdifftype nsd |
| 3796 | set gdiffcont nsc |
| 3797 | } else { |
| 3798 | set gdifftype psd |
| 3799 | set gdiffcont psc |
| 3800 | } |
| 3801 | set gsurround $sub_surround |
| 3802 | } |
| 3803 | if {$use_n_guard == 1} { |
| 3804 | set gsubtype nwell |
| 3805 | set gresdiff_spacing 0.525 |
| 3806 | set gresdiff_end 0.525 |
| 3807 | } else { |
| 3808 | set gsubtype psub |
| 3809 | set gresdiff_spacing 0.48 |
| 3810 | set gresdiff_end 0.48 |
| 3811 | } |
| 3812 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3813 | set newdict [dict create \ |
| 3814 | res_type ppres \ |
| 3815 | res_idtype res5p73 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3816 | end_type xpc \ |
| 3817 | end_contact_type xpc \ |
| 3818 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3819 | plus_diff_type $gdifftype \ |
| 3820 | plus_contact_type $gdiffcont \ |
| 3821 | sub_type $gsubtype \ |
| 3822 | guard_sub_surround $gsurround \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3823 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3824 | end_spacing $gresdiff_end \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3825 | end_to_end_space 0.52 \ |
| 3826 | end_contact_size 0.19 \ |
| 3827 | res_to_endcont 1.985 \ |
| 3828 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3829 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3830 | mask_clearance 0.52 \ |
| 3831 | overlap_compress 0.36 \ |
| 3832 | ] |
| 3833 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3834 | return [sky130::res_draw $drawdict] |
| 3835 | } |
| 3836 | |
| 3837 | #---------------------------------------------------------------- |
| 3838 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3839 | proc sky130::sky130_fd_pr__res_xhigh_po_0p35_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3840 | |
| 3841 | # Set a local variable for each rule in ruleset |
| 3842 | foreach key [dict keys $sky130::ruleset] { |
| 3843 | set $key [dict get $sky130::ruleset $key] |
| 3844 | } |
| 3845 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3846 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3847 | if {[dict exists $parameters hv_guard]} { |
| 3848 | set use_hv_guard [dict get $parameters hv_guard] |
| 3849 | } else { |
| 3850 | set use_hv_guard 0 |
| 3851 | } |
| 3852 | if {[dict exists $parameters n_guard]} { |
| 3853 | set use_n_guard [dict get $parameters n_guard] |
| 3854 | } else { |
| 3855 | set use_n_guard 0 |
| 3856 | } |
| 3857 | |
| 3858 | if {$use_hv_guard == 1} { |
| 3859 | if {$use_n_guard == 1} { |
| 3860 | set gdifftype mvnsd |
| 3861 | set gdiffcont mvnsc |
| 3862 | } else { |
| 3863 | set gdifftype mvpsd |
| 3864 | set gdiffcont mvpsc |
| 3865 | } |
| 3866 | set gsurround 0.33 |
| 3867 | } else { |
| 3868 | if {$use_n_guard == 1} { |
| 3869 | set gdifftype nsd |
| 3870 | set gdiffcont nsc |
| 3871 | } else { |
| 3872 | set gdifftype psd |
| 3873 | set gdiffcont psc |
| 3874 | } |
| 3875 | set gsurround $sub_surround |
| 3876 | } |
| 3877 | if {$use_n_guard == 1} { |
| 3878 | set gsubtype nwell |
| 3879 | set gresdiff_spacing 0.785 |
| 3880 | set gresdiff_end 0.525 |
| 3881 | } else { |
| 3882 | set gsubtype psub |
| 3883 | set gresdiff_spacing 0.48 |
| 3884 | set gresdiff_end 0.48 |
| 3885 | } |
| 3886 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 3887 | set newdict [dict create \ |
| 3888 | res_type xpres \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3889 | res_idtype res0p35 \ |
| 3890 | end_type xpc \ |
| 3891 | end_contact_type xpc \ |
| 3892 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3893 | plus_diff_type $gdifftype \ |
| 3894 | plus_contact_type $gdiffcont \ |
| 3895 | sub_type $gsubtype \ |
| 3896 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3897 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3898 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3899 | end_to_end_space 0.52 \ |
| 3900 | end_contact_size 0.19 \ |
| 3901 | res_to_endcont 1.985 \ |
| 3902 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3903 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3904 | mask_clearance 0.52 \ |
| 3905 | overlap_compress 0.36 \ |
| 3906 | ] |
| 3907 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3908 | return [sky130::res_draw $drawdict] |
| 3909 | } |
| 3910 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3911 | proc sky130::sky130_fd_pr__res_xhigh_po_0p69_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3912 | |
| 3913 | # Set a local variable for each rule in ruleset |
| 3914 | foreach key [dict keys $sky130::ruleset] { |
| 3915 | set $key [dict get $sky130::ruleset $key] |
| 3916 | } |
| 3917 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3918 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3919 | if {[dict exists $parameters hv_guard]} { |
| 3920 | set use_hv_guard [dict get $parameters hv_guard] |
| 3921 | } else { |
| 3922 | set use_hv_guard 0 |
| 3923 | } |
| 3924 | if {[dict exists $parameters n_guard]} { |
| 3925 | set use_n_guard [dict get $parameters n_guard] |
| 3926 | } else { |
| 3927 | set use_n_guard 0 |
| 3928 | } |
| 3929 | |
| 3930 | if {$use_hv_guard == 1} { |
| 3931 | if {$use_n_guard == 1} { |
| 3932 | set gdifftype mvnsd |
| 3933 | set gdiffcont mvnsc |
| 3934 | } else { |
| 3935 | set gdifftype mvpsd |
| 3936 | set gdiffcont mvpsc |
| 3937 | } |
| 3938 | set gsurround 0.33 |
| 3939 | } else { |
| 3940 | if {$use_n_guard == 1} { |
| 3941 | set gdifftype nsd |
| 3942 | set gdiffcont nsc |
| 3943 | } else { |
| 3944 | set gdifftype psd |
| 3945 | set gdiffcont psc |
| 3946 | } |
| 3947 | set gsurround $sub_surround |
| 3948 | } |
| 3949 | if {$use_n_guard == 1} { |
| 3950 | set gsubtype nwell |
| 3951 | set gresdiff_spacing 0.615 |
| 3952 | set gresdiff_end 0.525 |
| 3953 | } else { |
| 3954 | set gsubtype psub |
| 3955 | set gresdiff_spacing 0.48 |
| 3956 | set gresdiff_end 0.48 |
| 3957 | } |
| 3958 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3959 | set newdict [dict create \ |
| 3960 | res_type xpres \ |
| 3961 | res_idtype res0p69 \ |
| 3962 | end_type xpc \ |
| 3963 | end_contact_type xpc \ |
| 3964 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3965 | plus_diff_type $gdifftype \ |
| 3966 | plus_contact_type $gdiffcont \ |
| 3967 | sub_type $gsubtype \ |
| 3968 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3969 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3970 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3971 | end_to_end_space 0.52 \ |
| 3972 | end_contact_size 0.19 \ |
| 3973 | res_to_endcont 1.985 \ |
| 3974 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3975 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3976 | mask_clearance 0.52 \ |
| 3977 | overlap_compress 0.36 \ |
| 3978 | ] |
| 3979 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 3980 | return [sky130::res_draw $drawdict] |
| 3981 | } |
| 3982 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 3983 | proc sky130::sky130_fd_pr__res_xhigh_po_1p41_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 3984 | |
| 3985 | # Set a local variable for each rule in ruleset |
| 3986 | foreach key [dict keys $sky130::ruleset] { |
| 3987 | set $key [dict get $sky130::ruleset $key] |
| 3988 | } |
| 3989 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 3990 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 3991 | if {[dict exists $parameters hv_guard]} { |
| 3992 | set use_hv_guard [dict get $parameters hv_guard] |
| 3993 | } else { |
| 3994 | set use_hv_guard 0 |
| 3995 | } |
| 3996 | if {[dict exists $parameters n_guard]} { |
| 3997 | set use_n_guard [dict get $parameters n_guard] |
| 3998 | } else { |
| 3999 | set use_n_guard 0 |
| 4000 | } |
| 4001 | |
| 4002 | if {$use_hv_guard == 1} { |
| 4003 | if {$use_n_guard == 1} { |
| 4004 | set gdifftype mvnsd |
| 4005 | set gdiffcont mvnsc |
| 4006 | } else { |
| 4007 | set gdifftype mvpsd |
| 4008 | set gdiffcont mvpsc |
| 4009 | } |
| 4010 | set gsurround 0.33 |
| 4011 | } else { |
| 4012 | if {$use_n_guard == 1} { |
| 4013 | set gdifftype nsd |
| 4014 | set gdiffcont nsc |
| 4015 | } else { |
| 4016 | set gdifftype psd |
| 4017 | set gdiffcont psc |
| 4018 | } |
| 4019 | set gsurround $sub_surround |
| 4020 | } |
| 4021 | if {$use_n_guard == 1} { |
| 4022 | set gsubtype nwell |
| 4023 | set gresdiff_spacing 0.525 |
| 4024 | set gresdiff_end 0.525 |
| 4025 | } else { |
| 4026 | set gsubtype psub |
| 4027 | set gresdiff_spacing 0.48 |
| 4028 | set gresdiff_end 0.48 |
| 4029 | } |
| 4030 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4031 | set newdict [dict create \ |
| 4032 | res_type xpres \ |
| 4033 | res_idtype res1p41 \ |
| 4034 | end_type xpc \ |
| 4035 | end_contact_type xpc \ |
| 4036 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4037 | plus_diff_type $gdifftype \ |
| 4038 | plus_contact_type $gdiffcont \ |
| 4039 | sub_type $gsubtype \ |
| 4040 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4041 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4042 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4043 | end_to_end_space 0.52 \ |
| 4044 | end_contact_size 0.19 \ |
| 4045 | res_to_endcont 1.985 \ |
| 4046 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4047 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4048 | mask_clearance 0.52 \ |
| 4049 | overlap_compress 0.36 \ |
| 4050 | ] |
| 4051 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4052 | return [sky130::res_draw $drawdict] |
| 4053 | } |
| 4054 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4055 | proc sky130::sky130_fd_pr__res_xhigh_po_2p85_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4056 | |
| 4057 | # Set a local variable for each rule in ruleset |
| 4058 | foreach key [dict keys $sky130::ruleset] { |
| 4059 | set $key [dict get $sky130::ruleset $key] |
| 4060 | } |
| 4061 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4062 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 4063 | if {[dict exists $parameters hv_guard]} { |
| 4064 | set use_hv_guard [dict get $parameters hv_guard] |
| 4065 | } else { |
| 4066 | set use_hv_guard 0 |
| 4067 | } |
| 4068 | if {[dict exists $parameters n_guard]} { |
| 4069 | set use_n_guard [dict get $parameters n_guard] |
| 4070 | } else { |
| 4071 | set use_n_guard 0 |
| 4072 | } |
| 4073 | |
| 4074 | if {$use_hv_guard == 1} { |
| 4075 | if {$use_n_guard == 1} { |
| 4076 | set gdifftype mvnsd |
| 4077 | set gdiffcont mvnsc |
| 4078 | } else { |
| 4079 | set gdifftype mvpsd |
| 4080 | set gdiffcont mvpsc |
| 4081 | } |
| 4082 | set gsurround 0.33 |
| 4083 | } else { |
| 4084 | if {$use_n_guard == 1} { |
| 4085 | set gdifftype nsd |
| 4086 | set gdiffcont nsc |
| 4087 | } else { |
| 4088 | set gdifftype psd |
| 4089 | set gdiffcont psc |
| 4090 | } |
| 4091 | set gsurround $sub_surround |
| 4092 | } |
| 4093 | if {$use_n_guard == 1} { |
| 4094 | set gsubtype nwell |
| 4095 | set gresdiff_spacing 0.525 |
| 4096 | set gresdiff_end 0.525 |
| 4097 | } else { |
| 4098 | set gsubtype psub |
| 4099 | set gresdiff_spacing 0.48 |
| 4100 | set gresdiff_end 0.48 |
| 4101 | } |
| 4102 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4103 | set newdict [dict create \ |
| 4104 | res_type xpres \ |
| 4105 | res_idtype res2p85 \ |
| 4106 | end_type xpc \ |
| 4107 | end_contact_type xpc \ |
| 4108 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4109 | plus_diff_type $gdifftype \ |
| 4110 | plus_contact_type $gdiffcont \ |
| 4111 | sub_type $gsubtype \ |
| 4112 | guard_sub_surround $gsurround \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4113 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4114 | end_spacing $gresdiff_end \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4115 | end_to_end_space 0.52 \ |
| 4116 | end_contact_size 0.19 \ |
| 4117 | res_to_endcont 1.985 \ |
| 4118 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4119 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4120 | mask_clearance 0.52 \ |
| 4121 | overlap_compress 0.36 \ |
| 4122 | ] |
| 4123 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4124 | return [sky130::res_draw $drawdict] |
| 4125 | } |
| 4126 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4127 | proc sky130::sky130_fd_pr__res_xhigh_po_5p73_draw {parameters} { |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4128 | |
| 4129 | # Set a local variable for each rule in ruleset |
| 4130 | foreach key [dict keys $sky130::ruleset] { |
| 4131 | set $key [dict get $sky130::ruleset $key] |
| 4132 | } |
| 4133 | |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4134 | # Handle options related to guard ring type (high/low voltage, nwell/psub) |
| 4135 | if {[dict exists $parameters hv_guard]} { |
| 4136 | set use_hv_guard [dict get $parameters hv_guard] |
| 4137 | } else { |
| 4138 | set use_hv_guard 0 |
| 4139 | } |
| 4140 | if {[dict exists $parameters n_guard]} { |
| 4141 | set use_n_guard [dict get $parameters n_guard] |
| 4142 | } else { |
| 4143 | set use_n_guard 0 |
| 4144 | } |
| 4145 | |
| 4146 | if {$use_hv_guard == 1} { |
| 4147 | if {$use_n_guard == 1} { |
| 4148 | set gdifftype mvnsd |
| 4149 | set gdiffcont mvnsc |
| 4150 | } else { |
| 4151 | set gdifftype mvpsd |
| 4152 | set gdiffcont mvpsc |
| 4153 | } |
| 4154 | set gsurround 0.33 |
| 4155 | } else { |
| 4156 | if {$use_n_guard == 1} { |
| 4157 | set gdifftype nsd |
| 4158 | set gdiffcont nsc |
| 4159 | } else { |
| 4160 | set gdifftype psd |
| 4161 | set gdiffcont psc |
| 4162 | } |
| 4163 | set gsurround $sub_surround |
| 4164 | } |
| 4165 | if {$use_n_guard == 1} { |
| 4166 | set gsubtype nwell |
| 4167 | set gresdiff_spacing 0.525 |
| 4168 | set gresdiff_end 0.525 |
| 4169 | } else { |
| 4170 | set gsubtype psub |
| 4171 | set gresdiff_spacing 0.48 |
| 4172 | set gresdiff_end 0.48 |
| 4173 | } |
| 4174 | |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4175 | set newdict [dict create \ |
| 4176 | res_type xpres \ |
| 4177 | res_idtype res5p73 \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4178 | end_type xpc \ |
| 4179 | end_contact_type xpc \ |
| 4180 | end_contact_size 0 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4181 | plus_diff_type $gdifftype \ |
| 4182 | plus_contact_type $gdiffcont \ |
| 4183 | sub_type $gsubtype \ |
| 4184 | guard_sub_surround $gsurround \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4185 | end_surround $poly_surround \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4186 | end_spacing $gresdiff_end \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4187 | end_to_end_space 0.52 \ |
| 4188 | end_contact_size 0.19 \ |
| 4189 | res_to_endcont 1.985 \ |
| 4190 | res_spacing 1.24 \ |
Tim Edwards | f788cea | 2021-04-20 12:43:52 -0400 | [diff] [blame] | 4191 | res_diff_spacing $gresdiff_spacing \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4192 | mask_clearance 0.52 \ |
| 4193 | overlap_compress 0.36 \ |
| 4194 | ] |
| 4195 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4196 | return [sky130::res_draw $drawdict] |
| 4197 | } |
| 4198 | |
| 4199 | #---------------------------------------------------------------- |
| 4200 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4201 | proc sky130::sky130_fd_pr__res_generic_nd_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4202 | |
| 4203 | # Set a local variable for each rule in ruleset |
| 4204 | foreach key [dict keys $sky130::ruleset] { |
| 4205 | set $key [dict get $sky130::ruleset $key] |
| 4206 | } |
| 4207 | |
| 4208 | set newdict [dict create \ |
| 4209 | res_type rdn \ |
| 4210 | end_type ndiff \ |
| 4211 | end_contact_type ndc \ |
| 4212 | plus_diff_type psd \ |
| 4213 | plus_contact_type psc \ |
| 4214 | sub_type psub \ |
| 4215 | end_surround $diff_surround \ |
| 4216 | end_spacing 0.44 \ |
| 4217 | res_to_endcont 0.37 \ |
| 4218 | res_spacing 0.30 \ |
| 4219 | res_diff_spacing 0.44 \ |
| 4220 | mask_clearance 0.22 \ |
| 4221 | overlap_compress 0.36 \ |
| 4222 | ] |
| 4223 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4224 | return [sky130::res_draw $drawdict] |
| 4225 | } |
| 4226 | |
| 4227 | #---------------------------------------------------------------- |
| 4228 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4229 | proc sky130::sky130_fd_pr__res_generic_nd__hv_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4230 | |
| 4231 | # Set a local variable for each rule in ruleset |
| 4232 | foreach key [dict keys $sky130::ruleset] { |
| 4233 | set $key [dict get $sky130::ruleset $key] |
| 4234 | } |
| 4235 | |
| 4236 | set newdict [dict create \ |
| 4237 | res_type mvrdn \ |
| 4238 | end_type mvndiff \ |
| 4239 | end_contact_type mvndc \ |
| 4240 | plus_diff_type mvpsd \ |
| 4241 | plus_contact_type mvpsc \ |
| 4242 | sub_type psub \ |
| 4243 | end_surround $diff_surround \ |
| 4244 | end_spacing 0.44 \ |
| 4245 | res_to_endcont 0.37 \ |
| 4246 | res_spacing 0.30 \ |
| 4247 | res_diff_spacing 0.44 \ |
| 4248 | mask_clearance 0.22 \ |
| 4249 | overlap_compress 0.36 \ |
| 4250 | ] |
| 4251 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4252 | return [sky130::res_draw $drawdict] |
| 4253 | } |
| 4254 | |
| 4255 | #---------------------------------------------------------------- |
| 4256 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4257 | proc sky130::sky130_fd_pr__res_generic_pd_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4258 | |
| 4259 | # Set a local variable for each rule in ruleset |
| 4260 | foreach key [dict keys $sky130::ruleset] { |
| 4261 | set $key [dict get $sky130::ruleset $key] |
| 4262 | } |
| 4263 | |
| 4264 | set newdict [dict create \ |
| 4265 | res_type rdp \ |
| 4266 | end_type pdiff \ |
| 4267 | end_contact_type pdc \ |
| 4268 | plus_diff_type nsd \ |
| 4269 | plus_contact_type nsc \ |
| 4270 | sub_type nwell \ |
| 4271 | end_surround $diff_surround \ |
| 4272 | end_spacing 0.44 \ |
| 4273 | res_to_endcont 0.37 \ |
| 4274 | res_spacing $diff_spacing \ |
| 4275 | res_diff_spacing 0.44 \ |
| 4276 | mask_clearance 0.22 \ |
| 4277 | overlap_compress 0.36 \ |
| 4278 | ] |
| 4279 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4280 | return [sky130::res_draw $drawdict] |
| 4281 | } |
| 4282 | |
| 4283 | #---------------------------------------------------------------- |
| 4284 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4285 | proc sky130::sky130_fd_pr__res_generic_pd__hv_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4286 | |
| 4287 | # Set a local variable for each rule in ruleset |
| 4288 | foreach key [dict keys $sky130::ruleset] { |
| 4289 | set $key [dict get $sky130::ruleset $key] |
| 4290 | } |
| 4291 | |
| 4292 | set newdict [dict create \ |
| 4293 | res_type mvrdp \ |
| 4294 | end_type mvpdiff \ |
| 4295 | end_contact_type mvpdc \ |
| 4296 | plus_diff_type mvnsd \ |
| 4297 | plus_contact_type mvnsc \ |
| 4298 | sub_type nwell \ |
| 4299 | end_surround $diff_surround \ |
| 4300 | guard_sub_surround 0.33 \ |
| 4301 | end_spacing 0.44 \ |
| 4302 | res_to_endcont 0.37 \ |
| 4303 | res_spacing 0.30 \ |
| 4304 | res_diff_spacing 0.44 \ |
| 4305 | mask_clearance 0.22 \ |
| 4306 | overlap_compress 0.36 \ |
| 4307 | ] |
| 4308 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4309 | return [sky130::res_draw $drawdict] |
| 4310 | } |
| 4311 | |
| 4312 | #---------------------------------------------------------------- |
| 4313 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4314 | proc sky130::sky130_fd_pr__res_iso_pw_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4315 | |
| 4316 | # Set a local variable for each rule in ruleset |
| 4317 | foreach key [dict keys $sky130::ruleset] { |
| 4318 | set $key [dict get $sky130::ruleset $key] |
| 4319 | } |
| 4320 | |
| 4321 | set newdict [dict create \ |
| 4322 | well_res_type pwell \ |
| 4323 | res_type rpw \ |
| 4324 | end_type psd \ |
| 4325 | end_contact_type psc \ |
| 4326 | plus_diff_type nsd \ |
| 4327 | plus_contact_type nsc \ |
| 4328 | sub_type dnwell \ |
| 4329 | sub_surround 0.23 \ |
| 4330 | guard_sub_type nwell \ |
| 4331 | guard_sub_surround 0.63 \ |
| 4332 | end_surround $diff_surround \ |
| 4333 | end_spacing 0.63 \ |
| 4334 | end_to_end_space 1.15 \ |
| 4335 | end_overlap_cont 0.06 \ |
| 4336 | end_contact_size 0.53 \ |
| 4337 | overlap_compress -0.17 \ |
| 4338 | res_to_endcont 0.265 \ |
| 4339 | res_spacing 1.4 \ |
| 4340 | res_diff_spacing 0.63 \ |
| 4341 | well_res_overlap 0.2 \ |
| 4342 | ] |
| 4343 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4344 | return [sky130::res_draw $drawdict] |
| 4345 | } |
| 4346 | |
| 4347 | #---------------------------------------------------------------- |
| 4348 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4349 | proc sky130::sky130_fd_pr__res_generic_l1_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4350 | |
| 4351 | # Set a local variable for each rule in ruleset |
| 4352 | foreach key [dict keys $sky130::ruleset] { |
| 4353 | set $key [dict get $sky130::ruleset $key] |
| 4354 | } |
| 4355 | |
| 4356 | set newdict [dict create \ |
| 4357 | guard 0 \ |
| 4358 | res_type rli \ |
| 4359 | end_type li \ |
| 4360 | end_surround 0.0 \ |
| 4361 | end_spacing 0.0 \ |
| 4362 | res_to_endcont 0.2 \ |
| 4363 | end_to_end_space 0.23 \ |
| 4364 | res_spacing $metal_spacing \ |
| 4365 | ] |
| 4366 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4367 | return [sky130::res_draw $drawdict] |
| 4368 | } |
| 4369 | |
| 4370 | #---------------------------------------------------------------- |
| 4371 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4372 | proc sky130::sky130_fd_pr__res_generic_m1_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4373 | |
| 4374 | # Set a local variable for each rule in ruleset |
| 4375 | foreach key [dict keys $sky130::ruleset] { |
| 4376 | set $key [dict get $sky130::ruleset $key] |
| 4377 | } |
| 4378 | |
| 4379 | set newdict [dict create \ |
| 4380 | guard 0 \ |
| 4381 | res_type rm1 \ |
| 4382 | end_type m1 \ |
| 4383 | end_surround 0.0 \ |
| 4384 | end_spacing 0.0 \ |
| 4385 | end_to_end_space 0.28 \ |
| 4386 | res_to_endcont 0.2 \ |
| 4387 | res_spacing $mmetal_spacing \ |
| 4388 | ] |
| 4389 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4390 | return [sky130::res_draw $drawdict] |
| 4391 | } |
| 4392 | |
| 4393 | #---------------------------------------------------------------- |
| 4394 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4395 | proc sky130::sky130_fd_pr__res_generic_m2_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4396 | |
| 4397 | # Set a local variable for each rule in ruleset |
| 4398 | foreach key [dict keys $sky130::ruleset] { |
| 4399 | set $key [dict get $sky130::ruleset $key] |
| 4400 | } |
| 4401 | |
| 4402 | set newdict [dict create \ |
| 4403 | guard 0 \ |
| 4404 | res_type rm2 \ |
| 4405 | end_type m2 \ |
| 4406 | end_surround 0.0 \ |
| 4407 | end_spacing 0.0 \ |
| 4408 | end_to_end_space 0.28 \ |
| 4409 | res_to_endcont 0.2 \ |
| 4410 | res_spacing $mmetal_spacing \ |
| 4411 | ] |
| 4412 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4413 | return [sky130::res_draw $drawdict] |
| 4414 | } |
| 4415 | |
| 4416 | #---------------------------------------------------------------- |
| 4417 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4418 | proc sky130::sky130_fd_pr__res_generic_m3_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4419 | |
| 4420 | # Set a local variable for each rule in ruleset |
| 4421 | foreach key [dict keys $sky130::ruleset] { |
| 4422 | set $key [dict get $sky130::ruleset $key] |
| 4423 | } |
| 4424 | |
| 4425 | set newdict [dict create \ |
| 4426 | guard 0 \ |
| 4427 | res_type rm3 \ |
| 4428 | end_type m3 \ |
| 4429 | end_surround 0.0 \ |
| 4430 | end_spacing 0.0 \ |
| 4431 | end_to_end_space 0.28 \ |
| 4432 | res_to_endcont 0.2 \ |
| 4433 | res_spacing $mmetal_spacing \ |
| 4434 | ] |
| 4435 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4436 | return [sky130::res_draw $drawdict] |
| 4437 | } |
| 4438 | |
| 4439 | #---------------------------------------------------------------- |
| 4440 | |
| 4441 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4442 | proc sky130::sky130_fd_pr__res_generic_m4_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4443 | |
| 4444 | # Set a local variable for each rule in ruleset |
| 4445 | foreach key [dict keys $sky130::ruleset] { |
| 4446 | set $key [dict get $sky130::ruleset $key] |
| 4447 | } |
| 4448 | |
| 4449 | set newdict [dict create \ |
| 4450 | guard 0 \ |
| 4451 | res_type rm4 \ |
| 4452 | end_type m4 \ |
| 4453 | end_surround 0.0 \ |
| 4454 | end_spacing 0.0 \ |
| 4455 | end_to_end_space 0.28 \ |
| 4456 | res_to_endcont 0.2 \ |
| 4457 | res_spacing $mmetal_spacing \ |
| 4458 | ] |
| 4459 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4460 | return [sky130::res_draw $drawdict] |
| 4461 | } |
| 4462 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4463 | proc sky130::sky130_fd_pr__res_generic_m5_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4464 | # Set a local variable for each rule in ruleset |
| 4465 | foreach key [dict keys $sky130::ruleset] { |
| 4466 | set $key [dict get $sky130::ruleset $key] |
| 4467 | } |
| 4468 | |
| 4469 | set newdict [dict create \ |
| 4470 | guard 0 \ |
| 4471 | res_type rm5 \ |
| 4472 | end_type m5 \ |
| 4473 | end_surround 0.0 \ |
| 4474 | end_spacing 0.0 \ |
| 4475 | end_to_end_space 1.6 \ |
| 4476 | res_to_endcont 0.2 \ |
| 4477 | res_spacing $mmetal_spacing \ |
| 4478 | ] |
| 4479 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 4480 | return [sky130::res_draw $drawdict] |
| 4481 | } |
| 4482 | #endif (METAL5) |
| 4483 | |
| 4484 | #---------------------------------------------------------------- |
| 4485 | # Resistor total length computation |
| 4486 | #---------------------------------------------------------------- |
| 4487 | |
| 4488 | proc sky130::compute_ltot {parameters} { |
| 4489 | # In case snake not defined |
| 4490 | set snake 0 |
| 4491 | set caplen 0 |
| 4492 | |
| 4493 | foreach key [dict keys $parameters] { |
| 4494 | set $key [dict get $parameters $key] |
| 4495 | } |
| 4496 | |
| 4497 | set l [magic::spice2float $l] |
| 4498 | set l [magic::3digitpastdecimal $l] |
| 4499 | |
| 4500 | # Compute total length. Use catch to prevent error in batch/scripted mode. |
| 4501 | if {$snake == 1} { |
| 4502 | catch {set magic::ltot_val [expr ($caplen * ($nx - 1)) + ($l * $nx) + ($nx - 1)]} |
| 4503 | } else { |
| 4504 | catch {set magic::ltot_val $l} |
| 4505 | } |
| 4506 | } |
| 4507 | |
| 4508 | #---------------------------------------------------------------- |
| 4509 | # resistor: Check device parameters for out-of-bounds values |
| 4510 | #---------------------------------------------------------------- |
| 4511 | |
| 4512 | proc sky130::res_check {device parameters} { |
| 4513 | |
| 4514 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 4515 | set snake 0 |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4516 | set guard 0 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4517 | set sterm 0.0 |
| 4518 | set caplen 0 |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4519 | set wmax 0 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4520 | |
| 4521 | foreach key [dict keys $parameters] { |
| 4522 | set $key [dict get $parameters $key] |
| 4523 | } |
| 4524 | |
| 4525 | # Normalize distance units to microns |
| 4526 | set w [magic::spice2float $w] |
| 4527 | set w [magic::3digitpastdecimal $w] |
| 4528 | set l [magic::spice2float $l] |
| 4529 | set l [magic::3digitpastdecimal $l] |
| 4530 | |
| 4531 | set val [magic::spice2float $val] |
| 4532 | set rho [magic::spice2float $rho] |
| 4533 | |
| 4534 | # nf, m must be integer |
| 4535 | if {![string is int $nx]} { |
| 4536 | puts stderr "X repeat must be an integer!" |
| 4537 | dict set parameters nx 1 |
| 4538 | } |
| 4539 | if {![string is int $m]} { |
| 4540 | puts stderr "Y repeat must be an integer!" |
| 4541 | dict set parameters m 1 |
| 4542 | } |
| 4543 | |
| 4544 | # Width always needs to be specified |
| 4545 | if {$w < $wmin} { |
| 4546 | puts stderr "Resistor width must be >= $wmin um" |
| 4547 | dict set parameters w $wmin |
| 4548 | } |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4549 | if {$wmax > 0 && $w > $wmax} { |
| 4550 | puts stderr "Resistor width must be <= $wmax um" |
| 4551 | dict set parameters w $wmax |
| 4552 | } |
| 4553 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4554 | # Val and W specified - no L |
| 4555 | if {$l == 0} { |
| 4556 | set l [expr ($w - $dw) * $val / $rho] |
| 4557 | set l [magic::3digitpastdecimal $l] |
| 4558 | set stringval [magic::float2spice $val] |
| 4559 | dict set parameters l [magic::float2spice [expr $l * 1e-6]] |
| 4560 | # L and W specified - ignore Val if specified |
| 4561 | } else { |
| 4562 | if {$snake == 0} { |
| 4563 | set val [expr (2 * $term + $l * $rho) / ($w - $dw)] |
| 4564 | } else { |
| 4565 | set val [expr $rho * ($nx - 1) + ((2 * ($term + $sterm)) \ |
| 4566 | + ($rho * $l * $nx) + ($rho * $caplen * ($nx - 1))) \ |
| 4567 | / ($w - $dw)] |
| 4568 | } |
| 4569 | set val [magic::float2spice $val] |
| 4570 | dict set parameters val $val |
| 4571 | } |
| 4572 | if {$l < $lmin} { |
| 4573 | puts stderr "Resistor length must be >= $lmin um" |
| 4574 | dict set parameters l $lmin |
| 4575 | } |
| 4576 | if {$nx < 1} { |
| 4577 | puts stderr "X repeat must be >= 1" |
| 4578 | dict set parameters nx 1 |
| 4579 | } |
| 4580 | if {$m < 1} { |
| 4581 | puts stderr "Y repeat must be >= 1" |
| 4582 | dict set parameters m 1 |
| 4583 | } |
| 4584 | |
| 4585 | # Snake resistors cannot have width greater than length |
| 4586 | if {$snake == 1} { |
| 4587 | if {$w > $l} { |
| 4588 | puts stderr "Snake resistor width must be < length" |
| 4589 | dict set parameters w $l |
| 4590 | } |
| 4591 | } |
| 4592 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4593 | # Check via coverage for syntax |
| 4594 | if {$guard == 1} { |
| 4595 | if {[catch {expr abs($viagb)}]} { |
| 4596 | puts stderr "Guard ring bottom via coverage must be numeric!" |
| 4597 | dict set parameters viagb 0 |
| 4598 | } elseif {[expr abs($viagb)] > 100} { |
| 4599 | puts stderr "Guard ring bottom via coverage can't be more than 100%" |
| 4600 | dict set parameters viagb 100 |
| 4601 | } |
| 4602 | if {[catch {expr abs($viagt)}]} { |
| 4603 | puts stderr "Guard ring top via coverage must be numeric!" |
| 4604 | dict set parameters viagt 0 |
| 4605 | } elseif {[expr abs($viagt)] > 100} { |
| 4606 | puts stderr "Guard ring top via coverage can't be more than 100%" |
| 4607 | dict set parameters viagt 100 |
| 4608 | } |
| 4609 | if {[catch {expr abs($viagr)}]} { |
| 4610 | puts stderr "Guard ring right via coverage must be numeric!" |
| 4611 | dict set parameters viagr 0 |
| 4612 | } elseif {[expr abs($viagr)] > 100} { |
| 4613 | puts stderr "Guard ring right via coverage can't be more than 100%" |
| 4614 | dict set parameters viagr 100 |
| 4615 | } |
| 4616 | if {[catch {expr abs($viagl)}]} { |
| 4617 | puts stderr "Guard ring left via coverage must be numeric!" |
| 4618 | dict set parameters viagl 0 |
| 4619 | } elseif {[expr abs($viagl)] > 100} { |
| 4620 | puts stderr "Guard ring left via coverage can't be more than 100%" |
| 4621 | dict set parameters viagl 100 |
| 4622 | } |
| 4623 | } |
| 4624 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4625 | # Diffusion resistors must satisfy diffusion-to-tap spacing of 20um. |
| 4626 | # Therefore the maximum of guard ring width or height cannot exceed 40um. |
| 4627 | # If in violation, reduce counts first, as these are easiest to recover |
| 4628 | # by duplicating the device and overlapping the wells. |
| 4629 | if {$device == "rdn" || $device == "rdp"} { |
| 4630 | set origm $m |
| 4631 | set orignx $nx |
| 4632 | while true { |
| 4633 | set xext [expr ($w + 0.8) * $nx + 1.0] |
| 4634 | set yext [expr ($l + 1.7) * $m + 1.7] |
| 4635 | if {[expr min($xext, $yext)] > 40.0} { |
| 4636 | if {$yext > 40.0 && $m > 1} { |
| 4637 | incr m -1 |
| 4638 | } elseif {$xext > 40.0 && $nx > 1} { |
| 4639 | incr nx -1 |
| 4640 | } elseif {$yext > 40.0} { |
| 4641 | set l 36.6 |
| 4642 | puts -nonewline stderr "Diffusion resistor length must be < 36.6 um" |
| 4643 | puts stderr " to avoid tap spacing violation." |
| 4644 | dict set parameters l $l |
| 4645 | } elseif {$xext > 40.0} { |
| 4646 | set w 38.2 |
| 4647 | puts -nonewline stderr "Diffusion resistor width must be < 38.2 um" |
| 4648 | puts stderr " to avoid tap spacing violation." |
| 4649 | dict set parameters w $w |
| 4650 | } |
| 4651 | } else { |
| 4652 | break |
| 4653 | } |
| 4654 | } |
| 4655 | if {$m != $origm} { |
| 4656 | puts stderr "Y repeat reduced to prevent tap distance violation" |
| 4657 | dict set parameters m $m |
| 4658 | } |
| 4659 | if {$nx != $orignx} { |
| 4660 | puts stderr "X repeat reduced to prevent tap distance violation" |
| 4661 | dict set parameters nx $nx |
| 4662 | } |
| 4663 | } |
| 4664 | sky130::compute_ltot $parameters |
| 4665 | return $parameters |
| 4666 | } |
| 4667 | |
| 4668 | #---------------------------------------------------------------- |
| 4669 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4670 | proc sky130::sky130_fd_pr__res_iso_pw_check {parameters} { |
| 4671 | return [sky130::res_check sky130_fd_pr__res_iso_pw $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4672 | } |
| 4673 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4674 | proc sky130::sky130_fd_pr__res_generic_po_check {parameters} { |
| 4675 | return [sky130::res_check sky130_fd_pr__res_generic_po $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4676 | } |
| 4677 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4678 | proc sky130::sky130_fd_pr__res_high_po_0p35_check {parameters} { |
| 4679 | return [sky130::res_check sky130_fd_pr__res_high_po_0p35 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4680 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4681 | proc sky130::sky130_fd_pr__res_high_po_0p69_check {parameters} { |
| 4682 | return [sky130::res_check sky130_fd_pr__res_high_po_0p69 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4683 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4684 | proc sky130::sky130_fd_pr__res_high_po_1p41_check {parameters} { |
| 4685 | return [sky130::res_check sky130_fd_pr__res_high_po_1p41 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4686 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4687 | proc sky130::sky130_fd_pr__res_high_po_2p85_check {parameters} { |
| 4688 | return [sky130::res_check sky130_fd_pr__res_high_po_2p85 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4689 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4690 | proc sky130::sky130_fd_pr__res_high_po_5p73_check {parameters} { |
| 4691 | return [sky130::res_check sky130_fd_pr__res_high_po_5p73 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4692 | } |
| 4693 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4694 | proc sky130::sky130_fd_pr__res_xhigh_po_0p35_check {parameters} { |
| 4695 | return [sky130::res_check sky130_fd_pr__res_xhigh_po_0p35 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4696 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4697 | proc sky130::sky130_fd_pr__res_xhigh_po_0p69_check {parameters} { |
| 4698 | return [sky130::res_check sky130_fd_pr__res_xhigh_po_0p69 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4699 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4700 | proc sky130::sky130_fd_pr__res_xhigh_po_1p41_check {parameters} { |
| 4701 | return [sky130::res_check sky130_fd_pr__res_xhigh_po_1p41 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4702 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4703 | proc sky130::sky130_fd_pr__res_xhigh_po_2p85_check {parameters} { |
| 4704 | return [sky130::res_check sky130_fd_pr__res_xhigh_po_2p85 $parameters] |
Tim Edwards | bf5ec17 | 2020-08-09 14:04:00 -0400 | [diff] [blame] | 4705 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4706 | proc sky130::sky130_fd_pr__res_xhigh_po_5p73_check {parameters} { |
| 4707 | return [sky130::res_check sky130_fd_pr__res_xhigh_po_5p73 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4708 | } |
| 4709 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4710 | proc sky130::sky130_fd_pr__res_generic_nd_check {parameters} { |
| 4711 | return [sky130::res_check sky130_fd_pr__res_generic_nd $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4712 | } |
| 4713 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4714 | proc sky130::sky130_fd_pr__res_generic_pd_check {parameters} { |
| 4715 | return [sky130::res_check sky130_fd_pr__res_generic_pd $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4716 | } |
| 4717 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4718 | proc sky130::sky130_fd_pr__res_generic_nd__hv_check {parameters} { |
| 4719 | return [sky130::res_check sky130_fd_pr__res_generic_nd__hv $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4720 | } |
| 4721 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4722 | proc sky130::sky130_fd_pr__res_generic_pd__hv_check {parameters} { |
| 4723 | return [sky130::res_check sky130_fd_pr__res_generic_pd__hv $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4724 | } |
| 4725 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4726 | proc sky130::sky130_fd_pr__res_generic_l1_check {parameters} { |
| 4727 | return [sky130::res_check sky130_fd_pr__res_generic_l1 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4728 | } |
| 4729 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4730 | proc sky130::sky130_fd_pr__res_generic_m1_check {parameters} { |
| 4731 | return [sky130::res_check sky130_fd_pr__res_generic_m1 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4732 | } |
| 4733 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4734 | proc sky130::sky130_fd_pr__res_generic_m2_check {parameters} { |
| 4735 | return [sky130::res_check sky130_fd_pr__res_generic_m2 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4736 | } |
| 4737 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4738 | proc sky130::sky130_fd_pr__res_generic_m3_check {parameters} { |
| 4739 | return [sky130::res_check sky130_fd_pr__res_generic_m3 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4740 | } |
| 4741 | |
| 4742 | #ifdef METAL5 |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4743 | proc sky130::sky130_fd_pr__res_generic_m4_check {parameters} { |
| 4744 | return [sky130::res_check sky130_fd_pr__res_generic_m4 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4745 | } |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4746 | proc sky130::sky130_fd_pr__res_generic_m5_check {parameters} { |
| 4747 | return [sky130::res_check sky130_fd_pr__res_generic_m5 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4748 | } |
| 4749 | #endif (METAL5) |
| 4750 | |
| 4751 | #---------------------------------------------------------------- |
| 4752 | # MOS defaults: |
| 4753 | #---------------------------------------------------------------- |
| 4754 | # w = Gate width |
| 4755 | # l = Gate length |
| 4756 | # m = Multiplier |
| 4757 | # nf = Number of fingers |
| 4758 | # diffcov = Diffusion contact coverage |
| 4759 | # polycov = Poly contact coverage |
| 4760 | # topc = Top gate contact |
| 4761 | # botc = Bottom gate contact |
| 4762 | # guard = Guard ring |
| 4763 | # |
| 4764 | # (not user-editable) |
| 4765 | # |
| 4766 | # lmin = Gate minimum length |
| 4767 | # wmin = Gate minimum width |
| 4768 | #---------------------------------------------------------------- |
| 4769 | |
| 4770 | #---------------------------------------------------------------- |
| 4771 | # pmos: Specify all user-editable default values and those |
| 4772 | # needed by mos_check |
| 4773 | #---------------------------------------------------------------- |
| 4774 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4775 | proc sky130::sky130_fd_pr__pfet_01v8_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4776 | return {w 0.42 l 0.15 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4777 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4778 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.15 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4779 | compatible {sky130_fd_pr__pfet_01v8 \ |
| 4780 | sky130_fd_pr__pfet_01v8_lvt sky130_fd_pr__pfet_01v8_hvt \ |
Tim Edwards | 3e4e81e | 2021-02-13 17:13:05 -0500 | [diff] [blame] | 4781 | sky130_fd_pr__pfet_g5v0d10v5} full_metal 1 \ |
| 4782 | viasrc 100 viadrn 100 viagate 100 \ |
| 4783 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4784 | } |
| 4785 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4786 | proc sky130::sky130_fd_pr__pfet_01v8_lvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4787 | return {w 0.42 l 0.35 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4788 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4789 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.35 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4790 | compatible {sky130_fd_pr__pfet_01v8 \ |
| 4791 | sky130_fd_pr__pfet_01v8_lvt sky130_fd_pr__pfet_01v8_hvt \ |
Tim Edwards | 3e4e81e | 2021-02-13 17:13:05 -0500 | [diff] [blame] | 4792 | sky130_fd_pr__pfet_g5v0d10v5} full_metal 1 \ |
| 4793 | viasrc 100 viadrn 100 viagate 100 \ |
| 4794 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4795 | } |
| 4796 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4797 | proc sky130::sky130_fd_pr__pfet_01v8_hvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4798 | return {w 0.42 l 0.15 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4799 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4800 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.15 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4801 | compatible {sky130_fd_pr__pfet_01v8 \ |
| 4802 | sky130_fd_pr__pfet_01v8_lvt sky130_fd_pr__pfet_01v8_hvt \ |
Tim Edwards | 3e4e81e | 2021-02-13 17:13:05 -0500 | [diff] [blame] | 4803 | sky130_fd_pr__pfet_g5v0d10v5} full_metal 1 \ |
| 4804 | viasrc 100 viadrn 100 viagate 100 \ |
| 4805 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4806 | } |
| 4807 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4808 | proc sky130::sky130_fd_pr__pfet_g5v0d10v5_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4809 | return {w 0.42 l 0.50 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4810 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4811 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.50 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4812 | compatible {sky130_fd_pr__pfet_01v8 \ |
| 4813 | sky130_fd_pr__pfet_01v8_lvt sky130_fd_pr__pfet_01v8_hvt \ |
Tim Edwards | 3e4e81e | 2021-02-13 17:13:05 -0500 | [diff] [blame] | 4814 | sky130_fd_pr__pfet_g5v0d10v5} full_metal 1 \ |
| 4815 | viasrc 100 viadrn 100 viagate 100 \ |
| 4816 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4817 | } |
| 4818 | |
| 4819 | #---------------------------------------------------------------- |
| 4820 | # nmos: Specify all user-editable default values and those |
| 4821 | # needed by mos_check |
| 4822 | #---------------------------------------------------------------- |
| 4823 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4824 | proc sky130::sky130_fd_pr__nfet_01v8_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4825 | return {w 0.420 l 0.150 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4826 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4827 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.15 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4828 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4829 | sky130_fd_bs_flash__special_sonosfet_star \ |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4830 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4831 | sky130_fd_pr__nfet_03v3_nvt} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4832 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4833 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4834 | } |
| 4835 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4836 | proc sky130::sky130_fd_pr__nfet_01v8_lvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4837 | return {w 0.420 l 0.150 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4838 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4839 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.15 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4840 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4841 | sky130_fd_bs_flash__special_sonosfet_star \ |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4842 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4843 | sky130_fd_pr__nfet_03v3_nvt} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4844 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4845 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4846 | } |
| 4847 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4848 | proc sky130::sky130_fd_bs_flash__special_sonosfet_star_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4849 | return {w 0.420 l 0.150 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4850 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4851 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.15 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4852 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4853 | sky130_fd_bs_flash__special_sonosfet_star \ |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4854 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4855 | sky130_fd_pr__nfet_03v3_nvt} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4856 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4857 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4858 | } |
| 4859 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4860 | proc sky130::sky130_fd_pr__nfet_g5v0d10v5_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4861 | return {w 0.42 l 0.50 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4862 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4863 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.50 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4864 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4865 | sky130_fd_bs_flash__special_sonosfet_star \ |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4866 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4867 | sky130_fd_pr__nfet_03v3_nvt} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4868 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4869 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4870 | } |
| 4871 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4872 | proc sky130::sky130_fd_pr__nfet_05v0_nvt_defaults {} { |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4873 | return {w 0.42 l 0.90 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4874 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4875 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.90 wmin 0.42 \ |
| 4876 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4877 | sky130_fd_bs_flash__special_sonosfet_star \ |
| 4878 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4879 | sky130_fd_pr__nfet_03v3_nvt} \ |
| 4880 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4881 | viagb 0 viagr 0 viagl 0 viagt 0} |
| 4882 | } |
| 4883 | |
| 4884 | proc sky130::sky130_fd_pr__nfet_03v3_nvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4885 | return {w 0.42 l 0.50 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4886 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4887 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.50 wmin 0.42 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4888 | compatible {sky130_fd_pr__nfet_01v8 sky130_fd_pr__nfet_01v8_lvt \ |
| 4889 | sky130_fd_bs_flash__special_sonosfet_star \ |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4890 | sky130_fd_pr__nfet_g5v0d10v5 sky130_fd_pr__nfet_05v0_nvt \ |
| 4891 | sky130_fd_pr__nfet_03v3_nvt} \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4892 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4893 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4894 | } |
| 4895 | |
| 4896 | #---------------------------------------------------------------- |
| 4897 | # mos varactor: Specify all user-editable default values and those |
| 4898 | # needed by mosvc_check |
| 4899 | #---------------------------------------------------------------- |
| 4900 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4901 | proc sky130::sky130_fd_pr__cap_var_lvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4902 | return {w 1.0 l 0.18 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4903 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4904 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.18 wmin 1.0 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4905 | compatible {sky130_fd_pr__cap_var_lvt \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4906 | sky130_fd_pr__cap_var_hvt sky130_fd_pr__cap_var} \ |
| 4907 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4908 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4909 | } |
| 4910 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4911 | proc sky130::sky130_fd_pr__cap_var_hvt_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4912 | return {w 1.0 l 0.18 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4913 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4914 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.18 wmin 1.0 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4915 | compatible {sky130_fd_pr__cap_var_lvt \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4916 | sky130_fd_pr__cap_var_hvt sky130_fd_pr__cap_var} \ |
| 4917 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4918 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4919 | } |
| 4920 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4921 | proc sky130::sky130_fd_pr__cap_var_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4922 | return {w 1.0 l 0.50 m 1 nf 1 diffcov 100 polycov 100 \ |
| 4923 | guard 1 glc 1 grc 1 gtc 1 gbc 1 tbcov 100 rlcov 100 \ |
| 4924 | topc 1 botc 1 poverlap 0 doverlap 1 lmin 0.50 wmin 1.0 \ |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4925 | compatible {sky130_fd_pr__cap_var_lvt \ |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 4926 | sky130_fd_pr__cap_var_hvt sky130_fd_pr__cap_var} \ |
| 4927 | full_metal 1 viasrc 100 viadrn 100 viagate 100 \ |
| 4928 | viagb 0 viagr 0 viagl 0 viagt 0} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4929 | } |
| 4930 | |
| 4931 | #---------------------------------------------------------------- |
| 4932 | # mos: Conversion from SPICE netlist parameters to toolkit |
| 4933 | #---------------------------------------------------------------- |
| 4934 | |
| 4935 | proc sky130::mos_convert {parameters} { |
| 4936 | set pdkparams [dict create] |
| 4937 | dict for {key value} $parameters { |
| 4938 | switch -nocase $key { |
| 4939 | l - |
| 4940 | w { |
| 4941 | # Length and width are converted to units of microns |
| 4942 | set value [magic::spice2float $value] |
| 4943 | # set value [expr $value * 1e6] |
| 4944 | set value [magic::3digitpastdecimal $value] |
| 4945 | dict set pdkparams [string tolower $key] $value |
| 4946 | } |
| 4947 | m { |
Tim Edwards | 23c9766 | 2020-08-09 11:57:32 -0400 | [diff] [blame] | 4948 | dict set pdkparams [string tolower $key] $value |
| 4949 | } |
| 4950 | nf { |
| 4951 | # Adjustment ot W will be handled below |
| 4952 | dict set pdkparams [string tolower $key] $value |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4953 | } |
| 4954 | } |
| 4955 | } |
Tim Edwards | 23c9766 | 2020-08-09 11:57:32 -0400 | [diff] [blame] | 4956 | |
| 4957 | # Magic does not understand "nf" as a parameter, but expands to |
| 4958 | # "nf" number of devices connected horizontally. The "w" value |
| 4959 | # must be divided down accordingly, as the "nf" parameter implies |
| 4960 | # that the total width "w" is divided into "nf" fingers. |
| 4961 | |
| 4962 | catch { |
| 4963 | set w [dict get $pdkparams w] |
| 4964 | set nf [dict get $pdkparams nf] |
| 4965 | if {$nf > 1} { |
| 4966 | dict set pdkparams w [expr $w / $nf] |
| 4967 | } |
| 4968 | } |
| 4969 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4970 | return $pdkparams |
| 4971 | } |
| 4972 | |
| 4973 | #---------------------------------------------------------------- |
| 4974 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4975 | proc sky130::sky130_fd_pr__nfet_01v8_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4976 | return [sky130::mos_convert $parameters] |
| 4977 | } |
| 4978 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4979 | proc sky130::sky130_fd_pr__nfet_01v8_lvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4980 | return [sky130::mos_convert $parameters] |
| 4981 | } |
| 4982 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4983 | proc sky130::sky130_fd_bs_flash__special_sonosfet_star_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4984 | return [sky130::mos_convert $parameters] |
| 4985 | } |
| 4986 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4987 | proc sky130::sky130_fd_pr__nfet_g5v0d10v5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4988 | return [sky130::mos_convert $parameters] |
| 4989 | } |
| 4990 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4991 | proc sky130::sky130_fd_pr__nfet_05v0_nvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 4992 | return [sky130::mos_convert $parameters] |
| 4993 | } |
| 4994 | |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 4995 | proc sky130::sky130_fd_pr__nfet_03v3_nvt_convert {parameters} { |
| 4996 | return [sky130::mos_convert $parameters] |
| 4997 | } |
| 4998 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 4999 | proc sky130::sky130_fd_pr__pfet_01v8_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5000 | return [sky130::mos_convert $parameters] |
| 5001 | } |
| 5002 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5003 | proc sky130::sky130_fd_pr__pfet_01v8_lvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5004 | return [sky130::mos_convert $parameters] |
| 5005 | } |
| 5006 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5007 | proc sky130::sky130_fd_pr__pfet_01v8_hvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5008 | return [sky130::mos_convert $parameters] |
| 5009 | } |
| 5010 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5011 | proc sky130::sky130_fd_pr__pfet_g5v0d10v5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5012 | return [sky130::mos_convert $parameters] |
| 5013 | } |
| 5014 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5015 | proc sky130::sky130_fd_pr__cap_var_lvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5016 | return [sky130::mos_convert $parameters] |
| 5017 | } |
| 5018 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5019 | proc sky130::sky130_fd_pr__cap_var_hvt_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5020 | return [sky130::mos_convert $parameters] |
| 5021 | } |
| 5022 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5023 | proc sky130::sky130_fd_pr__cap_var_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5024 | return [sky130::mos_convert $parameters] |
| 5025 | } |
| 5026 | |
| 5027 | #---------------------------------------------------------------- |
| 5028 | # mos: Interactively specifies the fixed layout parameters |
| 5029 | #---------------------------------------------------------------- |
| 5030 | |
| 5031 | proc sky130::mos_dialog {device parameters} { |
| 5032 | # Editable fields: w, l, nf, m, diffcov, polycov |
| 5033 | # Checked fields: topc, botc |
| 5034 | # For specific devices, gate type is a selection list |
| 5035 | |
| 5036 | magic::add_entry w "Width (um)" $parameters |
| 5037 | magic::add_entry l "Length (um)" $parameters |
| 5038 | magic::add_entry nf "Fingers" $parameters |
| 5039 | magic::add_entry m "M" $parameters |
| 5040 | |
| 5041 | if {[dict exists $parameters compatible]} { |
| 5042 | set sellist [dict get $parameters compatible] |
| 5043 | magic::add_selectlist gencell "Device type" $sellist $parameters $device |
| 5044 | } |
| 5045 | |
| 5046 | magic::add_entry diffcov "Diffusion contact coverage (%)" $parameters |
| 5047 | magic::add_entry polycov "Poly contact coverage (%)" $parameters |
| 5048 | magic::add_entry rlcov "Guard ring contact coverage (%)" $parameters |
| 5049 | if {[dict exists $parameters gbc]} { |
| 5050 | magic::add_entry tbcov "Guard ring top/bottom contact coverage (%)" $parameters |
| 5051 | } |
| 5052 | |
| 5053 | magic::add_checkbox poverlap "Overlap at poly contact" $parameters |
| 5054 | magic::add_checkbox doverlap "Overlap at diffusion contact" $parameters |
| 5055 | magic::add_checkbox topc "Add top gate contact" $parameters |
| 5056 | magic::add_checkbox botc "Add bottom gate contact" $parameters |
| 5057 | |
| 5058 | magic::add_checkbox guard "Add guard ring" $parameters |
| 5059 | magic::add_checkbox full_metal "Full metal guard ring" $parameters |
| 5060 | magic::add_checkbox glc "Add left guard ring contact" $parameters |
| 5061 | magic::add_checkbox grc "Add right guard ring contact" $parameters |
| 5062 | if {[dict exists $parameters gbc]} { |
| 5063 | magic::add_checkbox gbc "Add bottom guard ring contact" $parameters |
| 5064 | } |
| 5065 | if {[dict exists $parameters gtc]} { |
| 5066 | magic::add_checkbox gtc "Add top guard ring contact" $parameters |
| 5067 | } |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5068 | |
| 5069 | magic::add_entry viasrc "Source via coverage \[+/-\](%)" $parameters |
| 5070 | magic::add_entry viadrn "Drain via coverage \[+/-\](%)" $parameters |
| 5071 | magic::add_entry viagate "Gate via coverage \[+/-\](%)" $parameters |
| 5072 | magic::add_entry viagb "Bottom guard ring via coverage \[+/-\](%)" $parameters |
| 5073 | magic::add_entry viagt "Top guard ring via coverage \[+/-\](%)" $parameters |
| 5074 | magic::add_entry viagr "Right guard ring via coverage \[+/-\](%)" $parameters |
| 5075 | magic::add_entry viagl "Left guard ring via coverage \[+/-\](%)" $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5076 | } |
| 5077 | |
| 5078 | #---------------------------------------------------------------- |
| 5079 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5080 | proc sky130::sky130_fd_pr__nfet_01v8_dialog {parameters} { |
| 5081 | sky130::mos_dialog sky130_fd_pr__nfet_01v8 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5082 | } |
| 5083 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5084 | proc sky130::sky130_fd_pr__nfet_01v8_lvt_dialog {parameters} { |
| 5085 | sky130::mos_dialog sky130_fd_pr__nfet_01v8_lvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5086 | } |
| 5087 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5088 | proc sky130::sky130_fd_bs_flash__special_sonosfet_star_dialog {parameters} { |
| 5089 | sky130::mos_dialog sky130_fd_bs_flash__special_sonosfet_star $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5090 | } |
| 5091 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5092 | proc sky130::sky130_fd_pr__nfet_g5v0d10v5_dialog {parameters} { |
| 5093 | sky130::mos_dialog sky130_fd_pr__nfet_g5v0d10v5 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5094 | } |
| 5095 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5096 | proc sky130::sky130_fd_pr__nfet_05v0_nvt_dialog {parameters} { |
| 5097 | sky130::mos_dialog sky130_fd_pr__nfet_05v0_nvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5098 | } |
| 5099 | |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 5100 | proc sky130::sky130_fd_pr__nfet_03v3_nvt_dialog {parameters} { |
| 5101 | sky130::mos_dialog sky130_fd_pr__nfet_03v3_nvt $parameters |
| 5102 | } |
| 5103 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5104 | proc sky130::sky130_fd_pr__pfet_01v8_dialog {parameters} { |
| 5105 | sky130::mos_dialog sky130_fd_pr__pfet_01v8 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5106 | } |
| 5107 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5108 | proc sky130::sky130_fd_pr__pfet_01v8_lvt_dialog {parameters} { |
| 5109 | sky130::mos_dialog sky130_fd_pr__pfet_01v8_lvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5110 | } |
| 5111 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5112 | proc sky130::sky130_fd_pr__pfet_01v8_hvt_dialog {parameters} { |
| 5113 | sky130::mos_dialog sky130_fd_pr__pfet_01v8_hvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5114 | } |
| 5115 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5116 | proc sky130::sky130_fd_pr__pfet_g5v0d10v5_dialog {parameters} { |
| 5117 | sky130::mos_dialog sky130_fd_pr__pfet_g5v0d10v5 $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5118 | } |
| 5119 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5120 | proc sky130::sky130_fd_pr__cap_var_lvt_dialog {parameters} { |
| 5121 | sky130::mos_dialog sky130_fd_pr__cap_var_lvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5122 | } |
| 5123 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5124 | proc sky130::sky130_fd_pr__cap_var_hvt_dialog {parameters} { |
| 5125 | sky130::mos_dialog sky130_fd_pr__cap_var_hvt $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5126 | } |
| 5127 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 5128 | proc sky130::sky130_fd_pr__cap_var_dialog {parameters} { |
| 5129 | sky130::mos_dialog sky130_fd_pr__cap_var $parameters |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5130 | } |
| 5131 | |
| 5132 | #---------------------------------------------------------------- |
| 5133 | # getbox: Get the current cursor box, in microns |
| 5134 | #---------------------------------------------------------------- |
| 5135 | |
| 5136 | proc sky130::getbox {} { |
| 5137 | set curbox [box values] |
| 5138 | set newbox [] |
| 5139 | set oscale [cif scale out] |
| 5140 | for {set i 0} {$i < 4} {incr i} { |
| 5141 | set v [* [lindex $curbox $i] $oscale] |
| 5142 | lappend newbox $v |
| 5143 | } |
| 5144 | return $newbox |
| 5145 | } |
| 5146 | |
| 5147 | #---------------------------------------------------------------- |
| 5148 | # unionbox: Get the union bounding box of box1 and box2 |
| 5149 | #---------------------------------------------------------------- |
| 5150 | |
| 5151 | proc sky130::unionbox {box1 box2} { |
| 5152 | set newbox [] |
| 5153 | for {set i 0} {$i < 2} {incr i} { |
| 5154 | set v [lindex $box1 $i] |
| 5155 | set o [lindex $box2 $i] |
| 5156 | if {$v < $o} { |
| 5157 | lappend newbox $v |
| 5158 | } else { |
| 5159 | lappend newbox $o |
| 5160 | } |
| 5161 | } |
| 5162 | for {set i 2} {$i < 4} {incr i} { |
| 5163 | set v [lindex $box1 $i] |
| 5164 | set o [lindex $box2 $i] |
| 5165 | if {$v > $o} { |
| 5166 | lappend newbox $v |
| 5167 | } else { |
| 5168 | lappend newbox $o |
| 5169 | } |
| 5170 | } |
| 5171 | return $newbox |
| 5172 | } |
| 5173 | |
| 5174 | #---------------------------------------------------------------- |
| 5175 | # Draw a contact |
| 5176 | #---------------------------------------------------------------- |
| 5177 | |
| 5178 | proc sky130::draw_contact {w h s o x atype ctype mtype {orient vert}} { |
| 5179 | |
| 5180 | # Draw a minimum-size diff contact centered at current position |
| 5181 | # w is width, h is height. Minimum size ensured. |
| 5182 | # x is contact size |
| 5183 | # s is contact diffusion (or poly) surround |
| 5184 | # o is contact metal surround |
| 5185 | # atype is active (e.g., ndiff) or bottom metal if a via |
| 5186 | # ctype is contact (e.g., ndc) |
| 5187 | # mtype is metal (e.g., m1) or top metal if a via |
| 5188 | # orient is the orientation of the contact |
| 5189 | |
| 5190 | # Set orientations for the bottom material based on material type. |
| 5191 | # Substrate diffusions (tap) need not overlap the contact in all |
| 5192 | # directions, but other (diff) types do. The metal (local |
| 5193 | # interconnect) layer always overlaps in two directions only. |
| 5194 | |
| 5195 | set lv_sub_types {"psd" "nsd"} |
| 5196 | if {[lsearch $lv_sub_types $atype] >= 0} { |
| 5197 | set aorient $orient |
| 5198 | } else { |
| 5199 | set aorient "full" |
| 5200 | } |
| 5201 | |
| 5202 | pushbox |
| 5203 | box size 0 0 |
| 5204 | if {$w < $x} {set w $x} |
| 5205 | if {$h < $x} {set h $x} |
| 5206 | set hw [/ $w 2.0] |
| 5207 | set hh [/ $h 2.0] |
| 5208 | box grow n ${hh}um |
| 5209 | box grow s ${hh}um |
| 5210 | box grow e ${hw}um |
| 5211 | box grow w ${hw}um |
| 5212 | paint ${ctype} |
| 5213 | pushbox |
| 5214 | # Bottom layer surrounded on sides as declared by aorient |
| 5215 | if {($aorient == "vert") || ($aorient == "full")} { |
| 5216 | box grow n ${s}um |
| 5217 | box grow s ${s}um |
| 5218 | } |
| 5219 | if {($aorient == "horz") || ($aorient == "full")} { |
| 5220 | box grow e ${s}um |
| 5221 | box grow w ${s}um |
| 5222 | } |
| 5223 | paint ${atype} |
| 5224 | set extents [sky130::getbox] |
| 5225 | popbox |
| 5226 | # Top layer surrounded on sides as declared by orient |
| 5227 | if {($orient == "vert") || ($orient == "full")} { |
| 5228 | box grow n ${o}um |
| 5229 | box grow s ${o}um |
| 5230 | } |
| 5231 | if {($orient == "horz") || ($orient == "full")} { |
| 5232 | box grow e ${o}um |
| 5233 | box grow w ${o}um |
| 5234 | } |
| 5235 | paint ${mtype} |
| 5236 | popbox |
| 5237 | return $extents |
| 5238 | } |
| 5239 | |
| 5240 | #---------------------------------------------------------------- |
| 5241 | # Draw a guard ring |
| 5242 | #---------------------------------------------------------------- |
| 5243 | |
| 5244 | proc sky130::guard_ring {gw gh parameters} { |
| 5245 | |
| 5246 | # Set local default values if they are not in parameters |
| 5247 | set rlcov 100 ;# Right-left contact coverage percentage |
| 5248 | set tbcov 100 ;# Top-bottom contact coverage percentage |
| 5249 | set grc 1 ;# Draw right side contact |
| 5250 | set glc 1 ;# Draw left side contact |
| 5251 | set gtc 1 ;# Draw right side contact |
| 5252 | set gbc 1 ;# Draw left side contact |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5253 | set viagb 0 ;# Draw bottom side via |
| 5254 | set viagt 0 ;# Draw top side via |
| 5255 | set viagr 0 ;# Draw right side via |
| 5256 | set viagl 0 ;# Draw left side via |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5257 | set full_metal 1 ;# Draw full (continuous) metal ring |
| 5258 | set guard_sub_type pwell ;# substrate type under guard ring |
| 5259 | set guard_sub_surround 0 ;# substrate type surrounds guard ring |
| 5260 | set plus_diff_type nsd ;# guard ring diffusion type |
| 5261 | set plus_contact_type nsc ;# guard ring diffusion contact type |
| 5262 | set sub_type pwell ;# substrate type |
| 5263 | |
| 5264 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 5265 | foreach key [dict keys $parameters] { |
| 5266 | set $key [dict get $parameters $key] |
| 5267 | } |
| 5268 | |
| 5269 | # Set guard_sub_type to sub_type if it is not defined |
| 5270 | if {![dict exists $parameters guard_sub_type]} { |
| 5271 | set guard_sub_type $sub_type |
| 5272 | } |
| 5273 | |
| 5274 | set hx [/ $contact_size 2.0] |
| 5275 | set hw [/ $gw 2.0] |
| 5276 | set hh [/ $gh 2.0] |
| 5277 | |
| 5278 | # Watch for (LV) substrate diffusion types, which have a different |
| 5279 | # contact surround amount depending on the direction |
| 5280 | |
| 5281 | set lv_sub_types {"psd" "nsd"} |
| 5282 | if {[lsearch $lv_sub_types $plus_diff_type] >= 0} { |
| 5283 | set diff_surround 0 |
| 5284 | } |
| 5285 | |
| 5286 | # Compute diffusion width |
| 5287 | set difft [+ $contact_size $diff_surround $diff_surround] |
| 5288 | set hdifft [/ $difft 2.0] |
| 5289 | # Compute guard ring diffusion width and height |
| 5290 | set hdiffw [/ [+ $gw $difft] 2.0] |
| 5291 | set hdiffh [/ [+ $gh $difft] 2.0] |
| 5292 | |
| 5293 | pushbox |
| 5294 | box size 0 0 |
| 5295 | |
| 5296 | pushbox |
| 5297 | box move n ${hh}um |
| 5298 | box grow n ${hdifft}um |
| 5299 | box grow s ${hdifft}um |
| 5300 | box grow e ${hdiffw}um |
| 5301 | box grow w ${hdiffw}um |
| 5302 | paint $plus_diff_type |
| 5303 | if {$guard_sub_surround > 0} { |
| 5304 | box grow c ${guard_sub_surround}um |
| 5305 | paint $guard_sub_type |
| 5306 | } |
| 5307 | popbox |
| 5308 | pushbox |
| 5309 | box move s ${hh}um |
| 5310 | box grow n ${hdifft}um |
| 5311 | box grow s ${hdifft}um |
| 5312 | box grow e ${hdiffw}um |
| 5313 | box grow w ${hdiffw}um |
| 5314 | paint $plus_diff_type |
| 5315 | if {$guard_sub_surround > 0} { |
| 5316 | box grow c ${guard_sub_surround}um |
| 5317 | paint $guard_sub_type |
| 5318 | } |
| 5319 | popbox |
| 5320 | pushbox |
| 5321 | box move e ${hw}um |
| 5322 | box grow e ${hdifft}um |
| 5323 | box grow w ${hdifft}um |
| 5324 | box grow n ${hdiffh}um |
| 5325 | box grow s ${hdiffh}um |
| 5326 | paint $plus_diff_type |
| 5327 | if {$guard_sub_surround > 0} { |
| 5328 | box grow c ${guard_sub_surround}um |
| 5329 | paint $guard_sub_type |
| 5330 | } |
| 5331 | popbox |
| 5332 | pushbox |
| 5333 | box move w ${hw}um |
| 5334 | box grow e ${hdifft}um |
| 5335 | box grow w ${hdifft}um |
| 5336 | box grow n ${hdiffh}um |
| 5337 | box grow s ${hdiffh}um |
| 5338 | paint $plus_diff_type |
| 5339 | if {$guard_sub_surround > 0} { |
| 5340 | box grow c ${guard_sub_surround}um |
| 5341 | paint $guard_sub_type |
| 5342 | } |
| 5343 | popbox |
| 5344 | |
| 5345 | if {$full_metal} { |
| 5346 | set hmetw [/ [+ $gw $contact_size] 2.0] |
| 5347 | set hmeth [/ [+ $gh $contact_size] 2.0] |
| 5348 | pushbox |
| 5349 | box move n ${hh}um |
| 5350 | box grow n ${hx}um |
| 5351 | box grow s ${hx}um |
| 5352 | box grow e ${hmetw}um |
| 5353 | box grow w ${hmetw}um |
| 5354 | paint li |
| 5355 | popbox |
| 5356 | pushbox |
| 5357 | box move s ${hh}um |
| 5358 | box grow n ${hx}um |
| 5359 | box grow s ${hx}um |
| 5360 | box grow e ${hmetw}um |
| 5361 | box grow w ${hmetw}um |
| 5362 | paint li |
| 5363 | popbox |
| 5364 | pushbox |
| 5365 | box move e ${hw}um |
| 5366 | box grow e ${hx}um |
| 5367 | box grow w ${hx}um |
| 5368 | box grow n ${hmeth}um |
| 5369 | box grow s ${hmeth}um |
| 5370 | paint li |
| 5371 | popbox |
| 5372 | pushbox |
| 5373 | box move w ${hw}um |
| 5374 | box grow e ${hx}um |
| 5375 | box grow w ${hx}um |
| 5376 | box grow n ${hmeth}um |
| 5377 | box grow s ${hmeth}um |
| 5378 | paint li |
| 5379 | popbox |
| 5380 | } |
| 5381 | |
| 5382 | # Set guard ring height so that contact metal reaches to end, scale by $per |
| 5383 | # set ch [* [+ $gh $contact_size [* $metal_surround -2.0]] [/ $rlcov 100.0]] |
| 5384 | set ch [* [- $gh $contact_size [* [+ $metal_surround $metal_spacing] \ |
| 5385 | 2.0]] [/ $rlcov 100.0]] |
| 5386 | if {$ch < $contact_size} {set ch $contact_size} |
| 5387 | |
| 5388 | # Set guard ring width so that contact metal reaches to side contacts |
| 5389 | set cw [* [- $gw $contact_size [* [+ $metal_surround $metal_spacing] \ |
| 5390 | 2.0]] [/ $tbcov 100.0]] |
| 5391 | if {$cw < $contact_size} {set cw $contact_size} |
| 5392 | |
| 5393 | if {$tbcov > 0.0} { |
| 5394 | if {$gtc == 1} { |
| 5395 | pushbox |
| 5396 | box move n ${hh}um |
| 5397 | sky130::draw_contact $cw 0 $diff_surround $metal_surround \ |
| 5398 | $contact_size $plus_diff_type $plus_contact_type li horz |
| 5399 | popbox |
| 5400 | } |
| 5401 | if {$gbc == 1} { |
| 5402 | pushbox |
| 5403 | box move s ${hh}um |
| 5404 | sky130::draw_contact $cw 0 $diff_surround $metal_surround \ |
| 5405 | $contact_size $plus_diff_type $plus_contact_type li horz |
| 5406 | popbox |
| 5407 | } |
| 5408 | } |
| 5409 | if {$rlcov > 0.0} { |
| 5410 | if {$grc == 1} { |
| 5411 | pushbox |
| 5412 | box move e ${hw}um |
| 5413 | sky130::draw_contact 0 $ch $diff_surround $metal_surround \ |
| 5414 | $contact_size $plus_diff_type $plus_contact_type li vert |
| 5415 | popbox |
| 5416 | } |
| 5417 | if {$glc == 1} { |
| 5418 | pushbox |
| 5419 | box move w ${hw}um |
| 5420 | sky130::draw_contact 0 $ch $diff_surround $metal_surround \ |
| 5421 | $contact_size $plus_diff_type $plus_contact_type li vert |
| 5422 | popbox |
| 5423 | } |
| 5424 | } |
| 5425 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5426 | # Vias |
| 5427 | if {$viagb != 0} { |
| 5428 | pushbox |
| 5429 | set ch $via_size |
| 5430 | set cw [* [- $gw $via_size] [/ [expr abs($viagb)] 100.0]] |
| 5431 | if {$cw < $via_size} {set cw $via_size} |
| 5432 | box move s ${hh}um |
| 5433 | box grow n [/ $ch 2]um |
| 5434 | box grow s [/ $ch 2]um |
| 5435 | set anchor [string index $viagb 0] |
| 5436 | if {$anchor == "+"} { |
| 5437 | box move w [/ [- $gw $via_size] 2]um |
| 5438 | box grow e ${cw}um |
| 5439 | } elseif {$anchor == "-"} { |
| 5440 | box move e [/ [- $gw $via_size] 2]um |
| 5441 | box grow w ${cw}um |
| 5442 | } else { |
| 5443 | box grow e [/ $cw 2]um |
| 5444 | box grow w [/ $cw 2]um |
| 5445 | } |
| 5446 | sky130::mcon_draw horz |
| 5447 | popbox |
| 5448 | } |
| 5449 | if {$viagt != 0} { |
| 5450 | pushbox |
| 5451 | set ch $via_size |
| 5452 | set cw [* [- $gw $via_size] [/ [expr abs($viagt)] 100.0]] |
| 5453 | if {$cw < $via_size} {set cw $via_size} |
| 5454 | box move n ${hh}um |
| 5455 | box grow n [/ $ch 2]um |
| 5456 | box grow s [/ $ch 2]um |
| 5457 | set anchor [string index $viagt 0] |
| 5458 | if {$anchor == "+"} { |
| 5459 | box move w [/ [- $gw $via_size] 2]um |
| 5460 | box grow e ${cw}um |
| 5461 | } elseif {$anchor == "-"} { |
| 5462 | box move e [/ [- $gw $via_size] 2]um |
| 5463 | box grow w ${cw}um |
| 5464 | } else { |
| 5465 | box grow e [/ $cw 2]um |
| 5466 | box grow w [/ $cw 2]um |
| 5467 | } |
| 5468 | sky130::mcon_draw horz |
| 5469 | popbox |
| 5470 | } |
| 5471 | if {$viagr != 0} { |
| 5472 | pushbox |
| 5473 | set ch [* [- $gh $via_size] [/ [expr abs($viagr)] 100.0]] |
| 5474 | if {$ch < $via_size} {set ch $via_size} |
| 5475 | set cw $via_size |
| 5476 | box move e ${hw}um |
| 5477 | box grow e [/ $cw 2]um |
| 5478 | box grow w [/ $cw 2]um |
| 5479 | set anchor [string index $viagr 0] |
| 5480 | if {$anchor == "+"} { |
Tim Edwards | 933e61e | 2020-11-21 16:50:06 -0500 | [diff] [blame] | 5481 | box move s [/ [- $gh $via_size] 2]um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5482 | box grow n ${ch}um |
| 5483 | } elseif {$anchor == "-"} { |
Tim Edwards | 933e61e | 2020-11-21 16:50:06 -0500 | [diff] [blame] | 5484 | box move n [/ [- $gh $via_size] 2]um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5485 | box grow s ${ch}um |
| 5486 | } else { |
| 5487 | box grow n [/ $ch 2]um |
| 5488 | box grow s [/ $ch 2]um |
| 5489 | } |
| 5490 | sky130::mcon_draw vert |
| 5491 | popbox |
| 5492 | } |
| 5493 | if {$viagl != 0} { |
| 5494 | pushbox |
| 5495 | set ch [* [- $gh $via_size] [/ [expr abs($viagl)] 100.0]] |
| 5496 | if {$ch < $via_size} {set ch $via_size} |
| 5497 | set cw $via_size |
| 5498 | box move w ${hw}um |
| 5499 | box grow e [/ $cw 2]um |
| 5500 | box grow w [/ $cw 2]um |
| 5501 | set anchor [string index $viagl 0] |
| 5502 | if {$anchor == "+"} { |
Tim Edwards | 933e61e | 2020-11-21 16:50:06 -0500 | [diff] [blame] | 5503 | box move s [/ [- $gh $via_size] 2]um |
Tim Edwards | 275e28d | 2020-11-21 16:43:41 -0500 | [diff] [blame] | 5504 | box grow n ${ch}um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5505 | } elseif {$anchor == "-"} { |
Tim Edwards | 933e61e | 2020-11-21 16:50:06 -0500 | [diff] [blame] | 5506 | box move n [/ [- $gh $via_size] 2]um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5507 | box grow s ${ch}um |
| 5508 | } else { |
| 5509 | box grow n [/ $ch 2]um |
| 5510 | box grow s [/ $ch 2]um |
| 5511 | } |
| 5512 | sky130::mcon_draw vert |
| 5513 | popbox |
| 5514 | } |
| 5515 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5516 | pushbox |
| 5517 | box grow e ${hw}um |
| 5518 | box grow w ${hw}um |
| 5519 | box grow n ${hh}um |
| 5520 | box grow s ${hh}um |
| 5521 | # Create boundary using properties |
| 5522 | property FIXED_BBOX [box values] |
| 5523 | box grow c ${hx}um ;# to edge of contact |
| 5524 | box grow c ${diff_surround}um ;# to edge of diffusion |
| 5525 | box grow c ${sub_surround}um ;# sub/well overlap of diff (NOT guard_sub) |
| 5526 | paint $sub_type |
| 5527 | set cext [sky130::getbox] |
| 5528 | popbox |
| 5529 | popbox |
| 5530 | |
| 5531 | return $cext |
| 5532 | } |
| 5533 | |
| 5534 | #---------------------------------------------------------------- |
| 5535 | # MOSFET: Draw a single device |
| 5536 | #---------------------------------------------------------------- |
| 5537 | |
| 5538 | proc sky130::mos_device {parameters} { |
| 5539 | |
| 5540 | # Epsilon for avoiding round-off errors |
| 5541 | set eps 0.0005 |
| 5542 | |
| 5543 | # Set local default values if they are not in parameters |
| 5544 | set diffcov 100 ;# percent coverage of diffusion contact |
| 5545 | set polycov 100 ;# percent coverage of poly contact |
| 5546 | set topc 1 ;# draw top poly contact |
| 5547 | set botc 1 ;# draw bottom poly contact |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5548 | set viasrc 100 ;# draw source vias |
| 5549 | set viadrn 100 ;# draw drain vias |
| 5550 | set viagate 100 ;# draw gate vias |
| 5551 | set evens 1 ;# even or odd numbered device finger, in X |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5552 | set dev_sub_type "" ;# device substrate type (if different from guard ring) |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5553 | set dev_sub_dist 0 ;# device substrate distance (if nondefault dev_sub_type) |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5554 | set min_effl 0 ;# gate length below which finger pitch must be stretched |
| 5555 | set diff_overlap_cont 0 ;# extra overlap of end contact by diffusion |
| 5556 | |
| 5557 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 5558 | foreach key [dict keys $parameters] { |
| 5559 | set $key [dict get $parameters $key] |
| 5560 | } |
| 5561 | |
| 5562 | # Draw the diffusion and poly |
| 5563 | pushbox |
| 5564 | box size 0 0 |
| 5565 | pushbox |
| 5566 | set hw [/ $w 2.0] |
| 5567 | set hl [/ $l 2.0] |
| 5568 | set he [/ $min_effl 2.0] |
| 5569 | if {$nf == 1 || $he < $hl} {set he $hl} |
| 5570 | box grow n ${hw}um |
| 5571 | box grow s ${hw}um |
| 5572 | box grow e ${hl}um |
| 5573 | box grow w ${hl}um |
| 5574 | pushbox |
| 5575 | if {${diff_extension} > ${gate_to_diffcont}} { |
| 5576 | box grow e ${diff_extension}um |
| 5577 | box grow w ${diff_extension}um |
| 5578 | } else { |
| 5579 | box grow e ${gate_to_diffcont}um |
| 5580 | box grow w ${gate_to_diffcont}um |
| 5581 | } |
| 5582 | paint ${diff_type} |
| 5583 | popbox |
| 5584 | pushbox |
| 5585 | if {${gate_extension} > ${gate_to_polycont}} { |
| 5586 | box grow n ${gate_extension}um |
| 5587 | box grow s ${gate_extension}um |
| 5588 | } else { |
| 5589 | if {$topc} { |
| 5590 | box grow n ${gate_to_polycont}um |
| 5591 | } else { |
| 5592 | box grow n ${gate_extension}um |
| 5593 | } |
| 5594 | if {$botc} { |
| 5595 | box grow s ${gate_to_polycont}um |
| 5596 | } else { |
| 5597 | box grow s ${gate_extension}um |
| 5598 | } |
| 5599 | } |
| 5600 | paint ${poly_type} |
| 5601 | set cext [sky130::getbox] |
| 5602 | popbox |
| 5603 | # save gate area now and paint later, so that diffusion surrounding the |
| 5604 | # contact does not paint over the gate area, in case the gate type is |
| 5605 | # not part of a "compose" entry in the techfile. |
| 5606 | set gaterect [box values] |
| 5607 | popbox |
| 5608 | |
| 5609 | # Adjust position of contacts for dogbone geometry |
| 5610 | # Rule 1: Minimize diffusion length. Contacts only move out |
| 5611 | # if width < contact diffusion height. They move out enough |
| 5612 | # that the diffusion-to-poly spacing is satisfied. |
| 5613 | |
| 5614 | set ddover 0 |
| 5615 | set cdwmin [+ ${contact_size} [* ${diff_surround} 2]] |
| 5616 | set cstem [- ${gate_to_diffcont} [/ ${cdwmin} 2.0]] |
| 5617 | set cgrow [- ${diff_poly_space} ${cstem}] |
| 5618 | if {[+ ${w} ${eps}] < ${cdwmin}} { |
| 5619 | if {${cgrow} > 0} { |
| 5620 | set gate_to_diffcont [+ ${gate_to_diffcont} ${cgrow}] |
| 5621 | } |
| 5622 | set ddover [/ [- ${cdwmin} ${w}] 2.0] |
| 5623 | } |
| 5624 | |
| 5625 | # Rule 2: Minimum poly width. Poly contacts only move out |
| 5626 | # if length < contact poly width. They move out enough |
| 5627 | # that the diffusion-to-poly spacing is satisfied. |
| 5628 | |
| 5629 | set gporig ${gate_to_polycont} |
| 5630 | set cplmin [+ ${contact_size} [* ${poly_surround} 2]] |
| 5631 | set cstem [- ${gate_to_polycont} [/ ${cplmin} 2.0]] |
| 5632 | set cgrow [- ${diff_poly_space} ${cstem}] |
| 5633 | if {[+ ${l} ${eps}] < ${cplmin}} { |
| 5634 | if {${cgrow} > 0} { |
| 5635 | set gate_to_polycont [+ ${gate_to_polycont} ${cgrow}] |
| 5636 | } |
| 5637 | } |
| 5638 | |
| 5639 | # Rule 3: If both poly and diffusion are dogboned, then move |
| 5640 | # poly out further to clear spacing to the diffusion contact |
| 5641 | |
| 5642 | if {[+ ${w} ${eps}] < ${cdwmin}} { |
| 5643 | if {[+ ${l} ${eps}] < ${cplmin}} { |
| 5644 | set cgrow [/ [- ${cplmin} ${w}] 2.0] |
| 5645 | set gate_to_polycont [+ ${gate_to_polycont} ${cgrow}] |
| 5646 | } |
| 5647 | } |
| 5648 | |
| 5649 | # Rule 4: If M > 1 and poly contacts overlap, then increase the |
| 5650 | # transistor-to-poly-contact distance by the amount of any |
| 5651 | # diffusion dogbone overhang. |
| 5652 | |
| 5653 | if {($poverlap == 1) && ($m > 1)} { |
| 5654 | if {${gate_to_polycont} - $gporig < $ddover} { |
| 5655 | set gate_to_polycont [+ ${gporig} ${ddover}] |
| 5656 | } |
| 5657 | } |
| 5658 | |
| 5659 | # Reduce contact sizes by poly or diffusion surround so that |
| 5660 | # the contact area edges match the device diffusion or poly. |
| 5661 | # (Minimum dimensions will be enforced by the contact drawing routine) |
| 5662 | set tsurround [+ ${diff_surround} ${diff_overlap_cont}] |
| 5663 | set cdw [- ${w} [* ${tsurround} 2]] ;# diff contact height |
| 5664 | set cpl [- ${l} [* ${poly_surround} 2]] ;# poly contact width |
| 5665 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5666 | # Save the full diffusion (source/drain) and poly (gate) lengths |
| 5667 | set cdwfull $cdw |
| 5668 | set cplfull $cpl |
| 5669 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5670 | # Reduce by coverage percentage. NOTE: If overlapping multiple devices, |
| 5671 | # keep maximum poly contact coverage. |
| 5672 | |
| 5673 | set cdw [* ${cdw} [/ ${diffcov} 100.0]] |
| 5674 | if {($poverlap == 0) || ($m == 1)} { |
| 5675 | set cpl [* ${cpl} [/ ${polycov} 100.0]] |
| 5676 | } |
| 5677 | |
| 5678 | # Right diffusion contact |
| 5679 | pushbox |
| 5680 | box move e ${he}um |
| 5681 | box move e ${gate_to_diffcont}um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5682 | |
| 5683 | # Source via on top of contact |
| 5684 | if {$evens == 1} {set viatype $viasrc} else {set viatype $viadrn} |
| 5685 | if {$viatype != 0} { |
| 5686 | pushbox |
| 5687 | set cw $via_size |
| 5688 | set ch [* $cdwfull [/ [expr abs($viatype)] 100.0]] |
| 5689 | if {$ch < $via_size} {set ch $via_size} |
| 5690 | box grow e [/ $cw 2]um |
| 5691 | box grow w [/ $cw 2]um |
| 5692 | set anchor [string index $viatype 0] |
| 5693 | if {$anchor == "+"} { |
| 5694 | box move s [/ [- $cdwfull $via_size] 2]um |
| 5695 | box grow n ${ch}um |
| 5696 | } elseif {$anchor == "-"} { |
| 5697 | box move n [/ [- $cdwfull $via_size] 2]um |
| 5698 | box grow s ${ch}um |
| 5699 | } else { |
| 5700 | box grow n [/ $ch 2]um |
| 5701 | box grow s [/ $ch 2]um |
| 5702 | } |
| 5703 | sky130::mcon_draw vert |
| 5704 | popbox |
| 5705 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5706 | set cext [sky130::unionbox $cext [sky130::draw_contact 0 ${cdw} \ |
| 5707 | ${diff_surround} ${metal_surround} ${contact_size}\ |
| 5708 | ${diff_type} ${diff_contact_type} li vert]] |
| 5709 | popbox |
| 5710 | # Left diffusion contact |
| 5711 | pushbox |
| 5712 | box move w ${he}um |
| 5713 | box move w ${gate_to_diffcont}um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5714 | |
| 5715 | # Drain via on top of contact |
| 5716 | if {$evens == 1} {set viatype $viadrn} else {set viatype $viasrc} |
| 5717 | if {$viatype != 0} { |
| 5718 | pushbox |
| 5719 | set cw $via_size |
| 5720 | set ch [* $cdwfull [/ [expr abs($viatype)] 100.0]] |
| 5721 | if {$ch < $via_size} {set ch $via_size} |
| 5722 | box grow e [/ $cw 2]um |
| 5723 | box grow w [/ $cw 2]um |
| 5724 | set anchor [string index $viatype 0] |
| 5725 | if {$anchor == "+"} { |
| 5726 | box move s [/ [- $cdwfull $via_size] 2]um |
| 5727 | box grow n ${ch}um |
| 5728 | } elseif {$anchor == "-"} { |
| 5729 | box move n [/ [- $cdwfull $via_size] 2]um |
| 5730 | box grow s ${ch}um |
| 5731 | } else { |
| 5732 | box grow n [/ $ch 2]um |
| 5733 | box grow s [/ $ch 2]um |
| 5734 | } |
| 5735 | sky130::mcon_draw vert |
| 5736 | popbox |
| 5737 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5738 | set cext [sky130::unionbox $cext [sky130::draw_contact 0 ${cdw} \ |
| 5739 | ${diff_surround} ${metal_surround} ${contact_size} \ |
| 5740 | ${diff_type} ${diff_contact_type} li vert]] |
| 5741 | set diffarea $cext |
| 5742 | popbox |
| 5743 | # Top poly contact |
| 5744 | if {$topc} { |
| 5745 | pushbox |
| 5746 | box move n ${hw}um |
| 5747 | box move n ${gate_to_polycont}um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5748 | |
| 5749 | # Gate via on top of contact |
| 5750 | if {$viagate != 0} { |
| 5751 | pushbox |
| 5752 | set ch $via_size |
| 5753 | set cw [* $cplfull [/ [expr abs($viagate)] 100.0]] |
| 5754 | if {$cw < $via_size} {set cw $via_size} |
| 5755 | box grow n [/ $ch 2]um |
| 5756 | box grow s [/ $ch 2]um |
| 5757 | set anchor [string index $viagate 0] |
| 5758 | if {$anchor == "+"} { |
| 5759 | box move w [/ [- $cplfull $via_size] 2]um |
| 5760 | box grow e ${cw}um |
| 5761 | } elseif {$anchor == "-"} { |
| 5762 | box move e [/ [- $cplfull $via_size] 2]um |
| 5763 | box grow w ${cw}um |
| 5764 | } else { |
| 5765 | box grow e [/ $cw 2]um |
| 5766 | box grow w [/ $cw 2]um |
| 5767 | } |
| 5768 | sky130::mcon_draw horz |
| 5769 | popbox |
| 5770 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5771 | set cext [sky130::unionbox $cext [sky130::draw_contact ${cpl} 0 \ |
| 5772 | ${poly_surround} ${metal_surround} ${contact_size} \ |
| 5773 | ${poly_type} ${poly_contact_type} li horz]] |
| 5774 | popbox |
| 5775 | } |
| 5776 | # Bottom poly contact |
| 5777 | if {$botc} { |
| 5778 | pushbox |
| 5779 | box move s ${hw}um |
| 5780 | box move s ${gate_to_polycont}um |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5781 | |
| 5782 | # Gate via on top of contact |
| 5783 | if {$viagate != 0} { |
| 5784 | pushbox |
| 5785 | set ch $via_size |
| 5786 | set cw [* $cplfull [/ [expr abs($viagate)] 100.0]] |
| 5787 | if {$cw < $via_size} {set cw $via_size} |
| 5788 | box grow n [/ $ch 2]um |
| 5789 | box grow s [/ $ch 2]um |
| 5790 | set anchor [string index $viagate 0] |
| 5791 | if {$anchor == "+"} { |
| 5792 | box move w [/ [- $cplfull $via_size] 2]um |
| 5793 | box grow e ${cw}um |
| 5794 | } elseif {$anchor == "-"} { |
| 5795 | box move e [/ [- $cplfull $via_size] 2]um |
| 5796 | box grow w ${cw}um |
| 5797 | } else { |
| 5798 | box grow e [/ $cw 2]um |
| 5799 | box grow w [/ $cw 2]um |
| 5800 | } |
| 5801 | sky130::mcon_draw horz |
| 5802 | popbox |
| 5803 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5804 | set cext [sky130::unionbox $cext [sky130::draw_contact ${cpl} 0 \ |
| 5805 | ${poly_surround} ${metal_surround} ${contact_size} \ |
| 5806 | ${poly_type} ${poly_contact_type} li horz]] |
| 5807 | popbox |
| 5808 | } |
| 5809 | |
| 5810 | # Now draw the gate, after contacts have been drawn |
| 5811 | pushbox |
| 5812 | box values {*}${gaterect} |
| 5813 | # gate_type need not be defined if poly over diff paints the right type. |
| 5814 | catch {paint ${gate_type}} |
| 5815 | # sub_surround_dev, if defined, may create a larger area around the gate |
| 5816 | # than sub_surround creates around the diffusion/poly area. |
| 5817 | if [dict exists $parameters sub_surround_dev] { |
| 5818 | box grow n ${sub_surround_dev}um |
| 5819 | box grow s ${sub_surround_dev}um |
| 5820 | box grow e ${sub_surround_dev}um |
| 5821 | box grow w ${sub_surround_dev}um |
| 5822 | paint ${dev_sub_type} |
| 5823 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 5824 | } |
| 5825 | popbox |
| 5826 | |
| 5827 | if {$dev_sub_type != ""} { |
| 5828 | box values [lindex $diffarea 0]um [lindex $diffarea 1]um \ |
| 5829 | [lindex $diffarea 2]um [lindex $diffarea 3]um |
| 5830 | box grow n ${sub_surround}um |
| 5831 | box grow s ${sub_surround}um |
| 5832 | box grow e ${sub_surround}um |
| 5833 | box grow w ${sub_surround}um |
| 5834 | paint ${dev_sub_type} |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5835 | if {$dev_sub_dist > 0} { |
| 5836 | set cext [sky130::unionbox $cext [sky130::getbox]] |
| 5837 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5838 | # puts stdout "Diagnostic: bounding box is $cext" |
| 5839 | } |
| 5840 | |
| 5841 | popbox |
| 5842 | return $cext |
| 5843 | } |
| 5844 | |
| 5845 | #---------------------------------------------------------------- |
| 5846 | # MOSFET: Draw the tiled device |
| 5847 | #---------------------------------------------------------------- |
| 5848 | |
| 5849 | proc sky130::mos_draw {parameters} { |
| 5850 | tech unlock * |
| 5851 | set savesnap [snap] |
| 5852 | snap internal |
| 5853 | |
| 5854 | # Set defaults if they are not in parameters |
| 5855 | set poverlap 0 ;# overlap poly contacts when tiling |
| 5856 | set doverlap 1 ;# overlap diffusion contacts when tiling |
| 5857 | set dev_sub_dist 0 ;# substrate to guard ring, if dev_sub_type defined |
| 5858 | set dev_sub_space 0 ;# distance between substrate areas for arrayed devices |
| 5859 | set min_allc 0 ;# gate length below which poly contacts must be interleaved |
| 5860 | set id_type "" ;# additional type covering everything |
| 5861 | set id_surround 0 ;# amount of surround on above type |
| 5862 | set id2_type "" ;# additional type covering everything |
| 5863 | set id2_surround 0 ;# amount of surround on above type |
| 5864 | |
| 5865 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 5866 | foreach key [dict keys $parameters] { |
| 5867 | set $key [dict get $parameters $key] |
| 5868 | } |
| 5869 | |
| 5870 | # Diff-to-tap spacing is by default the same as diff spacing |
| 5871 | if {![dict exist $parameters diff_tap_space]} { |
| 5872 | set diff_tap_space $diff_spacing |
| 5873 | } |
| 5874 | |
| 5875 | # If poverlap is 1 then both poly contacts must be present |
| 5876 | if {$poverlap == 1} { |
| 5877 | set topc 1 |
| 5878 | set botc 1 |
| 5879 | dict set parameters topc 1 |
| 5880 | dict set parameters botc 1 |
| 5881 | } |
| 5882 | |
| 5883 | # Normalize distance units to microns |
| 5884 | set w [magic::spice2float $w] |
| 5885 | set l [magic::spice2float $l] |
| 5886 | |
| 5887 | pushbox |
| 5888 | box values 0 0 0 0 |
| 5889 | |
| 5890 | # If dx < (poly contact space + poly contact width), then there is not |
| 5891 | # enough room for a row of contacts, so force alternating contacts |
| 5892 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5893 | set evens 1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5894 | if {$nf > 1 && $l < $min_allc} { |
| 5895 | set intc 1 |
| 5896 | set evenodd 1 |
| 5897 | set topc 1 |
| 5898 | set botc 1 |
| 5899 | dict set parameters topc 1 |
| 5900 | dict set parameters botc 1 |
| 5901 | set poverlap 0 |
| 5902 | } else { |
| 5903 | set intc 0 |
| 5904 | } |
| 5905 | |
| 5906 | # Determine the base device dimensions by drawing one device |
| 5907 | # while all layers are locked (nothing drawn). This allows the |
| 5908 | # base drawing routine to do complicated geometry without having |
| 5909 | # to duplicate it here with calculations. |
| 5910 | |
| 5911 | tech lock * |
| 5912 | set bbox [sky130::mos_device $parameters] |
| 5913 | # puts stdout "Diagnostic: Device bounding box e $bbox (um)" |
| 5914 | tech unlock * |
| 5915 | |
| 5916 | set fw [- [lindex $bbox 2] [lindex $bbox 0]] |
| 5917 | set fh [- [lindex $bbox 3] [lindex $bbox 1]] |
| 5918 | set lw [+ [lindex $bbox 2] [lindex $bbox 0]] |
| 5919 | set lh [+ [lindex $bbox 3] [lindex $bbox 1]] |
| 5920 | |
| 5921 | # If dev_sub_dist > 0 then each device must be in its own substrate |
| 5922 | # (well) area, and overlaps are disallowed. dev_sub_space determines |
| 5923 | # the distance between individual devices in an array. |
| 5924 | |
| 5925 | if {$dev_sub_dist > 0} { |
| 5926 | set poverlap 0 |
| 5927 | set doverlap 0 |
| 5928 | |
| 5929 | if {$dev_sub_space > $poly_spacing} { |
| 5930 | set dx [+ $fw $dev_sub_space] |
| 5931 | set dy [+ $fh $dev_sub_space] |
| 5932 | } else { |
| 5933 | set dx [+ $fw $poly_spacing] |
| 5934 | set dy [+ $fh $poly_spacing] |
| 5935 | } |
| 5936 | |
| 5937 | } else { |
| 5938 | |
| 5939 | # Determine tile width and height (depends on overlap) |
| 5940 | if {$poverlap == 0} { |
| 5941 | set dy [+ $fh $poly_spacing] |
| 5942 | } else { |
| 5943 | # overlap poly |
| 5944 | set dy [- $fh [+ $poly_surround $poly_surround $contact_size]] |
| 5945 | } |
| 5946 | |
| 5947 | if {$doverlap == 0} { |
| 5948 | set dx [+ $fw $diff_spacing] |
| 5949 | } else { |
| 5950 | # overlap diffusions |
| 5951 | set dx [- $fw [+ $diff_surround $diff_surround $contact_size]] |
| 5952 | } |
| 5953 | } |
| 5954 | |
| 5955 | # Determine core width and height |
| 5956 | set corex [+ [* [- $nf 1] $dx] $fw] |
| 5957 | set corey [+ [* [- $m 1] $dy] $fh] |
| 5958 | set corellx [/ [+ [- $corex $fw] $lw] 2.0] |
| 5959 | set corelly [/ [+ [- $corey $fh] $lh] 2.0] |
| 5960 | |
| 5961 | # If there is a diffusion dogbone, and no top poly contact, then |
| 5962 | # increase the core height by the amount of the dogbone overhang. |
| 5963 | |
| 5964 | if {$topc == 0} { |
| 5965 | set cdwmin [+ ${contact_size} [* ${diff_surround} 2]] |
| 5966 | if {${w} < ${cdwmin}} { |
| 5967 | set corey [+ $corey [/ [- ${cdwmin} ${w}] 2.0]] |
| 5968 | } |
| 5969 | } |
| 5970 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 5971 | # Calculate guard ring size (measured to contact center) |
| 5972 | if {($guard != 0) || (${id_type} != "")} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 5973 | if {($dev_sub_dist > 0) && ([+ $dev_sub_dist $sub_surround] > $diff_tap_space)} { |
| 5974 | set gx [+ $corex [* 2.0 [+ $dev_sub_dist $diff_surround]] $contact_size] |
| 5975 | } else { |
| 5976 | set gx [+ $corex [* 2.0 [+ $diff_tap_space $diff_surround]] $contact_size] |
| 5977 | } |
| 5978 | if {($dev_sub_dist > 0) && ([+ $dev_sub_dist $sub_surround] > $diff_gate_space)} { |
| 5979 | set gy [+ $corey [* 2.0 [+ $dev_sub_dist $diff_surround]] $contact_size] |
| 5980 | } else { |
| 5981 | set gy [+ $corey [* 2.0 [+ $diff_gate_space $diff_surround]] $contact_size] |
| 5982 | } |
| 5983 | |
| 5984 | # Somewhat tricky. . . if the width is small and the diffusion is |
| 5985 | # a dogbone, and the top or bottom poly contact is missing, then |
| 5986 | # the spacing to the guard ring may be limited by diffusion spacing, not |
| 5987 | # poly to diffusion. |
| 5988 | |
| 5989 | set inset [/ [+ $contact_size [* 2.0 $diff_surround] -$w] 2.0] |
| 5990 | set sdiff [- [+ $inset $diff_tap_space] [+ $gate_extension $diff_gate_space]] |
| 5991 | |
| 5992 | if {$sdiff > 0} { |
| 5993 | if {$topc == 0} { |
| 5994 | set gy [+ $gy $sdiff] |
| 5995 | set corelly [+ $corelly [/ $sdiff 2.0]] |
| 5996 | } |
| 5997 | if {$botc == 0} { |
| 5998 | set gy [+ $gy $sdiff] |
| 5999 | set corelly [- $corelly [/ $sdiff 2.0]] |
| 6000 | } |
| 6001 | } |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 6002 | } |
| 6003 | if {$guard != 0} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6004 | # Draw the guard ring first, as MOS well may interact with guard ring substrate |
| 6005 | sky130::guard_ring $gx $gy $parameters |
| 6006 | } |
| 6007 | |
| 6008 | pushbox |
| 6009 | # If any surrounding identifier type is defined, draw it |
| 6010 | if {${id_type} != ""} { |
| 6011 | set hw [/ $gx 2] |
| 6012 | set hh [/ $gy 2] |
| 6013 | box grow e ${hw}um |
| 6014 | box grow w ${hw}um |
| 6015 | box grow n ${hh}um |
| 6016 | box grow s ${hh}um |
| 6017 | box grow c ${id_surround}um |
| 6018 | paint ${id_type} |
| 6019 | } |
| 6020 | popbox |
| 6021 | pushbox |
| 6022 | box move w ${corellx}um |
| 6023 | box move s ${corelly}um |
| 6024 | for {set xp 0} {$xp < $nf} {incr xp} { |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 6025 | dict set parameters evens $evens |
| 6026 | set evens [- 1 $evens] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6027 | pushbox |
| 6028 | if {$intc == 1} { |
| 6029 | set evenodd [- 1 $evenodd] |
| 6030 | if {$evenodd == 1} { |
| 6031 | dict set parameters topc 1 |
| 6032 | dict set parameters botc 0 |
| 6033 | } else { |
| 6034 | dict set parameters topc 0 |
| 6035 | dict set parameters botc 1 |
| 6036 | } |
| 6037 | set saveeo $evenodd |
| 6038 | } |
| 6039 | for {set yp 0} {$yp < $m} {incr yp} { |
| 6040 | sky130::mos_device $parameters |
| 6041 | box move n ${dy}um |
| 6042 | if {$intc == 1} { |
| 6043 | set evenodd [- 1 $evenodd] |
| 6044 | if {$evenodd == 1} { |
| 6045 | dict set parameters topc 1 |
| 6046 | dict set parameters botc 0 |
| 6047 | } else { |
| 6048 | dict set parameters topc 0 |
| 6049 | dict set parameters botc 1 |
| 6050 | } |
| 6051 | } |
| 6052 | } |
| 6053 | if {$intc == 1} { |
| 6054 | set evenodd $saveeo |
| 6055 | } |
| 6056 | popbox |
| 6057 | box move e ${dx}um |
| 6058 | } |
| 6059 | popbox |
| 6060 | popbox |
| 6061 | |
| 6062 | snap $savesnap |
| 6063 | tech revert |
| 6064 | } |
| 6065 | |
| 6066 | #------------------- |
| 6067 | # nMOS 1.8V |
| 6068 | #------------------- |
| 6069 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6070 | proc sky130::sky130_fd_pr__nfet_01v8_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6071 | set newdict [dict create \ |
| 6072 | gate_type nfet \ |
| 6073 | diff_type ndiff \ |
| 6074 | diff_contact_type ndc \ |
| 6075 | plus_diff_type psd \ |
| 6076 | plus_contact_type psc \ |
| 6077 | poly_type poly \ |
| 6078 | poly_contact_type pc \ |
| 6079 | sub_type psub \ |
| 6080 | min_effl 0.185 \ |
| 6081 | min_allc 0.26 \ |
| 6082 | ] |
| 6083 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6084 | return [sky130::mos_draw $drawdict] |
| 6085 | } |
| 6086 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6087 | proc sky130::sky130_fd_pr__nfet_01v8_lvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6088 | set newdict [dict create \ |
| 6089 | gate_type nfetlvt \ |
| 6090 | diff_type ndiff \ |
| 6091 | diff_contact_type ndc \ |
| 6092 | plus_diff_type psd \ |
| 6093 | plus_contact_type psc \ |
| 6094 | poly_type poly \ |
| 6095 | poly_contact_type pc \ |
| 6096 | sub_type psub \ |
| 6097 | min_effl 0.185 \ |
| 6098 | min_allc 0.26 \ |
| 6099 | ] |
| 6100 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6101 | return [sky130::mos_draw $drawdict] |
| 6102 | } |
| 6103 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6104 | proc sky130::sky130_fd_bs_flash__special_sonosfet_star_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6105 | set newdict [dict create \ |
| 6106 | gate_type nsonos \ |
| 6107 | diff_type ndiff \ |
| 6108 | diff_contact_type ndc \ |
| 6109 | plus_diff_type psd \ |
| 6110 | plus_contact_type psc \ |
| 6111 | poly_type poly \ |
| 6112 | poly_contact_type pc \ |
| 6113 | sub_type psub \ |
| 6114 | id_type dnwell \ |
| 6115 | id_surround 1.355 \ |
| 6116 | min_effl 0.185 \ |
| 6117 | min_allc 0.26 \ |
| 6118 | ] |
| 6119 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6120 | return [sky130::mos_draw $drawdict] |
| 6121 | } |
| 6122 | |
| 6123 | #------------------- |
| 6124 | # pMOS 1.8V |
| 6125 | #------------------- |
| 6126 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6127 | proc sky130::sky130_fd_pr__pfet_01v8_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6128 | set newdict [dict create \ |
| 6129 | gate_type pfet \ |
| 6130 | diff_type pdiff \ |
| 6131 | diff_contact_type pdc \ |
| 6132 | plus_diff_type nsd \ |
| 6133 | plus_contact_type nsc \ |
| 6134 | poly_type poly \ |
| 6135 | poly_contact_type pc \ |
| 6136 | sub_type nwell \ |
Tim Edwards | 2788f17 | 2020-10-14 22:32:33 -0400 | [diff] [blame] | 6137 | dev_sub_type nwell \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6138 | gate_to_polycont 0.32 \ |
| 6139 | min_effl 0.185 \ |
| 6140 | min_allc 0.26 \ |
| 6141 | ] |
| 6142 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6143 | return [sky130::mos_draw $drawdict] |
| 6144 | } |
| 6145 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6146 | proc sky130::sky130_fd_pr__pfet_01v8_lvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6147 | set newdict [dict create \ |
| 6148 | gate_type pfetlvt \ |
| 6149 | diff_type pdiff \ |
| 6150 | diff_contact_type pdc \ |
| 6151 | plus_diff_type nsd \ |
| 6152 | plus_contact_type nsc \ |
| 6153 | poly_type poly \ |
| 6154 | poly_contact_type pc \ |
| 6155 | sub_type nwell \ |
Tim Edwards | 2788f17 | 2020-10-14 22:32:33 -0400 | [diff] [blame] | 6156 | dev_sub_type nwell \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6157 | gate_to_polycont 0.32 \ |
| 6158 | min_effl 0.185 \ |
| 6159 | min_allc 0.26 \ |
| 6160 | ] |
| 6161 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6162 | return [sky130::mos_draw $drawdict] |
| 6163 | } |
| 6164 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6165 | proc sky130::sky130_fd_pr__pfet_01v8_hvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6166 | set newdict [dict create \ |
| 6167 | gate_type pfethvt \ |
| 6168 | diff_type pdiff \ |
| 6169 | diff_contact_type pdc \ |
| 6170 | plus_diff_type nsd \ |
| 6171 | plus_contact_type nsc \ |
| 6172 | poly_type poly \ |
| 6173 | poly_contact_type pc \ |
| 6174 | sub_type nwell \ |
Tim Edwards | 2788f17 | 2020-10-14 22:32:33 -0400 | [diff] [blame] | 6175 | dev_sub_type nwell \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6176 | gate_to_polycont 0.32 \ |
| 6177 | min_effl 0.185 \ |
| 6178 | min_allc 0.26 \ |
| 6179 | ] |
| 6180 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6181 | return [sky130::mos_draw $drawdict] |
| 6182 | } |
| 6183 | |
| 6184 | #------------------- |
| 6185 | # pMOS 5.0V |
| 6186 | #------------------- |
| 6187 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6188 | proc sky130::sky130_fd_pr__pfet_g5v0d10v5_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6189 | set newdict [dict create \ |
| 6190 | gate_type mvpfet \ |
| 6191 | diff_type mvpdiff \ |
| 6192 | diff_contact_type mvpdc \ |
| 6193 | plus_diff_type mvnsd \ |
| 6194 | plus_contact_type mvnsc \ |
| 6195 | poly_type poly \ |
| 6196 | poly_contact_type pc \ |
| 6197 | sub_type nwell \ |
Tim Edwards | 2788f17 | 2020-10-14 22:32:33 -0400 | [diff] [blame] | 6198 | dev_sub_type nwell \ |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6199 | guard_sub_surround 0.33 \ |
| 6200 | gate_to_polycont 0.32 \ |
| 6201 | diff_spacing 0.31 \ |
| 6202 | diff_tap_space 0.38 \ |
| 6203 | diff_gate_space 0.38 \ |
| 6204 | ] |
| 6205 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6206 | return [sky130::mos_draw $drawdict] |
| 6207 | } |
| 6208 | |
| 6209 | #------------------- |
| 6210 | # nMOS 5.0V |
| 6211 | #------------------- |
| 6212 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6213 | proc sky130::sky130_fd_pr__nfet_g5v0d10v5_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6214 | set newdict [dict create \ |
| 6215 | gate_type mvnfet \ |
| 6216 | diff_type mvndiff \ |
| 6217 | diff_contact_type mvndc \ |
| 6218 | plus_diff_type mvpsd \ |
| 6219 | plus_contact_type mvpsc \ |
| 6220 | poly_type poly \ |
| 6221 | poly_contact_type pc \ |
| 6222 | sub_type psub \ |
| 6223 | diff_spacing 0.31 \ |
| 6224 | diff_tap_space 0.38 \ |
| 6225 | diff_gate_space 0.38 \ |
| 6226 | ] |
| 6227 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6228 | return [sky130::mos_draw $drawdict] |
| 6229 | } |
| 6230 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6231 | proc sky130::sky130_fd_pr__nfet_05v0_nvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6232 | set newdict [dict create \ |
| 6233 | gate_type mvnnfet \ |
| 6234 | diff_type mvndiff \ |
| 6235 | diff_contact_type mvndc \ |
| 6236 | plus_diff_type mvpsd \ |
| 6237 | plus_contact_type mvpsc \ |
| 6238 | poly_type poly \ |
| 6239 | poly_contact_type pc \ |
| 6240 | sub_type psub \ |
| 6241 | diff_spacing 0.30 \ |
| 6242 | diff_tap_space 0.38 \ |
| 6243 | diff_gate_space 0.38 \ |
| 6244 | ] |
| 6245 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6246 | return [sky130::mos_draw $drawdict] |
| 6247 | } |
| 6248 | |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 6249 | proc sky130::sky130_fd_pr__nfet_03v3_nvt_draw {parameters} { |
| 6250 | set newdict [dict create \ |
| 6251 | gate_type nnfet \ |
| 6252 | diff_type mvndiff \ |
| 6253 | diff_contact_type mvndc \ |
| 6254 | plus_diff_type mvpsd \ |
| 6255 | plus_contact_type mvpsc \ |
| 6256 | poly_type poly \ |
| 6257 | poly_contact_type pc \ |
| 6258 | sub_type psub \ |
| 6259 | diff_spacing 0.30 \ |
| 6260 | diff_tap_space 0.38 \ |
| 6261 | diff_gate_space 0.38 \ |
| 6262 | ] |
| 6263 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6264 | return [sky130::mos_draw $drawdict] |
| 6265 | } |
| 6266 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6267 | #------------------------ |
| 6268 | # MOS varactor (1.8V) |
| 6269 | #------------------------ |
| 6270 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6271 | proc sky130::sky130_fd_pr__cap_var_lvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6272 | set newdict [dict create \ |
| 6273 | gate_type var \ |
| 6274 | diff_type nnd \ |
| 6275 | diff_contact_type nsc \ |
| 6276 | plus_diff_type psd \ |
| 6277 | plus_contact_type psc \ |
| 6278 | poly_type poly \ |
| 6279 | poly_contact_type pc \ |
| 6280 | sub_type psub \ |
| 6281 | dev_sub_type nwell \ |
| 6282 | diff_overlap_cont 0.06 \ |
| 6283 | dev_sub_dist 0.14 \ |
| 6284 | dev_sub_space 1.27 \ |
| 6285 | gate_to_diffcont 0.34 \ |
| 6286 | diff_extension 0.485 \ |
| 6287 | ] |
| 6288 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6289 | return [sky130::mos_draw $drawdict] |
| 6290 | } |
| 6291 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6292 | proc sky130::sky130_fd_pr__cap_var_hvt_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6293 | set newdict [dict create \ |
| 6294 | gate_type varhvt \ |
| 6295 | diff_type nnd \ |
| 6296 | diff_contact_type nsc \ |
| 6297 | plus_diff_type psd \ |
| 6298 | plus_contact_type psc \ |
| 6299 | poly_type poly \ |
| 6300 | poly_contact_type pc \ |
| 6301 | sub_type psub \ |
| 6302 | dev_sub_type nwell \ |
| 6303 | diff_overlap_cont 0.06 \ |
| 6304 | dev_sub_dist 0.14 \ |
| 6305 | dev_sub_space 1.27 \ |
| 6306 | gate_to_diffcont 0.34 \ |
| 6307 | diff_extension 0.485 \ |
| 6308 | ] |
| 6309 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6310 | return [sky130::mos_draw $drawdict] |
| 6311 | } |
| 6312 | |
| 6313 | #--------------------------------------------------------- |
| 6314 | # MOS varactor (5.0V) |
| 6315 | # NOTE: dev_sub_space set to 2.0 assuming different nets. |
| 6316 | # Should have option for same-net with merged wells. |
| 6317 | #--------------------------------------------------------- |
| 6318 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6319 | proc sky130::sky130_fd_pr__cap_var_draw {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6320 | set newdict [dict create \ |
| 6321 | gate_type mvvar \ |
| 6322 | diff_type mvnsd \ |
| 6323 | diff_contact_type mvnsc \ |
| 6324 | plus_diff_type mvpsd \ |
| 6325 | plus_contact_type mvpsc \ |
| 6326 | poly_type poly \ |
| 6327 | poly_contact_type pc \ |
| 6328 | sub_type psub \ |
| 6329 | dev_sub_type nwell \ |
| 6330 | sub_surround 0.38 \ |
| 6331 | sub_surround_dev 0.56 \ |
| 6332 | guard_sub_surround 0.18 \ |
| 6333 | diff_overlap_cont 0.06 \ |
| 6334 | dev_sub_dist 0.785 \ |
| 6335 | dev_sub_space 2.0 \ |
| 6336 | gate_to_diffcont 0.34 \ |
| 6337 | diff_extension 0.485 \ |
| 6338 | ] |
| 6339 | set drawdict [dict merge $sky130::ruleset $newdict $parameters] |
| 6340 | return [sky130::mos_draw $drawdict] |
| 6341 | } |
| 6342 | |
| 6343 | #---------------------------------------------------------------- |
| 6344 | # MOSFET: Check device parameters for out-of-bounds values |
| 6345 | #---------------------------------------------------------------- |
| 6346 | |
| 6347 | proc sky130::mos_check {device parameters} { |
| 6348 | |
| 6349 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 6350 | foreach key [dict keys $parameters] { |
| 6351 | set $key [dict get $parameters $key] |
| 6352 | } |
| 6353 | |
| 6354 | # Normalize distance units to microns |
| 6355 | set l [magic::spice2float $l] |
| 6356 | set l [magic::3digitpastdecimal $l] |
| 6357 | set w [magic::spice2float $w] |
| 6358 | set w [magic::3digitpastdecimal $w] |
| 6359 | |
| 6360 | # nf, m must be integer |
| 6361 | if {![string is int $nf]} { |
| 6362 | puts stderr "NF must be an integer!" |
| 6363 | dict set parameters nf 1 |
| 6364 | } |
| 6365 | if {![string is int $m]} { |
| 6366 | puts stderr "M must be an integer!" |
| 6367 | dict set parameters m 1 |
| 6368 | } |
| 6369 | # diffcov, polycov must be numeric |
| 6370 | if {[catch {expr abs($diffcov)}]} { |
| 6371 | puts stderr "diffcov must be numeric!" |
| 6372 | set diffcov 100 |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 6373 | dict set parameters diffcov $diffcov |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6374 | } |
| 6375 | if {[catch {expr abs($polycov)}]} { |
| 6376 | puts stderr "polycov must be numeric!" |
| 6377 | set polycov 100 |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 6378 | dict set parameters polycov $polycov |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6379 | } |
| 6380 | |
| 6381 | if {$l < $lmin} { |
| 6382 | puts stderr "Mos length must be >= $lmin um" |
| 6383 | dict set parameters l $lmin |
| 6384 | } |
| 6385 | if {$w < $wmin} { |
| 6386 | puts stderr "Mos width must be >= $wmin um" |
| 6387 | dict set parameters w $wmin |
| 6388 | } |
| 6389 | if {$nf < 1} { |
| 6390 | puts stderr "NF must be >= 1" |
| 6391 | dict set parameters nf 1 |
| 6392 | } |
| 6393 | if {$m < 1} { |
| 6394 | puts stderr "M must be >= 1" |
| 6395 | dict set parameters m 1 |
| 6396 | } |
| 6397 | if {$diffcov < 20 } { |
| 6398 | puts stderr "Diffusion contact coverage must be at least 20%" |
| 6399 | dict set parameters diffcov 20 |
| 6400 | } elseif {$diffcov > 100 } { |
| 6401 | puts stderr "Diffusion contact coverage can't be more than 100%" |
| 6402 | dict set parameters diffcov 100 |
| 6403 | } |
| 6404 | if {$polycov < 20 } { |
| 6405 | puts stderr "Poly contact coverage must be at least 20%" |
| 6406 | dict set parameters polycov 20 |
| 6407 | } elseif {$polycov > 100 } { |
| 6408 | puts stderr "Poly contact coverage can't be more than 100%" |
| 6409 | dict set parameters polycov 100 |
| 6410 | } |
| 6411 | |
Tim Edwards | 0ee0f18 | 2020-11-21 16:15:07 -0500 | [diff] [blame] | 6412 | if {[catch {expr abs($viasrc)}]} { |
| 6413 | puts stderr "Source via coverage must be numeric!" |
| 6414 | dict set parameters viasrc 100 |
| 6415 | } elseif {[expr abs($viasrc)] > 100} { |
| 6416 | puts stderr "Source via coverage can't be more than 100%" |
| 6417 | dict set parameters viasrc 100 |
| 6418 | } |
| 6419 | if {[catch {expr abs($viadrn)}]} { |
| 6420 | puts stderr "Drain via coverage must be numeric!" |
| 6421 | dict set parameters viadrn 100 |
| 6422 | } elseif {[expr abs($viadrn)] > 100} { |
| 6423 | puts stderr "Drain via coverage can't be more than 100%" |
| 6424 | dict set parameters viadrn 100 |
| 6425 | } |
| 6426 | if {[catch {expr abs($viagate)}]} { |
| 6427 | puts stderr "Gate via coverage must be numeric!" |
| 6428 | dict set parameters viagate 100 |
| 6429 | } elseif {[expr abs($viagate)] > 100} { |
| 6430 | puts stderr "Gate via coverage can't be more than 100%" |
| 6431 | dict set parameters viagate 100 |
| 6432 | } |
| 6433 | if {[catch {expr abs($viagb)}]} { |
| 6434 | puts stderr "Guard ring bottom via coverage must be numeric!" |
| 6435 | dict set parameters viagb 0 |
| 6436 | } elseif {[expr abs($viagb)] > 100} { |
| 6437 | puts stderr "Guard ring bottom via coverage can't be more than 100%" |
| 6438 | dict set parameters viagb 100 |
| 6439 | } |
| 6440 | if {[catch {expr abs($viagt)}]} { |
| 6441 | puts stderr "Guard ring top via coverage must be numeric!" |
| 6442 | dict set parameters viagt 0 |
| 6443 | } elseif {[expr abs($viagt)] > 100} { |
| 6444 | puts stderr "Guard ring top via coverage can't be more than 100%" |
| 6445 | dict set parameters viagt 100 |
| 6446 | } |
| 6447 | if {[catch {expr abs($viagr)}]} { |
| 6448 | puts stderr "Guard ring right via coverage must be numeric!" |
| 6449 | dict set parameters viagr 0 |
| 6450 | } elseif {[expr abs($viagr)] > 100} { |
| 6451 | puts stderr "Guard ring right via coverage can't be more than 100%" |
| 6452 | dict set parameters viagr 100 |
| 6453 | } |
| 6454 | if {[catch {expr abs($viagl)}]} { |
| 6455 | puts stderr "Guard ring left via coverage must be numeric!" |
| 6456 | dict set parameters viagl 0 |
| 6457 | } elseif {[expr abs($viagl)] > 100} { |
| 6458 | puts stderr "Guard ring left via coverage can't be more than 100%" |
| 6459 | dict set parameters viagl 100 |
| 6460 | } |
| 6461 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6462 | # Values must satisfy diffusion-to-tap spacing of 20um. |
| 6463 | # Therefore the maximum of guard ring width or height cannot exceed 40um. |
| 6464 | # If in violation, reduce counts first, as these are easiest to recover |
| 6465 | # by duplicating the device and overlapping the wells. |
| 6466 | set origm $m |
| 6467 | set orignf $nf |
| 6468 | while true { |
| 6469 | set yext [expr ($w + 3.0) * $m] |
| 6470 | set xext [expr ($l + 1.0) * $nf + 1.1] |
| 6471 | if {[expr min($xext, $yext)] > 40.0} { |
| 6472 | if {$yext > 40.0 && $m > 1} { |
| 6473 | incr m -1 |
| 6474 | } elseif {$xext > 40.0 && $nf > 1} { |
| 6475 | incr nf -1 |
| 6476 | } elseif {$yext > 40.0} { |
| 6477 | set w 37 |
| 6478 | puts -nonewline stderr "Transistor width must be < 37 um" |
| 6479 | puts stderr " to avoid tap spacing violation." |
| 6480 | dict set parameters w $w |
| 6481 | } elseif {$xext > 40.0} { |
| 6482 | set l 37.9 |
| 6483 | puts -nonewline stderr "Transistor length must be < 37.9 um" |
| 6484 | puts stderr " to avoid tap spacing violation." |
| 6485 | dict set parameters l $l |
| 6486 | } |
| 6487 | } else { |
| 6488 | break |
| 6489 | } |
| 6490 | } |
| 6491 | if {$m != $origm} { |
| 6492 | puts stderr "Y repeat reduced to prevent tap distance violation" |
| 6493 | dict set parameters m $m |
| 6494 | } |
| 6495 | if {$nf != $orignf} { |
| 6496 | puts stderr "X repeat reduced to prevent tap distance violation" |
| 6497 | dict set parameters nf $nf |
| 6498 | } |
| 6499 | |
| 6500 | return $parameters |
| 6501 | } |
| 6502 | |
| 6503 | #---------------------------------------------------------------- |
| 6504 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6505 | proc sky130::sky130_fd_pr__nfet_01v8_check {parameters} { |
| 6506 | return [sky130::mos_check sky130_fd_pr__nfet_01v8 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6507 | } |
| 6508 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6509 | proc sky130::sky130_fd_pr__nfet_01v8_lvt_check {parameters} { |
| 6510 | return [sky130::mos_check sky130_fd_pr__nfet_01v8_lvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6511 | } |
| 6512 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6513 | proc sky130::sky130_fd_bs_flash__special_sonosfet_star_check {parameters} { |
| 6514 | return [sky130::mos_check sky130_fd_bs_flash__special_sonosfet_star $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6515 | } |
| 6516 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6517 | proc sky130::sky130_fd_pr__nfet_g5v0d10v5_check {parameters} { |
| 6518 | return [sky130::mos_check sky130_fd_pr__nfet_g5v0d10v5 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6519 | } |
| 6520 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6521 | proc sky130::sky130_fd_pr__nfet_05v0_nvt_check {parameters} { |
| 6522 | return [sky130::mos_check sky130_fd_pr__nfet_05v0_nvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6523 | } |
| 6524 | |
Tim Edwards | ee44593 | 2021-03-31 12:32:04 -0400 | [diff] [blame] | 6525 | proc sky130::sky130_fd_pr__nfet_03v3_nvt_check {parameters} { |
| 6526 | return [sky130::mos_check sky130_fd_pr__nfet_03v3_nvt $parameters] |
| 6527 | } |
| 6528 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6529 | proc sky130::sky130_fd_pr__pfet_01v8_check {parameters} { |
| 6530 | return [sky130::mos_check sky130_fd_pr__pfet_01v8 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6531 | } |
| 6532 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6533 | proc sky130::sky130_fd_pr__pfet_01v8_lvt_check {parameters} { |
| 6534 | return [sky130::mos_check sky130_fd_pr__pfet_01v8_lvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6535 | } |
| 6536 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6537 | proc sky130::sky130_fd_pr__pfet_01v8_hvt_check {parameters} { |
| 6538 | return [sky130::mos_check sky130_fd_pr__pfet_01v8_hvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6539 | } |
| 6540 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6541 | proc sky130::sky130_fd_pr__pfet_g5v0d10v5_check {parameters} { |
| 6542 | return [sky130::mos_check sky130_fd_pr__pfet_g5v0d10v5 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6543 | } |
| 6544 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6545 | proc sky130::sky130_fd_pr__cap_var_lvt_check {parameters} { |
| 6546 | return [sky130::mos_check sky130_fd_pr__cap_var_lvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6547 | } |
| 6548 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6549 | proc sky130::sky130_fd_pr__cap_var_hvt_check {parameters} { |
| 6550 | return [sky130::mos_check sky130_fd_pr__cap_var_hvt $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6551 | } |
| 6552 | |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6553 | proc sky130::sky130_fd_pr__cap_var_check {parameters} { |
| 6554 | return [sky130::mos_check sky130_fd_pr__cap_var $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6555 | } |
| 6556 | |
| 6557 | #---------------------------------------------------------------- |
| 6558 | # Fixed device: Specify all user-editable default values |
| 6559 | # |
| 6560 | # deltax --- Additional horizontal space between devices |
| 6561 | # deltay --- Additional vertical space between devices |
| 6562 | # nx --- Number of arrayed devices in X |
| 6563 | # ny --- Number of arrayed devices in Y |
| 6564 | # |
| 6565 | # Note that these values, specifically nx, ny, deltax, |
| 6566 | # and deltay, are properties of the instance, not the cell. |
| 6567 | # They translate to the instance array x and y counts; while |
| 6568 | # deltax is the x pitch less the cell width, and deltay is the |
| 6569 | # y pitch less the cell height. |
| 6570 | # |
| 6571 | # non-user-editable |
| 6572 | # |
| 6573 | # nocell --- Indicates that this cell has a predefined layout |
| 6574 | # and therefore there is no cell to draw. |
| 6575 | # xstep --- Width of the cell (nominal array pitch in X) |
| 6576 | # ystep --- Height of the cell (nominal array pitch in Y) |
| 6577 | #---------------------------------------------------------------- |
| 6578 | |
| 6579 | # Fixed-layout devices (from sky130_fd_pr_base, _rf, and _rf2 libraries) |
| 6580 | # |
| 6581 | # Bipolar transistors: |
| 6582 | # |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6583 | # sky130_fd_pr__rf_npn_05v5_W1p00L1p00 |
| 6584 | # sky130_fd_pr__rf_npn_05v5_W1p00L2p00 |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6585 | # sky130_fd_pr__rf_pnp_05v5_W3p40L3p40 |
| 6586 | # sky130_fd_pr__rf_pnp_05v5_W0p68L0p68 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6587 | # |
| 6588 | # Parallel Plate Capacitors: |
| 6589 | # |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6590 | # sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldlim5 |
| 6591 | # sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6592 | # sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1 |
| 6593 | # sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6594 | # |
| 6595 | # Inductors: |
| 6596 | # |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6597 | # sky130_fd_pr__rf_test_coil1 |
| 6598 | # sky130_fd_pr__rf_test_coil2 |
| 6599 | # sky130_fd_pr__rf_test_coil3 |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6600 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6601 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6602 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 7.03 ystep 7.03} |
| 6603 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6604 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6605 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 7.03 ystep 8.03} |
| 6606 | } |
| 6607 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6608 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68_defaults {} { |
Tim Edwards | 7e29496 | 2021-05-04 20:33:17 -0400 | [diff] [blame] | 6609 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 3.72 ystep 3.72} |
| 6610 | } |
| 6611 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6612 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40_defaults {} { |
Tim Edwards | d7289eb | 2020-09-10 21:48:31 -0400 | [diff] [blame] | 6613 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 6.44 ystep 6.44} |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6614 | } |
| 6615 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6616 | proc sky130::sky130_fd_pr__rf_test_coil1_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6617 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 258 ystep 258} |
| 6618 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6619 | proc sky130::sky130_fd_pr__rf_test_coil2_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6620 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 290 ystep 404} |
| 6621 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6622 | proc sky130::sky130_fd_pr__rf_test_coil3_defaults {} { |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6623 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 290 ystep 404} |
| 6624 | } |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6625 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6626 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6627 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 11.08 ystep 11.36} |
| 6628 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6629 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6630 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 11.08 ystep 11.36} |
| 6631 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6632 | proc sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6633 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 11.08 ystep 11.36} |
| 6634 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6635 | proc sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1_defaults {} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6636 | return {nx 1 ny 1 deltax 0 deltay 0 nocell 1 xstep 11.08 ystep 11.36} |
| 6637 | } |
| 6638 | |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6639 | #---------------------------------------------------------------- |
| 6640 | # Fixed device: Conversion from SPICE netlist parameters to toolkit |
| 6641 | #---------------------------------------------------------------- |
| 6642 | |
| 6643 | proc sky130::fixed_convert {parameters} { |
| 6644 | set pdkparams [dict create] |
| 6645 | dict for {key value} $parameters { |
| 6646 | switch -nocase $key { |
| 6647 | m { |
| 6648 | dict set pdkparams nx $value |
| 6649 | } |
| 6650 | } |
| 6651 | } |
| 6652 | return $pdkparams |
| 6653 | } |
| 6654 | |
| 6655 | #---------------------------------------------------------------- |
| 6656 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6657 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6658 | return [sky130::fixed_convert $parameters] |
| 6659 | } |
| 6660 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6661 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6662 | return [sky130::fixed_convert $parameters] |
| 6663 | } |
| 6664 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6665 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68_convert {parameters} { |
Tim Edwards | 7e29496 | 2021-05-04 20:33:17 -0400 | [diff] [blame] | 6666 | return [sky130::fixed_convert $parameters] |
| 6667 | } |
| 6668 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6669 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6670 | return [sky130::fixed_convert $parameters] |
| 6671 | } |
| 6672 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6673 | proc sky130::sky130_fd_pr__rf_test_coil1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6674 | return [sky130::fixed_convert $parameters] |
| 6675 | } |
| 6676 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6677 | proc sky130::sky130_fd_pr__rf_test_coil2_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6678 | return [sky130::fixed_convert $parameters] |
| 6679 | } |
| 6680 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6681 | proc sky130::sky130_fd_pr__rf_test_coil3_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6682 | return [sky130::fixed_convert $parameters] |
| 6683 | } |
| 6684 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6685 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6686 | return [sky130::fixed_convert $parameters] |
| 6687 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6688 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6689 | return [sky130::fixed_convert $parameters] |
| 6690 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6691 | proc sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6692 | return [sky130::fixed_convert $parameters] |
| 6693 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6694 | proc sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1_convert {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6695 | return [sky130::fixed_convert $parameters] |
| 6696 | } |
| 6697 | |
| 6698 | #---------------------------------------------------------------- |
| 6699 | # Fixed device: Interactively specifies the fixed layout parameters |
| 6700 | #---------------------------------------------------------------- |
| 6701 | |
| 6702 | proc sky130::fixed_dialog {parameters} { |
| 6703 | # Instance fields: nx, ny, pitchx, pitchy |
| 6704 | # Editable fields: nx, ny, deltax, deltay |
| 6705 | # Non-editable fields: nocell, xstep, ystep |
| 6706 | |
| 6707 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 6708 | foreach key [dict keys $parameters] { |
| 6709 | set $key [dict get $parameters $key] |
| 6710 | } |
| 6711 | |
| 6712 | # "nocell" field causes nx and ny to be dropped in from |
| 6713 | # "array count". Also "pitchx" and "pitchy" are passed |
| 6714 | # in internal units. Convert these to microns and generate |
| 6715 | # If there is no pitchx and pitchy, then the device has not |
| 6716 | # yet been created, so keep the deltax and deltay defaults. |
| 6717 | |
| 6718 | if [dict exists $parameters pitchx] { |
| 6719 | set pitchux [magic::i2u $pitchx] |
| 6720 | set stepux [magic::spice2float $xstep] |
| 6721 | set deltax [magic::3digitpastdecimal [expr $pitchux - $stepux]] |
| 6722 | # An array size 1 should not cause deltax to go negative |
| 6723 | if {$deltax < 0.0} {set deltax 0.0} |
| 6724 | dict set parameters deltax $deltax |
| 6725 | } |
| 6726 | if [dict exists $parameters pitchy] { |
| 6727 | set pitchuy [magic::i2u $pitchy] |
| 6728 | set stepuy [magic::spice2float $ystep] |
| 6729 | set deltay [magic::3digitpastdecimal [expr $pitchuy - $stepuy]] |
| 6730 | # An array size 1 should not cause deltay to go negative |
| 6731 | if {$deltay < 0.0} {set deltay 0.0} |
| 6732 | dict set parameters deltay $deltay |
| 6733 | } |
| 6734 | |
| 6735 | magic::add_entry nx "NX" $parameters |
| 6736 | magic::add_entry ny "NY" $parameters |
| 6737 | magic::add_entry deltax "X step (um)" $parameters |
| 6738 | magic::add_entry deltay "Y step (um)" $parameters |
| 6739 | } |
| 6740 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6741 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6742 | sky130::fixed_dialog $parameters |
| 6743 | } |
| 6744 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6745 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6746 | sky130::fixed_dialog $parameters |
| 6747 | } |
| 6748 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6749 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68_dialog {parameters} { |
Tim Edwards | 7e29496 | 2021-05-04 20:33:17 -0400 | [diff] [blame] | 6750 | sky130::fixed_dialog $parameters |
| 6751 | } |
| 6752 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6753 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6754 | sky130::fixed_dialog $parameters |
| 6755 | } |
| 6756 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6757 | proc sky130::sky130_fd_pr__rf_test_coil1_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6758 | sky130::fixed_dialog $parameters |
| 6759 | } |
| 6760 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6761 | proc sky130::sky130_fd_pr__rf_test_coil2_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6762 | sky130::fixed_dialog $parameters |
| 6763 | } |
| 6764 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6765 | proc sky130::sky130_fd_pr__rf_test_coil3_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6766 | sky130::fixed_dialog $parameters |
| 6767 | } |
| 6768 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6769 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6770 | sky130::fixed_dialog $parameters |
| 6771 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6772 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6773 | sky130::fixed_dialog $parameters |
| 6774 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6775 | proc sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6776 | sky130::fixed_dialog $parameters |
| 6777 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6778 | proc sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1_dialog {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6779 | sky130::fixed_dialog $parameters |
| 6780 | } |
| 6781 | |
| 6782 | #---------------------------------------------------------------- |
| 6783 | # Fixed device: Draw the device |
| 6784 | #---------------------------------------------------------------- |
| 6785 | |
| 6786 | proc sky130::fixed_draw {devname parameters} { |
| 6787 | |
| 6788 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 6789 | foreach key [dict keys $parameters] { |
| 6790 | set $key [dict get $parameters $key] |
| 6791 | } |
| 6792 | |
| 6793 | # This cell declares "nocell" in parameters, so it needs to |
| 6794 | # instance the cell and set properties. |
| 6795 | |
| 6796 | # Instantiate the cell. The name corresponds to the cell in the sky130_fd_pr_* directory. |
| 6797 | set instname [getcell ${devname}] |
| 6798 | |
| 6799 | set deltax [magic::spice2float $deltax] |
| 6800 | set deltay [magic::spice2float $deltay] |
| 6801 | set xstep [magic::spice2float $xstep] |
| 6802 | set ystep [magic::spice2float $ystep] |
| 6803 | |
| 6804 | # Array stepping |
| 6805 | if {$nx > 1 || $ny > 1} { |
| 6806 | set xstep [expr $xstep + $deltax] |
| 6807 | set ystep [expr $ystep + $deltay] |
| 6808 | box size ${xstep}um ${ystep}um |
| 6809 | array $nx $ny |
| 6810 | } |
| 6811 | select cell $instname |
| 6812 | expand |
| 6813 | return $instname |
| 6814 | } |
| 6815 | |
| 6816 | #---------------------------------------------------------------- |
| 6817 | # No additional parameters declared for drawing |
| 6818 | #---------------------------------------------------------------- |
| 6819 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6820 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00_draw {parameters} { |
| 6821 | return [sky130::fixed_draw sky130_fd_pr__rf_npn_05v5_W1p00L1p00 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6822 | } |
| 6823 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6824 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00_draw {parameters} { |
| 6825 | return [sky130::fixed_draw sky130_fd_pr__rf_npn_05v5_W1p00L2p00 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6826 | } |
| 6827 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6828 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68_draw {parameters} { |
| 6829 | return [sky130::fixed_draw sky130_fd_pr__rf_pnp_05v5_W0p68L0p68 $parameters] |
Tim Edwards | 7e29496 | 2021-05-04 20:33:17 -0400 | [diff] [blame] | 6830 | } |
| 6831 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6832 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40_draw {parameters} { |
| 6833 | return [sky130::fixed_draw sky130_fd_pr__rf_pnp_05v5_W3p40L3p40 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6834 | } |
| 6835 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6836 | proc sky130::sky130_fd_pr__rf_test_coil1_draw {parameters} { |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6837 | return [sky130::fixed_draw sky130_fd_pr__rf_test_coil1 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6838 | } |
| 6839 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6840 | proc sky130::sky130_fd_pr__rf_test_coil2_draw {parameters} { |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6841 | return [sky130::fixed_draw sky130_fd_pr__rf_test_coil2 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6842 | } |
| 6843 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6844 | proc sky130::sky130_fd_pr__rf_test_coil3_draw {parameters} { |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6845 | return [sky130::fixed_draw sky130_fd_pr__rf_test_coil3 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6846 | } |
| 6847 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6848 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5_draw {parameters} { |
| 6849 | return [sky130::fixed_draw sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6850 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6851 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield_draw {parameters} { |
| 6852 | return [sky130::fixed_draw sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6853 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6854 | proc sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1_draw {parameters} { |
| 6855 | return [sky130::fixed_draw sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6856 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6857 | proc sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1_draw {parameters} { |
| 6858 | return [sky130::fixed_draw sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1 $parameters] |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6859 | } |
| 6860 | |
| 6861 | #---------------------------------------------------------------- |
| 6862 | # Fixed device: Check device parameters for out-of-bounds values |
| 6863 | #---------------------------------------------------------------- |
| 6864 | |
| 6865 | proc sky130::fixed_check {parameters} { |
| 6866 | |
| 6867 | # Set a local variable for each parameter (e.g., $l, $w, etc.) |
| 6868 | foreach key [dict keys $parameters] { |
| 6869 | set $key [dict get $parameters $key] |
| 6870 | } |
| 6871 | |
| 6872 | # Normalize distance units to microns |
| 6873 | set deltax [magic::spice2float $deltax -1] |
| 6874 | set deltax [magic::3digitpastdecimal $deltax] |
| 6875 | set deltay [magic::spice2float $deltay -1] |
| 6876 | set deltay [magic::3digitpastdecimal $deltay] |
| 6877 | |
| 6878 | # nx, ny must be integer |
| 6879 | if {![string is int $nx]} { |
| 6880 | puts stderr "NX must be an integer!" |
| 6881 | dict set parameters nx 1 |
| 6882 | } |
| 6883 | if {![string is int $ny]} { |
| 6884 | puts stderr "NY must be an integer!" |
| 6885 | dict set parameters nx 1 |
| 6886 | } |
| 6887 | |
| 6888 | # Number of devices in X and Y must be at least 1 |
| 6889 | if {$nx < 1} { |
| 6890 | puts stderr "NX must be >= 1" |
| 6891 | dict set parameters nx 1 |
| 6892 | } |
| 6893 | if {$ny < 1} { |
| 6894 | puts stderr "NY must be >= 1" |
| 6895 | dict set parameters nx 1 |
| 6896 | } |
| 6897 | # Step less than zero violates DRC |
| 6898 | if {$deltax < 0} { |
| 6899 | puts stderr "X step must be >= 0" |
| 6900 | dict set parameters deltax 0 |
| 6901 | } |
| 6902 | if {$deltay < 0} { |
| 6903 | puts stderr "Y step must be >= 0" |
| 6904 | dict set parameters deltay 0 |
| 6905 | } |
| 6906 | return $parameters |
| 6907 | } |
| 6908 | |
| 6909 | #---------------------------------------------------------------- |
| 6910 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6911 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L1p00_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6912 | return [sky130::fixed_check $parameters] |
| 6913 | } |
| 6914 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6915 | proc sky130::sky130_fd_pr__rf_npn_05v5_W1p00L2p00_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6916 | return [sky130::fixed_check $parameters] |
| 6917 | } |
| 6918 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6919 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W0p68L0p68_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6920 | return [sky130::fixed_check $parameters] |
| 6921 | } |
| 6922 | |
Tim Edwards | 956e302 | 2021-05-27 20:43:26 -0400 | [diff] [blame] | 6923 | proc sky130::sky130_fd_pr__rf_pnp_05v5_W3p40L3p40_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6924 | return [sky130::fixed_check $parameters] |
| 6925 | } |
| 6926 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6927 | proc sky130::sky130_fd_pr__rf_test_coil1_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6928 | return [sky130::fixed_check $parameters] |
| 6929 | } |
| 6930 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6931 | proc sky130::sky130_fd_pr__rf_test_coil2_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6932 | return [sky130::fixed_check $parameters] |
| 6933 | } |
| 6934 | |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6935 | proc sky130::sky130_fd_pr__rf_test_coil3_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6936 | return [sky130::fixed_check $parameters] |
| 6937 | } |
| 6938 | |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6939 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2m3m4_shieldl1m5_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6940 | return [sky130::fixed_check $parameters] |
| 6941 | } |
Tim Edwards | c6202ef | 2020-09-20 17:16:33 -0400 | [diff] [blame] | 6942 | proc sky130::sky130_fd_pr__cap_vpp_11p5x11p7_m1m2_noshield_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6943 | return [sky130::fixed_check $parameters] |
| 6944 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6945 | proc sky130::sky130_fd_pr__cap_vpp_08p6x07p8_m1m2_shieldl1_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6946 | return [sky130::fixed_check $parameters] |
| 6947 | } |
Tim Edwards | e4b4535 | 2022-01-01 11:53:31 -0500 | [diff] [blame] | 6948 | proc sky130::sky130_fd_pr__cap_vpp_04p4x04p6_m1m2_shieldl1_check {parameters} { |
Tim Edwards | 55f4d0e | 2020-07-05 15:41:02 -0400 | [diff] [blame] | 6949 | return [sky130::fixed_check $parameters] |
| 6950 | } |