Expand bits in delayed assignments.

This commit is contained in:
steve 1999-09-22 21:25:42 +00:00
parent 0955058fbe
commit 59b1b4c7b9
1 changed files with 17 additions and 5 deletions

View File

@ -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.95 1999/09/22 04:30:04 steve Exp $" #ident "$Id: elaborate.cc,v 1.96 1999/09/22 21:25:42 steve Exp $"
#endif #endif
/* /*
@ -1608,6 +1608,12 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
} }
assert(rv); assert(rv);
/* Try to evaluate the expression, at least as far as possible. */
if (NetExpr*tmp = rv->eval_tree()) {
delete rv;
rv = tmp;
}
NetAssign*cur; NetAssign*cur;
/* Rewrite delayed assignments as assignments that are /* Rewrite delayed assignments as assignments that are
@ -1630,10 +1636,13 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
string n = des->local_symbol(path); string n = des->local_symbol(path);
unsigned wid = reg->pin_count(); unsigned wid = reg->pin_count();
rv->set_width(reg->pin_count());
rv = pad_to_width(rv, reg->pin_count());
if (! rv->set_width(reg->pin_count())) { if (! rv->set_width(reg->pin_count())) {
cerr << get_line() << ": Unable to match expression " cerr << get_line() << ": error: Unable to match "
"width of " << rv->expr_width() << " to l-value" "expression width of " << rv->expr_width() <<
" width of " << wid << "." << endl; " to l-value width of " << wid << "." << endl;
//XXXX delete rv; //XXXX delete rv;
return 0; return 0;
} }
@ -1711,7 +1720,7 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
} else { } else {
assert(reg->pin_count() == 1); assert(reg->pin_count() == 1);
cerr << get_line() << ": Sorry, l-value bit select expression" cerr << get_line() << ": Sorry: l-value bit select expression"
" must be constant." << endl; " must be constant." << endl;
delete reg; delete reg;
delete rv; delete rv;
@ -2616,6 +2625,9 @@ Design* elaborate(const map<string,Module*>&modules,
/* /*
* $Log: elaborate.cc,v $ * $Log: elaborate.cc,v $
* Revision 1.96 1999/09/22 21:25:42 steve
* Expand bits in delayed assignments.
*
* Revision 1.95 1999/09/22 04:30:04 steve * Revision 1.95 1999/09/22 04:30:04 steve
* Parse and elaborate named for/join blocks. * Parse and elaborate named for/join blocks.
* *