Add function cm_get_neg_node_name

as cm_get_node_name delivers only the pos node.
This commit is contained in:
Holger Vogt 2025-06-04 12:31:13 +02:00
parent b57ef4a42d
commit b7d434550a
5 changed files with 35 additions and 0 deletions

View File

@ -99,6 +99,7 @@ double cm_netlist_get_l(void);
void cm_irreversible(unsigned int);
const char *cm_get_node_name(const char *, unsigned int);
const char *cm_get_neg_node_name(const char *, unsigned int);
bool cm_probe_node(unsigned int, unsigned int, void *);
bool cm_schedule_output(unsigned int, unsigned int, double, void *);

View File

@ -61,6 +61,7 @@ struct coreInfo_t {
double ((*dllitf_cm_netlist_get_l)(void));
void ((*dllitf_cm_irreversible)(unsigned int));
const char * ((*dllitf_cm_get_node_name)(const char *, unsigned int));
const char* ((*dllitf_cm_get_neg_node_name)(const char*, unsigned int));
bool ((*dllitf_cm_probe_node)(unsigned int, unsigned int,
void *));
bool ((*dllitf_cm_schedule_output)(unsigned int, unsigned int,

View File

@ -40,6 +40,7 @@ INTERFACES
cm_irreversible()
cm_get_node_name()
cm_get_neg_node_name()
cm_probe_node()
REFERENCED FILES
@ -852,6 +853,33 @@ const char *cm_get_node_name(const char *port_name, unsigned int index)
return NULL;
}
/* Get the neg name of a circuit node connected to a port. */
const char* cm_get_neg_node_name(const char* port_name, unsigned int index)
{
MIFinstance* instance;
Mif_Conn_Data_t* conn;
Mif_Port_Data_t* port;
int i;
instance = g_mif_info.instance;
for (i = 0; i < instance->num_conn; ++i) {
conn = instance->conn[i];
if (!strcmp(port_name, conn->name)) {
if (index >= (unsigned int)conn->size)
return NULL;
port = conn->port[index];
if (port->type == MIF_DIGITAL || port->type == MIF_USER_DEFINED) {
/* Event node, no name in port data. */
return NULL;
}
return port->neg_node_str;
}
}
return NULL;
}
/* Test the resolved value of a connected Digital/UDN node, given
* an assumed value for a particular port.
*/

View File

@ -60,6 +60,7 @@ struct coreInfo_t coreInfo =
cm_netlist_get_l,
cm_irreversible,
cm_get_node_name,
cm_get_neg_node_name,
cm_probe_node,
cm_schedule_output,
cp_getvar,

View File

@ -350,6 +350,10 @@ const char *cm_get_node_name(const char *port, unsigned int index) {
return coreitf->dllitf_cm_get_node_name(port, index);
}
const char *cm_get_neg_node_name(const char *port, unsigned int index) {
return coreitf->dllitf_cm_get_neg_node_name(port, index);
}
bool cm_probe_node(unsigned int conn_index,
unsigned int port_index,
void *value) {