properly handle vhdl open ports in component instantiations.

This commit is contained in:
Stephen Williams 2011-06-12 16:59:07 -07:00
parent cab974c0c2
commit 41601696cc
5 changed files with 17 additions and 4 deletions

View File

@ -52,7 +52,10 @@ void ComponentInstantiation::dump(ostream&out, int indent) const
for (map<perm_string,Expression*>::const_iterator cur = port_map_.begin()
; cur != port_map_.end() ; ++cur) {
out << setw(indent+2) <<""<< cur->first << " => ..." << endl;
cur->second->dump(out, indent+6);
if (cur->second)
cur->second->dump(out, indent+6);
else
out << setw(indent+6) <<""<< "OPEN" << endl;
}
}

View File

@ -42,7 +42,7 @@ int Architecture::Statement::elaborate(Entity*, Architecture*)
return 0;
}
int ComponentInstantiation::elaborate(Entity*, Architecture*arc)
int ComponentInstantiation::elaborate(Entity*ent, Architecture*arc)
{
int errors = 0;
@ -65,6 +65,11 @@ int ComponentInstantiation::elaborate(Entity*, Architecture*arc)
errors += 1;
continue;
}
/* It is possible for the port to be explicitly
unconnected. In that case, the Expression will be nil */
if (cur->second)
cur->second->elaborate_expr(ent, arc, iport->type);
}
return errors;

View File

@ -96,6 +96,9 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc)
const char*comma = "";
for (map<perm_string,Expression*>::iterator cur = port_map_.begin()
; cur != port_map_.end() ; ++cur) {
// Skip unconnected ports
if (cur->second == 0)
continue;
out << comma << "." << cur->first << "(";
errors += cur->second->emit(out, ent, arc);
out << ")";

View File

@ -75,6 +75,7 @@ not, GN_KEYWORD_2008, K_not
null, GN_KEYWORD_2008, K_null
of, GN_KEYWORD_2008, K_of
on, GN_KEYWORD_2008, K_on
open, GN_KEYWORD_2008, K_open
or, GN_KEYWORD_2008, K_or
others, GN_KEYWORD_2008, K_others
out, GN_KEYWORD_2008, K_out

View File

@ -287,8 +287,9 @@ association_element
$$ = tmp;
}
| IDENTIFIER ARROW K_open
{ sorrymsg(@3, "Port map \"open\" not supported.\n");
$$ = 0;
{ named_expr_t*tmp = new named_expr_t(lex_strings.make($1), 0);
delete[]$1;
$$ = tmp;
}
| IDENTIFIER ARROW error
{ errormsg(@3, "Invalid target for port map association.\n");