From a82c178fd91df4f214a34ded6061a4cec2a0845b Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 14 Jun 2002 21:38:41 +0000 Subject: [PATCH] Fix expression width for repeat concatenations. --- design_dump.cc | 13 ++++++++++--- elab_expr.cc | 10 +++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index 1e1fcac22..97f960197 100644 --- a/design_dump.cc +++ b/design_dump.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: design_dump.cc,v 1.127 2002/06/08 23:42:46 steve Exp $" +#ident "$Id: design_dump.cc,v 1.128 2002/06/14 21:38:41 steve Exp $" #endif # include "config.h" @@ -843,8 +843,12 @@ void NetEBinary::dump(ostream&o) const void NetEConcat::dump(ostream&o) const { - if (repeat_) - o << *repeat_; + if (repeat_calculated_) { + if (repeat_value_ != 1) + o << repeat_value_; + } else if (repeat_) { + o << "<" << *repeat_ << ">"; + } if (parms_[0]) o << "{" << *parms_[0]; @@ -973,6 +977,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.128 2002/06/14 21:38:41 steve + * Fix expression width for repeat concatenations. + * * Revision 1.127 2002/06/08 23:42:46 steve * Add NetRamDq synthsesis from memory l-values. * diff --git a/elab_expr.cc b/elab_expr.cc index 6165865a5..e9c129698 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) && !defined(macintosh) -#ident "$Id: elab_expr.cc,v 1.60 2002/05/24 00:44:54 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.61 2002/06/14 21:38:41 steve Exp $" #endif # include "config.h" @@ -375,6 +375,8 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const NetEConcat*tmp = new NetEConcat(parms_.count(), repeat); tmp->set_line(*this); + unsigned wid_sum = 0; + /* Elaborate all the parameters and attach them to the concat node. */ for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) { assert(parms_[idx]); @@ -390,9 +392,12 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const des->errors += 1; } + wid_sum += ex->expr_width(); tmp->set(idx, ex); } + tmp->set_width(wid_sum * tmp->repeat()); + return tmp; } @@ -869,6 +874,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const /* * $Log: elab_expr.cc,v $ + * Revision 1.61 2002/06/14 21:38:41 steve + * Fix expression width for repeat concatenations. + * * Revision 1.60 2002/05/24 00:44:54 steve * Add support for $bits (SystemVerilog) *