From 65a4f36de5f682783468deea19a14b2406c21ae4 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 21 Aug 2008 18:58:38 -0700 Subject: [PATCH] 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. --- elab_expr.cc | 14 ++++++++++++++ pform_dump.cc | 3 +++ 2 files changed, 17 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index c496b04de..d9a693711 100644 --- a/elab_expr.cc +++ b/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 (lp)) { if (NetEConst*rpc = dynamic_cast (rp)) { // Handle the super-special case that both diff --git a/pform_dump.cc b/pform_dump.cc index f506bd655..3dae41844 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -274,6 +274,9 @@ void PEBinary::dump(ostream&out) const case 'l': out << "<<"; break; + case 'L': + out << "<="; + break; case 'n': out << "!="; break;