From 6f1445ff9d4161c715325e75ea23c0eed17e29e0 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 10 Mar 2008 22:18:41 -0700 Subject: [PATCH] Minor cleanup of vpi_put_value to wire Comments to clarify the vpiForceFlag and vpiReleaseFlag behaviors. --- vvp/vpi_signal.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index a94cd768a..c466550e3 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -600,6 +600,16 @@ static vpiHandle signal_put_value(vpiHandle ref, s_vpi_value*vp, int flags) struct __vpiSignal*rfp = vpip_signal_from_handle(ref); assert(rfp); + /* If this is a release, then we are not really putting a + value. Instead, issue a release "command" to the signal + node to cause it to release a forced value. */ + if (flags == vpiReleaseFlag) { + vvp_net_ptr_t dest_cmd(rfp->node, 3); + /* Assume this is a net. (XXXX Are we sure?) */ + vvp_send_long(dest_cmd, 2 /* release/net */); + return ref; + } + /* Make a vvp_vector4_t vector to receive the translated value that we are going to poke. This will get populated differently depending on the format. */ @@ -659,12 +669,8 @@ static vpiHandle signal_put_value(vpiHandle ref, s_vpi_value*vp, int flags) } - if (flags == vpiReleaseFlag) { - vvp_net_ptr_t dest_cmd(rfp->node, 3); - vvp_send_long(dest_cmd, 2 /* release/net */); - return ref; - } - + /* If this is a vpiForce, then instead of writing to the + signal input port, we write to the special "force" port. */ int dest_port = 0; if (flags == vpiForceFlag) dest_port = 2;