A number of changes, mostly to the SPICE libraries and netlists in support of Xyce (without compromising support for ngspice). Also: Additional Monte Carlo parameters were found in PSPICE format in the models and have been converted to something ngspice-compatible. The 11V NPN GDS cell name was changed to allow correct extraction from magic and prevent shadowing the model name. The Monte Carlo switch parameter behavior was changed again to make a separate set of library sections for mismatch-enabled corners vs. the original corners, which have been configured to have mismatch disabled. This avoids any requirement to add a parameter definition to every testbench for sky130. Xyce compatibility includes changing '$' comments to ';', which is also ngspice compatible, and adding the library section name after '.endl', which is also ngspice-compatible. Complete Xyce support requires a change to the all.spice file and calls to function agauss(), the solution to which has not yet been determined.
diff --git a/sky130/custom/scripts/mismatch_params.py b/sky130/custom/scripts/mismatch_params.py index eda8462..b6616d7 100755 --- a/sky130/custom/scripts/mismatch_params.py +++ b/sky130/custom/scripts/mismatch_params.py
@@ -69,6 +69,13 @@ print('') #-------------------------------------------------------------------- +# Create regexp for the alternative PSPICE "dev/gauss" syntax used in +# a number of places in the models. +#-------------------------------------------------------------------- + +gaussrex = re.compile('\'[ \t]+dev\/gauss=\'', re.IGNORECASE) + +#-------------------------------------------------------------------- # Step 2. Make replacements #-------------------------------------------------------------------- @@ -86,19 +93,25 @@ for line in infile: line_number += 1 + newline = line + + gmatch = gaussrex.search(newline) + if gmatch: + newline = gaussrex.sub('+' + mm_switch_param + '*AGAUSS(0,1.0,1)*', newline) + replaced_something = True + print(" Line {}: Found PSPICE dev/gauss and replaced.".format(line_number)) if state == 'before_mismatch': - outfile.write(line) - mmatch = mmrex.match(line) + outfile.write(newline) + mmatch = mmrex.match(newline) if mmatch: state = 'in_mismatch' elif state == 'in_mismatch': - outfile.write(line) - ematch = endrex.match(line) + outfile.write(newline) + ematch = endrex.match(newline) if ematch: state = 'after_mismatch' elif state == 'after_mismatch': - newline = line for (param, replacement) in mismatch_params: if param in newline: newline = newline.replace(param, replacement)