diff --git a/src/include/ngspice/evt.h b/src/include/ngspice/evt.h index 7dfb35c27..0f01779d5 100644 --- a/src/include/ngspice/evt.h +++ b/src/include/ngspice/evt.h @@ -91,35 +91,27 @@ struct Evt_Node_Info { }; struct Evt_Inst_Info { - Evt_Inst_Info_t *next; /* the next in the linked list of node info */ + Evt_Inst_Info_t *next; /* the next in the linked list */ MIFinstance *inst_ptr; /* Pointer to MIFinstance struct for this instance */ }; struct Evt_Info { - Evt_Inst_Info_t *inst_list; /* static info about event/hybrid instances */ - Evt_Node_Info_t *node_list; /* static info about event nodes */ - Evt_Port_Info_t *port_list; /* static info about event ports */ - Evt_Output_Info_t *output_list; /* static info about event outputs */ - int *hybrid_index; /* vector of inst indexs for hybrids */ - Evt_Inst_Info_t **inst_table; /* vector of pointers to elements in inst_list */ - Evt_Node_Info_t **node_table; /* vector of pointers to elements in node_list */ - Evt_Port_Info_t **port_table; /* vector of pointers to elements in port_list */ - Evt_Output_Info_t **output_table; /* vector of pointers to elements in output_list */ + Evt_Inst_Info_t *inst_list; /* static info about event instances */ + Evt_Node_Info_t *node_list; /* static info about event nodes */ + Evt_Port_Info_t *port_list; /* static info about event ports */ + Evt_Output_Info_t *output_list; /* static info about event outputs */ + MIFinstance **hybrids; /* vector of inst pointers for hybrids */ + Evt_Inst_Info_t **inst_table; /* vector of pointers to elements in inst_list */ + Evt_Node_Info_t **node_table; /* vector of pointers to elements in node_list */ + Evt_Port_Info_t **port_table; /* vector of pointers to elements in port_list */ + Evt_Output_Info_t **output_table; /* vector of pointers to elements in output_list */ }; - - - - - - /* *************** */ /* Queue structure */ /* *************** */ - - struct Evt_Inst_Event { Evt_Inst_Event_t *next; /* the next in the linked list */ double event_time; /* Time for this event to happen */ diff --git a/src/include/ngspice/evtproto.h b/src/include/ngspice/evtproto.h index f37bb0fa7..83066409b 100644 --- a/src/include/ngspice/evtproto.h +++ b/src/include/ngspice/evtproto.h @@ -92,7 +92,7 @@ void EVTqueue_inst( void EVTdequeue(CKTcircuit *ckt, double time); -int EVTload(CKTcircuit *ckt, int inst_index); +int EVTload(CKTcircuit *ckt, MIFinstance *inst); void EVTprint(wordlist *wl); void EVTprintvcd(wordlist *wl); diff --git a/src/xspice/evt/evtcall_hybrids.c b/src/xspice/evt/evtcall_hybrids.c index f8a82106c..1427b746d 100644 --- a/src/xspice/evt/evtcall_hybrids.c +++ b/src/xspice/evt/evtcall_hybrids.c @@ -60,18 +60,17 @@ void EVTcall_hybrids( CKTcircuit *ckt) /* the main circuit structure */ { - int i; - int num_hybrids; - - int *hybrid_index; + int i; + int num_hybrids; + MIFinstance **hybrids; /* Get needed data for fast access */ + num_hybrids = ckt->evt->counts.num_hybrids; - hybrid_index = ckt->evt->info.hybrid_index; + hybrids = ckt->evt->info.hybrids; /* Call EVTload for all hybrids */ for(i = 0; i < num_hybrids; i++) - EVTload(ckt, hybrid_index[i]); - + EVTload(ckt, hybrids[i]); } diff --git a/src/xspice/evt/evtdest.c b/src/xspice/evt/evtdest.c index c80367686..4fa4dfca9 100644 --- a/src/xspice/evt/evtdest.c +++ b/src/xspice/evt/evtdest.c @@ -330,5 +330,5 @@ Evt_Info_destroy(Evt_Info_t *info) } tfree(info->output_table); - tfree(info->hybrid_index); + tfree(info->hybrids); } diff --git a/src/xspice/evt/evtinit.c b/src/xspice/evt/evtinit.c index 283c1ea79..17883d8b1 100644 --- a/src/xspice/evt/evtinit.c +++ b/src/xspice/evt/evtinit.c @@ -207,7 +207,7 @@ static int EVTinit_info( Evt_Port_Info_t **port_table = NULL; Evt_Output_Info_t **output_table = NULL; - int *hybrid_index = NULL; + MIFinstance **hybrids = NULL; int num_hybrids; @@ -253,15 +253,14 @@ static int EVTinit_info( ckt->evt->info.output_table = output_table; - /* Allocate and create table of indexes into inst_table for hybrids */ + /* Allocate and create table of hybrids */ num_hybrids = ckt->evt->counts.num_hybrids; - CKALLOC(hybrid_index, num_hybrids, int) + CKALLOC(hybrids, num_hybrids, MIFinstance *) for(i = 0, j = 0; i < num_insts; i++) { if(inst_table[i]->inst_ptr->analog) - hybrid_index[j++] = i; + hybrids[j++] = inst_table[i]->inst_ptr; } - ckt->evt->info.hybrid_index = hybrid_index; - + ckt->evt->info.hybrids = hybrids; /* Return */ return(OK); diff --git a/src/xspice/evt/evtiter.c b/src/xspice/evt/evtiter.c index 7f906a355..f72573a5f 100644 --- a/src/xspice/evt/evtiter.c +++ b/src/xspice/evt/evtiter.c @@ -256,7 +256,7 @@ int EVTiter( for(i = 0; i < num_to_call; i++) { inst_index = inst_queue->to_call_index[i]; inst_queue->to_call[inst_index] = MIF_FALSE; - EVTload(ckt, inst_index); + EVTload(ckt, ckt->evt->info.inst_table[inst_index]->inst_ptr); } inst_queue->num_to_call = 0; diff --git a/src/xspice/evt/evtload.c b/src/xspice/evt/evtload.c index a2603e818..edce5e119 100644 --- a/src/xspice/evt/evtload.c +++ b/src/xspice/evt/evtload.c @@ -82,8 +82,8 @@ ignored. */ int EVTload( - CKTcircuit *ckt, /* The circuit structure */ - int inst_index) /* The instance to call code model for */ + CKTcircuit *ckt, /* The circuit structure */ + MIFinstance *inst) /* The instance to call */ { int i; @@ -96,10 +96,9 @@ int EVTload( Mif_Conn_Data_t *conn; Mif_Port_Data_t *port; Evt_Node_Data_t *node_data; - MIFinstance *inst; Mif_Private_t cm_data; - + void *value_ptr; /* ***************************** */ /* Prepare the code model inputs */ @@ -107,7 +106,7 @@ int EVTload( /* Get pointer to instance data structure and other data */ /* needed for fast access */ - inst = ckt->evt->info.inst_table[inst_index]->inst_ptr; + node_data = ckt->evt->data.node; /* Setup circuit data in struct to be passed to code model function */ @@ -145,8 +144,7 @@ int EVTload( /* create a new state for the instance */ if((g_mif_info.circuit.anal_type == MIF_TRAN) && inst->initialized) - EVTcreate_state(ckt, inst_index); - + EVTcreate_state(ckt, inst->inst_index); /* Loop through all connections on the instance and setup */ /* load, total_load, and msg on all ports, and changed flag */