Add ExpName::elaborate_rval member function
This function is for the time being used in the component instatiation. It is checked, whether an expression is a correct r-value. To be a correct r-value, it must be either port name or signal name.
This commit is contained in:
parent
5821139e0f
commit
e2932cb6b5
|
|
@ -66,6 +66,9 @@ int ComponentInstantiation::elaborate(Entity*ent, Architecture*arc)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExpName* tmp;
|
||||||
|
if (cur->second && (tmp = dynamic_cast<ExpName*>(cur->second)))
|
||||||
|
errors += tmp->elaborate_rval(ent, arc);
|
||||||
/* It is possible for the port to be explicitly
|
/* It is possible for the port to be explicitly
|
||||||
unconnected. In that case, the Expression will be nil */
|
unconnected. In that case, the Expression will be nil */
|
||||||
if (cur->second)
|
if (cur->second)
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,7 @@ class ExpName : public Expression {
|
||||||
|
|
||||||
public: // Base methods
|
public: // Base methods
|
||||||
int elaborate_lval(Entity*ent, Architecture*arc, bool);
|
int elaborate_lval(Entity*ent, Architecture*arc, bool);
|
||||||
|
int elaborate_rval(Entity*ent, Architecture*arc);
|
||||||
const VType* probe_type(Entity*ent, Architecture*arc) const;
|
const VType* probe_type(Entity*ent, Architecture*arc) const;
|
||||||
int elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype);
|
int elaborate_expr(Entity*ent, Architecture*arc, const VType*ltype);
|
||||||
int emit(ostream&out, Entity*ent, Architecture*arc);
|
int emit(ostream&out, Entity*ent, Architecture*arc);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,25 @@ int ExpName::elaborate_lval(Entity*ent, Architecture*arc, bool is_sequ)
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ExpName::elaborate_rval(Entity*ent, Architecture*arc)
|
||||||
|
{
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
|
if (const InterfacePort*cur = ent->find_port(name_)) {
|
||||||
|
/* OK */
|
||||||
|
|
||||||
|
} else if (Signal* fs = arc->find_signal(name_)) {
|
||||||
|
/* OK */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cerr << get_fileline() << ": error: No port or signal " << name_
|
||||||
|
<< " to be used as r-value." << endl;
|
||||||
|
errors += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
int ExpNameALL::elaborate_lval(Entity*ent, Architecture*arc, bool is_sequ)
|
int ExpNameALL::elaborate_lval(Entity*ent, Architecture*arc, bool is_sequ)
|
||||||
{
|
{
|
||||||
return Expression::elaborate_lval(ent, arc, is_sequ);
|
return Expression::elaborate_lval(ent, arc, is_sequ);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue