Parameters cannot have their width changed.

This commit is contained in:
steve 2005-05-17 20:56:55 +00:00
parent 82be4ab189
commit 7796c8bcfb
4 changed files with 37 additions and 7 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: design_dump.cc,v 1.158 2005/05/07 03:13:30 steve Exp $" #ident "$Id: design_dump.cc,v 1.159 2005/05/17 20:56:55 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -999,7 +999,7 @@ void NetEConstParam::dump(ostream&o) const
{ {
o << "<" << name_ << "="; o << "<" << name_ << "=";
NetEConst::dump(o); NetEConst::dump(o);
o << ">"; o << ", wid=" << expr_width() << ">";
} }
void NetECReal::dump(ostream&o) const void NetECReal::dump(ostream&o) const
@ -1143,6 +1143,9 @@ void Design::dump(ostream&o) const
/* /*
* $Log: design_dump.cc,v $ * $Log: design_dump.cc,v $
* Revision 1.159 2005/05/17 20:56:55 steve
* Parameters cannot have their width changed.
*
* Revision 1.158 2005/05/07 03:13:30 steve * Revision 1.158 2005/05/07 03:13:30 steve
* Include delay expressions for assignments in dump. * Include delay expressions for assignments in dump.
* *

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: elaborate.cc,v 1.322 2005/05/13 05:12:39 steve Exp $" #ident "$Id: elaborate.cc,v 1.323 2005/05/17 20:56:55 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -1861,9 +1861,10 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
continue; continue;
NetESignal*sig = new NetESignal(port); NetESignal*sig = new NetESignal(port);
NetExpr*rv = pad_to_width(sig, count_lval_width(lv));
/* Generate the assignment statement. */ /* Generate the assignment statement. */
NetAssign*ass = new NetAssign(lv, sig); NetAssign*ass = new NetAssign(lv, rv);
block->append(ass); block->append(ass);
} }
@ -2478,8 +2479,15 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const
/* Make the r-value of the initial assignment, and size it /* Make the r-value of the initial assignment, and size it
properly. Then use it to build the assignment statement. */ properly. Then use it to build the assignment statement. */
etmp = expr1_->elaborate_expr(des, scope); etmp = elab_and_eval(des, scope, expr1_);
etmp->set_width(lv->lwidth()); etmp->set_width(lv->lwidth());
etmp = pad_to_width(etmp, lv->lwidth());
if (debug_elaborate) {
cerr << get_line() << ": debug: FOR initial assign: "
<< sig->name() << " = " << *etmp << endl;
assert(etmp->expr_width() >= lv->lwidth());
}
NetAssign*init = new NetAssign(lv, etmp); NetAssign*init = new NetAssign(lv, etmp);
init->set_line(*this); init->set_line(*this);
@ -2957,6 +2965,9 @@ Design* elaborate(list<perm_string>roots)
/* /*
* $Log: elaborate.cc,v $ * $Log: elaborate.cc,v $
* Revision 1.323 2005/05/17 20:56:55 steve
* Parameters cannot have their width changed.
*
* Revision 1.322 2005/05/13 05:12:39 steve * Revision 1.322 2005/05/13 05:12:39 steve
* Some debug messages. * Some debug messages.
* *

View File

@ -19,7 +19,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: netlist.h,v 1.342 2005/05/08 23:44:08 steve Exp $" #ident "$Id: netlist.h,v 1.343 2005/05/17 20:56:55 steve Exp $"
#endif #endif
/* /*
@ -1123,6 +1123,7 @@ class NetEConstParam : public NetEConst {
perm_string name() const; perm_string name() const;
const NetScope*scope() const; const NetScope*scope() const;
virtual bool set_width(unsigned w);
virtual void expr_scan(struct expr_scan_t*) const; virtual void expr_scan(struct expr_scan_t*) const;
virtual void dump(ostream&) const; virtual void dump(ostream&) const;
@ -3443,6 +3444,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.343 2005/05/17 20:56:55 steve
* Parameters cannot have their width changed.
*
* Revision 1.342 2005/05/08 23:44:08 steve * Revision 1.342 2005/05/08 23:44:08 steve
* Add support for variable part select. * Add support for variable part select.
* *

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: set_width.cc,v 1.35 2005/01/24 05:28:31 steve Exp $" #ident "$Id: set_width.cc,v 1.36 2005/05/17 20:56:55 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -312,6 +312,15 @@ bool NetEConst::set_width(unsigned w)
} }
} }
/*
* Parameter vectors cannot be resized because they refer to a common
* value.
*/
bool NetEConstParam::set_width(unsigned w)
{
return w == expr_width();
}
/* /*
* Real constants can have whatever width the environment wants, * Real constants can have whatever width the environment wants,
* because it isn't really a vector. The environment will convert this * because it isn't really a vector. The environment will convert this
@ -405,6 +414,9 @@ bool NetEUReduce::set_width(unsigned w)
/* /*
* $Log: set_width.cc,v $ * $Log: set_width.cc,v $
* Revision 1.36 2005/05/17 20:56:55 steve
* Parameters cannot have their width changed.
*
* Revision 1.35 2005/01/24 05:28:31 steve * Revision 1.35 2005/01/24 05:28:31 steve
* Remove the NetEBitSel and combine all bit/part select * Remove the NetEBitSel and combine all bit/part select
* behavior into the NetESelect node and IVL_EX_SELECT * behavior into the NetESelect node and IVL_EX_SELECT