Fix vpi_control operation codes to be standard

Apparently, the vpi_user.h definitions for vpiStop et al were added
before they were standardized by 1364-2000, and never corrected.
Change the values to be standard. (Submitted by Matt Trostel.)

I also added some binary compatibility for existing .vpi modules
that were compiled with the older constant values.
This commit is contained in:
Stephen Williams 2009-10-29 11:16:26 -07:00
parent cf2f99ec3d
commit 711365521d
2 changed files with 11 additions and 4 deletions

View File

@ -469,10 +469,13 @@ extern PLI_INT32 vpi_remove_cb(vpiHandle ref);
* vpiSetInteractiveScope -
*/
extern void vpi_control(PLI_INT32 operation, ...);
#define vpiStop 1
#define vpiFinish 2
#define vpiReset 3
#define vpiSetInteractiveScope 4
/************* vpi_control() constants (added with 1364-2000) *************/
#define vpiStop 66 /* execute simulator's $stop */
#define vpiFinish 67 /* execute simulator's $finish */
#define vpiReset 68 /* execute simulator's $reset */
#define vpiSetInteractiveScope 69 /* set simulator's interactive scope */
#define __ivl_legacy_vpiStop 1
#define __ivl_legacy_vpiFinish 2
/* vpi_sim_control is the incorrect name for vpi_control. */
extern void vpi_sim_control(PLI_INT32 operation, ...);

View File

@ -203,6 +203,8 @@ static const char* vpi_property_str(PLI_INT32 code)
return "vpiTimeUnit";
case vpiTimePrecision:
return "vpiTimePrecision";
case vpiSize:
return "vpiSize";
default:
sprintf(buf, "%d", code);
}
@ -1192,11 +1194,13 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap)
switch (operation) {
case vpiFinish:
case __ivl_legacy_vpiFinish:
diag_msg = va_arg(ap, long);
schedule_finish(diag_msg);
break;
case vpiStop:
case __ivl_legacy_vpiStop:
diag_msg = va_arg(ap, long);
schedule_stop(diag_msg);
break;