nor2 and and2 optimized gates.
This commit is contained in:
parent
51e96a2d8b
commit
e71413123e
15
t-vvm.cc
15
t-vvm.cc
|
|
@ -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.113 2000/03/17 17:25:53 steve Exp $"
|
#ident "$Id: t-vvm.cc,v 1.114 2000/03/17 19:23:59 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
|
@ -1256,7 +1256,10 @@ void target_vvm::logic(ostream&os, const NetLogic*gate)
|
||||||
|
|
||||||
switch (gate->type()) {
|
switch (gate->type()) {
|
||||||
case NetLogic::AND:
|
case NetLogic::AND:
|
||||||
os << "static vvm_and" << "<" << gate->pin_count()-1 << "> ";
|
if ((gate->pin_count()-1) == 2)
|
||||||
|
os << "static vvm_and2 ";
|
||||||
|
else
|
||||||
|
os << "static vvm_and" << "<" << gate->pin_count()-1 << "> ";
|
||||||
break;
|
break;
|
||||||
case NetLogic::BUF:
|
case NetLogic::BUF:
|
||||||
os << "static vvm_buf ";
|
os << "static vvm_buf ";
|
||||||
|
|
@ -1271,7 +1274,10 @@ void target_vvm::logic(ostream&os, const NetLogic*gate)
|
||||||
os << "static vvm_nand" << "<" << gate->pin_count()-1 << "> ";
|
os << "static vvm_nand" << "<" << gate->pin_count()-1 << "> ";
|
||||||
break;
|
break;
|
||||||
case NetLogic::NOR:
|
case NetLogic::NOR:
|
||||||
os << "static vvm_nor" << "<" << gate->pin_count()-1 << "> ";
|
if ((gate->pin_count()-1) == 2)
|
||||||
|
os << "static vvm_nor2 ";
|
||||||
|
else
|
||||||
|
os << "static vvm_nor" << "<" << gate->pin_count()-1 << "> ";
|
||||||
break;
|
break;
|
||||||
case NetLogic::NOT:
|
case NetLogic::NOT:
|
||||||
os << "static vvm_not ";
|
os << "static vvm_not ";
|
||||||
|
|
@ -2239,6 +2245,9 @@ extern const struct target tgt_vvm = {
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* $Log: t-vvm.cc,v $
|
* $Log: t-vvm.cc,v $
|
||||||
|
* Revision 1.114 2000/03/17 19:23:59 steve
|
||||||
|
* nor2 and and2 optimized gates.
|
||||||
|
*
|
||||||
* Revision 1.113 2000/03/17 17:25:53 steve
|
* Revision 1.113 2000/03/17 17:25:53 steve
|
||||||
* Adder and comparator in nexus style.
|
* Adder and comparator in nexus style.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: vvm_gates.cc,v 1.8 2000/03/17 03:36:07 steve Exp $"
|
#ident "$Id: vvm_gates.cc,v 1.9 2000/03/17 19:24:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvm_gates.h"
|
# include "vvm_gates.h"
|
||||||
|
|
@ -134,6 +134,36 @@ void compute_mux(vpip_bit_t*out, unsigned wid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vvm_and2::vvm_and2(unsigned long d)
|
||||||
|
: vvm_1bit_out(d)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
vvm_and2::~vvm_and2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_and2::init_I(unsigned idx, vpip_bit_t val)
|
||||||
|
{
|
||||||
|
assert(idx < 2);
|
||||||
|
input_[idx] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_and2::start()
|
||||||
|
{
|
||||||
|
output(input_[0] & input_[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_and2::take_value(unsigned key, vpip_bit_t val)
|
||||||
|
{
|
||||||
|
if (input_[key] == val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
input_[key] = val;
|
||||||
|
output(input_[0] & input_[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vvm_buf::vvm_buf(unsigned long d)
|
vvm_buf::vvm_buf(unsigned long d)
|
||||||
: vvm_1bit_out(d)
|
: vvm_1bit_out(d)
|
||||||
{
|
{
|
||||||
|
|
@ -214,6 +244,35 @@ vpip_bit_t vvm_eeq::compute_() const
|
||||||
return outval;
|
return outval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vvm_nor2::vvm_nor2(unsigned long d)
|
||||||
|
: vvm_1bit_out(d)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
vvm_nor2::~vvm_nor2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_nor2::init_I(unsigned idx, vpip_bit_t val)
|
||||||
|
{
|
||||||
|
assert(idx < 2);
|
||||||
|
input_[idx] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_nor2::start()
|
||||||
|
{
|
||||||
|
output(v_not(input_[0] | input_[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
void vvm_nor2::take_value(unsigned key, vpip_bit_t val)
|
||||||
|
{
|
||||||
|
if (input_[key] == val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
input_[key] = val;
|
||||||
|
output(v_not(input_[0] | input_[1]));
|
||||||
|
}
|
||||||
|
|
||||||
vvm_not::vvm_not(unsigned long d)
|
vvm_not::vvm_not(unsigned long d)
|
||||||
: vvm_1bit_out(d)
|
: vvm_1bit_out(d)
|
||||||
{
|
{
|
||||||
|
|
@ -239,6 +298,9 @@ void vvm_not::take_value(unsigned, vpip_bit_t val)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvm_gates.cc,v $
|
* $Log: vvm_gates.cc,v $
|
||||||
|
* Revision 1.9 2000/03/17 19:24:00 steve
|
||||||
|
* nor2 and and2 optimized gates.
|
||||||
|
*
|
||||||
* Revision 1.8 2000/03/17 03:36:07 steve
|
* Revision 1.8 2000/03/17 03:36:07 steve
|
||||||
* Remove some useless template parameters.
|
* Remove some useless template parameters.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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_gates.h,v 1.44 2000/03/17 17:25:53 steve Exp $"
|
#ident "$Id: vvm_gates.h,v 1.45 2000/03/17 19:24:00 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "vvm.h"
|
# include "vvm.h"
|
||||||
|
|
@ -119,7 +119,12 @@ class vvm_add_sub : public vvm_nexus::recvr_t {
|
||||||
vvm_add_sub& operator= (const vvm_add_sub&);
|
vvm_add_sub& operator= (const vvm_add_sub&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are implementations of reduction AND. the vvm_and class is
|
||||||
|
* the parameterized form, that takes the width of the gate input as a
|
||||||
|
* parameter. The vvm_andN classes are versions that have specific
|
||||||
|
* widths. The latter should be preferred over the generic form.
|
||||||
|
*/
|
||||||
template <unsigned WIDTH>
|
template <unsigned WIDTH>
|
||||||
class vvm_and : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
class vvm_and : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||||
|
|
||||||
|
|
@ -146,6 +151,21 @@ class vvm_and : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||||
vpip_bit_t input_[WIDTH];
|
vpip_bit_t input_[WIDTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class vvm_and2 : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit vvm_and2(unsigned long d);
|
||||||
|
~vvm_and2();
|
||||||
|
|
||||||
|
void init_I(unsigned idx, vpip_bit_t val);
|
||||||
|
void start();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void take_value(unsigned key, vpip_bit_t val);
|
||||||
|
|
||||||
|
vpip_bit_t input_[2];
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class implements LPM_CLSHIFT devices with specified data width
|
* This class implements LPM_CLSHIFT devices with specified data width
|
||||||
* and selector input width. The direction bit is a single bit input.
|
* and selector input width. The direction bit is a single bit input.
|
||||||
|
|
@ -427,6 +447,20 @@ class vvm_nor : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||||
vpip_bit_t input_[WIDTH];
|
vpip_bit_t input_[WIDTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class vvm_nor2 : public vvm_1bit_out, public vvm_nexus::recvr_t {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit vvm_nor2(unsigned long d);
|
||||||
|
~vvm_nor2();
|
||||||
|
|
||||||
|
void init_I(unsigned idx, vpip_bit_t val);
|
||||||
|
void start();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void take_value(unsigned key, vpip_bit_t val);
|
||||||
|
vpip_bit_t input_[2];
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This object implements a LPM_RAM_DQ device, except for the actual
|
* This object implements a LPM_RAM_DQ device, except for the actual
|
||||||
* contents of the memory, which are stored in a vvm_memory_t
|
* contents of the memory, which are stored in a vvm_memory_t
|
||||||
|
|
@ -814,6 +848,9 @@ template <unsigned WIDTH> class vvm_pevent : public vvm_nexus::recvr_t {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: vvm_gates.h,v $
|
* $Log: vvm_gates.h,v $
|
||||||
|
* Revision 1.45 2000/03/17 19:24:00 steve
|
||||||
|
* nor2 and and2 optimized gates.
|
||||||
|
*
|
||||||
* Revision 1.44 2000/03/17 17:25:53 steve
|
* Revision 1.44 2000/03/17 17:25:53 steve
|
||||||
* Adder and comparator in nexus style.
|
* Adder and comparator in nexus style.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue