Remove vvp_signal_value from the vvp_fun_signal hierarchy.
We no longer need to access values from the signal functor. Use the filter (the wire part) everywhere to access signal values.
This commit is contained in:
parent
3d5d312786
commit
0a72df2025
|
|
@ -674,26 +674,6 @@ void vvp_wire_real::get_signal_value(struct t_vpi_value*vp)
|
|||
}
|
||||
}
|
||||
|
||||
void vvp_fun_signal4::get_value(struct t_vpi_value*vp)
|
||||
{
|
||||
get_signal_value(vp);
|
||||
}
|
||||
|
||||
void vvp_fun_signal8::get_value(struct t_vpi_value*vp)
|
||||
{
|
||||
switch (vp->format) {
|
||||
case vpiScalarVal:
|
||||
vp->value.scalar = value(0);
|
||||
break;
|
||||
case vpiSuppressVal:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "vpi_callback: value "
|
||||
"format %d not supported (fun_signal8)\n",
|
||||
vp->format);
|
||||
}
|
||||
}
|
||||
|
||||
void vvp_wire_vec4::get_value(struct t_vpi_value*value)
|
||||
{
|
||||
get_signal_value(value);
|
||||
|
|
|
|||
|
|
@ -1162,10 +1162,10 @@ static vpiHandle PV_put_value(vpiHandle ref, p_vpi_value vp, int)
|
|||
{
|
||||
assert(ref->vpi_type->type_code == vpiPartSelect);
|
||||
struct __vpiPV*rfp = (struct __vpiPV*)ref;
|
||||
vvp_fun_signal_vec*sig = dynamic_cast<vvp_fun_signal_vec*>(rfp->net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*>(rfp->net->fil);
|
||||
assert(sig);
|
||||
|
||||
unsigned sig_size = sig->size();
|
||||
unsigned sig_size = sig->value_size();
|
||||
unsigned width = rfp->width;
|
||||
int base = PV_get_base(rfp);
|
||||
if (base >= (signed) sig_size) return 0;
|
||||
|
|
|
|||
|
|
@ -1057,8 +1057,7 @@ bool of_ASSIGN_V0X1(vthread_t thr, vvp_code_t cp)
|
|||
unsigned delay = cp->bit_idx[0];
|
||||
unsigned bit = cp->bit_idx[1];
|
||||
|
||||
vvp_signal_value*sig
|
||||
= dynamic_cast<vvp_signal_value*> (cp->net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (cp->net->fil);
|
||||
assert(sig);
|
||||
|
||||
// We fell off the MSB end.
|
||||
|
|
@ -1094,8 +1093,7 @@ bool of_ASSIGN_V0X1D(vthread_t thr, vvp_code_t cp)
|
|||
vvp_time64_t delay = thr->words[cp->bit_idx[0]].w_int;
|
||||
unsigned bit = cp->bit_idx[1];
|
||||
|
||||
vvp_signal_value*sig
|
||||
= dynamic_cast<vvp_signal_value*> (cp->net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (cp->net->fil);
|
||||
assert(sig);
|
||||
|
||||
// We fell off the MSB end.
|
||||
|
|
@ -1130,8 +1128,7 @@ bool of_ASSIGN_V0X1E(vthread_t thr, vvp_code_t cp)
|
|||
long off = thr->words[1].w_int;
|
||||
unsigned bit = cp->bit_idx[0];
|
||||
|
||||
vvp_signal_value*sig
|
||||
= dynamic_cast<vvp_signal_value*> (cp->net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (cp->net->fil);
|
||||
assert(sig);
|
||||
|
||||
// We fell off the MSB end.
|
||||
|
|
@ -1375,7 +1372,7 @@ bool of_CASSIGN_X0(vthread_t thr, vvp_code_t cp)
|
|||
// X0 register.
|
||||
long index = thr->words[0].w_int;
|
||||
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (net->fil);
|
||||
|
||||
if (index < 0 && (wid <= (unsigned)-index))
|
||||
return true;
|
||||
|
|
@ -1806,13 +1803,15 @@ bool of_DEASSIGN(vthread_t thr, vvp_code_t cp)
|
|||
unsigned base = cp->bit_idx[0];
|
||||
unsigned width = cp->bit_idx[1];
|
||||
|
||||
vvp_signal_value*fil = dynamic_cast<vvp_signal_value*> (net->fil);
|
||||
assert(fil);
|
||||
vvp_fun_signal_vec*sig = dynamic_cast<vvp_fun_signal_vec*>(net->fun);
|
||||
assert(sig);
|
||||
|
||||
if (base >= sig->size()) return true;
|
||||
if (base+width > sig->size()) width = sig->size() - base;
|
||||
if (base >= fil->value_size()) return true;
|
||||
if (base+width > fil->value_size()) width = fil->value_size() - base;
|
||||
|
||||
bool full_sig = base == 0 && width == sig->size();
|
||||
bool full_sig = base == 0 && width == fil->value_size();
|
||||
|
||||
// This is the net that is forcing me...
|
||||
if (vvp_net_t*src = sig->cassign_link) {
|
||||
|
|
@ -4159,7 +4158,8 @@ bool of_SET_X0(vthread_t thr, vvp_code_t cp)
|
|||
// X0 register.
|
||||
long index = thr->words[0].w_int;
|
||||
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (net->fun);
|
||||
vvp_signal_value*sig = dynamic_cast<vvp_signal_value*> (net->fil);
|
||||
assert(sig);
|
||||
|
||||
// If the entire part is below the beginning of the vector,
|
||||
// then we are done.
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void vvp_fun_signal4_sa::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
|
|||
|
||||
case 1: // Continuous assign value
|
||||
bits4_ = bit;
|
||||
assign_mask_ = vvp_vector2_t(vvp_vector2_t::FILL1, size());
|
||||
assign_mask_ = vvp_vector2_t(vvp_vector2_t::FILL1, bits4_.size());
|
||||
ptr.ptr()->send_vec4(bits4_, 0);
|
||||
break;
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ void vvp_fun_signal4_sa::recv_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&bit
|
|||
|
||||
case 1: // Continuous assign value
|
||||
if (assign_mask_.size() == 0)
|
||||
assign_mask_ = vvp_vector2_t(vvp_vector2_t::FILL0, size());
|
||||
assign_mask_ = vvp_vector2_t(vvp_vector2_t::FILL0, bits4_.size());
|
||||
for (unsigned idx = 0 ; idx < wid ; idx += 1) {
|
||||
if (base+idx >= bits4_.size())
|
||||
break;
|
||||
|
|
@ -252,31 +252,11 @@ void vvp_fun_signal_base::deassign_pv(unsigned base, unsigned wid)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned vvp_fun_signal4_sa::value_size() const
|
||||
{
|
||||
return bits4_.size();
|
||||
}
|
||||
|
||||
vvp_bit4_t vvp_fun_signal4_sa::value(unsigned idx) const
|
||||
{
|
||||
assert(0 /* XXXX return filtered_value(bits4_, idx); */);
|
||||
}
|
||||
|
||||
vvp_scalar_t vvp_fun_signal4_sa::scalar_value(unsigned idx) const
|
||||
{
|
||||
return vvp_scalar_t(value(idx), 6, 6);
|
||||
}
|
||||
|
||||
vvp_vector4_t vvp_fun_signal4_sa::vec4_unfiltered_value() const
|
||||
{
|
||||
return bits4_;
|
||||
}
|
||||
|
||||
vvp_vector4_t vvp_fun_signal4_sa::vec4_value() const
|
||||
{
|
||||
assert(0 /* XXXX return filtered_vec4(bits4_); */);
|
||||
}
|
||||
|
||||
vvp_fun_signal4_aa::vvp_fun_signal4_aa(unsigned wid, vvp_bit4_t init)
|
||||
{
|
||||
context_idx_ = vpip_add_item_to_context(this, vpip_peek_context_scope());
|
||||
|
|
@ -450,27 +430,6 @@ void vvp_fun_signal8::recv_vec8_pv(vvp_net_ptr_t ptr, const vvp_vector8_t&bit,
|
|||
}
|
||||
}
|
||||
|
||||
unsigned vvp_fun_signal8::value_size() const
|
||||
{
|
||||
return bits8_.size();
|
||||
}
|
||||
|
||||
vvp_bit4_t vvp_fun_signal8::value(unsigned idx) const
|
||||
{
|
||||
assert(0 /* XXXX return filtered_value(bits8_, idx).value(); */);
|
||||
}
|
||||
|
||||
vvp_vector4_t vvp_fun_signal8::vec4_value() const
|
||||
{
|
||||
assert(0 /* XXXX return reduce4(filtered_vec8(bits8_)); */);
|
||||
}
|
||||
|
||||
vvp_scalar_t vvp_fun_signal8::scalar_value(unsigned idx) const
|
||||
{
|
||||
assert(0 /* XXXX return filtered_value(bits8_, idx); */);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Testing for equality, we want a bitwise test instead of an
|
||||
* arithmetic test because we want to treat for example -0 different
|
||||
|
|
|
|||
|
|
@ -109,19 +109,15 @@ class vvp_signal_value {
|
|||
* This abstract class is a little more specific than the signal_base
|
||||
* class, in that it adds vector access methods.
|
||||
*/
|
||||
class vvp_fun_signal_vec : public vvp_fun_signal_base, public vvp_signal_value {
|
||||
class vvp_fun_signal_vec : public vvp_fun_signal_base {
|
||||
public:
|
||||
virtual vvp_vector4_t vec4_unfiltered_value() const =0;
|
||||
unsigned size() const { return value_size(); }
|
||||
};
|
||||
|
||||
class vvp_fun_signal4 : public vvp_fun_signal_vec {
|
||||
|
||||
public:
|
||||
explicit vvp_fun_signal4() {};
|
||||
|
||||
void get_value(struct t_vpi_value*value);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -144,10 +140,6 @@ class vvp_fun_signal4_sa : public vvp_fun_signal4 {
|
|||
unsigned base, unsigned wid, unsigned vwid);
|
||||
|
||||
// Get information about the vector value.
|
||||
unsigned value_size() const;
|
||||
vvp_bit4_t value(unsigned idx) const;
|
||||
vvp_scalar_t scalar_value(unsigned idx) const;
|
||||
vvp_vector4_t vec4_value() const;
|
||||
vvp_vector4_t vec4_unfiltered_value() const;
|
||||
|
||||
private:
|
||||
|
|
@ -204,14 +196,6 @@ class vvp_fun_signal8 : public vvp_fun_signal_vec {
|
|||
void recv_vec8_pv(vvp_net_ptr_t port, const vvp_vector8_t&bit,
|
||||
unsigned base, unsigned wid, unsigned vwid);
|
||||
|
||||
// Get information about the vector value.
|
||||
unsigned value_size() const;
|
||||
vvp_bit4_t value(unsigned idx) const;
|
||||
vvp_scalar_t scalar_value(unsigned idx) const;
|
||||
vvp_vector4_t vec4_value() const;
|
||||
|
||||
void get_value(struct t_vpi_value*value);
|
||||
|
||||
private:
|
||||
vvp_vector8_t bits8_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ static void __compile_var(char*label, char*name,
|
|||
assert(!array);
|
||||
if (obj) vpip_attach_to_current_scope(obj);
|
||||
if (!vpip_peek_current_scope()->is_automatic)
|
||||
schedule_init_vector(vvp_net_ptr_t(node,0), vsig->vec4_unfiltered_value());
|
||||
schedule_init_vector(vvp_net_ptr_t(node,0), vfil->vec4_value());
|
||||
}
|
||||
// If this is an array word, then it does not have a name, and
|
||||
// it is attached to the addressed array.
|
||||
|
|
|
|||
Loading…
Reference in New Issue