vhdlpp: 'image attribute.
This commit is contained in:
parent
dff1ad08b0
commit
b711f16f05
|
|
@ -605,6 +605,9 @@ int ExpTypeAttribute::elaborate_expr(Entity*, ScopeBase*, const VType*)
|
||||||
|
|
||||||
const VType* ExpTypeAttribute::probe_type(Entity*, ScopeBase*) const
|
const VType* ExpTypeAttribute::probe_type(Entity*, ScopeBase*) const
|
||||||
{
|
{
|
||||||
|
if(name_ == "image")
|
||||||
|
return &primitive_STRING;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,30 @@ int ExpTypeAttribute::emit(ostream&out, Entity*ent, ScopeBase*scope)
|
||||||
{
|
{
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
|
// Special case: The image attribute
|
||||||
|
if (name_=="image") {
|
||||||
|
if(!args_ || args_->size() != 1) {
|
||||||
|
out << "/* Invalid 'image attribute */" << endl;
|
||||||
|
cerr << get_fileline() << ": error: 'image attribute takes "
|
||||||
|
<< "exactly one argument." << endl;
|
||||||
|
++errors;
|
||||||
|
} else {
|
||||||
|
out << "$sformatf(\"";
|
||||||
|
|
||||||
|
if(base_->type_match(&primitive_INTEGER))
|
||||||
|
out << "%0d";
|
||||||
|
else if(base_->type_match(&primitive_REAL))
|
||||||
|
out << "%f";
|
||||||
|
else if(base_->type_match(&primitive_CHARACTER))
|
||||||
|
out << "'%c'";
|
||||||
|
|
||||||
|
out << "\",";
|
||||||
|
args_->front()->emit(out, ent, scope);
|
||||||
|
out << ")";
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
out << "$ivl_attribute(";
|
out << "$ivl_attribute(";
|
||||||
errors += base_->emit_def(out, empty_perm_string);
|
errors += base_->emit_def(out, empty_perm_string);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue