diff --git a/Module.h b/Module.h index 5985ab717..3222a2838 100644 --- a/Module.h +++ b/Module.h @@ -121,7 +121,7 @@ class Module : public PScope, public LineInfo { /* The module has a list of genvars that may be used in various generate schemes. */ - list > genvars; + map genvars; /* the module has a list of generate schemes that appear in the module definition. These are used at elaboration time. */ diff --git a/PExpr.cc b/PExpr.cc index aa1265856..96428204f 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -191,7 +191,7 @@ PEIdent::~PEIdent() /* * An identifier can be in a constant expression if (and only if) it is - * a parameter. + * a parameter or genvar. * * NOTE: This test does not work if the name is hierarchical! */ @@ -212,6 +212,11 @@ bool PEIdent::is_constant(Module*mod) const if (cur != mod->localparams.end()) return true; } + { map::const_iterator cur; + cur = mod->genvars.find(tmp); + if (cur != mod->genvars.end()) return true; + } + return false; } diff --git a/pform.cc b/pform.cc index 8a613fb13..295262eed 100644 --- a/pform.cc +++ b/pform.cc @@ -369,8 +369,7 @@ void pform_genvars(const struct vlltype&li, list*names) for (cur = names->begin(); cur != names->end() ; *cur++) { LineInfo*lni = new LineInfo(); FILE_NAME(lni, li); - pform_cur_module->genvars.push_back( - pair(*cur, lni)); + pform_cur_module->genvars[*cur] = lni; } delete names; diff --git a/pform_dump.cc b/pform_dump.cc index 9bcc7efa3..1473865ee 100644 --- a/pform_dump.cc +++ b/pform_dump.cc @@ -995,7 +995,7 @@ void Module::dump(ostream&out) const out << "/* ERROR */;" << endl; } - typedef list >::const_iterator genvar_iter_t; + typedef map::const_iterator genvar_iter_t; for (genvar_iter_t cur = genvars.begin() ; cur != genvars.end() ; cur++) { out << " genvar " << ((*cur).first) << ";" << endl;