From 4e925018645a7510977b4be21b45447f13869e9c Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 25 Oct 2001 04:19:53 +0000 Subject: [PATCH] VPI support for callback to return values. --- vpi/sys_display.c | 9 ++++++++- vpi/sys_vcd.c | 6 +++++- vvp/vpi_callback.cc | 16 +++++++++++++++- vvp/vthread.cc | 6 ++++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 396b54b15..2fcd9c63f 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: sys_display.c,v 1.29 2001/08/16 03:26:04 steve Exp $" +#ident "$Id: sys_display.c,v 1.30 2001/10/25 04:19:53 steve Exp $" #endif # include "config.h" @@ -318,6 +318,7 @@ static int sys_strobe_calltf(char*name) cb.cb_rtn = strobe_cb; cb.time = &time; cb.obj = 0; + cb.value = 0; cb.user_data = (char*)info; vpi_register_cb(&cb); return 0; @@ -358,6 +359,7 @@ static int monitor_cb_1(p_cb_data cause) cb.cb_rtn = monitor_cb_1; cb.time = &time; cb.obj = cause->obj; + cb.value = 0; cb.user_data = cause->user_data; *cbh = vpi_register_cb(&cb); @@ -375,6 +377,7 @@ static int monitor_cb_1(p_cb_data cause) cb.cb_rtn = monitor_cb_2; cb.time = &time; cb.obj = 0; + cb.value = 0; vpi_register_cb(&cb); return 0; @@ -415,6 +418,7 @@ static int sys_monitor_calltf(char*name) cb.reason = cbValueChange; cb.cb_rtn = monitor_cb_1; cb.time = &time; + cb.value = NULL; for (idx = 0 ; idx < monitor_info.nitems ; idx += 1) { switch (vpi_get(vpiType, monitor_info.items[idx])) { @@ -741,6 +745,9 @@ void sys_display_register() /* * $Log: sys_display.c,v $ + * Revision 1.30 2001/10/25 04:19:53 steve + * VPI support for callback to return values. + * * Revision 1.29 2001/08/16 03:26:04 steve * Add some missing print escape sequences. * diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index f635da9b4..d9c976baa 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: sys_vcd.c,v 1.24 2001/10/15 01:50:23 steve Exp $" +#ident "$Id: sys_vcd.c,v 1.25 2001/10/25 04:19:53 steve Exp $" #endif # include "config.h" @@ -570,6 +570,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) cb.time = &info->time; cb.user_data = (char*)info; + cb.value = NULL; cb.obj = item; cb.reason = cbValueChange; cb.cb_rtn = variable_cb; @@ -781,6 +782,9 @@ void sys_vcd_register() /* * $Log: sys_vcd.c,v $ + * Revision 1.25 2001/10/25 04:19:53 steve + * VPI support for callback to return values. + * * Revision 1.24 2001/10/15 01:50:23 steve * Include scope information in VCD output. * diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index 3530ea164..2a0f1d5f9 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_callback.cc,v 1.7 2001/10/12 03:00:09 steve Exp $" +#ident "$Id: vpi_callback.cc,v 1.8 2001/10/25 04:19:53 steve Exp $" #endif /* @@ -243,6 +243,17 @@ void vvp_cb_fobj_s::set(vvp_ipoint_t i, functor_t f, bool push) while (next) { struct __vpiCallback * cur = next; next = cur->next; + if (cur->cb_data.value) { + switch (cur->cb_data.value->format) { + case vpiScalarVal: + cur->cb_data.value->value.scalar = f->ival & 3; + break; + case vpiSuppressVal: + break; + default: + fprintf(stderr, "vpi_callback: value format %d not supported\n", cur->cb_data.value->format); + } + } cur->cb_data.time->type = vpiSimTime; cur->cb_data.time->low = schedule_simtime(); cur->cb_data.time->high = 0; @@ -260,6 +271,9 @@ void vpip_trip_monitor_callbacks(void) /* * $Log: vpi_callback.cc,v $ + * Revision 1.8 2001/10/25 04:19:53 steve + * VPI support for callback to return values. + * * Revision 1.7 2001/10/12 03:00:09 steve * M42 implementation of mode 2 (Stephan Boettcher) * diff --git a/vvp/vthread.cc b/vvp/vthread.cc index d9418999b..4190de4a8 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vthread.cc,v 1.60 2001/10/23 03:49:13 steve Exp $" +#ident "$Id: vthread.cc,v 1.61 2001/10/25 04:19:53 steve Exp $" #endif # include "vthread.h" @@ -142,7 +142,6 @@ unsigned vthread_get_bit(struct vthread_s*thr, unsigned addr) void vthread_put_bit(struct vthread_s*thr, unsigned addr, unsigned bit) { - thr_check_addr(thr, addr); thr_put_bit(thr, addr, bit); } @@ -1673,6 +1672,9 @@ bool of_ZOMBIE(vthread_t thr, vvp_code_t) /* * $Log: vthread.cc,v $ + * Revision 1.61 2001/10/25 04:19:53 steve + * VPI support for callback to return values. + * * Revision 1.60 2001/10/23 03:49:13 steve * Fix carry between works for %add instruction. *