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 - * vpiSetInteractiveScope -
*/ */
extern void vpi_control(PLI_INT32 operation, ...); extern void vpi_control(PLI_INT32 operation, ...);
#define vpiStop 1 /************* vpi_control() constants (added with 1364-2000) *************/
#define vpiFinish 2 #define vpiStop 66 /* execute simulator's $stop */
#define vpiReset 3 #define vpiFinish 67 /* execute simulator's $finish */
#define vpiSetInteractiveScope 4 #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. */ /* vpi_sim_control is the incorrect name for vpi_control. */
extern void vpi_sim_control(PLI_INT32 operation, ...); 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"; return "vpiTimeUnit";
case vpiTimePrecision: case vpiTimePrecision:
return "vpiTimePrecision"; return "vpiTimePrecision";
case vpiSize:
return "vpiSize";
default: default:
sprintf(buf, "%d", code); sprintf(buf, "%d", code);
} }
@ -1192,11 +1194,13 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap)
switch (operation) { switch (operation) {
case vpiFinish: case vpiFinish:
case __ivl_legacy_vpiFinish:
diag_msg = va_arg(ap, long); diag_msg = va_arg(ap, long);
schedule_finish(diag_msg); schedule_finish(diag_msg);
break; break;
case vpiStop: case vpiStop:
case __ivl_legacy_vpiStop:
diag_msg = va_arg(ap, long); diag_msg = va_arg(ap, long);
schedule_stop(diag_msg); schedule_stop(diag_msg);
break; break;