Revised several custom sky130 scripts to accept the option "-ef_format" and handle the syntax of the filesystem under libs.ref/ accordingly. Change only affects installations using EF_STYLE=1.
diff --git a/sky130/Makefile.in b/sky130/Makefile.in index a8ab1a4..81fcd3e 100644 --- a/sky130/Makefile.in +++ b/sky130/Makefile.in
@@ -818,7 +818,7 @@ # Install device subcircuits from vendor files ${STAGE} -source ${SKYWATER_LIBS_PATH} -target ${STAGING_PATH}/${SKY130A} \ -ngspice sky130_fd_pr/latest/models/* \ - filter=custom/scripts/rename_models.py \ + filter=custom/scripts/rename_models.py ${EF_FORMAT} \ 2>&1 | tee -a ${SKY130A}_make.log # Install device layouts from custom sources ${STAGE} -source ./custom -target ${STAGING_PATH}/${SKY130A} \ @@ -867,12 +867,12 @@ tail -39 ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/sky130_fd_pr__pnp_05v5_W3p40L3p40.model.spice >> ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/temp mv ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/temp ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/sky130_fd_pr__pnp_05v5_W3p40L3p40.model.spice # Custom: Add the PNP 3.4x3.4um device model to the includes in "all.spice" - ./custom/scripts/fix_spice_includes.py \ + ./custom/scripts/fix_spice_includes.py ${EF_FORMAT} \ ${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/all.spice \ 2>&1 | tee -a ${SKY130A}_make.log || true # Custom: Parse the (commented out) statistics blocks and generate # ngspice-compatible monte carlo parameters for mismatch and process - ./custom/scripts/mismatch_params.py \ + ./custom/scripts/mismatch_params.py ${EF_FORMAT} \ 2>&1 | tee -a ${SKY130A}_make.log || true ./custom/scripts/mismatch_params.py \ ${STAGING_PATH}/${SKY130A}/libs.tech/ngspice \ @@ -903,7 +903,7 @@ 2>&1 | tee -a ${SKY130A}_make.log || true # Custom: Add special device ID layers to bipolar layouts in magic # to make the extraction models correct. - ./custom/scripts/add_bipolar_ids.py \ + ./custom/scripts/add_bipolar_ids.py ${EF_FORMAT} \ 2>&1 | tee -a ${SKY130A}_make.log || true # Custom: Add "spinit" file
diff --git a/sky130/custom/scripts/add_bipolar_ids.py b/sky130/custom/scripts/add_bipolar_ids.py index 1668ef4..247d522 100755 --- a/sky130/custom/scripts/add_bipolar_ids.py +++ b/sky130/custom/scripts/add_bipolar_ids.py
@@ -11,10 +11,20 @@ import re import sys -magpath = 'sky130A/libs.ref/sky130_fd_pr/mag' +options = [] +arguments = [] +for item in sys.argv[1:]: + if item.find('-', 0) == 0: + options.append(item[1:]) + else: + arguments.append(item) -if len(sys.argv) > 1: - magpath = sys.argv[1] +magpath = 'sky130A/libs.ref/sky130_fd_pr/mag' +if len(options) > 0: + if options[0] == 'ef_format': + magpath = 'sky130A/libs.ref/mag/sky130_fd_pr' +elif len(arguments) > 0: + magpath = arguments[0] baserex = re.compile('<< [np]base >>')
diff --git a/sky130/custom/scripts/fix_spice_includes.py b/sky130/custom/scripts/fix_spice_includes.py index 7465786..1aaa0b5 100755 --- a/sky130/custom/scripts/fix_spice_includes.py +++ b/sky130/custom/scripts/fix_spice_includes.py
@@ -15,12 +15,25 @@ newdevs = [] newdevs.append('sky130_fd_pr__pnp_05v5_W3p40L3p40') -if len(sys.argv) <= 1: - print('Usage: fix_spice_includes.py <path_to_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) < 1: + print('Usage: fix_spice_includes.py <path_to_file> [-ef_format]') sys.exit(1) else: - infile_name = sys.argv[1] + infile_name = arguments[0] + + libpath = 'sky130_fd_pr/spice/' + if len(options) > 0: + if options[0] == 'ef_format': + libpath = 'spi/sky130_fd_pr/' filepath = os.path.split(infile_name)[0] outfile_name = os.path.join(filepath, 'temp') @@ -36,7 +49,7 @@ if 'pnp_05v5' in line: # Insert these additional lines for newdev in newdevs: - newline = '.include "../../libs.ref/sky130_fd_pr/spice/' + newdev + '.model.spice"\n' + newline = '.include "../../libs.ref/' + libpath + newdev + '.model.spice"\n' outfile.write(newline) replaced_something = True
diff --git a/sky130/custom/scripts/mismatch_params.py b/sky130/custom/scripts/mismatch_params.py index b6616d7..c370c56 100755 --- a/sky130/custom/scripts/mismatch_params.py +++ b/sky130/custom/scripts/mismatch_params.py
@@ -12,10 +12,21 @@ mm_switch_param = 'MC_MM_SWITCH' +options = [] +arguments = [] +for item in sys.argv[1:]: + if item.find('-', 0) == 0: + options.append(item[1:]) + else: + arguments.append(item) + walkpath = 'sky130A/libs.ref/sky130_fd_pr/spice' -if len(sys.argv) > 1: - walkpath = sys.argv[1] +if len(options) > 0: + if options[0] == 'ef_format': + walkpath = 'sky130A/libs.ref/spi/sky130_fd_pr' +elif len(arguments) > 0: + walkpath = arguments[0] mismatch_params = []
diff --git a/sky130/custom/scripts/rename_models.py b/sky130/custom/scripts/rename_models.py index 80e153c..b883be8 100755 --- a/sky130/custom/scripts/rename_models.py +++ b/sky130/custom/scripts/rename_models.py
@@ -14,7 +14,12 @@ import os import sys -def filter(inname, outname): +def filter(inname, outname, ef_format = True): + + if ef_format: + libpath = 'spi/sky130_fd_pr/' + else: + libpath = 'sky130_fd_pr/spice/' # Read input try: @@ -33,7 +38,7 @@ for line in spilines: # Fix: Replace "../cells/<name>/" with "../../libs.ref/sky130_fd_pr/spice/" - fixedline = re.sub('\.\./cells/[^/]+/', '../../libs.ref/sky130_fd_pr/spice/', line) + fixedline = re.sub('\.\./cells/[^/]+/', '../../libs.ref/' + libpath, line) # This subsitution makes SPICE files compatible with Xyce without # breaking ngspice compatibility ('$' comments changed to ';') @@ -82,11 +87,19 @@ if len(arguments) > 0: infilename = arguments[0] + else: + print('Usage: rename_models.py <filename> [<outfilename>] [-ef_format]') + sys.exit(1) if len(arguments) > 1: outfilename = arguments[1] else: outfilename = None - result = filter(infilename, outfilename) + ef_format = False + if len(options) > 0: + if options[0] == 'ef_format': + ef_format = True + + result = filter(infilename, outfilename, ef_format) sys.exit(result)