Make the 'Null_Allowed' option for XSPICE code model parameters

behave as reasonably expected and as described in the manual.
Previously a missing (null) value was always accepted if the ifsspec.ifs
file contained a default value, and several of the the included
code models worked that way.  Where there was a useful default,
"no" has channged to "yes".  Some models with a look-up table defined
by two parameters had such defaults that did nothing useful. Thay have
been given useful vector defaults.  These changes should not affect
previously-working netlists.
This commit is contained in:
Giles Atkinson 2023-09-12 16:22:43 +01:00 committed by Holger Vogt
parent df71478cbc
commit 8347e59667
17 changed files with 228 additions and 215 deletions

View File

@ -719,7 +719,17 @@ static int write_param_info(
p_param_cur->default_value_cnt = 0;
continue;
}
rc |= fprintf(fp, "static union Mif_Parse_Value %s_default[] = {\n",
if (!p_param_cur->null_allowed) {
fprintf(stderr,
"Default value given for parameter %s but "
"the user must set instance value (Null_Allowed: no).",
p_param_cur->name);
return 1;
}
rc |= fprintf(fp,
"static union Mif_Parse_Value %s_default[] = {\n",
p_param_cur->name);
do { // Write the default values for this parameter.

View File

@ -15,7 +15,7 @@ AUTHORS
SUMMARY
This file contains the interface specification file for the
This file contains the interface specification file for the
analog multi-input gate pwl code model.
===============================================================================*/
@ -44,7 +44,7 @@ PARAMETER_TABLE:
Parameter_Name: x y model
Description: "x array" "y array" "model type"
Data_Type: real real string
Default_Value: 0.0 0.0 "and"
Default_Value: - - "and"
Limits: - - -
Vector: yes yes no
Vector_Bounds: [2 -] [2 -] -

View File

@ -6,14 +6,14 @@ Georgia Tech Research Corporation
Atlanta, Georgia 30332
AUTHORS
AUTHORS
20 Mar 1991 Harry Li
SUMMARY
This file contains the interface specification file for the
This file contains the interface specification file for the
analog oneshot code model.
===============================================================================*/
@ -28,92 +28,92 @@ Description: "one-shot"
PORT_TABLE:
Port_Name: clk cntl_in
Description: "clock input" "input"
Direction: in in
Port_Name: clk cntl_in
Description: "clock input" "input"
Direction: in in
Default_Type: v v
Allowed_Types: [v,vd,vnam,i,id] [v,vnam,vd,i,id]
Vector: no no
Vector_Bounds: - -
Null_Allowed: no yes
Allowed_Types: [v,vd,vnam,i,id] [v,vnam,vd,i,id]
Vector: no no
Vector_Bounds: - -
Null_Allowed: no yes
PORT_TABLE:
Port_Name: clear out
Description: "clear signal" "output"
Direction: in out
Direction: in out
Default_Type: v v
Allowed_Types: [v,vd,vnam,i,id] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Allowed_Types: [v,vd,vnam,i,id] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes no
PARAMETER_TABLE:
Parameter_Name: cntl_array pw_array
Parameter_Name: cntl_array pw_array
Description: "control in array" "pulse width array"
Data_Type: real real
Default_Value: 0.0 1.0e-6
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Data_Type: real real
Default_Value: [0.0 1.0] [1.0e-6 0.9999999]
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: clk_trig pos_edge_trig
Description: "clock trigger value" "pos/neg edge trigger switch"
Data_Type: real boolean
Default_Value: 0.5 TRUE
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
Data_Type: real boolean
Default_Value: 0.5 TRUE
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: out_low out_high
Description: "output low value" "output high value"
Data_Type: real real
Default_Value: 0.0 1.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Data_Type: real real
Default_Value: 0.0 1.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: rise_time
Description: "output rise time"
Data_Type: real
Default_Value: 1.0e-9
Limits: -
Vector: no
Vector_Bounds: -
Description: "output rise time"
Data_Type: real
Default_Value: 1.0e-9
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: rise_delay fall_delay
Description: "output delay from trigger" "output delay from pw"
Data_Type: real real
Default_Value: 1.0e-9 1.0e-9
Parameter_Name: rise_delay fall_delay
Description: "output delay from trigger" "output delay from pw"
Data_Type: real real
Default_Value: 1.0e-9 1.0e-9
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: fall_time retrig
Description: "output rise time" "retrigger switch"
Description: "output rise time" "retrigger switch"
Data_Type: real boolean
Default_Value: 1.0e-9 FALSE
Limits: - -
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes

View File

@ -33,8 +33,8 @@ Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types: [v,vd,i,id,vnam] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
PARAMETER_TABLE:
@ -42,11 +42,11 @@ PARAMETER_TABLE:
Parameter_Name: cntl_array freq_array
Description: "control in array" "frequency array"
Data_Type: real real
Default_Value: 0.0 1.0e3
Default_Value: [0.0 1.0] [1.0e3 2.0e3]
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -56,7 +56,6 @@ Description: "output low value" "output high value"
Data_Type: real real
Default_Value: -1.0 1.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes

View File

@ -33,8 +33,8 @@ Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types: [v,vd,i,id,vnam] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
PARAMETER_TABLE:
@ -42,11 +42,11 @@ PARAMETER_TABLE:
Parameter_Name: cntl_array freq_array
Description: "control in array" "frequency array"
Data_Type: real real
Default_Value: 0.0 1.0e3
Default_Value: [0.0 1.0] [1.0e3 2.0e3]
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -56,8 +56,8 @@ Description: "output low value" "output high value"
Data_Type: real real
Default_Value: -1.0 1.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -67,8 +67,8 @@ Description: "duty cycle" "rise time"
Data_Type: real real
Default_Value: 0.5 1.0e-9
Limits: [1e-6 .999999] -
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -78,8 +78,8 @@ Description: "fall time"
Data_Type: real
Default_Value: 1.0e-9
Limits: -
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes

View File

@ -28,25 +28,25 @@ Description: "controlled triangle wave oscillator"
PORT_TABLE:
Port_Name: cntl_in out
Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types: [v,vd,i,id,vnam] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
Port_Name: cntl_in out
Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types: [v,vd,i,id,vnam] [v,vd,i,id]
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
PARAMETER_TABLE:
Parameter_Name: cntl_array freq_array
Description: "control in array" "frequency array"
Data_Type: real real
Default_Value: 0.0 1.0e3
Default_Value: [0.0 1.0] [1.0e3 2.0e3]
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:

View File

@ -64,7 +64,7 @@ PARAMETER_TABLE:
Parameter_Name: table_values
Description: "lookup table values"
Data_Type: string
Default_Value: "0"
Default_Value: -
Limits: -
Vector: no
Vector_Bounds: -

View File

@ -55,8 +55,8 @@ Description: "input load value (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
@ -64,10 +64,10 @@ PARAMETER_TABLE:
Parameter_Name: table_values
Description: "lookup table values"
Data_Type: string
Default_Value: "0"
Default_Value: -
Limits: -
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
STATIC_VAR_TABLE:

View File

@ -32,8 +32,8 @@ Description: "control input" "output"
Direction: in out
Default_Type: v d
Allowed_Types: [v,vd,i,id] [d]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
@ -43,11 +43,11 @@ PARAMETER_TABLE:
Parameter_Name: cntl_array freq_array
Description: "control array" "frequency array"
Data_Type: real real
Default_Value: 0.0 1.0e6
Default_Value: [0.0 1.0] [1.0e6 2.0e6]
Limits: - [0 -]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:

View File

@ -34,8 +34,8 @@ Description: "control input" "output"
Direction: in out
Default_Type: v d
Allowed_Types: [v,vd,i,id] [d]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
@ -45,11 +45,11 @@ PARAMETER_TABLE:
Parameter_Name: cntl_array dc_array
Description: "control array" "duty cycle array"
Data_Type: real real
Default_Value: 0.0 0.5
Limits: - [0 1]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: no no
Default_Value: [-1 1] [0 1]
Limits: - [0 1]
Vector: yes yes
Vector_Bounds: [2 -] [2 -]
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -59,9 +59,9 @@ Description: "oscillator frequency" "initial phase of output"
Data_Type: real real
Default_Value: 1e6 0
Limits: [1e-6 -] [-180.0 +360.0]
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -71,9 +71,9 @@ Description: "rise delay" "fall delay"
Data_Type: real real
Default_Value: 1e-9 1e-9
Limits: [0 -] [0 -]
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
STATIC_VAR_TABLE:

View File

@ -14,7 +14,7 @@ AUTHORS
SUMMARY
This file contains the interface specification file for the
This file contains the interface specification file for the
digital d_source code model.
===============================================================================*/
@ -33,8 +33,8 @@ Description: "output"
Direction: out
Default_Type: d
Allowed_Types: [d]
Vector: yes
Vector_Bounds: -
Vector: yes
Vector_Bounds: -
Null_Allowed: no
@ -42,25 +42,25 @@ Null_Allowed: no
PARAMETER_TABLE:
Parameter_Name: input_file
Description: "digital input vector filename"
Data_Type: string
Default_Value: "source.txt"
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "digital input vector filename"
Data_Type: string
Default_Value: "source.txt"
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: input_load
Description: "input loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "input loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
STATIC_VAR_TABLE:

View File

@ -13,7 +13,7 @@ AUTHORS
SUMMARY
This file contains the interface specification file for the
This file contains the interface specification file for the
digital d_state (state machine) code model.
===============================================================================*/
@ -35,8 +35,8 @@ Description: "input" "clock"
Direction: in in
Default_Type: d d
Allowed_Types: [d] [d]
Vector: yes no
Vector_Bounds: - -
Vector: yes no
Vector_Bounds: - -
Null_Allowed: yes no
@ -48,8 +48,8 @@ Description: "reset" "output"
Direction: in out
Default_Type: d d
Allowed_Types: [d] [d]
Vector: no yes
Vector_Bounds: - [1 -]
Vector: no yes
Vector_Bounds: - [1 -]
Null_Allowed: yes no
@ -61,73 +61,75 @@ Parameter_Name: clk_delay reset_delay
Description: "delay from CLK" "delay from reset"
Data_Type: real real
Default_Value: 1.0e-9 1.0e-9
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
Parameter_Name: state_file
Description: "state transition specification file name"
Data_Type: string
Default_Value: "state.txt"
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "state transition specification file name"
Data_Type: string
Default_Value: "state.txt"
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: reset_state
Description: "default state on RESET & at DC"
Data_Type: int
Default_Value: 0
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "default state on RESET & at DC"
Data_Type: int
Default_Value: 0
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: input_load
Description: "input loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "input loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: clk_load
Description: "clock loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "clock loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
PARAMETER_TABLE:
Parameter_Name: reset_load
Description: "reset loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
Description: "reset loading capacitance (F)"
Data_Type: real
Default_Value: 1.0e-12
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
STATIC_VAR_TABLE:

View File

@ -51,8 +51,8 @@ Description: "capacitor terminals"
Direction: inout
Default_Type: hd
Allowed_Types: [hd]
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
@ -63,9 +63,6 @@ Description: "capacitance" "voltage initial condition"
Data_Type: real real
Default_Value: - 0.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
Vector: no no
Vector_Bounds: - -
Null_Allowed: no yes

View File

@ -51,8 +51,8 @@ Description: "inductor terminals"
Direction: inout
Default_Type: gd
Allowed_Types: [gd]
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
@ -63,8 +63,8 @@ Description: "inductance" "current initial condition"
Data_Type: real real
Default_Value: - 0.0
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
Vector: no no
Vector_Bounds: - -
Null_Allowed: no yes

View File

@ -25,10 +25,10 @@ SUMMARY
This file contains the definition of a memristor code model
with threshold according to
Y. V. Pershin, M. Di Ventra: "SPICE model of memristive devices with threshold",
arXiv:1204.2600v1 [physics.comp-ph] 12 Apr 2012,
Y. V. Pershin, M. Di Ventra: "SPICE model of memristive devices with threshold",
arXiv:1204.2600v1 [physics.comp-ph] 12 Apr 2012,
http://arxiv.org/pdf/1204.2600.pdf.
** Experimental, still to be tested in circuits !! **
INTERFACES
@ -59,8 +59,8 @@ Description: "memristor terminals"
Direction: inout
Default_Type: gd
Allowed_Types: [gd]
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
@ -71,9 +71,9 @@ Description: "minimum resistance" "maximum resistance" "initial
Data_Type: real real real
Default_Value: 10.0 10000.0 7000.0
Limits: - - -
Vector: no no no
Vector_Bounds: - - -
Null_Allowed: no no no
Vector: no no no
Vector_Bounds: - - -
Null_Allowed: yes yes yes
PARAMETER_TABLE:
@ -84,6 +84,6 @@ Default_Value: 0.0 1.0 0.0
Limits: - - -
Vector: no no no
Vector_Bounds: - - -
Null_Allowed: no no no
Null_Allowed: yes yes yes

View File

@ -36,8 +36,8 @@ Description: "diode port"
Direction: inout
Default_Type: gd
Allowed_Types: [gd]
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: no
@ -49,9 +49,9 @@ Description: "resistance on-state" "resistance off-state"
Data_Type: real real
Default_Value: 1 1
Limits: [1e-6 - ] [1e-12 -]
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
PARAMETER_TABLE:
@ -61,7 +61,7 @@ Description: "forward voltage" "reverse breakdown voltage"
Data_Type: real real
Default_Value: 0. 1e30
Limits: [0. -] [0. -]
Vector: no no
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
@ -74,8 +74,8 @@ Description: "limit of on-current" "limit of breakdown current"
Data_Type: real real
Default_Value: 1e30 1e30
Limits: [1e-15 -] [1e-15 -]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
@ -86,8 +86,8 @@ Description: "width quadrat. r 1" "width quadratic region 2"
Data_Type: real real
Default_Value: 0. 0.
Limits: [0. -] [0. -]
Vector: no no
Vector_Bounds: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
@ -99,8 +99,8 @@ Description: "resistance in breakdown"
Data_Type: real
Default_Value: 0.
Limits: -
Vector: no
Vector_Bounds: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes

View File

@ -567,28 +567,33 @@ MIF_INP2A (
param_info = &(DEVices[type]->DEVpublic.param[i]);
if(mdfast->param[i]->is_null) {
char* emessage;
if (mdfast->param[i]->is_null) {
char* emessage = NULL;
if(param_info->default_value_siz == 0) {
if (!param_info->null_allowed) {
emessage = tprintf("Null not allowed for parameter %s "
"on model %s.",
param_info->name, mdfast->gen.GENmodName);
} else if (param_info->default_value_siz == 0) {
if (param_info->type == MIF_STRING)
continue; // Allow NULL
emessage = tprintf("Parameter %s on model %s has no default",
param_info->name, mdfast->gen.GENmodName);
}
if (emessage) {
LITERR(emessage);
tfree(emessage);
gc_end();
return;
}
}
if((! mdfast->param[i]->is_null) && (param_info->is_array)) {
if(param_info->has_conn_ref) {
if(fast[0]->conn[param_info->conn_ref]->size != fast[0]->param[i]->size) {
LITERR("Array parameter size on model does not match connection size");
gc_end();
return;
}
}
} else if (param_info->is_array && param_info->has_conn_ref &&
fast[0]->conn[param_info->conn_ref]->size !=
fast[0]->param[i]->size) {
LITERR("Array parameter size on model does not match "
"connection size");
gc_end();
return;
}
}
gc_end();