From a40d1a65c48ed71d8aad20ce6293a2d4de521f09 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Feb 2016 15:47:26 +0100 Subject: [PATCH] vhdlpp: Emit enum type as int. --- vhdlpp/vtype.h | 1 + vhdlpp/vtype_emit.cc | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/vhdlpp/vtype.h b/vhdlpp/vtype.h index a4bdf9baf..fc1d52c0e 100644 --- a/vhdlpp/vtype.h +++ b/vhdlpp/vtype.h @@ -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; diff --git a/vhdlpp/vtype_emit.cc b/vhdlpp/vtype_emit.cc index 48ffd50d7..8327af50c 100644 --- a/vhdlpp/vtype_emit.cc +++ b/vhdlpp/vtype_emit.cc @@ -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;