diff --git a/vhdlpp/library.cc b/vhdlpp/library.cc index 61ae426df..87cf41fa2 100644 --- a/vhdlpp/library.cc +++ b/vhdlpp/library.cc @@ -409,6 +409,14 @@ void generate_global_types(ActiveScope*res) res->use_name(perm_string::literal("natural"), &primitive_NATURAL); } +void emit_std_types(ostream&out) +{ + out << "`ifndef __VHDL_STD_TYPES" << endl; + out << "`define __VHDL_STD_TYPES" << endl; + out << "typedef enum bit { \\false , \\true } boolean ;" << endl; + out << "`endif" << endl; +} + bool is_global_type(perm_string name) { if (name == "boolean") return true; diff --git a/vhdlpp/library.h b/vhdlpp/library.h index ab6464f45..fe04aad23 100644 --- a/vhdlpp/library.h +++ b/vhdlpp/library.h @@ -26,6 +26,7 @@ extern void library_add_directory(const char*directory); extern Subprogram*library_find_subprogram(perm_string name); +extern void emit_std_types(ostream&out); extern int emit_packages(void); #endif /* IVL_library_H */ diff --git a/vhdlpp/main.cc b/vhdlpp/main.cc index b142d3845..418e73daa 100644 --- a/vhdlpp/main.cc +++ b/vhdlpp/main.cc @@ -232,6 +232,8 @@ int main(int argc, char*argv[]) return 3; } + emit_std_types(cout); + errors = emit_packages(); if (errors > 0) { fprintf(stderr, "%d errors emitting packages.\n", errors); diff --git a/vhdlpp/vtype_emit.cc b/vhdlpp/vtype_emit.cc index 64577e004..bfce8e215 100644 --- a/vhdlpp/vtype_emit.cc +++ b/vhdlpp/vtype_emit.cc @@ -149,6 +149,8 @@ int VTypePrimitive::emit_primitive_type(ostream&out) const int errors = 0; switch (type_) { case BOOLEAN: + out << "boolean"; + break; case BIT: out << "bool"; break;