Get rid of gate templates.
This commit is contained in:
parent
65020bc6de
commit
5f292e546d
49
t-vvm.cc
49
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.200 2001/01/12 04:20:18 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.201 2001/01/16 03:57:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -1926,64 +1926,70 @@ void target_vvm::logic(const NetLogic*gate)
|
|||
switch (gate->type()) {
|
||||
case NetLogic::AND:
|
||||
if ((gate->pin_count()-1) == 2)
|
||||
out << "static vvm_and2 ";
|
||||
out << "static vvm_and2 " << mname << "(";
|
||||
else
|
||||
out << "static vvm_and" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_and " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
case NetLogic::BUF:
|
||||
out << "static vvm_buf ";
|
||||
out << "static vvm_buf " << mname << "(";
|
||||
break;
|
||||
case NetLogic::BUFIF0:
|
||||
out << "static vvm_bufif0 ";
|
||||
out << "static vvm_bufif0 " << mname << "(";
|
||||
break;
|
||||
case NetLogic::BUFIF1:
|
||||
out << "static vvm_bufif1 ";
|
||||
out << "static vvm_bufif1 " << mname << "(";
|
||||
break;
|
||||
case NetLogic::NAND:
|
||||
out << "static vvm_nand" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_nand " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
case NetLogic::NMOS:
|
||||
out << "static vvm_nmos ";
|
||||
out << "static vvm_nmos " << mname << "(";
|
||||
break;
|
||||
case NetLogic::NOR:
|
||||
if ((gate->pin_count()-1) == 2)
|
||||
out << "static vvm_nor2 ";
|
||||
out << "static vvm_nor2 " << mname << "(";
|
||||
else
|
||||
out << "static vvm_nor" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_nor " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
case NetLogic::NOT:
|
||||
out << "static vvm_not ";
|
||||
out << "static vvm_not " << mname << "(";
|
||||
break;
|
||||
case NetLogic::NOTIF0:
|
||||
out << "static vvm_notif0 ";
|
||||
out << "static vvm_notif0 " << mname << "(";
|
||||
break;
|
||||
case NetLogic::NOTIF1:
|
||||
out << "static vvm_notif1 ";
|
||||
out << "static vvm_notif1 " << mname << "(";
|
||||
break;
|
||||
case NetLogic::OR:
|
||||
out << "static vvm_or" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_or " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
case NetLogic::RNMOS:
|
||||
out << "static vvm_rnmos ";
|
||||
out << "static vvm_rnmos " << mname << "(";
|
||||
break;
|
||||
case NetLogic::RPMOS:
|
||||
out << "static vvm_rpmos ";
|
||||
out << "static vvm_rpmos " << mname << "(";
|
||||
break;
|
||||
case NetLogic::PMOS:
|
||||
out << "static vvm_pmos ";
|
||||
out << "static vvm_pmos " << mname << "(";
|
||||
break;
|
||||
case NetLogic::XNOR:
|
||||
out << "static vvm_xnor" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_xnor " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
case NetLogic::XOR:
|
||||
out << "static vvm_xor" << "<" << gate->pin_count()-1 << "> ";
|
||||
out << "static vvm_xor " << mname << "("
|
||||
<< (gate->pin_count()-1 ) << ", ";
|
||||
break;
|
||||
default:
|
||||
out << "#error \"internal ivl error:bad gate type for " <<
|
||||
gate->name() << "\"" << endl;
|
||||
}
|
||||
|
||||
out << mname << " (" << gate->rise_time() << ");" << endl;
|
||||
out << gate->rise_time() << ");" << endl;
|
||||
|
||||
/* Write the code to invoke startup for this object. */
|
||||
|
||||
|
|
@ -3621,6 +3627,9 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.201 2001/01/16 03:57:46 steve
|
||||
* Get rid of gate templates.
|
||||
*
|
||||
* Revision 1.200 2001/01/12 04:20:18 steve
|
||||
* Generated function prototype. (PR#107)
|
||||
*
|
||||
|
|
|
|||
179
vvm/vvm_gates.cc
179
vvm/vvm_gates.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_gates.cc,v 1.20 2000/12/10 06:42:00 steve Exp $"
|
||||
#ident "$Id: vvm_gates.cc,v 1.21 2001/01/16 03:57:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm_gates.h"
|
||||
|
|
@ -174,6 +174,35 @@ vpip_bit_t reduce_strength(vpip_bit_t val)
|
|||
return(HiZ);
|
||||
}
|
||||
|
||||
vvm_and::vvm_and(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_and::~vvm_and()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_and::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_and::start()
|
||||
{
|
||||
output(compute_and(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_and::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_and(input_,width_));
|
||||
}
|
||||
|
||||
vvm_and2::vvm_and2(unsigned long d)
|
||||
: vvm_1bit_out(d)
|
||||
{
|
||||
|
|
@ -367,6 +396,93 @@ vpip_bit_t vvm_eeq::compute_() const
|
|||
return outval;
|
||||
}
|
||||
|
||||
vvm_nand::vvm_nand(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_nand::~vvm_nand()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_nand::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_nand::start()
|
||||
{
|
||||
output(compute_nand(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_nand::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_nand(input_, width_));
|
||||
}
|
||||
|
||||
vvm_nor::vvm_nor(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_nor::~vvm_nor()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_nor::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_nor::start()
|
||||
{
|
||||
output(compute_nor(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_nor::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_nor(input_, width_));
|
||||
}
|
||||
|
||||
vvm_or::vvm_or(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_or::~vvm_or()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_or::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_or::start()
|
||||
{
|
||||
output(compute_or(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_or::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_or(input_, width_));
|
||||
}
|
||||
|
||||
vvm_nmos::vvm_nmos(unsigned long d)
|
||||
: vvm_1bit_out(d)
|
||||
{
|
||||
|
|
@ -663,8 +779,69 @@ void vvm_notif1::take_value(unsigned key, vpip_bit_t val)
|
|||
}
|
||||
}
|
||||
|
||||
vvm_xnor::vvm_xnor(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_xnor::~vvm_xnor()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_xnor::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_xnor::start()
|
||||
{
|
||||
output(compute_xnor(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_xnor::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_xnor(input_, width_));
|
||||
}
|
||||
|
||||
vvm_xor::vvm_xor(unsigned wid, unsigned long d)
|
||||
: vvm_1bit_out(d), width_(wid)
|
||||
{
|
||||
input_ = new vpip_bit_t[wid];
|
||||
}
|
||||
|
||||
vvm_xor::~vvm_xor()
|
||||
{
|
||||
delete [] input_;
|
||||
}
|
||||
|
||||
void vvm_xor::init_I(unsigned idx, vpip_bit_t val)
|
||||
{
|
||||
input_[idx] = val;
|
||||
}
|
||||
|
||||
void vvm_xor::start()
|
||||
{
|
||||
output(compute_xor(input_,width_));
|
||||
}
|
||||
|
||||
void vvm_xor::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(key < width_);
|
||||
if (input_[key] == val) return;
|
||||
input_[key] = val;
|
||||
output(compute_xor(input_, width_));
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: vvm_gates.cc,v $
|
||||
* Revision 1.21 2001/01/16 03:57:46 steve
|
||||
* Get rid of gate templates.
|
||||
*
|
||||
* Revision 1.20 2000/12/10 06:42:00 steve
|
||||
* Support delays on continuous assignment from idents. (PR#40)
|
||||
*
|
||||
|
|
|
|||
144
vvm/vvm_gates.h
144
vvm/vvm_gates.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_gates.h,v 1.69 2000/12/15 20:05:16 steve Exp $"
|
||||
#ident "$Id: vvm_gates.h,v 1.70 2001/01/16 03:57:46 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm.h"
|
||||
|
|
@ -136,30 +136,22 @@ class vvm_add_sub : public vvm_nexus::recvr_t {
|
|||
* parameter. The vvm_andN classes are versions that have specific
|
||||
* widths. The latter should be preferred over the generic form.
|
||||
*/
|
||||
template <unsigned WIDTH>
|
||||
class vvm_and : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_and(unsigned d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_and(unsigned wid, unsigned long d);
|
||||
~vvm_and();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val)
|
||||
{ input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start();
|
||||
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_and(input_,WIDTH)); }
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val) return;
|
||||
input_[idx] = val;
|
||||
output(compute_and(input_,WIDTH));
|
||||
}
|
||||
|
||||
private:
|
||||
vpip_bit_t input_[WIDTH];
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
class vvm_and2 : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
|
@ -450,57 +442,40 @@ class vvm_mux : public vvm_nexus::recvr_t {
|
|||
vvm_mux& operator= (vvm_mux&);
|
||||
};
|
||||
|
||||
template <unsigned WIDTH>
|
||||
class vvm_or : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_or(unsigned long d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_or(unsigned wid, unsigned long d);
|
||||
~vvm_or();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val)
|
||||
{ input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_or(input_,WIDTH)); }
|
||||
void start();
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val)
|
||||
return;
|
||||
input_[idx] = val;
|
||||
output(compute_or(input_,WIDTH));
|
||||
}
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
private:
|
||||
vpip_bit_t input_[WIDTH];
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
template <unsigned WIDTH>
|
||||
class vvm_nor : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_nor(unsigned long d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_nor(unsigned wid, unsigned long d);
|
||||
~vvm_nor();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val)
|
||||
{ input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_nor(input_,WIDTH)); }
|
||||
void start();
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val)
|
||||
return;
|
||||
input_[idx] = val;
|
||||
output(compute_nor(input_,WIDTH));
|
||||
}
|
||||
|
||||
vpip_bit_t input_[WIDTH];
|
||||
private:
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
class vvm_nor2 : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
|
@ -671,30 +646,23 @@ class vvm_notif1 : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
|||
void take_value(unsigned key, vpip_bit_t val);
|
||||
};
|
||||
|
||||
template <unsigned WIDTH>
|
||||
class vvm_nand : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_nand(unsigned long d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_nand(unsigned wid, unsigned long d);
|
||||
~vvm_nand();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val)
|
||||
{ input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_nand(input_,WIDTH)); }
|
||||
void start();
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val) return;
|
||||
input_[idx] = val;
|
||||
output(compute_nand(input_,WIDTH));
|
||||
}
|
||||
|
||||
private:
|
||||
vpip_bit_t input_[WIDTH];
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -765,56 +733,41 @@ class vvm_rpmos : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
|||
};
|
||||
|
||||
|
||||
template <unsigned WIDTH>
|
||||
class vvm_xnor : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_xnor(unsigned long d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_xnor(unsigned wid, unsigned long d);
|
||||
~vvm_xnor();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val) { input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_xnor(input_,WIDTH)); }
|
||||
void start();
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val)
|
||||
return;
|
||||
input_[idx] = val;
|
||||
output(compute_xnor(input_,WIDTH));
|
||||
}
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
private:
|
||||
vpip_bit_t input_[WIDTH];
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
template <unsigned WIDTH>
|
||||
|
||||
class vvm_xor : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_xor(unsigned long d)
|
||||
: vvm_1bit_out(d) { }
|
||||
explicit vvm_xor(unsigned wid, unsigned long d);
|
||||
~vvm_xor();
|
||||
|
||||
void init_I(unsigned idx, vpip_bit_t val)
|
||||
{ input_[idx] = val; }
|
||||
void init_I(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void start()
|
||||
{ output(compute_xor(input_,WIDTH)); }
|
||||
void start();
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val) { set_I(key, val); }
|
||||
|
||||
void set_I(unsigned idx, vpip_bit_t val)
|
||||
{ if (input_[idx] == val)
|
||||
return;
|
||||
input_[idx] = val;
|
||||
output(compute_xor(input_,WIDTH)); }
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
private:
|
||||
vpip_bit_t input_[WIDTH];
|
||||
unsigned width_;
|
||||
vpip_bit_t*input_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -1006,6 +959,9 @@ class vvm_posedge : public vvm_nexus::recvr_t {
|
|||
|
||||
/*
|
||||
* $Log: vvm_gates.h,v $
|
||||
* Revision 1.70 2001/01/16 03:57:46 steve
|
||||
* Get rid of gate templates.
|
||||
*
|
||||
* Revision 1.69 2000/12/15 20:05:16 steve
|
||||
* Fix memory access in vvm. (PR#70)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue