Implement release and deassign more directly.
There is no use implementing the release and deassign methods as port commands. It's confusing and a waste of vvp_net_t functionality. It also obscures what needs to be done to more force/release into the filter object.
This commit is contained in:
parent
d780af1eca
commit
682ab886d8
|
|
@ -757,9 +757,13 @@ static vpiHandle signal_put_value(vpiHandle ref, s_vpi_value*vp, int flags)
|
||||||
value. Instead, issue a release "command" to the signal
|
value. Instead, issue a release "command" to the signal
|
||||||
node to cause it to release a forced value. */
|
node to cause it to release a forced value. */
|
||||||
if (flags == vpiReleaseFlag) {
|
if (flags == vpiReleaseFlag) {
|
||||||
vvp_net_ptr_t dest_cmd(rfp->node, 3);
|
vvp_fun_signal_base*sig
|
||||||
|
= reinterpret_cast<vvp_fun_signal_base*>(rfp->node->fun);
|
||||||
|
assert(sig);
|
||||||
|
|
||||||
|
vvp_net_ptr_t ptr(rfp->node, 0);
|
||||||
/* Assume this is a net. (XXXX Are we sure?) */
|
/* Assume this is a net. (XXXX Are we sure?) */
|
||||||
vvp_send_long(dest_cmd, 2 /* release/net */);
|
sig->release(ptr, true);
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1747,11 +1747,10 @@ bool of_DEASSIGN(vthread_t thr, vvp_code_t cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we release all or part of the net? */
|
/* Do we release all or part of the net? */
|
||||||
vvp_net_ptr_t ptr (net, 3);
|
|
||||||
if (full_sig) {
|
if (full_sig) {
|
||||||
vvp_send_long(ptr, 1);
|
sig->deassign();
|
||||||
} else {
|
} else {
|
||||||
vvp_send_long_pv(ptr, 1, base, width);
|
sig->deassign_pv(base, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1772,8 +1771,7 @@ bool of_DEASSIGN_WR(vthread_t thr, vvp_code_t cp)
|
||||||
sig->cassign_link = 0;
|
sig->cassign_link = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vvp_net_ptr_t ptr (net, 3);
|
sig->deassign();
|
||||||
vvp_send_long(ptr, 1);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3940,11 +3938,11 @@ bool of_RELEASE_NET(vthread_t thr, vvp_code_t cp)
|
||||||
assert(sig->force_link == 0);
|
assert(sig->force_link == 0);
|
||||||
|
|
||||||
/* Do we release all or part of the net? */
|
/* Do we release all or part of the net? */
|
||||||
vvp_net_ptr_t ptr (net, 3);
|
vvp_net_ptr_t ptr (net, 0);
|
||||||
if (full_sig) {
|
if (full_sig) {
|
||||||
vvp_send_long(ptr, 2);
|
sig->release(ptr, true);
|
||||||
} else {
|
} else {
|
||||||
vvp_send_long_pv(ptr, 2, base, width);
|
sig->release_pv(ptr, true, base, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -3980,11 +3978,11 @@ bool of_RELEASE_REG(vthread_t thr, vvp_code_t cp)
|
||||||
|
|
||||||
// Send a command to this signal to unforce itself.
|
// Send a command to this signal to unforce itself.
|
||||||
/* Do we release all or part of the net? */
|
/* Do we release all or part of the net? */
|
||||||
vvp_net_ptr_t ptr (net, 3);
|
vvp_net_ptr_t ptr (net, 0);
|
||||||
if (full_sig) {
|
if (full_sig) {
|
||||||
vvp_send_long(ptr, 3);
|
sig->release(ptr, false);
|
||||||
} else {
|
} else {
|
||||||
vvp_send_long_pv(ptr, 3, base, width);
|
sig->release_pv(ptr, false, base, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4008,9 +4006,8 @@ bool of_RELEASE_WR(vthread_t thr, vvp_code_t cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a command to this signal to unforce itself.
|
// Send a command to this signal to unforce itself.
|
||||||
vvp_net_ptr_t ptr (net, 3);
|
vvp_net_ptr_t ptr (net, 0);
|
||||||
vvp_send_long(ptr, 2 + type);
|
sig->release(ptr, type==0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,67 +254,6 @@ vvp_fun_signal_base::vvp_fun_signal_base()
|
||||||
count_functors_sig += 1;
|
count_functors_sig += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The signal functor takes commands as long values to port-3. This
|
|
||||||
* method interprets those commands.
|
|
||||||
*/
|
|
||||||
void vvp_fun_signal_base::recv_long(vvp_net_ptr_t ptr, long bit)
|
|
||||||
{
|
|
||||||
switch (ptr.port()) {
|
|
||||||
case 3: // Command port
|
|
||||||
switch (bit) {
|
|
||||||
case 1: // deassign command
|
|
||||||
deassign();
|
|
||||||
break;
|
|
||||||
case 2: // release/net
|
|
||||||
release(ptr, true);
|
|
||||||
break;
|
|
||||||
case 3: // release/reg
|
|
||||||
release(ptr, false);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "Unsupported command %ld.\n", bit);
|
|
||||||
assert(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // Other ports are errors.
|
|
||||||
fprintf(stderr, "Unsupported port type %d.\n", ptr.port());
|
|
||||||
assert(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void vvp_fun_signal_base::recv_long_pv(vvp_net_ptr_t ptr, long bit,
|
|
||||||
unsigned base, unsigned wid)
|
|
||||||
{
|
|
||||||
switch (ptr.port()) {
|
|
||||||
case 3: // Command port
|
|
||||||
switch (bit) {
|
|
||||||
case 1: // deassign command
|
|
||||||
deassign_pv(base, wid);
|
|
||||||
break;
|
|
||||||
case 2: // release/net
|
|
||||||
release_pv(ptr, true, base, wid);
|
|
||||||
break;
|
|
||||||
case 3: // release/reg
|
|
||||||
release_pv(ptr, false, base, wid);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "Unsupported command %ld.\n", bit);
|
|
||||||
assert(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // Other ports are errors.
|
|
||||||
fprintf(stderr, "Unsupported port type %d.\n", ptr.port());
|
|
||||||
assert(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vvp_fun_signal4_sa::vvp_fun_signal4_sa(unsigned wid, vvp_bit4_t init)
|
vvp_fun_signal4_sa::vvp_fun_signal4_sa(unsigned wid, vvp_bit4_t init)
|
||||||
: bits4_(wid, init)
|
: bits4_(wid, init)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -188,9 +188,6 @@ class vvp_fun_signal_base : public vvp_net_fun_t, public vvp_filter_wire_base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
vvp_fun_signal_base();
|
vvp_fun_signal_base();
|
||||||
void recv_long(vvp_net_ptr_t port, long bit);
|
|
||||||
void recv_long_pv(vvp_net_ptr_t port, long bit,
|
|
||||||
unsigned base, unsigned wid);
|
|
||||||
|
|
||||||
void deassign();
|
void deassign();
|
||||||
void deassign_pv(unsigned base, unsigned wid);
|
void deassign_pv(unsigned base, unsigned wid);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue