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)