Add ports to component declarations

This commit is contained in:
Nick Gasson 2008-06-10 11:24:16 +01:00
parent 191187ed1b
commit f6753a9013
2 changed files with 12 additions and 2 deletions

View File

@ -279,6 +279,8 @@ vhdl_component_decl *vhdl_component_decl::component_decl_for(const vhdl_entity *
vhdl_component_decl *decl = new vhdl_component_decl
(ent->get_name().c_str());
decl->ports_ = ent->get_ports();
return decl;
}
@ -286,7 +288,14 @@ void vhdl_component_decl::emit(std::ofstream &of, int level) const
{
emit_comment(of, level);
of << "component " << name_ << " is";
// ...ports...
if (ports_.size() > 0) {
newline(of, indent(level));
of << "port (";
emit_children<vhdl_decl>(of, ports_, indent(level), ";");
of << ");";
}
newline(of, level);
of << "end component;";
}

View File

@ -302,7 +302,7 @@ public:
private:
vhdl_component_decl(const char *name);
// TODO: Ports, etc.
decl_list_t ports_;
};
@ -429,6 +429,7 @@ public:
void add_port(vhdl_port_decl *decl);
vhdl_arch *get_arch() const { return arch_; }
vhdl_decl *get_decl(const std::string &name) const;
const decl_list_t &get_ports() const { return ports_; }
const std::string &get_name() const { return name_; }
void requires_package(const char *spec);
const std::string &get_derived_from() const { return derived_from_; }