Watch out for left operand of left shift that is not known early.
It is possible for the left operand of a left shift to be not known early during elaborate expression. In that case, make a punt expression and expect it to be resolved later.
This commit is contained in:
parent
04d49fcf35
commit
65a4f36de5
14
elab_expr.cc
14
elab_expr.cc
|
|
@ -287,6 +287,20 @@ NetExpr* PEBinary::elaborate_expr_base_lshift_(Design*des,
|
|||
{
|
||||
NetExpr*tmp;
|
||||
|
||||
long use_wid = lp->expr_width();
|
||||
if (expr_wid > 0)
|
||||
use_wid = expr_wid;
|
||||
|
||||
if (use_wid == 0) {
|
||||
if (debug_elaborate)
|
||||
cerr << get_fileline() << ": debug: "
|
||||
<< "Oops, left expression width is not known, "
|
||||
<< "so expression width is not known. Punt." << endl;
|
||||
tmp = new NetEBShift(op_, lp, rp);
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (NetEConst*lpc = dynamic_cast<NetEConst*> (lp)) {
|
||||
if (NetEConst*rpc = dynamic_cast<NetEConst*> (rp)) {
|
||||
// Handle the super-special case that both
|
||||
|
|
|
|||
|
|
@ -274,6 +274,9 @@ void PEBinary::dump(ostream&out) const
|
|||
case 'l':
|
||||
out << "<<";
|
||||
break;
|
||||
case 'L':
|
||||
out << "<=";
|
||||
break;
|
||||
case 'n':
|
||||
out << "!=";
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue