diff --git a/ChangeLog b/ChangeLog index 6d95cc019..06ecfaf9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-02-11 Robert Larice + * src/xspice/cmpp/mod_lex.l , + * src/xspice/cmpp/mod_yacc.y , + * src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod , + * src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs : + bug fix, when `show' a xspice spice2poly device (acgains) + 2011-02-11 Robert Larice * src/frontend/plotting/x11.c : bug fix a segfault when closing a second x11-window, then resizing the first diff --git a/src/xspice/cmpp/mod_lex.l b/src/xspice/cmpp/mod_lex.l index 948b4fc8e..1c438095b 100755 --- a/src/xspice/cmpp/mod_lex.l +++ b/src/xspice/cmpp/mod_lex.l @@ -88,6 +88,7 @@ AC_GAIN {return TOK_AC_GAIN;} OUTPUT_DELAY {return TOK_OUTPUT_DELAY;} STATIC_VAR {return TOK_STATIC_VAR;} STATIC_VAR_SIZE {return TOK_STATIC_VAR_SIZE;} +STATIC_VAR_INST {return TOK_STATIC_VAR_INST;} INPUT {return TOK_INPUT;} INPUT_STATE {return TOK_INPUT_STATE;} INPUT_TYPE {return TOK_INPUT_TYPE;} diff --git a/src/xspice/cmpp/mod_yacc.y b/src/xspice/cmpp/mod_yacc.y index 8cc748344..cdadc69fe 100755 --- a/src/xspice/cmpp/mod_yacc.y +++ b/src/xspice/cmpp/mod_yacc.y @@ -353,6 +353,7 @@ static void append (char *str) %token TOK_OUTPUT_DELAY %token TOK_STATIC_VAR %token TOK_STATIC_VAR_SIZE +%token TOK_STATIC_VAR_INST %token TOK_INPUT %token TOK_INPUT_STRENGTH %token TOK_INPUT_STATE @@ -492,6 +493,10 @@ macro : TOK_INIT {int i = valid_subid ($3, STATIC_VAR); fprintf (mod_yyout, "private->inst_var[%d]->size", i);} + | TOK_STATIC_VAR_INST TOK_LPAREN id TOK_RPAREN + {int i = valid_subid ($3, STATIC_VAR); + fprintf (mod_yyout, "private->inst_var[%d]", + i);} | TOK_OUTPUT_DELAY TOK_LPAREN subscriptable_id TOK_RPAREN {int i = valid_subid ($3, CONN); check_dir (i, OUT, "OUTPUT_DELAY"); diff --git a/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod b/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod index 7a23bf3a6..8bd0f5d63 100644 --- a/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod +++ b/src/xspice/icm/spice2poly/icm_spice2poly/cfunc.mod @@ -88,7 +88,6 @@ void spice2poly (ARGS) double sum; /* Temporary for accumulating sum of terms */ double product; /* Temporary for accumulating product */ - double *acgains; /* Static variable holding AC gains for AC analysis */ /* Get number of input values */ @@ -99,21 +98,19 @@ void spice2poly (ARGS) /* array */ if(INIT) { - acgains = (double *) malloc((size_t) num_inputs * sizeof(double)); + Mif_Inst_Var_Data_t *p = STATIC_VAR_INST(acgains); + p -> size = num_inputs; + p -> element = malloc((size_t) num_inputs * sizeof(Mif_Value_t)); for(i = 0; i < num_inputs; i++) - acgains[i] = 0.0; - STATIC_VAR(acgains) = acgains; + STATIC_VAR(acgains[i]) = 0.0; } - else - acgains = (double *) STATIC_VAR(acgains); /* If analysis type is AC, use the previously computed DC partials */ /* for the AC gains */ if(ANALYSIS == MIF_AC) { for(i = 0; i < num_inputs; i++) { - acgains = (double *) STATIC_VAR(acgains); - AC_GAIN(out,in[i]).real = acgains[i]; + AC_GAIN(out,in[i]).real = STATIC_VAR(acgains[i]); AC_GAIN(out,in[i]).imag = 0.0; } return; @@ -195,7 +192,7 @@ void spice2poly (ARGS) /* value in an AC analysis */ if(ANALYSIS == MIF_DC) - acgains[i] = sum; + STATIC_VAR(acgains[i]) = sum; } /* Free the allocated items and return */ diff --git a/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs b/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs index 33da52236..6aab4de10 100644 --- a/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs +++ b/src/xspice/icm/spice2poly/icm_spice2poly/ifspec.ifs @@ -71,5 +71,6 @@ Null_Allowed: no STATIC_VAR_TABLE: Static_Var_Name: acgains -Data_Type: pointer +Data_Type: real Description: "Partial derivatives from DC analysis used for AC gains" +Vector: yes