Add two macros TSTEP and TSTOP to XSPICE

This commit is contained in:
Holger Vogt 2025-08-16 09:24:45 +02:00
parent 724dc77b91
commit f1e234aa49
4 changed files with 14 additions and 0 deletions

View File

@ -333,6 +333,8 @@ typedef struct Mif_Circ_Data_s {
double frequency; /* Current analysis frequency */
double temperature; /* Current analysis temperature */
double t[8]; /* History of last 8 analysis times t[0]=time */
double tstep; /* tran simulation tstep */
double tstop; /* tran simulation tstop */
} Mif_Circ_Data_t;

View File

@ -101,6 +101,8 @@ TIME {return TOK_TIME;}
RAD_FREQ {return TOK_RAD_FREQ;}
TEMPERATURE {return TOK_TEMPERATURE;}
T {return TOK_T;}
TSTEP {return TOK_TSTEP;}
TSTOP {return TOK_TSTOP;}
LOAD {return TOK_LOAD;}
TOTAL_LOAD {return TOK_TOTAL_LOAD;}
MESSAGE {return TOK_MESSAGE;}

View File

@ -337,6 +337,8 @@ static void append (char *str)
%token TOK_RAD_FREQ
%token TOK_TEMPERATURE
%token TOK_T
%token TOK_TSTEP
%token TOK_TSTOP
%token TOK_PARAM
%token TOK_PARAM_SIZE
%token TOK_PARAM_NULL
@ -435,6 +437,10 @@ macro : TOK_INIT
{fprintf (mod_yyout, "mif_private->circuit.call_type");}
| TOK_TIME
{fprintf (mod_yyout, "mif_private->circuit.time");}
| TOK_TSTEP
{fprintf (mod_yyout, "mif_private->circuit.tstep");}
| TOK_TSTOP
{fprintf (mod_yyout, "mif_private->circuit.tstop");}
| TOK_RAD_FREQ
{fprintf (mod_yyout, "mif_private->circuit.frequency");}
| TOK_TEMPERATURE

View File

@ -194,6 +194,8 @@ MIFload(
/* otherwise, set the times to zero */
if(anal_type == MIF_TRAN) {
cm_data.circuit.time = ckt->CKTtime;
cm_data.circuit.tstep = ckt->CKTstep;
cm_data.circuit.tstop = ckt->CKTfinalTime;
cm_data.circuit.t[0] = ckt->CKTtime;
for(i = 1; i < 8; i++) {
cm_data.circuit.t[i] = cm_data.circuit.t[i-1] - ckt->CKTdeltaOld[i-1];
@ -203,6 +205,8 @@ MIFload(
}
else {
cm_data.circuit.time = 0.0;
cm_data.circuit.tstep = 0.0;
cm_data.circuit.tstop = 0.0;
for(i = 0; i < 8; i++) {
cm_data.circuit.t[i] = 0.0;
}