From d5c33420ab3b07d793001ac9e96367e444ee312e Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 1 Jan 2005 02:12:34 +0000 Subject: [PATCH] vvp_fun_signal propagates vvp_vector8_t vectors when appropriate. --- vvp/resolv.h | 9 +++++++-- vvp/vvp_net.cc | 40 ++++++++++++++++++++++++++++++---------- vvp/vvp_net.h | 17 +++++++++++++---- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/vvp/resolv.h b/vvp/resolv.h index a0755c5c8..4c2ab96a9 100644 --- a/vvp/resolv.h +++ b/vvp/resolv.h @@ -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. * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index f6ec9ced5..5b9d2d067 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -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 @@ -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. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index b6c63cf9f..b1d77396f 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -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 @@ -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. *