diff --git a/elab_expr.cc b/elab_expr.cc index b1544aae7..a214d0049 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elab_expr.cc,v 1.4 1999/09/29 22:57:10 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.5 1999/09/30 00:48:49 steve Exp $" #endif @@ -282,8 +282,43 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const return 0; } +/* + * Elaborate the Ternary operator. I know that the expressions were + * parsed so I can presume that they exist, and call elaboration + * methods. If any elaboration fails, then give up and return 0. + */ +NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const +{ + assert(expr_); + assert(tru_); + assert(fal_); + + NetExpr*con = expr_->elaborate_expr(des, path); + if (con == 0) + return 0; + + NetExpr*tru = tru_->elaborate_expr(des, path); + if (tru == 0) { + delete con; + return 0; + } + + NetExpr*fal = fal_->elaborate_expr(des, path); + if (fal == 0) { + delete con; + delete tru; + return 0; + } + + NetETernary*res = new NetETernary(con, tru, fal); + return res; +} + /* * $Log: elab_expr.cc,v $ + * Revision 1.5 1999/09/30 00:48:49 steve + * Cope with errors during ternary operator elaboration. + * * Revision 1.4 1999/09/29 22:57:10 steve * Move code to elab_expr.cc * diff --git a/elaborate.cc b/elaborate.cc index 8b87d9dd1..8f5b94069 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elaborate.cc,v 1.103 1999/09/29 22:57:10 steve Exp $" +#ident "$Id: elaborate.cc,v 1.104 1999/09/30 00:48:50 steve Exp $" #endif /* @@ -1157,16 +1157,6 @@ NetNet* PETernary::elaborate_net(Design*des, const string&path, return sig; } -NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const -{ - NetExpr*con = expr_->elaborate_expr(des, path); - NetExpr*tru = tru_->elaborate_expr(des, path); - NetExpr*fal = fal_->elaborate_expr(des, path); - - NetETernary*res = new NetETernary(con, tru, fal); - return res; -} - NetNet* PEUnary::elaborate_net(Design*des, const string&path, unsigned long rise, unsigned long fall, @@ -1401,8 +1391,9 @@ NetNet* PAssign_::elaborate_lval(Design*des, const string&path, NetNet*reg = des->find_signal(path, id->name()); if (reg == 0) { - cerr << get_line() << ": Could not match signal ``" << + cerr << get_line() << ": error: Could not match signal ``" << id->name() << "'' in ``" << path << "''" << endl; + des->errors += 1; return 0; } assert(reg); @@ -1416,8 +1407,9 @@ NetNet* PAssign_::elaborate_lval(Design*des, const string&path, if (id->msb_ && id->lsb_) { verinum*vl = id->lsb_->eval_const(des, path); if (vl == 0) { - cerr << id->lsb_->get_line() << ": Expression must be" - " constant in this context: " << *id->lsb_; + cerr << id->lsb_->get_line() << ": error: " + "Expression must be constant in this context: " + << *id->lsb_; des->errors += 1; return 0; } @@ -2508,6 +2500,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.104 1999/09/30 00:48:50 steve + * Cope with errors during ternary operator elaboration. + * * Revision 1.103 1999/09/29 22:57:10 steve * Move code to elab_expr.cc * diff --git a/pform_dump.cc b/pform_dump.cc index d4ac72bce..ab2344299 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: pform_dump.cc,v 1.42 1999/09/29 21:15:58 steve Exp $" +#ident "$Id: pform_dump.cc,v 1.43 1999/09/30 00:48:50 steve Exp $" #endif /* @@ -474,7 +474,10 @@ void PFunction::dump(ostream&out, unsigned ind) const out << (*ports_)[idx]->name() << ";" << endl; } - statement_->dump(out, ind); + if (statement_) + statement_->dump(out, ind); + else + out << setw(ind) << "" << "/* NOOP */" << endl; } void PRepeat::dump(ostream&out, unsigned ind) const @@ -663,6 +666,9 @@ void PUdp::dump(ostream&out) const /* * $Log: pform_dump.cc,v $ + * Revision 1.43 1999/09/30 00:48:50 steve + * Cope with errors during ternary operator elaboration. + * * Revision 1.42 1999/09/29 21:15:58 steve * Handle some mor missing names. *