release_pv methods need t account for net_flag.

Whether and what to propagate after a release of a part needs to
match the behavior of the full-vector release. Nets need to restore
their driver, and regs need to hold their forced value.
This commit is contained in:
Stephen Williams 2009-09-12 09:22:20 -07:00
parent caab6b3834
commit a1295db6bf
4 changed files with 30 additions and 12 deletions

View File

@ -4033,7 +4033,7 @@ static bool do_release_vec(vthread_t thr, vvp_code_t cp, bool net_flag)
if (full_sig) {
net->fil->release(ptr, net_flag);
} else {
net->fil->release_pv(ptr, base, width);
net->fil->release_pv(ptr, base, width, net_flag);
}
return true;

View File

@ -1137,7 +1137,7 @@ class vvp_net_fil_t : public vvp_vpi_callback {
virtual prop_t filter_long(long&val);
virtual void release(vvp_net_ptr_t ptr, bool net_flag) =0;
virtual void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid) =0;
virtual void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag) =0;
// The %force/link instruction needs a place to write the
// source node of the force, so that subsequent %force and

View File

@ -679,7 +679,7 @@ void vvp_wire_vec4::release(vvp_net_ptr_t ptr, bool net_flag)
}
}
void vvp_wire_vec4::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid)
void vvp_wire_vec4::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag)
{
assert(bits4_.size() >= base + wid);
@ -688,8 +688,15 @@ void vvp_wire_vec4::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid)
mask.set_bit(base+idx, 1);
release_mask(mask);
ptr.ptr()->send_vec4(bits4_,0);
run_vpi_callbacks();
if (net_flag) {
ptr.ptr()->send_vec4_pv(bits4_.subvalue(base,wid),
base, wid, bits4_.size(), 0);
run_vpi_callbacks();
} else {
ptr.ptr()->fun->recv_vec4_pv(ptr, force4_.subvalue(base,wid),
base, wid, bits4_.size(), 0);
}
}
unsigned vvp_wire_vec4::value_size() const
@ -800,7 +807,7 @@ void vvp_wire_vec8::release(vvp_net_ptr_t ptr, bool net_flag)
ptr.ptr()->fun->recv_vec8(ptr, force8_);
}
void vvp_wire_vec8::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid)
void vvp_wire_vec8::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag)
{
assert(width_ >= base + wid);
@ -809,7 +816,15 @@ void vvp_wire_vec8::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid)
mask.set_bit(base+idx, 1);
release_mask(mask);
ptr.ptr()->send_vec8(bits8_);
if (net_flag) {
ptr.ptr()->send_vec8_pv(bits8_.subvalue(base,wid),
base, wid, bits8_.size());
run_vpi_callbacks();
} else {
ptr.ptr()->fun->recv_vec8_pv(ptr, force8_.subvalue(base,wid),
base, wid, force8_.size());
}
}
unsigned vvp_wire_vec8::value_size() const
@ -894,14 +909,17 @@ void vvp_wire_real::release(vvp_net_ptr_t ptr, bool net_flag)
ptr.ptr()->fun->recv_real(ptr, force_, 0);
}
void vvp_wire_real::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid)
void vvp_wire_real::release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag)
{
vvp_vector2_t mask (vvp_vector2_t::FILL0, 1);
for (unsigned idx = 0 ; idx < wid ; idx += 1)
mask.set_bit(base+idx, 1);
release_mask(mask);
assert(0);
if (net_flag)
ptr.ptr()->send_real(bit_, 0);
else
ptr.ptr()->fun->recv_real(ptr, force_, 0);
}
unsigned vvp_wire_real::value_size() const

View File

@ -306,7 +306,7 @@ class vvp_wire_vec4 : public vvp_wire_base {
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
// Implementation of vvp_signal_value methods
unsigned value_size() const;
@ -342,7 +342,7 @@ class vvp_wire_vec8 : public vvp_wire_base {
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
// Implementation of vvp_signal_value methods
unsigned value_size() const;
@ -377,7 +377,7 @@ class vvp_wire_real : public vvp_wire_base {
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
// Implementation of vvp_signal_value methods
unsigned value_size() const;