vhdlpp: Do not evaluate generics.
They might change depending on the instance, so they cannot be evaluated using the default value.
This commit is contained in:
parent
ed3e67926f
commit
643a3f2f2c
|
|
@ -74,14 +74,13 @@ const VType*ExpName::elaborate_adjust_type_with_range_(Entity*ent, ScopeBase*sco
|
||||||
// If the name is an array, then a part select is
|
// If the name is an array, then a part select is
|
||||||
// also an array, but with different bounds.
|
// also an array, but with different bounds.
|
||||||
int64_t use_msb, use_lsb;
|
int64_t use_msb, use_lsb;
|
||||||
bool flag;
|
bool flag = true;
|
||||||
|
|
||||||
flag = range->msb()->evaluate(ent, scope, use_msb);
|
flag &= range->msb()->evaluate(ent, scope, use_msb);
|
||||||
ivl_assert(*this, flag);
|
flag &= range->lsb()->evaluate(ent, scope, use_lsb);
|
||||||
flag = range->lsb()->evaluate(ent, scope, use_lsb);
|
|
||||||
ivl_assert(*this, flag);
|
|
||||||
|
|
||||||
type = new VTypeArray(array->element_type(), use_msb, use_lsb);
|
if(flag)
|
||||||
|
type = new VTypeArray(array->element_type(), use_msb, use_lsb);
|
||||||
}
|
}
|
||||||
else if(idx) {
|
else if(idx) {
|
||||||
// If the name is an array or a vector, then an
|
// If the name is an array or a vector, then an
|
||||||
|
|
|
||||||
|
|
@ -144,19 +144,6 @@ bool ExpName::evaluate(Entity*ent, ScopeBase*scope, int64_t&val) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent) {
|
|
||||||
const InterfacePort*gen = ent->find_generic(name_);
|
|
||||||
if (gen) {
|
|
||||||
// Evaluate the default expression and use that.
|
|
||||||
if (gen->expr && gen->expr->evaluate(ent, scope, val))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
cerr << get_fileline() << ": sorry: I could not evaluate "
|
|
||||||
<< "generic override." << endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scope) {
|
if (scope) {
|
||||||
const VType*type;
|
const VType*type;
|
||||||
Expression*exp;
|
Expression*exp;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue