From 2e3e9ecf375682ac8bb054c8103414a7fc692d33 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 2 Aug 2000 00:57:02 +0000 Subject: [PATCH] tri01 support in vvm. --- t-vvm.cc | 24 +++++++++++++++++++++++- vvm/vvm_nexus.cc | 29 ++++++++++++++++++++++++++--- vvm/vvm_nexus.h | 11 +++++++++-- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/t-vvm.cc b/t-vvm.cc index 9e3b95fce..5f8abef36 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.164 2000/07/29 16:21:08 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.165 2000/08/02 00:57:02 steve Exp $" #endif # include @@ -1099,6 +1099,25 @@ void target_vvm::signal(ostream&os, const NetNet*sig) init_code << " nexus_wire_table[" << ncode << "].connect(&" << net_name << ", " << idx << ");" << endl; + /* By default, the nexus object uses a resolution + function that is suitable for simulating wire and tri + signals. If the signal is some other sort, the write + a resolution function into the nexus that properly + handles the different semantics. */ + + switch (sig->type()) { + case NetNet::TRI0: + init_code << " nexus_wire_table[" << ncode + << "].resolution_function = vvm_resolution_tri0;" + << endl; + break; + case NetNet::TRI1: + init_code << " nexus_wire_table[" << ncode + << "].resolution_function = vvm_resolution_tri1;" + << endl; + break; + } + // Propogate the initial value to inputs throughout. if (new_nexus_flag) { verinum::V init = sig->pin(idx).nexus()->get_init(); @@ -3088,6 +3107,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.165 2000/08/02 00:57:02 steve + * tri01 support in vvm. + * * Revision 1.164 2000/07/29 16:21:08 steve * Report code generation errors through proc_delay. * diff --git a/vvm/vvm_nexus.cc b/vvm/vvm_nexus.cc index d28f0d204..a251b935b 100644 --- a/vvm/vvm_nexus.cc +++ b/vvm/vvm_nexus.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_nexus.cc,v 1.8 2000/05/11 23:37:28 steve Exp $" +#ident "$Id: vvm_nexus.cc,v 1.9 2000/08/02 00:57:03 steve Exp $" #endif # include "vvm_nexus.h" @@ -36,6 +36,7 @@ vvm_nexus::vvm_nexus() forcer_key_ = 0; assigner_ = 0; assigner_key_ = 0; + resolution_function = &vvm_resolution_wire; } vvm_nexus::~vvm_nexus() @@ -269,13 +270,32 @@ vvm_nexus::recvr_t::~recvr_t() { } -vpip_bit_t vvm_nexus::resolution_function(const vpip_bit_t*bits, - unsigned nbits) const +vpip_bit_t vvm_resolution_wire(const vpip_bit_t*bits, unsigned nbits) { if (nbits == 0) return HiZ; return vpip_bits_resolve(bits, nbits); } +vpip_bit_t vvm_resolution_tri0(const vpip_bit_t*bits, unsigned nbits) +{ + if (nbits == 0) return Pu0; + + vpip_bit_t res = vpip_bits_resolve(bits, nbits); + if (B_ISZ(res)) return Pu0; + + return res; +} + +vpip_bit_t vvm_resolution_tri1(const vpip_bit_t*bits, unsigned nbits) +{ + if (nbits == 0) return Pu1; + + vpip_bit_t res = vpip_bits_resolve(bits, nbits); + if (B_ISZ(res)) return Pu1; + + return res; +} + class delayed_assign_event : public vvm_event { public: delayed_assign_event(vvm_nexus&l, vpip_bit_t r) @@ -297,6 +317,9 @@ void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val, /* * $Log: vvm_nexus.cc,v $ + * Revision 1.9 2000/08/02 00:57:03 steve + * tri01 support in vvm. + * * Revision 1.8 2000/05/11 23:37:28 steve * Add support for procedural continuous assignment. * diff --git a/vvm/vvm_nexus.h b/vvm/vvm_nexus.h index 945951a0c..4a913c6a1 100644 --- a/vvm/vvm_nexus.h +++ b/vvm/vvm_nexus.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_nexus.h,v 1.4 2000/05/11 23:37:28 steve Exp $" +#ident "$Id: vvm_nexus.h,v 1.5 2000/08/02 00:57:03 steve Exp $" #endif # include "vvm.h" @@ -123,7 +123,7 @@ class vvm_nexus { // generates the current value for the nexus. It also passes // that value on to the receuvers. void run_values(); - vpip_bit_t resolution_function(const vpip_bit_t*, unsigned) const; + vpip_bit_t (*resolution_function)(const vpip_bit_t*, unsigned); private: vpip_bit_t value_; @@ -150,6 +150,10 @@ class vvm_nexus { }; +extern vpip_bit_t vvm_resolution_wire(const vpip_bit_t*bits, unsigned nbits); +extern vpip_bit_t vvm_resolution_tri0(const vpip_bit_t*bits, unsigned nbits); +extern vpip_bit_t vvm_resolution_tri1(const vpip_bit_t*bits, unsigned nbits); + /* * This function arranges for a non-blocking reg_assign to a nexus. It * creates all the events needed to make it happen after the specified @@ -160,6 +164,9 @@ extern void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val, /* * $Log: vvm_nexus.h,v $ + * Revision 1.5 2000/08/02 00:57:03 steve + * tri01 support in vvm. + * * Revision 1.4 2000/05/11 23:37:28 steve * Add support for procedural continuous assignment. *