synthesis for unary reduction ! and N operators.
This commit is contained in:
parent
4bf3e37af3
commit
ea921efced
15
elab_expr.cc
15
elab_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_expr.cc,v 1.29 2000/09/26 05:05:58 steve Exp $"
|
||||
#ident "$Id: elab_expr.cc,v 1.30 2000/11/29 05:24:00 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -506,6 +506,16 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
|
|||
tmp = new NetEUnary(op_, ip);
|
||||
tmp->set_line(*this);
|
||||
break;
|
||||
case '!': // Logical NOT
|
||||
case '&': // Reduction AND
|
||||
case '|': // Reduction or
|
||||
case '^': // Reduction XOR
|
||||
case 'A': // Reduction NAND (~&)
|
||||
case 'N': // Reduction NOR (~|)
|
||||
case 'X': // Reduction NXOR (~^)
|
||||
tmp = new NetEUReduce(op_, ip);
|
||||
tmp->set_line(*this);
|
||||
break;
|
||||
case '~':
|
||||
tmp = new NetEUBits(op_, ip);
|
||||
tmp->set_line(*this);
|
||||
|
|
@ -516,6 +526,9 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
* Revision 1.30 2000/11/29 05:24:00 steve
|
||||
* synthesis for unary reduction ! and N operators.
|
||||
*
|
||||
* Revision 1.29 2000/09/26 05:05:58 steve
|
||||
* Detect indefinite widths where definite widths are required.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: expr_synth.cc,v 1.16 2000/11/29 02:09:52 steve Exp $"
|
||||
#ident "$Id: expr_synth.cc,v 1.17 2000/11/29 05:24:00 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -370,6 +370,46 @@ NetNet* NetEUBits::synthesize(Design*des)
|
|||
return osig;
|
||||
}
|
||||
|
||||
NetNet* NetEUReduce::synthesize(Design*des)
|
||||
{
|
||||
NetNet*isig = expr_->synthesize(des);
|
||||
|
||||
NetScope*scope = isig->scope();
|
||||
assert(scope);
|
||||
string path = des->local_symbol(scope->name());
|
||||
|
||||
NetNet*osig = new NetNet(scope, path, NetNet::IMPLICIT, 1);
|
||||
osig->local_flag(true);
|
||||
|
||||
string oname = des->local_symbol(path);
|
||||
NetLogic*gate;
|
||||
|
||||
switch (op()) {
|
||||
case 'N':
|
||||
case '!':
|
||||
gate = new NetLogic(scope, oname, isig->pin_count()+1,
|
||||
NetLogic::NOR);
|
||||
break;
|
||||
|
||||
case '&':
|
||||
gate = new NetLogic(scope, oname, isig->pin_count()+1,
|
||||
NetLogic::AND);
|
||||
break;
|
||||
|
||||
default:
|
||||
cerr << get_line() << ": internal error: "
|
||||
<< "Unable to synthesize " << *this << "." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
des->add_node(gate);
|
||||
connect(gate->pin(0), osig->pin(0));
|
||||
for (unsigned idx = 0 ; idx < isig->pin_count() ; idx += 1)
|
||||
connect(gate->pin(1+idx), isig->pin(idx));
|
||||
|
||||
return osig;
|
||||
}
|
||||
|
||||
|
||||
NetNet* NetETernary::synthesize(Design *des)
|
||||
{
|
||||
|
|
@ -404,6 +444,9 @@ NetNet* NetESignal::synthesize(Design*des)
|
|||
|
||||
/*
|
||||
* $Log: expr_synth.cc,v $
|
||||
* Revision 1.17 2000/11/29 05:24:00 steve
|
||||
* synthesis for unary reduction ! and N operators.
|
||||
*
|
||||
* Revision 1.16 2000/11/29 02:09:52 steve
|
||||
* Add support for || synthesis (PR#53)
|
||||
*
|
||||
|
|
|
|||
26
netlist.cc
26
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.cc,v 1.146 2000/11/20 00:58:40 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.147 2000/11/29 05:24:00 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -2237,17 +2237,6 @@ NetETernary* NetETernary::dup_expr() const
|
|||
NetEUnary::NetEUnary(char op, NetExpr*ex)
|
||||
: NetExpr(ex->expr_width()), op_(op), expr_(ex)
|
||||
{
|
||||
switch (op_) {
|
||||
case '!': // Logical not
|
||||
case '&': // Reduction and
|
||||
case '|': // Reduction or
|
||||
case '^': // Reduction XOR
|
||||
case 'A': // Reduction NAND (~&)
|
||||
case 'N': // Reduction NOR (~|)
|
||||
case 'X': // Reduction NXOR (~^)
|
||||
expr_width(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NetEUnary::~NetEUnary()
|
||||
|
|
@ -2269,6 +2258,16 @@ NetEUBits::~NetEUBits()
|
|||
{
|
||||
}
|
||||
|
||||
NetEUReduce::NetEUReduce(char op, NetExpr*ex)
|
||||
: NetEUnary(op, ex)
|
||||
{
|
||||
expr_width(1);
|
||||
}
|
||||
|
||||
NetEUReduce::~NetEUReduce()
|
||||
{
|
||||
}
|
||||
|
||||
NetLogic::NetLogic(NetScope*s, const string&n, unsigned pins, TYPE t)
|
||||
: NetNode(s, n, pins), type_(t)
|
||||
{
|
||||
|
|
@ -2466,6 +2465,9 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.147 2000/11/29 05:24:00 steve
|
||||
* synthesis for unary reduction ! and N operators.
|
||||
*
|
||||
* Revision 1.146 2000/11/20 00:58:40 steve
|
||||
* Add support for supply nets (PR#17)
|
||||
*
|
||||
|
|
|
|||
15
netlist.h
15
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.h,v 1.181 2000/11/29 02:09:53 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.182 2000/11/29 05:24:00 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -2426,6 +2426,16 @@ class NetEUBits : public NetEUnary {
|
|||
|
||||
};
|
||||
|
||||
class NetEUReduce : public NetEUnary {
|
||||
|
||||
public:
|
||||
NetEUReduce(char op, NetExpr*ex);
|
||||
~NetEUReduce();
|
||||
|
||||
virtual NetNet* synthesize(Design*);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A reference to a memory is represented by this expression. If the
|
||||
* index is not supplied, then the node is only valid in certain
|
||||
|
|
@ -2814,6 +2824,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.182 2000/11/29 05:24:00 steve
|
||||
* synthesis for unary reduction ! and N operators.
|
||||
*
|
||||
* Revision 1.181 2000/11/29 02:09:53 steve
|
||||
* Add support for || synthesis (PR#53)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue