signal bits are referenced at run time by the vpiSignal struct.

This commit is contained in:
steve 2000-03-25 05:02:24 +00:00
parent dcaea50b8f
commit 9f84deeb56
5 changed files with 50 additions and 21 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
# include <iostream> # include <iostream>
@ -833,11 +833,11 @@ void target_vvm::signal(ostream&os, const NetNet*sig)
os << "static vvm_bitset_t<" << sig->pin_count() << "> " << os << "static vvm_bitset_t<" << sig->pin_count() << "> " <<
net_name<< "_bits; /* " << sig->name() << net_name<< "_bits; /* " << sig->name() <<
" */" << endl; " */" << endl;
os << "static vvm_signal_t " << net_name << "(" << net_name << os << "static vvm_signal_t " << net_name << ";" << endl;
"_bits.bits, " << sig->pin_count() << ");" << endl;
init_code << " vpip_make_reg(&" << net_name << init_code << " vpip_make_reg(&" << net_name
", \"" << sig->name() << "\");" << endl; << ", \"" << sig->name() << "\"," << net_name<<"_bits.bits, "
<< sig->pin_count() << ");" << endl;
if (const NetScope*scope = sig->scope()) { if (const NetScope*scope = sig->scope()) {
string sname = mangle(scope->name()) + "_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<const NetObj*>(cur->get_obj())) if (! dynamic_cast<const NetObj*>(cur->get_obj()))
continue; continue;
if (dynamic_cast<const NetNet*>(cur->get_obj()))
continue;
// Build an init statement for the link, that writes the // Build an init statement for the link, that writes the
// value. // value.
ostrstream line; ostrstream line;
@ -2387,6 +2390,9 @@ extern const struct target tgt_vvm = {
}; };
/* /*
* $Log: t-vvm.cc,v $ * $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 * Revision 1.124 2000/03/25 02:43:56 steve
* Remove all remain vvm_bitset_t return values, * Remove all remain vvm_bitset_t return values,
* and disallow vvm_bitset_t copying. * and disallow vvm_bitset_t copying.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
/* /*
@ -258,7 +258,8 @@ struct __vpiNumberConst {
* of the constructed object. * of the constructed object.
*/ */
extern vpiHandle vpip_make_iterator(unsigned nargs, vpiHandle*args); 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, extern vpiHandle vpip_make_scope(struct __vpiScope*ref,
int type_code, int type_code,
const char*name); const char*name);
@ -269,7 +270,8 @@ extern vpiHandle vpip_make_number_const(struct __vpiNumberConst*ref,
unsigned nbits); unsigned nbits);
extern vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name, extern vpiHandle vpip_make_memory(struct __vpiMemory*ref, const char*name,
unsigned width, unsigned size); 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, extern vpiHandle vpip_make_time_var(struct __vpiTimeVar*ref,
const char*val); const char*val);
@ -335,6 +337,9 @@ extern int vpip_finished();
/* /*
* $Log: vpi_priv.h,v $ * $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 * Revision 1.12 2000/03/22 04:26:41 steve
* Replace the vpip_bit_t with a typedef and * Replace the vpip_bit_t with a typedef and
* define values for all the different bit * define values for all the different bit

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
# include "vpi_priv.h" # include "vpi_priv.h"
@ -75,10 +75,13 @@ static const struct __vpirt vpip_net_rt = {
0 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->base.vpi_type = &vpip_net_rt;
ref->name = name; ref->name = name;
ref->bits = b;
ref->nbits = nb;
ref->monitor = 0; ref->monitor = 0;
return &(ref->base); return &(ref->base);
} }
@ -93,16 +96,22 @@ static const struct __vpirt vpip_reg_rt = {
0 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->base.vpi_type = &vpip_reg_rt;
ref->name = name; ref->name = name;
ref->bits = b;
ref->nbits = nb;
ref->monitor = 0; ref->monitor = 0;
return &(ref->base); return &(ref->base);
} }
/* /*
* $Log: vpi_signal.c,v $ * $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 * Revision 1.7 2000/02/23 02:56:56 steve
* Macintosh compilers do not support ident. * Macintosh compilers do not support ident.
* *

View File

@ -17,15 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
# include "vvm_signal.h" # include "vvm_signal.h"
vvm_signal_t::vvm_signal_t(vpip_bit_t*b, unsigned nb) vvm_signal_t::vvm_signal_t()
{ {
bits = b; bits = 0;
nbits = nb; nbits = 0;
} }
vvm_signal_t::~vvm_signal_t() 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) void vvm_signal_t::take_value(unsigned key, vpip_bit_t val)
{ {
assert(key < nbits);
bits[key] = val; bits[key] = val;
vpip_run_value_changes(this); vpip_run_value_changes(this);
} }
@ -54,6 +55,9 @@ vvm_ram_callback::~vvm_ram_callback()
/* /*
* $Log: vvm_signal.cc,v $ * $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 * Revision 1.2 2000/03/17 20:21:14 steve
* Detemplatize the vvm_signal_t class. * Detemplatize the vvm_signal_t class.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #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 #endif
# include "vvm.h" # include "vvm.h"
@ -56,19 +56,21 @@ template <unsigned WIDTH> class vvm_bitset_t : public vvm_bits_t {
/* /*
* The vvm_signal_t template is the real object that handles the * The vvm_signal_t template is the real object that handles the
* receiving of assignments and doing whatever is done. It also * receiving of assignments and doing whatever is done. It also
* connects VPI to the C++/vvm design. The vvm_bitset_t stores the * connects VPI to the C++/vvm design. The actual bits are referenced
* actual bits, this just attaches the name and vpiSignal stuff to the * by the base vpiSignal structure.
* set.
*/ */
class vvm_signal_t : public __vpiSignal, public vvm_nexus::recvr_t { class vvm_signal_t : public __vpiSignal, public vvm_nexus::recvr_t {
public: public:
vvm_signal_t(vpip_bit_t*b, unsigned nb); vvm_signal_t();
~vvm_signal_t(); ~vvm_signal_t();
void init_P(unsigned idx, vpip_bit_t val); void init_P(unsigned idx, vpip_bit_t val);
void take_value(unsigned key, 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 { struct vvm_ram_callback {
@ -144,6 +146,9 @@ class vvm_memory_t : public __vpiMemory {
/* /*
* $Log: vvm_signal.h,v $ * $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 * Revision 1.5 2000/03/25 02:43:57 steve
* Remove all remain vvm_bitset_t return values, * Remove all remain vvm_bitset_t return values,
* and disallow vvm_bitset_t copying. * and disallow vvm_bitset_t copying.