vhdlpp: Emit enum type as int.

This commit is contained in:
Maciej Suminski 2016-02-11 15:47:26 +01:00
parent 248275e5e1
commit a40d1a65c4
2 changed files with 13 additions and 1 deletions

View File

@ -334,6 +334,7 @@ class VTypeEnum : public VType {
int get_width(ScopeBase*) const { return 32; }
int emit_def(std::ostream&out, perm_string name) const;
int emit_decl(std::ostream&out, perm_string name, bool reg_flag) const;
// Checks if the name is stored in the enum.
bool has_name(perm_string name) const;

View File

@ -153,7 +153,7 @@ int VTypeArray::emit_with_dims_(std::ostream&out, bool packed, perm_string name)
int VTypeEnum::emit_def(ostream&out, perm_string name) const
{
int errors = 0;
out << "enum integer {";
out << "enum int {";
assert(names_.size() >= 1);
out << "\\" << names_[0] << " ";
for (size_t idx = 1 ; idx < names_.size() ; idx += 1)
@ -165,6 +165,17 @@ int VTypeEnum::emit_def(ostream&out, perm_string name) const
return errors;
}
int VTypeEnum::emit_decl(std::ostream&out, perm_string name, bool reg_flag) const
{
if (!reg_flag)
out << "wire ";
out << "int";
emit_name(out, name);
return 0;
}
int VTypePrimitive::emit_primitive_type(ostream&out) const
{
int errors = 0;