Feature Request 72 - "Printing hidden errors to terminal" suggests

showing errors in XSPICE code model support functions by default.
But errors may occur routinely and be handled by code.
To aid developers, setting variable "noisyxspice" will display the messages.

Also fix an error report in cm_event_queue(), remove XSPICE parse error
messages that are now shown twice and fix errors in d_source that
were seen with the new error reporting.
This commit is contained in:
Giles Atkinson 2026-05-07 18:54:12 +01:00
parent b649ab78b9
commit aedd8fc2a2
5 changed files with 24 additions and 13 deletions

View File

@ -240,10 +240,13 @@ int cm_event_queue(
here = g_mif_info.instance;
ckt = g_mif_info.ckt;
/* If breakpoint time <= current event time, return error */
if(time <= g_mif_info.circuit.evt_step) {
/* If breakpoint time < current event time, return error. */
if (time < g_mif_info.circuit.evt_step ||
(time == g_mif_info.circuit.evt_step &&
g_mif_info.circuit.call_type == MIF_EVENT_DRIVEN)) {
g_mif_info.errmsg =
"ERROR - cm_event_queue() - Event time cannot be <= current time\n";
"ERROR - cm_event_queue() - Event time cannot be <= current time\n";
return(MIF_ERROR);
}

View File

@ -159,7 +159,6 @@ int EVTload_with_event(
g_mif_info.ckt = ckt;
g_mif_info.instance = inst;
g_mif_info.errmsg = "";
g_mif_info.circuit.call_type = MIF_EVENT_DRIVEN;
if(inst->initialized)
@ -250,6 +249,13 @@ int EVTload_with_event(
mod_type = MIFmodPtr(inst)->MIFmodType;
DEVices[mod_type]->DEVpublic.cm_func (&cm_data);
if (g_mif_info.errmsg && g_mif_info.errmsg[0] &&
cp_getvar("noisyxspice", CP_BOOL, NULL, 0)) {
fprintf(stderr, "XSPICE instance %s: %s",
inst->MIFname, g_mif_info.errmsg);
g_mif_info.errmsg = NULL;
}
/* ****************************** */
/* Process the code model outputs */

View File

@ -1089,7 +1089,8 @@ void cm_d_source(ARGS)
/* reset current breakpoint */
test_double = loc->all_timepoints[*row_index];
cm_event_queue( test_double );
if (test_double != 0)
cm_event_queue( test_double );
/* Output new values... */
for (i=0; i<loc->width; i++) {
@ -1154,7 +1155,8 @@ void cm_d_source(ARGS)
/* reset current breakpoint */
test_double = loc->all_timepoints[*row_index] - 1.0e-10;
cm_event_queue( test_double );
if (TIME != test_double)
cm_event_queue( test_double );
/* Output new values... */
for (i=0; i<loc->width; i++) {

View File

@ -370,13 +370,11 @@ MIF_INP2A (
/* First, do a couple of error checks */
if(next_token_type == MIF_LARRAY_TOK) {
LITERR("ERROR - Scalar connection expected, [ found");
printf("ERROR - Scalar connection expected, [ found. Returning . . .");
gc_end();
return;
}
if(next_token_type == MIF_RARRAY_TOK) {
LITERR("ERROR - Unexpected ]");
printf("ERROR - Unexpected ]. Returning . . .");
gc_end();
return;
}
@ -412,7 +410,6 @@ MIF_INP2A (
/* check for required leading array delim character [ and eat it if found */
if(next_token_type != MIF_LARRAY_TOK) {
LITERR("Missing [, an array connection was expected");
printf("Missing [, an array connection was expected. Returning . . .");
gc_end();
return;
} else /* eat the [ */
@ -448,19 +445,16 @@ MIF_INP2A (
or hold a non-null connection (netname) */
if(next_token_type == MIF_NULL_TOK) {
LITERR("NULL connection found where not allowed");
printf("NULL connection found where not allowed. Returning . . .");
gc_end();
return;
}
if(next_token_type == MIF_LARRAY_TOK) {
LITERR("ERROR - Unexpected [ - Arrays of arrays not allowed");
printf("ERROR - Unexpected [ - Arrays of arrays not allowed. Returning . . .");
gc_end();
return;
}
if(next_token_type == MIF_RARRAY_TOK) {
LITERR("ERROR - Unexpected ]");
printf("ERROR - Unexpected ]. Returning . . .");
gc_end();
return;
}

View File

@ -245,7 +245,6 @@ MIFload(
/* Prepare the data needed by the cm_.. functions */
/* ***************************************************************** */
g_mif_info.instance = here;
g_mif_info.errmsg = "";
if(here->initialized) {
cm_data.circuit.init = MIF_FALSE;
@ -461,6 +460,13 @@ MIFload(
(g_mif_info.auto_partial.global || g_mif_info.auto_partial.local))
MIFauto_partial(here, DEVices[mod_type]->DEVpublic.cm_func, &cm_data);
if (g_mif_info.errmsg && g_mif_info.errmsg[0] &&
cp_getvar("noisyxspice", CP_BOOL, NULL, 0)) {
fprintf(stderr, "XSPICE instance %s: %s",
g_mif_info.instance->MIFname, g_mif_info.errmsg);
g_mif_info.errmsg = NULL;
}
/* ***************************************************************** */
/* Loop through all connections on this instance and */
/* load the data into the matrix for each output port */