Allow genvars to also be constants.
This patch adds genvars to the list of constant values.
This commit is contained in:
parent
4f8b91e65c
commit
34e90bb3a6
2
Module.h
2
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<pair<perm_string,LineInfo*> > genvars;
|
||||
map<perm_string,LineInfo*> genvars;
|
||||
|
||||
/* the module has a list of generate schemes that appear in
|
||||
the module definition. These are used at elaboration time. */
|
||||
|
|
|
|||
7
PExpr.cc
7
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<perm_string,LineInfo*>::const_iterator cur;
|
||||
cur = mod->genvars.find(tmp);
|
||||
if (cur != mod->genvars.end()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
3
pform.cc
3
pform.cc
|
|
@ -369,8 +369,7 @@ void pform_genvars(const struct vlltype&li, list<perm_string>*names)
|
|||
for (cur = names->begin(); cur != names->end() ; *cur++) {
|
||||
LineInfo*lni = new LineInfo();
|
||||
FILE_NAME(lni, li);
|
||||
pform_cur_module->genvars.push_back(
|
||||
pair<perm_string,LineInfo*>(*cur, lni));
|
||||
pform_cur_module->genvars[*cur] = lni;
|
||||
}
|
||||
|
||||
delete names;
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@ void Module::dump(ostream&out) const
|
|||
out << "/* ERROR */;" << endl;
|
||||
}
|
||||
|
||||
typedef list<pair<perm_string,LineInfo*> >::const_iterator genvar_iter_t;
|
||||
typedef map<perm_string,LineInfo*>::const_iterator genvar_iter_t;
|
||||
for (genvar_iter_t cur = genvars.begin()
|
||||
; cur != genvars.end() ; cur++) {
|
||||
out << " genvar " << ((*cur).first) << ";" << endl;
|
||||
|
|
|
|||
Loading…
Reference in New Issue