Revised the fix_device_models script (again) to correct the
resistor to type R and diode to type D (from "X"), and to change
the diode properties from "a" and "p" to "area" and "pj".
Updated the magic technology file to also write the diodes as
low-level devices to match this usage, and with the property names
stated above.
diff --git a/sky130/custom/models/diode.spice b/sky130/custom/models/diode.spice
index 81bee35..67744d6 100644
--- a/sky130/custom/models/diode.spice
+++ b/sky130/custom/models/diode.spice
@@ -1,9 +1,9 @@
* For diodes called as a subcircuit
* (backwards compatible with earlier PDK version)
.subckt sky130_fd_pr__diode_pw2nd N P a=0 p=0
-D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=a
+D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=a pj=p
.ends
* (corresponds to current PDK)
-.subckt sky130_fd_pr__diode_pw2nd_05v5 N P area=0
-D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=area
+.subckt sky130_fd_pr__diode_pw2nd_05v5 N P area=0 perimeter=0
+D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=area pj=perimeter
.ends
diff --git a/sky130/custom/scripts/fix_device_models.py b/sky130/custom/scripts/fix_device_models.py
index 90a8434..3cafe1f 100755
--- a/sky130/custom/scripts/fix_device_models.py
+++ b/sky130/custom/scripts/fix_device_models.py
@@ -40,10 +40,16 @@
# Check for incorrect resistor reference
smatch = shortrex.match(line)
if dmatch:
- fixedlines.append(re.sub('pw2nd', 'pw2nd_05v5', line))
+ fline = re.sub('pw2nd', 'pw2nd_05v5', line)
+ fline = re.sub('^X', 'D', fline)
+ fline = re.sub('a=', 'area=', fline)
+ fline = re.sub('p=', 'pj=', fline)
+ fixedlines.append(fline)
modified = True
elif smatch:
- fixedlines.append(re.sub('short', 'sky130_fd_pr__res_generic_po', line))
+ fline = re.sub('short', 'sky130_fd_pr__res_generic_po', line)
+ fline = re.sub('^X', 'R', fline)
+ fixedlines.append(fline)
modified = True
else:
fixedlines.append(line)