Handle arrays of vectors in VHDL types.

This incidentally adds binding of generic to generic instantation.
This commit is contained in:
Stephen Williams 2011-11-06 09:01:02 -08:00
parent c1be255844
commit 8e0beff3ab
2 changed files with 15 additions and 2 deletions

View File

@ -141,6 +141,9 @@ int ExpName::elaborate_rval(Entity*ent, Architecture*arc, const InterfacePort*lv
} else if (arc->find_signal(name_)) {
/* OK */
} else if (ent->find_generic(name_)) {
/* OK */
} else {
cerr << get_fileline() << ": error: No port or signal " << name_
<< " to be used as r-value." << endl;

View File

@ -36,6 +36,18 @@ int VType::decl_t::emit(ostream&out, perm_string name) const
int VTypeArray::emit_def(ostream&out, perm_string name) const
{
int errors = 0;
if (const VTypeArray*sub = dynamic_cast<const VTypeArray*> (etype_)) {
sub->emit_def(out, name);
assert(dimensions() == 1);
out << "[";
errors += dimension(0).msb()->emit(out, 0, 0);
out << ":";
errors += dimension(0).lsb()->emit(out, 0, 0);
out << "] ";
return errors;
}
const VTypePrimitive*base = dynamic_cast<const VTypePrimitive*> (etype_);
assert(base != 0);
assert(dimensions() == 1);
@ -58,8 +70,6 @@ int VTypeArray::emit_def(ostream&out, perm_string name) const
int VTypeArray::emit_decl(ostream&out, perm_string name, bool reg_flag) const
{
int errors = 0;
const VTypePrimitive*base = dynamic_cast<const VTypePrimitive*> (etype_);
assert(base != 0);
assert(dimensions() == 1);
if (reg_flag)