Fix expression width for repeat concatenations.

This commit is contained in:
steve 2002-06-14 21:38:41 +00:00
parent 809bd18e66
commit a82c178fd9
2 changed files with 19 additions and 4 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) && !defined(macintosh) #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 #endif
# include "config.h" # include "config.h"
@ -843,8 +843,12 @@ void NetEBinary::dump(ostream&o) const
void NetEConcat::dump(ostream&o) const void NetEConcat::dump(ostream&o) const
{ {
if (repeat_) if (repeat_calculated_) {
o << *repeat_; if (repeat_value_ != 1)
o << repeat_value_;
} else if (repeat_) {
o << "<" << *repeat_ << ">";
}
if (parms_[0]) if (parms_[0])
o << "{" << *parms_[0]; o << "{" << *parms_[0];
@ -973,6 +977,9 @@ void Design::dump(ostream&o) const
/* /*
* $Log: design_dump.cc,v $ * $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 * Revision 1.127 2002/06/08 23:42:46 steve
* Add NetRamDq synthsesis from memory l-values. * Add NetRamDq synthsesis from memory l-values.
* *

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) && !defined(macintosh) #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 #endif
# include "config.h" # include "config.h"
@ -375,6 +375,8 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const
NetEConcat*tmp = new NetEConcat(parms_.count(), repeat); NetEConcat*tmp = new NetEConcat(parms_.count(), repeat);
tmp->set_line(*this); tmp->set_line(*this);
unsigned wid_sum = 0;
/* Elaborate all the parameters and attach them to the concat node. */ /* Elaborate all the parameters and attach them to the concat node. */
for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) { for (unsigned idx = 0 ; idx < parms_.count() ; idx += 1) {
assert(parms_[idx]); assert(parms_[idx]);
@ -390,9 +392,12 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const
des->errors += 1; des->errors += 1;
} }
wid_sum += ex->expr_width();
tmp->set(idx, ex); tmp->set(idx, ex);
} }
tmp->set_width(wid_sum * tmp->repeat());
return tmp; return tmp;
} }
@ -869,6 +874,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
/* /*
* $Log: elab_expr.cc,v $ * $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 * Revision 1.60 2002/05/24 00:44:54 steve
* Add support for $bits (SystemVerilog) * Add support for $bits (SystemVerilog)
* *