Added a script to modify the "all.spice" file and add the missing 3.4um x 3.4um emitter PNP device.
diff --git a/sky130/Makefile.in b/sky130/Makefile.in index 8af2b50..a8ab1a4 100644 --- a/sky130/Makefile.in +++ b/sky130/Makefile.in
@@ -866,6 +866,10 @@ head -15 ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/sky130_fd_pr__pnp_05v5_W3p40L3p40.model.spice > ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE}/temp 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 \ + ${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 \
diff --git a/sky130/custom/scripts/fix_spice_includes.py b/sky130/custom/scripts/fix_spice_includes.py new file mode 100755 index 0000000..7465786 --- /dev/null +++ b/sky130/custom/scripts/fix_spice_includes.py
@@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# +#-------------------------------------------------------------------- +# fix_spice_includes.py--- +# +# This script patches the "all.spice" file to add include statements +# for several devices that got left out (namely the PNP and NPN +# devices). +#-------------------------------------------------------------------- + +import os +import re +import sys + +newdevs = [] +newdevs.append('sky130_fd_pr__pnp_05v5_W3p40L3p40') + +if len(sys.argv) <= 1: + print('Usage: fix_spice_includes.py <path_to_file>') + sys.exit(1) + +else: + infile_name = sys.argv[1] + + filepath = os.path.split(infile_name)[0] + outfile_name = os.path.join(filepath, 'temp') + + infile = open(infile_name, 'r') + outfile = open(outfile_name, 'w') + + line_number = 0 + replaced_something = False + for line in infile: + line_number += 1 + + 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' + outfile.write(newline) + replaced_something = True + + newline = line + outfile.write(newline) + + infile.close() + outfile.close() + if replaced_something: + print("Something was replaced in '{}'".format(infile_name)) + os.rename(outfile_name, infile_name) + else: + print("Nothing was replaced in '{}'.".format(infile_name)) + os.remove(outfile_name) +