diff --git a/vhdlpp/architec_emit.cc b/vhdlpp/architec_emit.cc index cf18cdd84..d0d3fb1ff 100644 --- a/vhdlpp/architec_emit.cc +++ b/vhdlpp/architec_emit.cc @@ -150,6 +150,22 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc) arc->set_cur_component(this); + if(ComponentBase*comp = arc->find_component(cname_)) { + const std::vector& generics = comp->get_generics(); + + if(generics.size() != generic_map_.size()) + // Display an error for generics that do not have neither + // default nor component specific value defined + for(vector::const_iterator it = generics.begin(); + it != generics.end(); ++it) { + if(!(*it)->expr && generic_map_.count((*it)->name) == 0) { + cerr << get_fileline() << ": generic " << (*it)->name << + "value is not defined" << endl; + ++errors; + } + } + } + out << cname_; if (! generic_map_.empty()) { out << " #("; diff --git a/vhdlpp/entity.h b/vhdlpp/entity.h index 8c41e52ab..5e183d1a5 100644 --- a/vhdlpp/entity.h +++ b/vhdlpp/entity.h @@ -63,6 +63,7 @@ class ComponentBase : public LineInfo { const InterfacePort* find_port(perm_string by_name) const; const InterfacePort* find_generic(perm_string by_name) const; + const std::vector& get_generics() const { return parms_; } // Declare the ports for the entity. The parser calls this // method with a list of interface elements that were parsed