From 21b1f620ba4575647d7d0ceaab9fe827e8b5bf13 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Tue, 15 Sep 2009 17:10:59 -0700 Subject: [PATCH] Automatic variables cannot use wire filters. Make vec4 variables use stub filter functions so that the filter does not interfere with automatic values. --- vvp/vvp_net_sig.cc | 31 +++++++++++++++++++++++++++++++ vvp/vvp_net_sig.h | 21 +++++++++++++-------- vvp/words.cc | 19 ++++++++++--------- 3 files changed, 54 insertions(+), 17 deletions(-) diff --git a/vvp/vvp_net_sig.cc b/vvp/vvp_net_sig.cc index 2954a90b5..1c235a147 100644 --- a/vvp/vvp_net_sig.cc +++ b/vvp/vvp_net_sig.cc @@ -357,6 +357,37 @@ vvp_vector4_t vvp_fun_signal4_aa::vec4_unfiltered_value() const return vec4_value(); } +void vvp_fun_signal4_aa::release(vvp_net_ptr_t,bool) +{ + assert(0); +} + +void vvp_fun_signal4_aa::release_pv(vvp_net_ptr_t,unsigned,unsigned,bool) +{ + assert(0); +} + +unsigned vvp_fun_signal4_aa::filter_size() const +{ + assert(0); +} +void vvp_fun_signal4_aa::force_fil_vec4(const vvp_vector4_t&, vvp_vector2_t) +{ + assert(0); +} +void vvp_fun_signal4_aa::force_fil_vec8(const vvp_vector8_t&, vvp_vector2_t) +{ + assert(0); +} +void vvp_fun_signal4_aa::force_fil_real(double, vvp_vector2_t) +{ + assert(0); +} +void vvp_fun_signal4_aa::get_value(struct t_vpi_value*) +{ + assert(0); +} + vvp_fun_signal8::vvp_fun_signal8(unsigned wid) : bits8_(wid) { diff --git a/vvp/vvp_net_sig.h b/vvp/vvp_net_sig.h index 5066a71c2..738ce4db8 100644 --- a/vvp/vvp_net_sig.h +++ b/vvp/vvp_net_sig.h @@ -114,16 +114,10 @@ class vvp_fun_signal_vec : public vvp_fun_signal_base { virtual vvp_vector4_t vec4_unfiltered_value() const =0; }; -class vvp_fun_signal4 : public vvp_fun_signal_vec { - - public: - explicit vvp_fun_signal4() {}; -}; - /* * Statically allocated vvp_fun_signal4. */ -class vvp_fun_signal4_sa : public vvp_fun_signal4 { +class vvp_fun_signal4_sa : public vvp_fun_signal_vec { public: explicit vvp_fun_signal4_sa(unsigned wid, vvp_bit4_t init=BIT4_X); @@ -149,7 +143,7 @@ class vvp_fun_signal4_sa : public vvp_fun_signal4 { /* * Automatically allocated vvp_fun_signal4. */ -class vvp_fun_signal4_aa : public vvp_fun_signal4, public automatic_hooks_s { +class vvp_fun_signal4_aa : public vvp_fun_signal_vec, public vvp_signal_value, public vvp_net_fil_t, public automatic_hooks_s { public: explicit vvp_fun_signal4_aa(unsigned wid, vvp_bit4_t init=BIT4_X); @@ -175,6 +169,17 @@ class vvp_fun_signal4_aa : public vvp_fun_signal4, public automatic_hooks_s { vvp_vector4_t vec4_value() const; vvp_vector4_t vec4_unfiltered_value() const; + // Automatic variables cannot be forced or released. Provide + // stubs that assert. + virtual void release(vvp_net_ptr_t ptr, bool net_flag); + virtual void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag); + + virtual unsigned filter_size() const; + virtual void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask); + virtual void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask); + virtual void force_fil_real(double val, vvp_vector2_t mask); + virtual void get_value(struct t_vpi_value*value); + private: unsigned context_idx_; unsigned size_; diff --git a/vvp/words.cc b/vvp/words.cc index a5dedd91f..78f429238 100644 --- a/vvp/words.cc +++ b/vvp/words.cc @@ -88,16 +88,17 @@ static void __compile_var(char*label, char*name, { unsigned wid = ((msb > lsb)? msb-lsb : lsb-msb) + 1; - vvp_fun_signal_vec*vsig; - vvp_wire_vec4*vfil = new vvp_wire_vec4(wid, BIT4_X); - if (vpip_peek_current_scope()->is_automatic) { - vsig = new vvp_fun_signal4_aa(wid); - } else { - vsig = new vvp_fun_signal4_sa(wid); - } vvp_net_t*node = new vvp_net_t; - node->fun = vsig; - node->fil = vfil; + + if (vpip_peek_current_scope()->is_automatic) { + vvp_fun_signal4_aa*tmp = new vvp_fun_signal4_aa(wid); + node->fil = tmp; + node->fun = tmp; + } else { + node->fil = new vvp_wire_vec4(wid, BIT4_X); + node->fun = new vvp_fun_signal4_sa(wid); + } + vvp_signal_value*vfil = dynamic_cast(node->fil); define_functor_symbol(label, node);