vhdlpp: Display error message for undefined generic values.
This commit is contained in:
parent
7aab315ce5
commit
51d7237d52
|
|
@ -150,6 +150,22 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc)
|
||||||
|
|
||||||
arc->set_cur_component(this);
|
arc->set_cur_component(this);
|
||||||
|
|
||||||
|
if(ComponentBase*comp = arc->find_component(cname_)) {
|
||||||
|
const std::vector<InterfacePort*>& 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<InterfacePort*>::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_;
|
out << cname_;
|
||||||
if (! generic_map_.empty()) {
|
if (! generic_map_.empty()) {
|
||||||
out << " #(";
|
out << " #(";
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ class ComponentBase : public LineInfo {
|
||||||
|
|
||||||
const InterfacePort* find_port(perm_string by_name) const;
|
const InterfacePort* find_port(perm_string by_name) const;
|
||||||
const InterfacePort* find_generic(perm_string by_name) const;
|
const InterfacePort* find_generic(perm_string by_name) const;
|
||||||
|
const std::vector<InterfacePort*>& get_generics() const { return parms_; }
|
||||||
|
|
||||||
// Declare the ports for the entity. The parser calls this
|
// Declare the ports for the entity. The parser calls this
|
||||||
// method with a list of interface elements that were parsed
|
// method with a list of interface elements that were parsed
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue