Filters need to let through the forced value.
When the forced value is first set, the filter needs to let that value through. Otherwise, the forced value will not propagate out from the net.
This commit is contained in:
parent
ba00c6caf7
commit
a5046bd8c6
|
|
@ -43,6 +43,7 @@ template <class T> T coerce_to_width(const T&that, unsigned width)
|
|||
|
||||
vvp_filter_wire_base::vvp_filter_wire_base()
|
||||
{
|
||||
force_propagate_ = false;
|
||||
}
|
||||
|
||||
vvp_filter_wire_base::~vvp_filter_wire_base()
|
||||
|
|
@ -52,7 +53,8 @@ vvp_filter_wire_base::~vvp_filter_wire_base()
|
|||
const vvp_vector4_t* vvp_filter_wire_base::filter_vec4(const vvp_vector4_t&val)
|
||||
{
|
||||
if (force_mask_.size()) {
|
||||
bool propagate_flag = false;
|
||||
bool propagate_flag = force_propagate_;
|
||||
force_propagate_ = false;
|
||||
assert(val.size() == force_mask_.size());
|
||||
assert(val.size() == force4_.size());
|
||||
|
||||
|
|
@ -80,7 +82,8 @@ const vvp_vector4_t* vvp_filter_wire_base::filter_vec4(const vvp_vector4_t&val)
|
|||
const vvp_vector8_t* vvp_filter_wire_base::filter_vec8(const vvp_vector8_t&val)
|
||||
{
|
||||
if (force_mask_.size()) {
|
||||
bool propagate_flag = false;
|
||||
bool propagate_flag = force_propagate_;
|
||||
force_propagate_ = false;
|
||||
assert(val.size() == force_mask_.size());
|
||||
assert(val.size() == force8_.size());
|
||||
|
||||
|
|
@ -130,6 +133,7 @@ void vvp_filter_wire_base::force_vec4(const vvp_vector4_t&val, vvp_vector2_t mas
|
|||
|
||||
force_mask_.set_bit(idx, 1);
|
||||
force4_.set_bit(idx, val.value(idx));
|
||||
force_propagate_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +151,7 @@ void vvp_filter_wire_base::force_vec8(const vvp_vector8_t&val, vvp_vector2_t mas
|
|||
|
||||
force_mask_.set_bit(idx, 1);
|
||||
force8_.set_bit(idx, val.value(idx));
|
||||
force_propagate_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,6 +166,7 @@ void vvp_filter_wire_base::force_real(double val, vvp_vector2_t mask)
|
|||
continue;
|
||||
|
||||
force_mask_.set_bit(idx, 1);
|
||||
force_propagate_ = true;
|
||||
}
|
||||
|
||||
force_real_ = val;
|
||||
|
|
@ -370,8 +376,8 @@ void vvp_fun_signal4_sa::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
|
|||
if (tmp.size() != size())
|
||||
tmp = coerce_to_width(tmp, size());
|
||||
|
||||
ptr.ptr()->send_vec4(tmp, 0);
|
||||
force_vec4(tmp, vvp_vector2_t(vvp_vector2_t::FILL1,tmp.size()));
|
||||
calculate_output_(ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -678,13 +684,8 @@ void vvp_fun_signal8::recv_vec8(vvp_net_ptr_t ptr, const vvp_vector8_t&bit)
|
|||
if (tmp.size() != size())
|
||||
tmp = coerce_to_width(tmp, size());
|
||||
|
||||
// Propagate the forced value before setting the
|
||||
// force mask. This is so that the forced value gets
|
||||
// out to the network before the force filter is set
|
||||
// up. If the force filter is set up first, then the
|
||||
// filter will block the exact match.
|
||||
ptr.ptr()->send_vec8(tmp);
|
||||
force_vec8(tmp, vvp_vector2_t(vvp_vector2_t::FILL1,tmp.size()));
|
||||
calculate_output_(ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,9 @@ class vvp_filter_wire_base : public vvp_net_fil_t, public vvp_vpi_callback {
|
|||
vvp_vector4_t force4_;
|
||||
vvp_vector8_t force8_;
|
||||
double force_real_;
|
||||
// True if the next filter must propagate. Need this to allow
|
||||
// the forced value to get through.
|
||||
bool force_propagate_;
|
||||
// This is used as a static return value.
|
||||
mutable vvp_vector4_t filter4_;
|
||||
mutable vvp_vector8_t filter8_;
|
||||
|
|
|
|||
Loading…
Reference in New Issue