Languages

CommunityCategory: MODELZENImporting the external parameter definitions from a SPICE/Spectre-format file

MODELZEN

Importing the external parameter definitions from a SPICE/Spectre-format file

SA Support Team Staff 2020-06-15

I have a circuit design whose SPICE netlist contains some external parameters. For instance, the transistor sizes of a unit inverter, the parasitic resistance and capacitance values of a unit-length wire, etc. are set as parameters, of which values are defined in a separate file, using the HSPICE .PARAM statement syntax.

When I try to generate a model from this circuit netlist using MODELZEN, I am getting an error message like:

*** ERROR: error while evaluating the parameter expression 'R=2*A' of the instance '__TOP__.R1':
    name 'A' is not defined

From the MODELZEN User Guide, I learned that I can define the values of these external parameters in the technology configuration file by setting the devo_option['ext_params'] option. For example:

devo_option['ext_params'] = dict(A=1.0, B=2.0, C=3.0)

sets the values of the external parameters A, B, and C.

But I have more than 100 parameters listed in my parameter file and I don't want to manually type them again into the Python syntax. Is there a way to just import the parameter definitions from a file?

1 Answers
Best Answer
SA Support Team Staff 2020-06-15

Yes, you can use the 'read_paramfile()' function within the technology configuration file to import the external parameter definitions from a file listing the parameter values either using the HSPICE's .PARAM statements or Spectre's parameters statements.

For example, if you insert the following line in the technology configuration file, MODELZEN will import the external parameter definitions from a file named "/path/my_param.sp", assuming the HSPICE format by default:

read_paramfile("/path/my_param.sp")

If the parameter definition file is described in the Spectre format, set the 'format' argument to 'spectre':

read_paramfile("/path/my_param.scs", format='spectre')

If the file contains multiple sets of parameter definitions declared as libraries or sections, you can select one of them by setting the 'section' argument:

read_paramfile("/path/my_param.sp", section='typ_lib')