Skip to content

Commit

Permalink
Automatic variables cannot use wire filters.
Browse files Browse the repository at this point in the history
Make vec4 variables use stub filter functions so that the filter
does not interfere with automatic values.
  • Loading branch information
steveicarus committed Sep 16, 2009
1 parent 0a72df2 commit 21b1f62
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
31 changes: 31 additions & 0 deletions vvp/vvp_net_sig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
21 changes: 13 additions & 8 deletions vvp/vvp_net_sig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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_;
Expand Down
15 changes: 8 additions & 7 deletions vvp/words.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
vvp_net_t*node = new vvp_net_t;

if (vpip_peek_current_scope()->is_automatic) {
vsig = new vvp_fun_signal4_aa(wid);
vvp_fun_signal4_aa*tmp = new vvp_fun_signal4_aa(wid);
node->fil = tmp;
node->fun = tmp;
} else {
vsig = new vvp_fun_signal4_sa(wid);
node->fil = new vvp_wire_vec4(wid, BIT4_X);
node->fun = new vvp_fun_signal4_sa(wid);
}
vvp_net_t*node = new vvp_net_t;
node->fun = vsig;
node->fil = vfil;
vvp_signal_value*vfil = dynamic_cast<vvp_signal_value*>(node->fil);

define_functor_symbol(label, node);

Expand Down

0 comments on commit 21b1f62

Please sign in to comment.