Save the type name if an InterfacePort object.

This commit is contained in:
Stephen Williams 2011-01-06 08:12:55 -08:00
parent 5a6d07ff9f
commit d72f7ea249
4 changed files with 18 additions and 2 deletions

View File

@ -56,7 +56,8 @@ static void dump_design_entity(ostream&out, Entity*obj)
; cur != obj->ports.end() ; ++cur) { ; cur != obj->ports.end() ; ++cur) {
InterfacePort*item = *cur; InterfacePort*item = *cur;
out << setw(6) << "" << item->name out << setw(6) << "" << item->name
<< " : " << item->mode << endl; << " : " << item->mode
<< ", type=" << item->type_name << endl;
} }
} }
} }

View File

@ -27,8 +27,12 @@ typedef enum { PORT_NONE=0, PORT_IN, PORT_OUT } port_mode_t;
class InterfacePort { class InterfacePort {
public: public:
// Port direction from the source code.
port_mode_t mode; port_mode_t mode;
// Name of the port from the source code
perm_string name; perm_string name;
// Name of interface type as given in the source code.
perm_string type_name;
}; };
class Entity { class Entity {

View File

@ -54,6 +54,16 @@ int Entity::elaborate()
; cur != ports.end() ; ++cur) { ; cur != ports.end() ; ++cur) {
InterfacePort*port = *cur; InterfacePort*port = *cur;
// FIXME: this is a stub. This port handling code
// currently only supports std_logic signal tyes,
// so just assert that the user asked for std_logic.
if (port->type_name != "std_logic") {
cerr << "sorry: VHDL only supports std_logic ports."
<< " Expecting std_logic, but got \""
<< port->type_name << "\"" << endl;
errors += 1;
}
if (sep) cout << sep; if (sep) cout << sep;
else sep = ", "; else sep = ", ";

View File

@ -172,6 +172,7 @@ interface_element
{ InterfacePort*tmp = new InterfacePort; { InterfacePort*tmp = new InterfacePort;
tmp->mode = $3; tmp->mode = $3;
tmp->name = lex_strings.make($1); tmp->name = lex_strings.make($1);
tmp->type_name = lex_strings.make($4);
delete[]$1; delete[]$1;
delete[]$4; delete[]$4;
$$ = tmp; $$ = tmp;
@ -180,7 +181,7 @@ interface_element
interface_list interface_list
: interface_list ';' interface_element : interface_list ';' interface_element
{ std:list<InterfacePort*>*tmp = $1; { std::list<InterfacePort*>*tmp = $1;
tmp->push_back($3); tmp->push_back($3);
$$ = tmp; $$ = tmp;
} }