Fix context determined with of constants.

This commit is contained in:
steve 2006-07-07 04:06:37 +00:00
parent 1b8e2a17c7
commit aab6fefd8a
1 changed files with 15 additions and 2 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
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.105 2006/06/02 04:48:49 steve Exp $" #ident "$Id: elab_expr.cc,v 1.106 2006/07/07 04:06:37 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -1188,7 +1188,17 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*,
int expr_width, bool) const int expr_width, bool) const
{ {
assert(value_); assert(value_);
NetEConst*tmp = new NetEConst(*value_); verinum tvalue = *value_;
// If the expr_width is >0, then the context is requesting a
// specific size (for example this is part of the r-values of
// an assignment) so we pad to the desired width and ignore
// the self-determined size.
if (expr_width > 0) {
tvalue = pad_to_width(tvalue, expr_width);
}
NetEConst*tmp = new NetEConst(tvalue);
tmp->set_line(*this); tmp->set_line(*this);
return tmp; return tmp;
} }
@ -1372,6 +1382,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
/* /*
* $Log: elab_expr.cc,v $ * $Log: elab_expr.cc,v $
* Revision 1.106 2006/07/07 04:06:37 steve
* Fix context determined with of constants.
*
* Revision 1.105 2006/06/02 04:48:49 steve * Revision 1.105 2006/06/02 04:48:49 steve
* Make elaborate_expr methods aware of the width that the context * Make elaborate_expr methods aware of the width that the context
* requires of it. In the process, fix sizing of the width of unary * requires of it. In the process, fix sizing of the width of unary