vvp_fun_signal propagates vvp_vector8_t vectors when appropriate.

This commit is contained in:
steve 2005-01-01 02:12:34 +00:00
parent 34a14b983b
commit d5c33420ab
3 changed files with 50 additions and 16 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: resolv.h,v 1.10 2004/12/31 06:00:06 steve Exp $"
#ident "$Id: resolv.h,v 1.11 2005/01/01 02:12:34 steve Exp $"
#endif
# include "config.h"
@ -33,7 +33,9 @@
* attached.
*
* This node takes in vvp_vector8_t values, and emits a vvp_vector8_t
* value.
* value. It also takes in vvp_vector4_t values, which it treats as
* strong values (or HiZ) for the sake of resolution. In any case, the
* propagated value is a vvp_vector8_t value.
*/
class resolv_functor : public vvp_net_fun_t {
@ -51,6 +53,9 @@ class resolv_functor : public vvp_net_fun_t {
/*
* $Log: resolv.h,v $
* Revision 1.11 2005/01/01 02:12:34 steve
* vvp_fun_signal propagates vvp_vector8_t vectors when appropriate.
*
* Revision 1.10 2004/12/31 06:00:06 steve
* Implement .resolv functors, and stub signals recv_vec8 method.
*

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: vvp_net.cc,v 1.3 2004/12/31 06:00:06 steve Exp $"
#ident "$Id: vvp_net.cc,v 1.4 2005/01/01 02:12:34 steve Exp $"
# include "vvp_net.h"
# include <stdio.h>
@ -326,6 +326,11 @@ vvp_fun_signal::vvp_fun_signal(unsigned wid)
force_active_ = false;
}
bool vvp_fun_signal::type_is_vector8_() const
{
return bits8_.size() > 0;
}
/*
* Nets simply reflect their input to their output.
*/
@ -334,7 +339,7 @@ void vvp_fun_signal::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
switch (ptr.port()) {
case 0: // Normal input (feed from net, or set from process)
if (! continuous_assign_active_) {
bits_ = bit;
bits4_ = bit;
vvp_send_vec4(ptr.ptr()->out, bit);
run_vpi_callbacks();
}
@ -342,8 +347,13 @@ void vvp_fun_signal::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
case 1: // Continuous assign value
continuous_assign_active_ = true;
bits_ = bit;
vvp_send_vec4(ptr.ptr()->out, bit);
if (type_is_vector8_()) {
bits8_ = vvp_vector8_t(bit,6);
vvp_send_vec8(ptr.ptr()->out, bits8_);
} else {
bits4_ = bit;
vvp_send_vec4(ptr.ptr()->out, bits4_);
}
run_vpi_callbacks();
break;
@ -362,9 +372,14 @@ void vvp_fun_signal::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
void vvp_fun_signal::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit)
{
fprintf(stderr, "internal error: vvp_fun_signal "
"reducing vector8 input.\n");
recv_vec4(ptr, reduce4(bit));
// Only port-0 supports vector8_t inputs.
assert(ptr.port() == 0);
if (! continuous_assign_active_) {
bits8_ = bit;
vvp_send_vec8(ptr.ptr()->out, bit);
run_vpi_callbacks();
}
}
void vvp_fun_signal::deassign()
@ -376,10 +391,10 @@ void vvp_fun_signal::release(vvp_net_ptr_t ptr, bool net)
{
force_active_ = false;
if (net) {
vvp_send_vec4(ptr.ptr()->out, bits_);
vvp_send_vec4(ptr.ptr()->out, bits4_);
run_vpi_callbacks();
} else {
bits_ = force_;
bits4_ = force_;
}
}
@ -417,8 +432,10 @@ vvp_bit4_t vvp_fun_signal::value(unsigned idx) const
{
if (force_active_)
return force_.value(idx);
else if (type_is_vector8_())
return bits8_.value(idx).value();
else
return bits_.value(idx);
return bits4_.value(idx);
}
/* **** vvp_scaler_t methods **** */
@ -627,6 +644,9 @@ vvp_vector4_t reduce4(const vvp_vector8_t&that)
/*
* $Log: vvp_net.cc,v $
* Revision 1.4 2005/01/01 02:12:34 steve
* vvp_fun_signal propagates vvp_vector8_t vectors when appropriate.
*
* Revision 1.3 2004/12/31 06:00:06 steve
* Implement .resolv functors, and stub signals recv_vec8 method.
*

View File

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: vvp_net.h,v 1.4 2004/12/31 06:00:06 steve Exp $"
#ident "$Id: vvp_net.h,v 1.5 2005/01/01 02:12:34 steve Exp $"
# include <assert.h>
@ -367,8 +367,11 @@ class vvp_fun_part : public vvp_net_fun_t {
/* vvp_fun_signal
* This node is the place holder in a vvp network for signals,
* including nets of various sort. The output from a signal is always
* a vector4, use drivers if the context needs vector8 values.
* including nets of various sort. The output from a signal follows
* the type of its port-0 input. If vvp_vector4_t values come in
* through port-0, then vvp_vector4_t values are propagated. If
* vvp_vector8_t values come in through port-0, then vvp_vector8_t
* values are propaged. Thus, this node is sloghtly polymorphic.
*
* If the signal is a net (i.e. a wire or tri) then this node will
* have an input that is the data source. The data source will connect
@ -436,7 +439,10 @@ class vvp_fun_signal : public vvp_net_fun_t {
struct __vpiCallback*vpi_callbacks;
private:
vvp_vector4_t bits_;
vvp_vector4_t bits4_;
vvp_vector8_t bits8_;
bool type_is_vector8_() const;
bool continuous_assign_active_;
vvp_vector4_t force_;
@ -448,6 +454,9 @@ class vvp_fun_signal : public vvp_net_fun_t {
/*
* $Log: vvp_net.h,v $
* Revision 1.5 2005/01/01 02:12:34 steve
* vvp_fun_signal propagates vvp_vector8_t vectors when appropriate.
*
* Revision 1.4 2004/12/31 06:00:06 steve
* Implement .resolv functors, and stub signals recv_vec8 method.
*