bug fix, when `show' a xspice spice2poly device (acgains)

This commit is contained in:
rlar 2011-02-11 19:16:48 +00:00
parent a2303d4d78
commit f7f4bfe70f
5 changed files with 21 additions and 10 deletions

View File

@ -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

View File

@ -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;}

View File

@ -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");

View File

@ -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 */

View File

@ -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