Skip to content

Commit

Permalink
Multiplication all the way to simulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jan 13, 2000
1 parent 3d1ffce commit aa8908c
Show file tree
Hide file tree
Showing 18 changed files with 570 additions and 34 deletions.
10 changes: 9 additions & 1 deletion PExpr.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: PExpr.h,v 1.26 1999/12/16 03:46:39 steve Exp $" #ident "$Id: PExpr.h,v 1.27 2000/01/13 03:35:35 steve Exp $"
#endif #endif


# include <string> # include <string>
Expand Down Expand Up @@ -264,6 +264,11 @@ class PEBinary : public PExpr {
unsigned long rise, unsigned long rise,
unsigned long fall, unsigned long fall,
unsigned long decay) const; unsigned long decay) const;
NetNet* elaborate_net_mul_(Design*des, const string&path,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const;
NetNet* elaborate_net_shift_(Design*des, const string&path, NetNet* elaborate_net_shift_(Design*des, const string&path,
unsigned lwidth, unsigned lwidth,
unsigned long rise, unsigned long rise,
Expand Down Expand Up @@ -318,6 +323,9 @@ class PECallFunction : public PExpr {


/* /*
* $Log: PExpr.h,v $ * $Log: PExpr.h,v $
* Revision 1.27 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.26 1999/12/16 03:46:39 steve * Revision 1.26 1999/12/16 03:46:39 steve
* Structural logical or. * Structural logical or.
* *
Expand Down
15 changes: 12 additions & 3 deletions design_dump.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: design_dump.cc,v 1.65 2000/01/10 01:35:23 steve Exp $" #ident "$Id: design_dump.cc,v 1.66 2000/01/13 03:35:35 steve Exp $"
#endif #endif


/* /*
Expand Down Expand Up @@ -142,8 +142,14 @@ void NetCLShift::dump_node(ostream&o, unsigned ind) const


void NetCompare::dump_node(ostream&o, unsigned ind) const void NetCompare::dump_node(ostream&o, unsigned ind) const
{ {
o << setw(ind) << "" << "LPM_COMPARE (NetCompare): " << o << setw(ind) << "" << "LPM_COMPARE (NetCompare): " << name() << endl;
name() << endl; dump_node_pins(o, ind+4);
dump_obj_attr(o, ind+4);
}

void NetMult::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "LPM_MULT (NetMult): " << name() << endl;
dump_node_pins(o, ind+4); dump_node_pins(o, ind+4);
dump_obj_attr(o, ind+4); dump_obj_attr(o, ind+4);
} }
Expand Down Expand Up @@ -865,6 +871,9 @@ void Design::dump(ostream&o) const


/* /*
* $Log: design_dump.cc,v $ * $Log: design_dump.cc,v $
* Revision 1.66 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.65 2000/01/10 01:35:23 steve * Revision 1.65 2000/01/10 01:35:23 steve
* Elaborate parameters afer binding of overrides. * Elaborate parameters afer binding of overrides.
* *
Expand Down
10 changes: 9 additions & 1 deletion elab_expr.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: elab_expr.cc,v 1.14 2000/01/01 06:18:00 steve Exp $" #ident "$Id: elab_expr.cc,v 1.15 2000/01/13 03:35:35 steve Exp $"
#endif #endif




Expand Down Expand Up @@ -68,6 +68,11 @@ NetExpr* PEBinary::elaborate_expr(Design*des, const string&path) const
tmp->set_line(*this); tmp->set_line(*this);
break; break;


case '*':
tmp = new NetEBMult(op_, lp, rp);
tmp->set_line(*this);
break;

case 'l': case 'l':
case 'r': case 'r':
tmp = new NetEBShift(op_, lp, rp); tmp = new NetEBShift(op_, lp, rp);
Expand Down Expand Up @@ -373,6 +378,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const


/* /*
* $Log: elab_expr.cc,v $ * $Log: elab_expr.cc,v $
* Revision 1.15 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.14 2000/01/01 06:18:00 steve * Revision 1.14 2000/01/01 06:18:00 steve
* Handle synthesis of concatenation. * Handle synthesis of concatenation.
* *
Expand Down
67 changes: 54 additions & 13 deletions elab_net.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: elab_net.cc,v 1.18 2000/01/11 04:20:57 steve Exp $" #ident "$Id: elab_net.cc,v 1.19 2000/01/13 03:35:35 steve Exp $"
#endif #endif


# include "PExpr.h" # include "PExpr.h"
Expand All @@ -35,6 +35,10 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path,
unsigned long decay) const unsigned long decay) const
{ {
switch (op_) { switch (op_) {
case '*':
//case '/':
//case '%':
return elaborate_net_mul_(des, path, width, rise, fall, decay);
case '+': case '+':
case '-': case '-':
return elaborate_net_add_(des, path, width, rise, fall, decay); return elaborate_net_add_(des, path, width, rise, fall, decay);
Expand Down Expand Up @@ -272,18 +276,6 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, const string&path,
return 0; return 0;
} }


#if 0
if (lsig->pin_count() != rsig->pin_count()) {
cerr << get_line() << ": internal error: Cannot match "
"structural net widths " << lsig->pin_count() <<
" and " << rsig->pin_count() << "." << endl;
delete lsig;
delete rsig;
des->errors += 1;
return 0;
}
#endif

unsigned dwidth = lsig->pin_count(); unsigned dwidth = lsig->pin_count();
if (rsig->pin_count() > dwidth) dwidth = rsig->pin_count(); if (rsig->pin_count() > dwidth) dwidth = rsig->pin_count();


Expand Down Expand Up @@ -508,6 +500,52 @@ NetNet* PEBinary::elaborate_net_log_(Design*des, const string&path,
return osig; return osig;
} }


NetNet* PEBinary::elaborate_net_mul_(Design*des, const string&path,
unsigned lwidth,
unsigned long rise,
unsigned long fall,
unsigned long decay) const
{
NetNet*lsig = left_->elaborate_net(des, path, 0, 0, 0, 0);
if (lsig == 0) return 0;
NetNet*rsig = right_->elaborate_net(des, path, 0, 0, 0, 0);
if (rsig == 0) return 0;

unsigned rwidth = lsig->pin_count() + rsig->pin_count();
NetMult*mult = new NetMult(des->local_symbol(path), rwidth,
lsig->pin_count(),
rsig->pin_count());
des->add_node(mult);

for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1)
connect(mult->pin_DataA(idx), lsig->pin(idx));
for (unsigned idx = 0 ; idx < rsig->pin_count() ; idx += 1)
connect(mult->pin_DataB(idx), rsig->pin(idx));

if (lwidth == 0) lwidth = rwidth;
NetNet*osig = new NetNet(0, des->local_symbol(path),
NetNet::IMPLICIT, lwidth);
osig->local_flag(true);
des->add_signal(osig);

unsigned cnt = osig->pin_count();
if (cnt > rwidth) cnt = rwidth;

for (unsigned idx = 0 ; idx < cnt ; idx += 1)
connect(mult->pin_Result(idx), osig->pin(idx));

/* If the lvalue is larger then the result, then pad the
output with constant 0. */
if (cnt < osig->pin_count()) {
NetConst*tmp = new NetConst(des->local_symbol(path), verinum::V0);
des->add_node(tmp);
for (unsigned idx = cnt ; idx < osig->pin_count() ; idx += 1)
connect(osig->pin(idx), tmp->pin(0));
}

return osig;
}

NetNet* PEBinary::elaborate_net_shift_(Design*des, const string&path, NetNet* PEBinary::elaborate_net_shift_(Design*des, const string&path,
unsigned lwidth, unsigned lwidth,
unsigned long rise, unsigned long rise,
Expand Down Expand Up @@ -1224,6 +1262,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,


/* /*
* $Log: elab_net.cc,v $ * $Log: elab_net.cc,v $
* Revision 1.19 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.18 2000/01/11 04:20:57 steve * Revision 1.18 2000/01/11 04:20:57 steve
* Elaborate net widths of constants to as small * Elaborate net widths of constants to as small
* as is possible, obeying context constraints. * as is possible, obeying context constraints.
Expand Down
10 changes: 9 additions & 1 deletion emit.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: emit.cc,v 1.31 1999/11/28 23:42:02 steve Exp $" #ident "$Id: emit.cc,v 1.32 2000/01/13 03:35:35 steve Exp $"
#endif #endif


/* /*
Expand Down Expand Up @@ -85,6 +85,11 @@ void NetFF::emit_node(ostream&o, struct target_t*tgt) const
tgt->lpm_ff(o, this); tgt->lpm_ff(o, this);
} }


void NetMult::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->lpm_mult(o, this);
}

void NetMux::emit_node(ostream&o, struct target_t*tgt) const void NetMux::emit_node(ostream&o, struct target_t*tgt) const
{ {
tgt->lpm_mux(o, this); tgt->lpm_mux(o, this);
Expand Down Expand Up @@ -389,6 +394,9 @@ bool emit(ostream&o, const Design*des, const char*type)


/* /*
* $Log: emit.cc,v $ * $Log: emit.cc,v $
* Revision 1.32 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.31 1999/11/28 23:42:02 steve * Revision 1.31 1999/11/28 23:42:02 steve
* NetESignal object no longer need to be NetNode * NetESignal object no longer need to be NetNode
* objects. Let them keep a pointer to NetNet objects. * objects. Let them keep a pointer to NetNet objects.
Expand Down
11 changes: 10 additions & 1 deletion eval_tree.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: eval_tree.cc,v 1.6 1999/10/22 23:57:53 steve Exp $" #ident "$Id: eval_tree.cc,v 1.7 2000/01/13 03:35:35 steve Exp $"
#endif #endif


# include "netlist.h" # include "netlist.h"
Expand Down Expand Up @@ -138,6 +138,12 @@ NetEConst* NetEBLogic::eval_tree()
return 0; return 0;
} }


NetEConst* NetEBMult::eval_tree()
{
eval_sub_tree_();
return 0;
}

/* /*
* Evaluate the shift operator if possible. For this to work, both * Evaluate the shift operator if possible. For this to work, both
* operands must be constant. * operands must be constant.
Expand Down Expand Up @@ -262,6 +268,9 @@ NetExpr* NetEParam::eval_tree()


/* /*
* $Log: eval_tree.cc,v $ * $Log: eval_tree.cc,v $
* Revision 1.7 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.6 1999/10/22 23:57:53 steve * Revision 1.6 1999/10/22 23:57:53 steve
* do the <= in bits, not numbers. * do the <= in bits, not numbers.
* *
Expand Down
14 changes: 13 additions & 1 deletion functor.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: functor.cc,v 1.9 2000/01/02 17:57:20 steve Exp $" #ident "$Id: functor.cc,v 1.10 2000/01/13 03:35:35 steve Exp $"
#endif #endif


# include "functor.h" # include "functor.h"
Expand Down Expand Up @@ -51,6 +51,10 @@ void functor_t::lpm_logic(class Design*, class NetLogic*)
{ {
} }


void functor_t::lpm_mult(class Design*, class NetMult*)
{
}

void Design::functor(functor_t*fun) void Design::functor(functor_t*fun)
{ {
// apply to signals // apply to signals
Expand Down Expand Up @@ -107,6 +111,11 @@ void NetLogic::functor_node(Design*des, functor_t*fun)
fun->lpm_logic(des, this); fun->lpm_logic(des, this);
} }


void NetMult::functor_node(Design*des, functor_t*fun)
{
fun->lpm_mult(des, this);
}

proc_match_t::~proc_match_t() proc_match_t::~proc_match_t()
{ {
} }
Expand Down Expand Up @@ -158,6 +167,9 @@ int NetPEvent::match_proc(proc_match_t*that)


/* /*
* $Log: functor.cc,v $ * $Log: functor.cc,v $
* Revision 1.10 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.9 2000/01/02 17:57:20 steve * Revision 1.9 2000/01/02 17:57:20 steve
* Handle nodes running out during node scan. * Handle nodes running out during node scan.
* *
Expand Down
8 changes: 7 additions & 1 deletion functor.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) #if !defined(WINNT)
#ident "$Id: functor.h,v 1.6 1999/12/30 04:19:12 steve Exp $" #ident "$Id: functor.h,v 1.7 2000/01/13 03:35:35 steve Exp $"
#endif #endif


/* /*
Expand Down Expand Up @@ -53,6 +53,9 @@ struct functor_t {


/* Handle LPM combinational logic devices. */ /* Handle LPM combinational logic devices. */
virtual void lpm_logic(class Design*des, class NetLogic*); virtual void lpm_logic(class Design*des, class NetLogic*);

/* This method is called for each multiplier. */
virtual void lpm_mult(class Design*des, class NetMult*);
}; };


struct proc_match_t { struct proc_match_t {
Expand All @@ -67,6 +70,9 @@ struct proc_match_t {


/* /*
* $Log: functor.h,v $ * $Log: functor.h,v $
* Revision 1.7 2000/01/13 03:35:35 steve
* Multiplication all the way to simulation.
*
* Revision 1.6 1999/12/30 04:19:12 steve * Revision 1.6 1999/12/30 04:19:12 steve
* Propogate constant 0 in low bits of adders. * Propogate constant 0 in low bits of adders.
* *
Expand Down
Loading

0 comments on commit aa8908c

Please sign in to comment.