diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index a15e55b77..a0d3b6ca2 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -216,14 +216,14 @@ vvp_net_fil_t::prop_t vvp_net_fil_t::filter_vec8(const vvp_vector8_t&val, vvp_ve return PROP; } -bool vvp_net_fil_t::filter_real(double&) +vvp_net_fil_t::prop_t vvp_net_fil_t::filter_real(double&) { - return true; + return PROP; } -bool vvp_net_fil_t::filter_long(long&) +vvp_net_fil_t::prop_t vvp_net_fil_t::filter_long(long&) { - return true; + return PROP; } void vvp_net_fil_t::force_mask(vvp_vector2_t mask) diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index 58dc1bfe5..5d8ef49ac 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -1130,8 +1130,8 @@ class vvp_net_fil_t : public vvp_vpi_callback { // filter, or overridden by the rep argument if present. virtual prop_t filter_vec4(const vvp_vector4_t&bit, vvp_vector4_t&rep); virtual prop_t filter_vec8(const vvp_vector8_t&val, vvp_vector8_t&rep); - virtual bool filter_real(double&val); - virtual bool filter_long(long&val); + virtual prop_t filter_real(double&val); + 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; @@ -1165,10 +1165,9 @@ class vvp_net_fil_t : public vvp_vpi_callback { // method will use to hold a filtered value, if needed. This // method returns a pointer to val or buf. template prop_t filter_mask_(const T&val, const T&force, T&rep); - // This template method is a scalar value of the above. It - // leaves the val, or it replaces it iwth a forced value. - // (Not really implemented, yet.) - template bool filter_mask_(T&val); + // This template method is similar to the above, but works for + // native types that are not so expensive to edit in place. + template prop_t filter_mask_(T&val, T force); private: // Mask of forced bits diff --git a/vvp/vvp_net_sig.cc b/vvp/vvp_net_sig.cc index 4ae71d9e6..63de72f89 100644 --- a/vvp/vvp_net_sig.cc +++ b/vvp/vvp_net_sig.cc @@ -59,10 +59,16 @@ template vvp_net_fil_t::prop_t vvp_net_fil_t::filter_mask_(const T&val } } -template bool vvp_net_fil_t::filter_mask_(T&val) +template vvp_net_fil_t::prop_t vvp_net_fil_t::filter_mask_(T&val, T force) { + + if (test_force_mask(0)) { + val = force; + run_vpi_callbacks(); + return REPL; + } run_vpi_callbacks(); - return true; + return PROP; } vvp_signal_value::~vvp_signal_value() @@ -814,14 +820,10 @@ vvp_wire_real::vvp_wire_real() { } -bool vvp_wire_real::filter_real(double&bit) +vvp_net_fil_t::prop_t vvp_wire_real::filter_real(double&bit) { bit_ = bit; - if (test_force_mask(0)) { - bit = force_; - return false; - } - return true; + return filter_mask_(bit, force_); } unsigned vvp_wire_real::filter_size() const diff --git a/vvp/vvp_net_sig.h b/vvp/vvp_net_sig.h index 554887e48..ab3b49af6 100644 --- a/vvp/vvp_net_sig.h +++ b/vvp/vvp_net_sig.h @@ -363,7 +363,7 @@ class vvp_wire_real : public vvp_wire_base { explicit vvp_wire_real(void); // The main filter behavior for this class - bool filter_real(double&bit); + prop_t filter_real(double&bit); // Abstract methods from vvp_vpi_callback void get_value(struct t_vpi_value*value);