Handle implicit !=0 in if statements.
This commit is contained in:
parent
31bdb87c8f
commit
a890724b40
20
elaborate.cc
20
elaborate.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)
|
#if !defined(WINNT)
|
||||||
#ident "$Id: elaborate.cc,v 1.86 1999/09/15 04:17:52 steve Exp $"
|
#ident "$Id: elaborate.cc,v 1.87 1999/09/16 00:33:45 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2023,12 +2023,17 @@ NetProc* PCondit::elaborate(Design*des, const string&path) const
|
||||||
return new NetBlock(NetBlock::SEQU);
|
return new NetBlock(NetBlock::SEQU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the condition expression is more then 1 bits, then
|
||||||
|
// generate a comparison operator to get the result down to
|
||||||
|
// one bit. Turn <e> into <e> != 0;
|
||||||
|
|
||||||
if (! expr->set_width(1)) {
|
if (! expr->set_width(1)) {
|
||||||
cerr << get_line() << ": Unable to set expression width to 1."
|
assert(expr->expr_width() > 1);
|
||||||
<< endl;
|
verinum zero (verinum::V0, expr->expr_width());
|
||||||
des->errors += 1;
|
NetEConst*ezero = new NetEConst(zero);
|
||||||
delete expr;
|
ezero->set_width(expr->expr_width());
|
||||||
return 0;
|
NetEBComp*cmp = new NetEBComp('n', expr, ezero);
|
||||||
|
expr = cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Well, I actually need to generate code to handle the
|
// Well, I actually need to generate code to handle the
|
||||||
|
|
@ -2580,6 +2585,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: elaborate.cc,v $
|
* $Log: elaborate.cc,v $
|
||||||
|
* Revision 1.87 1999/09/16 00:33:45 steve
|
||||||
|
* Handle implicit !=0 in if statements.
|
||||||
|
*
|
||||||
* Revision 1.86 1999/09/15 04:17:52 steve
|
* Revision 1.86 1999/09/15 04:17:52 steve
|
||||||
* separate assign lval elaboration for error checking.
|
* separate assign lval elaboration for error checking.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: netlist.cc,v 1.62 1999/09/15 01:55:06 steve Exp $"
|
#ident "$Id: netlist.cc,v 1.63 1999/09/16 00:33:45 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
|
|
@ -805,6 +805,7 @@ bool NetEBBits::set_width(unsigned w)
|
||||||
NetEBComp::NetEBComp(char op, NetExpr*l, NetExpr*r)
|
NetEBComp::NetEBComp(char op, NetExpr*l, NetExpr*r)
|
||||||
: NetEBinary(op, l, r)
|
: NetEBinary(op, l, r)
|
||||||
{
|
{
|
||||||
|
expr_width(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetEBComp::~NetEBComp()
|
NetEBComp::~NetEBComp()
|
||||||
|
|
@ -1800,6 +1801,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: netlist.cc,v $
|
* $Log: netlist.cc,v $
|
||||||
|
* Revision 1.63 1999/09/16 00:33:45 steve
|
||||||
|
* Handle implicit !=0 in if statements.
|
||||||
|
*
|
||||||
* Revision 1.62 1999/09/15 01:55:06 steve
|
* Revision 1.62 1999/09/15 01:55:06 steve
|
||||||
* Elaborate non-blocking assignment to memories.
|
* Elaborate non-blocking assignment to memories.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue