diff --git a/vhdlpp/library.cc b/vhdlpp/library.cc index 67511b4ef..a981f520d 100644 --- a/vhdlpp/library.cc +++ b/vhdlpp/library.cc @@ -140,7 +140,7 @@ static void import_ieee_use_std_logic_1164(ActiveScope*res, perm_string name) if (all_flag || name == "std_logic_vector") { vector dims (1); res->bind_name(perm_string::literal("std_logic_vector"), - new VTypeArray(&primitive_STDLOGIC, dims, false)); + new VTypeArray(primitive_STDLOGIC, dims, false)); } } @@ -151,12 +151,12 @@ static void import_ieee_use_numeric_bit(ActiveScope*res, perm_string name) if (all_flag || name == "signed") { vector dims (1); res->bind_name(perm_string::literal("signed"), - new VTypeArray(&primitive_STDLOGIC, dims, true)); + new VTypeArray(primitive_STDLOGIC, dims, true)); } if (all_flag || name == "unsigned") { vector dims (1); res->bind_name(perm_string::literal("unsigned"), - new VTypeArray(&primitive_BIT, dims, false)); + new VTypeArray(primitive_BIT, dims, false)); } } @@ -167,12 +167,12 @@ static void import_ieee_use_numeric_std(ActiveScope*res, perm_string name) if (all_flag || name == "signed") { vector dims (1); res->bind_name(perm_string::literal("signed"), - new VTypeArray(&primitive_STDLOGIC, dims, true)); + new VTypeArray(primitive_STDLOGIC, dims, true)); } if (all_flag || name == "unsigned") { vector dims (1); res->bind_name(perm_string::literal("unsigned"), - new VTypeArray(&primitive_STDLOGIC, dims, false)); + new VTypeArray(primitive_STDLOGIC, dims, false)); } } @@ -194,20 +194,19 @@ static void import_ieee_use(ActiveScope*res, perm_string package, perm_string na } } +const VTypePrimitive* primitive_BOOLEAN = new VTypePrimitive(VTypePrimitive::BOOLEAN); +const VTypePrimitive* primitive_BIT = new VTypePrimitive(VTypePrimitive::BIT); +const VTypePrimitive* primitive_INTEGER = new VTypePrimitive(VTypePrimitive::INTEGER); +const VTypePrimitive* primitive_STDLOGIC = new VTypePrimitive(VTypePrimitive::STDLOGIC); -const VTypePrimitive primitive_BOOLEAN (VTypePrimitive::BOOLEAN); -const VTypePrimitive primitive_BIT (VTypePrimitive::BIT); -const VTypePrimitive primitive_INTEGER (VTypePrimitive::INTEGER); -const VTypePrimitive primitive_STDLOGIC(VTypePrimitive::STDLOGIC); - -const VTypeArray primitive_BIT_VECTOR(&primitive_BIT, vector (1)); -const VTypeArray primitive_BOOL_VECTOR(&primitive_BOOLEAN, vector (1)); +const VTypeArray* primitive_BIT_VECTOR = new VTypeArray(primitive_BIT, vector (1)); +const VTypeArray* primitive_BOOL_VECTOR = new VTypeArray(primitive_BOOLEAN, vector (1)); void generate_global_types(ActiveScope*res) { - res->bind_name(perm_string::literal("boolean"), &primitive_BOOLEAN); - res->bind_name(perm_string::literal("bit"), &primitive_BIT); - res->bind_name(perm_string::literal("integer"), &primitive_INTEGER); - res->bind_name(perm_string::literal("std_logic"), &primitive_STDLOGIC); - res->bind_name(perm_string::literal("bit_vector"),&primitive_BOOL_VECTOR); + res->bind_name(perm_string::literal("boolean"), primitive_BOOLEAN); + res->bind_name(perm_string::literal("bit"), primitive_BIT); + res->bind_name(perm_string::literal("integer"), primitive_INTEGER); + res->bind_name(perm_string::literal("std_logic"), primitive_STDLOGIC); + res->bind_name(perm_string::literal("bit_vector"),primitive_BOOL_VECTOR); } diff --git a/vhdlpp/vtype.h b/vhdlpp/vtype.h index d9a5636db..e01849358 100644 --- a/vhdlpp/vtype.h +++ b/vhdlpp/vtype.h @@ -83,10 +83,10 @@ class VTypePrimitive : public VType { type_t type_; }; -extern const VTypePrimitive primitive_BOOLEAN; -extern const VTypePrimitive primitive_BIT; -extern const VTypePrimitive primitive_INTEGER; -extern const VTypePrimitive primitive_STDLOGIC; +extern const VTypePrimitive* primitive_BOOLEAN; +extern const VTypePrimitive* primitive_BIT; +extern const VTypePrimitive* primitive_INTEGER; +extern const VTypePrimitive* primitive_STDLOGIC; /* * An array is a compound N-dimensional array of element type. The