vhdlpp: Emits typedef for boolean type.

This commit is contained in:
Maciej Suminski 2015-05-06 15:07:53 +02:00
parent 4304fd503e
commit 08e5aa021a
4 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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);

View File

@ -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;