Slight optimization to the SRAM macro install, which allows the
SPICE netlists to be renames through a filter script instead of
calling out each file in the Makefile. That prevents the Makefile
from having to be updated whenever the SRAM macro repository
changes.
diff --git a/VERSION b/VERSION
index bd7c3ec..5f7bf9c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.177
+1.0.178
diff --git a/sky130/Makefile.in b/sky130/Makefile.in
index cc3bce0..2e29af7 100644
--- a/sky130/Makefile.in
+++ b/sky130/Makefile.in
@@ -1006,18 +1006,13 @@
sram-a:
# Install SRAM library. NOTE: SRAM macros share some of the same
# cell names, so use special option script gds_import_sram.tcl
+ # To do: Add option to process each GDS file individually in magic,
+ # instead of all at once.
${STAGE} -source ${SRAM_PATH}/.. -target ${STAGING_PATH}/${SKY130A} \
-lef %l/*/*.lef \
-lib %l/*/*.lib \
-gds %l/*/*.gds options=custom/scripts/gds_import_sram.tcl \
- -spice %l/*/sky130_sram_1kbyte_1rw1r_32x256_8.lvs.sp \
- rename=sky130_sram_1kbyte_1rw1r_32x256_8.spice \
- -spice %l/*/sky130_sram_2kbyte_1rw1r_32x512_8.lvs.sp \
- rename=sky130_sram_2kbyte_1rw1r_32x512_8.spice \
- -spice %l/*/sky130_sram_4kbyte_1rw1r_32x1024_8.lvs.sp \
- rename=sky130_sram_4kbyte_1rw1r_32x1024_8.spice \
- -spice %l/*/sram_1rw1r_32_256_8_sky130.lvs.sp \
- rename=sram_1rw1r_32_256_8_sky130.spice \
+ -spice %l/*/*.lvs.sp filter=custom/scripts/sp_to_spice.py \
-verilog %l/*/*.v \
-library general sky130_sram_macros 2>&1 | tee -a ${SKY130A}_make.log
diff --git a/sky130/custom/scripts/gds_import_sram.tcl b/sky130/custom/scripts/gds_import_sram.tcl
index c84332f..f4c3ace 100644
--- a/sky130/custom/scripts/gds_import_sram.tcl
+++ b/sky130/custom/scripts/gds_import_sram.tcl
@@ -2,5 +2,5 @@
# TXT purpose (5) as pins, which is unfortunately done in a lot of the
# vendor GDS files.
cif istyle sky130(vendor)
-# Ensure unique cell names when reading multiple GDS files.
-calma unique on
+# Ensure unique cell names when reading multiple GDS files
+calma unique true
diff --git a/sky130/custom/scripts/sp_to_spice.py b/sky130/custom/scripts/sp_to_spice.py
new file mode 100755
index 0000000..bbcc641
--- /dev/null
+++ b/sky130/custom/scripts/sp_to_spice.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+#
+# sp_to_spice ---
+#
+# This script runs as a filter to foundry_install.sh and converts file
+# names ending with ".sp" to ".spice". If the file has multiple extensions
+# then all are stripped before adding ".spice".
+#
+# This script is a filter to be run by setting the name of this script as
+# the value to "filter=" for the model install in the sky130 Makefile.
+
+import os
+import sys
+
+def filter(inname):
+
+ filepath = os.path.split(inname)[0]
+ filename = os.path.split(inname)[1]
+
+ filebits = filename.split('.')
+ newname = filebits[0] + '.spice'
+ outname = os.path.join(filepath, newname)
+ if not os.path.isfile(inname):
+ print('No such file ' + inname)
+ return 1
+
+ print('Renaming file ' + filename + ' to ' + newname)
+ os.rename(inname, outname)
+ return 0
+
+if __name__ == '__main__':
+
+ # This script expects to get one argument, which is the input file.
+ # The script renames the file.
+
+ options = []
+ arguments = []
+ for item in sys.argv[1:]:
+ if item.find('-', 0) == 0:
+ options.append(item[1:])
+ else:
+ arguments.append(item)
+
+ if len(arguments) > 0:
+ infilename = arguments[0]
+ else:
+ sys.exit(1)
+
+ result = filter(infilename)
+ sys.exit(result)