Get rid of monitor_t and fold __vpiSignal into signal.

This commit is contained in:
steve 1999-10-28 21:36:00 +00:00
parent 162b895e1b
commit 2862178a6f
4 changed files with 25 additions and 100 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: t-vvm.cc,v 1.66 1999/10/28 04:48:29 steve Exp $"
#ident "$Id: t-vvm.cc,v 1.67 1999/10/28 21:36:00 steve Exp $"
#endif
# include <iostream>
@ -536,7 +536,7 @@ void vvm_parm_rval::expr_ident(const NetEIdent*expr)
void vvm_parm_rval::expr_signal(const NetESignal*expr)
{
string res = string("&") + mangle(expr->name()) + "_vpi.base";
string res = string("&") + mangle(expr->name()) + ".base";
result = res;
}
@ -1087,23 +1087,15 @@ void target_vvm::net_esignal(ostream&os, const NetESignal*net)
return;
flag = true;
string net_name = mangle(net->name());
os << "static vvm_bitset_t<" << net->pin_count() << "> " <<
mangle(net->name()) << "_bits; /* " << net->name() <<
net_name<< "_bits; /* " << net->name() <<
" */" << endl;
os << "static vvm_signal_t<" << net->pin_count() << "> " <<
mangle(net->name()) << "(\"" << net->name() << "\", &" <<
mangle(net->name()) << "_bits);" << endl;
net_name << "(&" << net_name << "_bits);" << endl;
os << "static struct __vpiSignal " << mangle(net->name()) <<
"_vpi;" << endl;
string vpi_name = mangle(net->name()) + "_vpi";
init_code << " vpip_make_reg(&" << vpi_name << ", \"" <<
net->name() << "\");" << endl;
init_code << " " << vpi_name << ".bits = " <<
mangle(net->name()) << "_bits.bits;" << endl;
init_code << " " << vpi_name << ".nbits = " <<
net->pin_count() << ";" << endl;
init_code << " vpip_make_reg(&" << net_name <<
", \"" << net->name() << "\");" << endl;
}
/*
@ -1766,6 +1758,9 @@ extern const struct target tgt_vvm = {
};
/*
* $Log: t-vvm.cc,v $
* Revision 1.67 1999/10/28 21:36:00 steve
* Get rid of monitor_t and fold __vpiSignal into signal.
*
* Revision 1.66 1999/10/28 04:48:29 steve
* Put strings into a single string table.
*

View File

@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.9 1999/10/28 00:47:25 steve Exp $"
#ident "$Id: Makefile.in,v 1.10 1999/10/28 21:36:00 steve Exp $"
#
#
SHELL = /bin/sh
@ -58,7 +58,7 @@ all: libvvm.a
$(CC) -Wall -fno-exceptions $(CFLAGS) -MD -c $< -o $*.o
mv $*.d dep
O = vvm_bit.o vvm_calltf.o vvm_event.o vvm_monitor.o vvm_pevent.o \
O = vvm_bit.o vvm_calltf.o vvm_event.o vvm_pevent.o \
vvm_simulation.o vvm_thread.o vpip.o
P = vpi_callback.o \

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvm.h,v 1.16 1999/10/28 00:47:25 steve Exp $"
#ident "$Id: vvm.h,v 1.17 1999/10/28 21:36:00 steve Exp $"
#endif
# include <vector>
@ -224,52 +224,37 @@ class vvm_simulation {
};
/*
* The vvm_monitor_t is a way of attaching a name to the signal, for
* use by the vpi_ functions. I need to make a base type so that I can
* avoid the casting problems with the vvm_signal_t template below.
*
* The vvm_signal_t template is the real object that handles the
* receiving of assignments and doing whatever is done.
* receiving of assignments and doing whatever is done. It also
* connects VPI to the C++/vvm design.
*/
class vvm_monitor_t {
public:
vvm_monitor_t(const char*);
~vvm_monitor_t();
const char* name() const;
private:
const char* name_;
private: // not implemented
vvm_monitor_t(const vvm_monitor_t&);
vvm_monitor_t& operator= (const vvm_monitor_t&);
};
template <unsigned WIDTH> class vvm_signal_t : public vvm_monitor_t {
template <unsigned WIDTH> class vvm_signal_t : public __vpiSignal {
public:
vvm_signal_t(const char*n, vvm_bitset_t<WIDTH>*b)
: vvm_monitor_t(n), bits_(b) { }
vvm_signal_t(vvm_bitset_t<WIDTH>*b)
{ bits = b->bits;
nbits = WIDTH;
}
~vvm_signal_t() { }
void init(unsigned idx, vpip_bit_t val)
{ (*bits_)[idx] = val; }
{ bits[idx] = val; }
void set(vvm_simulation*sim, unsigned idx, vpip_bit_t val)
{ (*bits_)[idx] = val;
{ bits[idx] = val;
}
void set(vvm_simulation*sim, const vvm_bitset_t<WIDTH>&val)
{ for (unsigned idx = 0 ; idx < WIDTH ; idx += 1)
set(sim, idx, val[idx]);
}
private:
vvm_bitset_t<WIDTH>*bits_;
};
/*
* $Log: vvm.h,v $
* Revision 1.17 1999/10/28 21:36:00 steve
* Get rid of monitor_t and fold __vpiSignal into signal.
*
* Revision 1.16 1999/10/28 00:47:25 steve
* Rewrite vvm VPI support to make objects more
* persistent, rewrite the simulation scheduler

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 1998 Stephen Williams (steve@picturel.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vvm_monitor.cc,v 1.3 1999/10/28 00:47:25 steve Exp $"
#endif
# include "vvm.h"
vvm_monitor_t::vvm_monitor_t(const char*n)
: name_(n)
{
}
vvm_monitor_t::~vvm_monitor_t()
{
}
const char*vvm_monitor_t::name() const
{
return name_;
}
/*
* $Log: vvm_monitor.cc,v $
* Revision 1.3 1999/10/28 00:47:25 steve
* Rewrite vvm VPI support to make objects more
* persistent, rewrite the simulation scheduler
* in C (to interface with VPI) and add VPI support
* for callbacks.
*
* Revision 1.2 1999/08/15 01:23:56 steve
* Convert vvm to implement system tasks with vpi.
*
* Revision 1.1 1998/11/09 23:44:11 steve
* Add vvm library.
*
*/