From d090fd7a1737b85034f5a811110a217751f5cd8e Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 29 Oct 2009 11:16:26 -0700 Subject: [PATCH] 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. (cherry picked from commit 711365521d8d7f2637967114c184e717357abc4e) --- vpi_user.h | 11 +++++++---- vvp/vpi_priv.cc | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/vpi_user.h b/vpi_user.h index 3c0ba4ae7..14255b6a8 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -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, ...); diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 74acb2c13..862828c0a 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -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;