Changed "convert_spectre.py" to "spectre_to_spice.py". Corrected the script to properly identify weird "spectreisms" in which resistors or capacitors are prefixed as subcircuits with "x" but use a model which is a resistor or capacitor. Also: Added more handling of SRAM (coreid) layers in the magic techfile for support of OpenRAM, and added a first pass at fill pattern generation in magic.
diff --git a/common/convert_spectre.py b/common/spectre_to_spice.py similarity index 93% rename from common/convert_spectre.py rename to common/spectre_to_spice.py index 6c3655c..a00dc18 100755 --- a/common/convert_spectre.py +++ b/common/spectre_to_spice.py
@@ -8,7 +8,7 @@ import glob def usage(): - print('convert_spectre.py <path_to_spectre> <path_to_spice>') + print('spectre_to_spice.py <path_to_spectre> <path_to_spice>') # Check if a parameter value is a valid number (real, float, integer) # or is some kind of expression. @@ -385,13 +385,30 @@ if not isspectre: cmatch = cdlrex.match(line) if cmatch: + devtype = cmatch.group(1) + devmodel = cmatch.group(4) + + # Handle spectreisms. . . + if devmodel == 'capacitor': + devtype = 'c' + devmodel = '' + elif devmodel == 'resistor': + devtype = 'r' + devmodel = '' + elif devmodel == 'resbody': + # This is specific to the SkyWater models; handling it + # in a generic way would be difficult, as it would be + # necessary to find the model and discover that the + # model is a resistor and not a subcircuit. + devtype = 'r' + fmtline = parse_param_line(cmatch.group(5), True, insub) if fmtline != '': inparam = True - spicelines.append(cmatch.group(1) + cmatch.group(2) + ' ' + cmatch.group(3) + ' ' + cmatch.group(4) + ' ' + fmtline) + spicelines.append(devtype + cmatch.group(2) + ' ' + cmatch.group(3) + ' ' + devmodel + ' ' + fmtline) continue else: - spicelines.append(cmatch.group(1) + cmatch.group(2) + ' ' + cmatch.group(3) + ' ' + cmatch.group(4) + ' ' + cmatch.group(5)) + spicelines.append(devtype + cmatch.group(2) + ' ' + cmatch.group(3) + ' ' + devmodel + ' ' + cmatch.group(5)) continue # Check for a line that begins with the subcircuit name @@ -448,7 +465,7 @@ debug = False if len(sys.argv) == 1: - print("No options given to convert_spectre.py.") + print("No options given to spectre_to_spice.py.") usage() sys.exit(0) @@ -462,7 +479,7 @@ arguments.append(option) if len(arguments) != 2: - print("Wrong number of arguments given to convert_spectre.py.") + print("Wrong number of arguments given to spectre_to_spice.py.") usage() sys.exit(0)
diff --git a/sky130/magic/sky130.tech b/sky130/magic/sky130.tech index 9f41101..1e2861d 100644 --- a/sky130/magic/sky130.tech +++ b/sky130/magic/sky130.tech
@@ -251,12 +251,14 @@ metal1 via1,m2contact,m2cut,m2c,via,v,v1 -metal1 obsm1 -metal1 padl + -metal1 m1fill # Metal 2 metal2 metal2,m2,met2 -metal2 rmetal2,rm2,rmet2 metal2 via2,m3contact,m3cut,m3c,v2 -metal2 obsm2 + -metal2 m2fill # Metal 3 metal3 metal3,m3,met3 @@ -264,6 +266,7 @@ -metal3 obsm3 #ifdef METAL5 metal3 via3,v3 + -metal3 m3fill #ifdef MIM -cap1 mimcap,mim,capm @@ -275,6 +278,7 @@ -metal4 rmetal4,rm4,rmet4 -metal4 obsm4 metal4 via4,v4 + -metal4 m4fill #ifdef MIM -cap2 mimcap2,mim2,capm2 @@ -285,6 +289,7 @@ metal5 metal5,m5,met5 -metal5 rm5,rmetal5,rmet5 -metal5 obsm5 + -metal5 m5fill #endif (METAL5) #ifdef REDISTRIBUTION @@ -518,14 +523,17 @@ obslic metal1 metal2 via1arrow metal1 metal2 + m1fill metal2 rm1 metal2 poly_resist_stripes obsm1 metal2 m2c metal2 metal3 via2arrow metal2 metal3 + m2fill metal3 rm2 metal3 poly_resist_stripes obsm2 metal3 m3c metal3 metal4 via3alt metal3 metal4 + m3fill metal4 rm3 metal4 poly_resist_stripes obsm3 metal4 #ifdef METAL5 @@ -537,10 +545,12 @@ #endif (MIM) via3 metal4 metal5 via4 metal4 metal5 + m4fill metal5 rm4 metal5 poly_resist_stripes obsm4 metal5 via4 metal5 metal6 via5 metal5 metal6 + m5fill metal6 rm5 metal6 poly_resist_stripes obsm5 metal6 #endif (METAL5) @@ -635,12 +645,12 @@ *nwell,*nsd,*mvnsd,dnwell *nwell,*nsd,*mvnsd,dnwell pwell,*psd,*mvpsd pwell,*psd,*mvpsd *li,coreli *li,coreli - *m1 *m1 - *m2 *m2 - *m3 *m3 + *m1,m1fill *m1,m1fill + *m2,m2fill *m2,m2fill + *m3,m3fill *m3,m3fill #ifdef METAL5 - *m4 *m4 - *m5 *m5 + *m4,m4fill *m4,m4fill + *m5,m5fill *m5,m5fill #ifdef MIM *mimcap *mimcap *mimcap2 *mimcap2 @@ -1031,7 +1041,7 @@ #---------------------------------------------------------------- # MET1 #---------------------------------------------------------------- - layer MET1 allm1 + layer MET1 allm1,m1fill calma 68 20 layer MET1TXT @@ -1056,7 +1066,7 @@ #---------------------------------------------------------------- # MET2 #---------------------------------------------------------------- - layer MET2 allm2 + layer MET2 allm2,m2fill calma 69 20 layer MET2TXT @@ -1081,7 +1091,7 @@ #---------------------------------------------------------------- # MET3 #---------------------------------------------------------------- - layer MET3 allm3 + layer MET3 allm3,m3fill calma 70 20 layer MET3TXT @@ -1110,7 +1120,7 @@ #---------------------------------------------------------------- # MET4 #---------------------------------------------------------------- - layer MET4 allm4 + layer MET4 allm4,m4fill calma 71 20 layer MET4TXT @@ -1138,7 +1148,7 @@ #---------------------------------------------------------------- # MET5 #---------------------------------------------------------------- - layer MET5 allm5 + layer MET5 allm5,m5fill calma 72 20 layer MET5TXT @@ -1467,26 +1477,356 @@ style wafflefill #---------------------------------------------------------------- # Style used by scripts for automatically generating fill layers -# (under development) #---------------------------------------------------------------- scalefactor 10 nanometers options calma-permissive-labels gridlimit 5 #--------------------------------------------------- -# MET1 fill (under development) +# FOM fill (under development) #--------------------------------------------------- - templayer slots_m1 - bbox top - slots 33400 1150 1650 46000 13350 14650 - templayer obstruct_m1 allm1,allpad,obsm1 - grow 800 - shrink 500 + templayer slots_fom_pass1 + bbox top + slots 0 4080 1320 0 4080 1320 1360 0 + templayer obstruct_fom_pass1 alldiff,allpoly,rpw grow 500 - layer met1fill slots_m1 - and-not obstruct_m1 - shrink 550 - grow 550 + templayer fomfill_pass1 slots_fom_pass1 + and-not obstruct_fom_pass1 + shrink 2035 + grow 2035 + + templayer slots_fom_pass2 + bbox top + slots 0 2500 1320 0 2500 1320 1360 0 + templayer obstruct_fom_pass2 fomfill_pass1 + grow 820 + or alldiff,allpoly,rpw + grow 500 + templayer fomfill_pass2 slots_fom_pass2 + and-not obstruct_fom_pass2 + shrink 1245 + grow 1245 + + templayer slots_fom_coarse + bbox top + slots 0 1500 1320 0 1500 1320 1360 0 + templayer obstruct_fom_coarse fomfill_pass1,fomfill_pass2 + grow 820 + or alldiff,allpoly,rpw + grow 500 + templayer fomfill_coarse slots_fom_coarse + and-not obstruct_fom_coarse + shrink 745 + grow 745 + + templayer slots_fom_fine + bbox top + slots 0 500 400 0 500 400 160 0 + templayer obstruct_fom_fine fomfill_pass1,fomfill_pass2,fomfill_coarse + grow 820 + or alldiff,allpoly,rpw + grow 500 + templayer fomfill_fine slots_fom_fine + and-not obstruct_fom_fine + shrink 245 + grow 245 + + layer FOMMASK fomfill_pass1 + or fomfill_pass2 + or fomfill_coarse + or fomfill_fine + calma 23 0 + +#--------------------------------------------------- +# POLY fill (under development) +#--------------------------------------------------- + templayer slots_poly_pass1 + bbox top + slots 0 720 360 0 720 360 240 0 + templayer obstruct_poly_pass1 alldiff,allpoly,rpw + grow 1000 + templayer polyfill_pass1 slots_poly_pass1 + and-not obstruct_poly_pass1 + shrink 355 + grow 355 + + templayer slots_poly_coarse + bbox top + slots 0 720 360 0 720 360 240 120 + templayer obstruct_poly_coarse alldiff,allpoly,rpw + grow 640 + or polyfill_pass1 + grow 360 + templayer polyfill_coarse slots_poly_coarse + and-not obstruct_poly_coarse + shrink 355 + grow 355 + + templayer slots_poly_medium + bbox top + slots 0 540 360 0 540 360 240 100 + templayer obstruct_poly_medium alldiff,allpoly,rpw + grow 650 + or polyfill_pass1,polyfill_coarse + grow 360 + templayer polyfill_medium slots_poly_medium + and-not obstruct_poly_medium + shrink 265 + grow 265 + + templayer slots_poly_fine + bbox top + slots 0 480 360 0 480 360 240 200 + templayer obstruct_poly_fine alldiff,allpoly,rpw + grow 650 + or polyfill_pass1,polyfill_coarse,polyfill_medium + grow 360 + templayer polyfill_fine slots_poly_fine + and-not obstruct_poly_fine + shrink 235 + grow 235 + + layer POLYMASK polyfill_pass1 + or polyfill_coarse + or polyfill_medium + or polyfill_fine + calma 28 0 + +#--------------------------------------------------- +# MET1 fill +#--------------------------------------------------- + templayer slots_m1_coarse + bbox top + slots 0 2000 200 0 2000 200 700 0 + templayer obstruct_m1_coarse allm1,allpad,obsm1,m1fill,fillblock + grow 3000 + templayer met1fill_coarse slots_m1_coarse + and-not obstruct_m1_coarse + shrink 995 + grow 995 + + templayer slots_m1_medium + bbox top + slots 0 1000 200 0 1000 200 700 0 + templayer obstruct_m1_medium allm1,allpad,obsm1,m1fill,fillblock + grow 2800 + or met1fill_coarse + grow 200 + templayer met1fill_medium slots_m1_medium + and-not obstruct_m1_medium + shrink 495 + grow 495 + + templayer slots_m1_fine + bbox top + slots 0 580 200 0 580 200 700 0 + templayer obstruct_m1_fine allm1,allpad,obsm1,m1fill,fillblock + grow 300 + or met1fill_coarse,met1fill_medium + grow 200 + templayer met1fill_fine slots_m1_fine + and-not obstruct_m1_fine + shrink 285 + grow 285 + + templayer slots_m1_veryfine + bbox top + slots 0 300 200 0 300 200 100 50 + templayer obstruct_m1_veryfine allm1,allpad,obsm1,m1fill,fillblock + grow 100 + or met1fill_coarse,met1fill_medium,met1fill_fine + grow 200 + templayer met1fill_veryfine slots_m1_veryfine + and-not obstruct_m1_veryfine + shrink 145 + grow 145 + + layer MET1MASK met1fill_coarse + or met1fill_medium + or met1fill_fine + or met1fill_veryfine + calma 36 0 + +#--------------------------------------------------- +# MET2 fill +#--------------------------------------------------- + templayer slots_m2_coarse + bbox top + slots 0 2000 200 0 2000 200 700 350 + templayer obstruct_m2 allm2,allpad,obsm2,m2fill,fillblock + grow 3000 + templayer met2fill_coarse slots_m2_coarse + and-not obstruct_m2 + shrink 995 + grow 995 + + templayer slots_m2_medium + bbox top + slots 0 1000 200 0 1000 200 700 350 + templayer obstruct_m2_medium allm2,allpad,obsm2,m2fill,fillblock + grow 2800 + or met2fill_coarse + grow 200 + templayer met2fill_medium slots_m2_medium + and-not obstruct_m2_medium + shrink 495 + grow 495 + + templayer slots_m2_fine + bbox top + slots 0 580 200 0 580 200 700 350 + templayer obstruct_m2_fine allm2,allpad,obsm2,m2fill,fillblock + grow 300 + or met2fill_coarse,met2fill_medium + grow 200 + templayer met2fill_fine slots_m2_fine + and-not obstruct_m2_fine + shrink 285 + grow 285 + + templayer slots_m2_veryfine + bbox top + slots 0 300 200 0 300 200 100 100 + templayer obstruct_m2_veryfine allm2,allpad,obsm2,m2fill,fillblock + grow 100 + or met2fill_coarse,met2fill_medium,met2fill_fine + grow 200 + templayer met2fill_veryfine slots_m2_veryfine + and-not obstruct_m2_veryfine + shrink 145 + grow 145 + + layer MET2MASK met2fill_coarse + or met2fill_medium + or met2fill_fine + or met2fill_veryfine + calma 41 0 + +#--------------------------------------------------- +# MET3 fill +#--------------------------------------------------- + templayer slots_m3_coarse + bbox top + slots 0 2000 300 0 2000 300 700 700 + templayer obstruct_m3 allm3,allpad,obsm3,m3fill,fillblock + grow 3000 + templayer met3fill_coarse slots_m3_coarse + and-not obstruct_m3 + shrink 995 + grow 995 + + templayer slots_m3_medium + bbox top + slots 0 1000 300 0 1000 300 700 700 + templayer obstruct_m3_medium allm3,allpad,obsm3,m3fill,fillblock + grow 2700 + or met3fill_coarse + grow 300 + templayer met3fill_medium slots_m3_medium + and-not obstruct_m3_medium + shrink 495 + grow 495 + + templayer slots_m3_fine + bbox top + slots 0 580 300 0 580 300 700 700 + templayer obstruct_m3_fine allm3,allpad,obsm3,m3fill,fillblock + grow 200 + or met3fill_coarse,met3fill_medium + grow 300 + templayer met3fill_fine slots_m3_fine + and-not obstruct_m3_fine + shrink 285 + grow 285 + + templayer slots_m3_veryfine + bbox top + slots 0 400 300 0 400 300 150 200 + templayer obstruct_m3_veryfine allm3,allpad,obsm3,m3fill,fillblock + or met3fill_coarse,met3fill_medium,met3fill_fine + grow 300 + templayer met3fill_veryfine slots_m3_veryfine + and-not obstruct_m3_veryfine + shrink 195 + grow 195 + + layer MET3MASK met3fill_coarse + or met3fill_medium + or met3fill_fine + or met3fill_veryfine + calma 34 0 + +#ifdef METAL5 +#--------------------------------------------------- +# MET4 fill +#--------------------------------------------------- + templayer slots_m4_coarse + bbox top + slots 0 2000 300 0 2000 300 700 1050 + templayer obstruct_m4 allm4,allpad,obsm4,m4fill,fillblock + grow 3000 + templayer met4fill_coarse slots_m4_coarse + and-not obstruct_m4 + shrink 995 + grow 995 + + templayer slots_m4_medium + bbox top + slots 0 1000 300 0 1000 300 700 1050 + templayer obstruct_m4_medium allm4,allpad,obsm4,m4fill,fillblock + grow 2700 + or met4fill_coarse + grow 300 + templayer met4fill_medium slots_m4_medium + and-not obstruct_m4_medium + shrink 495 + grow 495 + + templayer slots_m4_fine + bbox top + slots 0 580 300 0 580 300 700 1050 + templayer obstruct_m4_fine allm4,allpad,obsm4,m4fill,fillblock + grow 200 + or met4fill_coarse,met4fill_medium + grow 300 + templayer met4fill_fine slots_m4_fine + and-not obstruct_m4_fine + shrink 285 + grow 285 + + templayer slots_m4_veryfine + bbox top + slots 0 400 300 0 400 300 150 300 + templayer obstruct_m4_veryfine allm4,allpad,obsm4,m4fill,fillblock + or met4fill_coarse,met4fill_medium,met4fill_fine + grow 300 + templayer met4fill_veryfine slots_m4_veryfine + and-not obstruct_m4_veryfine + shrink 195 + grow 195 + + layer MET4MASK met4fill_coarse + or met4fill_medium + or met4fill_fine + or met4fill_veryfine + calma 51 0 + +#--------------------------------------------------- +# MET5 fill +#--------------------------------------------------- + templayer slots_m5 + bbox top + slots 0 3000 1600 0 3000 1600 1000 100 + templayer obstruct_m5 allm5,allpad,obsm5,m5fill,fillblock + grow 3000 + templayer met5fill_gen slots_m5 + and-not obstruct_m5 + shrink 1495 + grow 1495 + + layer MET5MASK met5fill_gen + calma 59 0 +#endif (METAL5) end @@ -2426,6 +2766,9 @@ and MET1RES,MET1SHORT labels MET1RES,MET1SHORT + layer m1fill MET1FILL + labels MET1FILL + #ifdef MIM layer mimcap MET3 and CAPM @@ -2471,6 +2814,9 @@ and MET2RES,MET2SHORT labels MET2RES,MET2SHORT + layer m2fill MET2FILL + labels MET2FILL + templayer m3cbase VIA2 grow 40 @@ -2494,6 +2840,9 @@ and MET3RES,MET3SHORT labels MET3RES,MET3SHORT + layer m3fill MET3FILL + labels MET3FILL + #ifdef (METAL5) templayer via3base VIA3 @@ -2522,6 +2871,9 @@ and MET4RES,MET4SHORT labels MET4RES,MET4SHORT + layer m4fill MET4FILL + labels MET4FILL + layer m5 MET5,MET5TXT,MET5PIN and-not MET5RES,MET5SHORT labels MET5 @@ -2532,6 +2884,9 @@ and MET5RES,MET5SHORT labels MET5RES,MET5SHORT + layer m5fill MET5FILL + labels MET5FILL + templayer via4base VIA4 #ifdef MIM and-not CAPM2 @@ -2890,6 +3245,14 @@ calma MET5RES 72 13 #endif + calma MET1FILL 68 28 + calma MET2FILL 69 28 + calma MET3FILL 70 28 +#ifdef METAL5 + calma MET4FILL 71 28 + calma MET5FILL 72 28 +#endif + calma POLYSHORT 66 15 calma LISHORT 67 15 calma MET1SHORT 68 15 @@ -3294,6 +3657,7 @@ #ifdef METAL5 +#undef METAL5 #-------------------------------------------------- # VIA3 - Requires METAL5 Module #-------------------------------------------------- @@ -3343,6 +3707,7 @@ spacing allm5 allm5,obsm5 1600 touching_ok "Metal5 spacing < %d (Met5 2)" area allm5,obsm5 4000000 1600 "Metal5 minimum area < %a (Met5 4)" +#define METAL5 #endif (METAL5) #ifdef REDISTRIBUTION