Convert XSPICE's hybrid_index array to instance pointers.
That simplifies code and will be needed for irreversible code model support.
This commit is contained in:
parent
508fad0f55
commit
34e6c4abea
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,5 +330,5 @@ Evt_Info_destroy(Evt_Info_t *info)
|
|||
}
|
||||
tfree(info->output_table);
|
||||
|
||||
tfree(info->hybrid_index);
|
||||
tfree(info->hybrids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue