From 9f84deeb56197deaf3f547087ae1b328de355519 Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 25 Mar 2000 05:02:24 +0000 Subject: [PATCH] signal bits are referenced at run time by the vpiSignal struct. --- t-vvm.cc | 16 +++++++++++----- vvm/vpi_priv.h | 11 ++++++++--- vvm/vpi_signal.c | 15 ++++++++++++--- vvm/vvm_signal.cc | 12 ++++++++---- vvm/vvm_signal.h | 17 +++++++++++------ 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/t-vvm.cc b/t-vvm.cc index 69f917092..429347e77 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.124 2000/03/25 02:43:56 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.125 2000/03/25 05:02:24 steve Exp $" #endif # include @@ -833,11 +833,11 @@ void target_vvm::signal(ostream&os, const NetNet*sig) os << "static vvm_bitset_t<" << sig->pin_count() << "> " << net_name<< "_bits; /* " << sig->name() << " */" << endl; - os << "static vvm_signal_t " << net_name << "(" << net_name << - "_bits.bits, " << sig->pin_count() << ");" << endl; + os << "static vvm_signal_t " << net_name << ";" << endl; - init_code << " vpip_make_reg(&" << net_name << - ", \"" << sig->name() << "\");" << endl; + init_code << " vpip_make_reg(&" << net_name + << ", \"" << sig->name() << "\"," << net_name<<"_bits.bits, " + << sig->pin_count() << ");" << endl; if (const NetScope*scope = sig->scope()) { string sname = mangle(scope->name()) + "_scope"; @@ -973,6 +973,9 @@ void target_vvm::emit_init_value_(const NetObj::Link&lnk, verinum::V val) if (! dynamic_cast(cur->get_obj())) continue; + if (dynamic_cast(cur->get_obj())) + continue; + // Build an init statement for the link, that writes the // value. ostrstream line; @@ -2387,6 +2390,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.125 2000/03/25 05:02:24 steve + * signal bits are referenced at run time by the vpiSignal struct. + * * Revision 1.124 2000/03/25 02:43:56 steve * Remove all remain vvm_bitset_t return values, * and disallow vvm_bitset_t copying. diff --git a/vvm/vpi_priv.h b/vvm/vpi_priv.h index 09c592d1b..f766d4910 100644 --- a/vvm/vpi_priv.h +++ b/vvm/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_priv.h,v 1.12 2000/03/22 04:26:41 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.13 2000/03/25 05:02:24 steve Exp $" #endif /* @@ -258,7 +258,8 @@ struct __vpiNumberConst { * of the constructed object. */ extern vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args); -extern vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name); +extern vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name, + vpip_bit_t*bits, unsigned nbits); extern vpiHandle vpip_make_scope(struct __vpiScope*ref, int type_code, const char*name); @@ -269,7 +270,8 @@ extern vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref, unsigned nbits); extern vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name, unsigned width, unsigned size); -extern vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name); +extern vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name, + vpip_bit_t*bits, unsigned nbits); extern vpiHandle vpip_make_time_var(struct __vpiTimeVar*ref, const char*val); @@ -335,6 +337,9 @@ extern int vpip_finished(); /* * $Log: vpi_priv.h,v $ + * Revision 1.13 2000/03/25 05:02:24 steve + * signal bits are referenced at run time by the vpiSignal struct. + * * Revision 1.12 2000/03/22 04:26:41 steve * Replace the vpip_bit_t with a typedef and * define values for all the different bit diff --git a/vvm/vpi_signal.c b/vvm/vpi_signal.c index c511350df..c9a95e20a 100644 --- a/vvm/vpi_signal.c +++ b/vvm/vpi_signal.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_signal.c,v 1.7 2000/02/23 02:56:56 steve Exp $" +#ident "$Id: vpi_signal.c,v 1.8 2000/03/25 05:02:25 steve Exp $" #endif # include "vpi_priv.h" @@ -75,10 +75,13 @@ static const struct __vpirt vpip_net_rt = { 0 }; -vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name) +vpiHandle vpip_make_net(struct __vpiSignal*ref, const char*name, + vpip_bit_t*b, unsigned nb) { ref->base.vpi_type = &vpip_net_rt; ref->name = name; + ref->bits = b; + ref->nbits = nb; ref->monitor = 0; return &(ref->base); } @@ -93,16 +96,22 @@ static const struct __vpirt vpip_reg_rt = { 0 }; -vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name) +vpiHandle vpip_make_reg(struct __vpiSignal*ref, const char*name, + vpip_bit_t*b, unsigned nb) { ref->base.vpi_type = &vpip_reg_rt; ref->name = name; + ref->bits = b; + ref->nbits = nb; ref->monitor = 0; return &(ref->base); } /* * $Log: vpi_signal.c,v $ + * Revision 1.8 2000/03/25 05:02:25 steve + * signal bits are referenced at run time by the vpiSignal struct. + * * Revision 1.7 2000/02/23 02:56:56 steve * Macintosh compilers do not support ident. * diff --git a/vvm/vvm_signal.cc b/vvm/vvm_signal.cc index 4eac0e61d..2b2a8caac 100644 --- a/vvm/vvm_signal.cc +++ b/vvm/vvm_signal.cc @@ -17,15 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_signal.cc,v 1.2 2000/03/17 20:21:14 steve Exp $" +#ident "$Id: vvm_signal.cc,v 1.3 2000/03/25 05:02:25 steve Exp $" #endif # include "vvm_signal.h" -vvm_signal_t::vvm_signal_t(vpip_bit_t*b, unsigned nb) +vvm_signal_t::vvm_signal_t() { - bits = b; - nbits = nb; + bits = 0; + nbits = 0; } vvm_signal_t::~vvm_signal_t() @@ -40,6 +40,7 @@ void vvm_signal_t::init_P(unsigned idx, vpip_bit_t val) void vvm_signal_t::take_value(unsigned key, vpip_bit_t val) { + assert(key < nbits); bits[key] = val; vpip_run_value_changes(this); } @@ -54,6 +55,9 @@ vvm_ram_callback::~vvm_ram_callback() /* * $Log: vvm_signal.cc,v $ + * Revision 1.3 2000/03/25 05:02:25 steve + * signal bits are referenced at run time by the vpiSignal struct. + * * Revision 1.2 2000/03/17 20:21:14 steve * Detemplatize the vvm_signal_t class. * diff --git a/vvm/vvm_signal.h b/vvm/vvm_signal.h index 0b030c678..9d17afe2b 100644 --- a/vvm/vvm_signal.h +++ b/vvm/vvm_signal.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_signal.h,v 1.5 2000/03/25 02:43:57 steve Exp $" +#ident "$Id: vvm_signal.h,v 1.6 2000/03/25 05:02:25 steve Exp $" #endif # include "vvm.h" @@ -56,19 +56,21 @@ template class vvm_bitset_t : public vvm_bits_t { /* * The vvm_signal_t template is the real object that handles the * receiving of assignments and doing whatever is done. It also - * connects VPI to the C++/vvm design. The vvm_bitset_t stores the - * actual bits, this just attaches the name and vpiSignal stuff to the - * set. + * connects VPI to the C++/vvm design. The actual bits are referenced + * by the base vpiSignal structure. */ class vvm_signal_t : public __vpiSignal, public vvm_nexus::recvr_t { public: - vvm_signal_t(vpip_bit_t*b, unsigned nb); + vvm_signal_t(); ~vvm_signal_t(); void init_P(unsigned idx, vpip_bit_t val); - void take_value(unsigned key, vpip_bit_t val); + + private: // not implemented + vvm_signal_t(const vvm_signal_t&); + vvm_signal_t& operator= (const vvm_signal_t&); }; struct vvm_ram_callback { @@ -144,6 +146,9 @@ class vvm_memory_t : public __vpiMemory { /* * $Log: vvm_signal.h,v $ + * Revision 1.6 2000/03/25 05:02:25 steve + * signal bits are referenced at run time by the vpiSignal struct. + * * Revision 1.5 2000/03/25 02:43:57 steve * Remove all remain vvm_bitset_t return values, * and disallow vvm_bitset_t copying.