diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-10-04 05:57:42 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-10-04 05:57:42 +0200 |
commit | d1f7774d255a509b61983fd6cbfc81ca2dd596fc (patch) | |
tree | 50661f69f3eaa75c6a6285d26539dfb54654dc3f | |
parent | 5e70bbd59e2ced9ee725e62821ff78ca0b2b0639 (diff) | |
download | ghdl-d1f7774d255a509b61983fd6cbfc81ca2dd596fc.tar.gz ghdl-d1f7774d255a509b61983fd6cbfc81ca2dd596fc.tar.bz2 ghdl-d1f7774d255a509b61983fd6cbfc81ca2dd596fc.zip |
case statement: check element of one-dimensional type is a character type.
-rw-r--r-- | src/vhdl/iirs.adb | 16 | ||||
-rw-r--r-- | src/vhdl/iirs.ads | 7 | ||||
-rw-r--r-- | src/vhdl/nodes_meta.adb | 425 | ||||
-rw-r--r-- | src/vhdl/nodes_meta.ads | 2 | ||||
-rw-r--r-- | src/vhdl/sem_types.adb | 13 | ||||
-rw-r--r-- | src/vhdl/std_package.adb | 2 |
6 files changed, 256 insertions, 209 deletions
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb index bcbbc842e..8a30242e4 100644 --- a/src/vhdl/iirs.adb +++ b/src/vhdl/iirs.adb @@ -3006,6 +3006,22 @@ package body Iirs is Set_Flag4 (Atype, Flag); end Set_Only_Characters_Flag; + function Get_Is_Character_Type (Atype : Iir) return Boolean is + begin + pragma Assert (Atype /= Null_Iir); + pragma Assert (Has_Is_Character_Type (Get_Kind (Atype)), + "no field Is_Character_Type"); + return Get_Flag5 (Atype); + end Get_Is_Character_Type; + + procedure Set_Is_Character_Type (Atype : Iir; Flag : Boolean) is + begin + pragma Assert (Atype /= Null_Iir); + pragma Assert (Has_Is_Character_Type (Get_Kind (Atype)), + "no field Is_Character_Type"); + Set_Flag5 (Atype, Flag); + end Set_Is_Character_Type; + function Get_Type_Staticness (Atype : Iir) return Iir_Staticness is begin pragma Assert (Atype /= Null_Iir); diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index cebb3b013..550d338b6 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -2050,6 +2050,8 @@ package Iirs is -- -- Get/Set_Only_Characters_Flag (Flag4) -- + -- Get/Set_Is_Character_Type (Flag5) + -- -- Get/Set_Is_Ref (Flag12) -- -- Get/Set_Type_Staticness (State1) @@ -6498,6 +6500,11 @@ package Iirs is function Get_Only_Characters_Flag (Atype : Iir) return Boolean; procedure Set_Only_Characters_Flag (Atype : Iir; Flag : Boolean); + -- True if enumeration type ATYPE is a character type. + -- Field: Flag5 + function Get_Is_Character_Type (Atype : Iir) return Boolean; + procedure Set_Is_Character_Type (Atype : Iir; Flag : Boolean); + -- Field: State1 (pos) function Get_Type_Staticness (Atype : Iir) return Iir_Staticness; procedure Set_Type_Staticness (Atype : Iir; Static : Iir_Staticness); diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb index 69fe06520..ad947d079 100644 --- a/src/vhdl/nodes_meta.adb +++ b/src/vhdl/nodes_meta.adb @@ -168,6 +168,7 @@ package body Nodes_Meta is Field_Simultaneous_Right => Type_Iir, Field_Text_File_Flag => Type_Boolean, Field_Only_Characters_Flag => Type_Boolean, + Field_Is_Character_Type => Type_Boolean, Field_Type_Staticness => Type_Iir_Staticness, Field_Constraint_State => Type_Iir_Constraint, Field_Index_Subtype_List => Type_Iir_List, @@ -650,6 +651,8 @@ package body Nodes_Meta is return "text_file_flag"; when Field_Only_Characters_Flag => return "only_characters_flag"; + when Field_Is_Character_Type => + return "is_character_type"; when Field_Type_Staticness => return "type_staticness"; when Field_Constraint_State => @@ -1844,6 +1847,8 @@ package body Nodes_Meta is return Attr_None; when Field_Only_Characters_Flag => return Attr_None; + when Field_Is_Character_Type => + return Attr_None; when Field_Type_Staticness => return Attr_None; when Field_Constraint_State => @@ -2656,6 +2661,7 @@ package body Nodes_Meta is Field_Signal_Type_Flag, Field_Has_Signal_Flag, Field_Only_Characters_Flag, + Field_Is_Character_Type, Field_Type_Staticness, Field_Enumeration_Literal_List, Field_Range_Constraint, @@ -4435,211 +4441,211 @@ package body Nodes_Meta is Iir_Kind_Floating_Subtype_Definition => 369, Iir_Kind_Integer_Subtype_Definition => 379, Iir_Kind_Enumeration_Subtype_Definition => 389, - Iir_Kind_Enumeration_Type_Definition => 399, - Iir_Kind_Integer_Type_Definition => 407, - Iir_Kind_Floating_Type_Definition => 415, - Iir_Kind_Physical_Type_Definition => 426, - Iir_Kind_Range_Expression => 434, - Iir_Kind_Protected_Type_Body => 441, - Iir_Kind_Wildcard_Type_Definition => 446, - Iir_Kind_Subtype_Definition => 451, - Iir_Kind_Scalar_Nature_Definition => 455, - Iir_Kind_Overload_List => 456, - Iir_Kind_Type_Declaration => 463, - Iir_Kind_Anonymous_Type_Declaration => 469, - Iir_Kind_Subtype_Declaration => 476, - Iir_Kind_Nature_Declaration => 482, - Iir_Kind_Subnature_Declaration => 488, - Iir_Kind_Package_Declaration => 502, - Iir_Kind_Package_Instantiation_Declaration => 515, - Iir_Kind_Package_Body => 523, - Iir_Kind_Configuration_Declaration => 532, - Iir_Kind_Entity_Declaration => 544, - Iir_Kind_Architecture_Body => 556, - Iir_Kind_Context_Declaration => 562, - Iir_Kind_Package_Header => 564, - Iir_Kind_Unit_Declaration => 572, - Iir_Kind_Library_Declaration => 579, - Iir_Kind_Component_Declaration => 589, - Iir_Kind_Attribute_Declaration => 596, - Iir_Kind_Group_Template_Declaration => 602, - Iir_Kind_Group_Declaration => 609, - Iir_Kind_Element_Declaration => 617, - Iir_Kind_Non_Object_Alias_Declaration => 625, - Iir_Kind_Psl_Declaration => 633, - Iir_Kind_Psl_Endpoint_Declaration => 647, - Iir_Kind_Terminal_Declaration => 653, - Iir_Kind_Free_Quantity_Declaration => 662, - Iir_Kind_Across_Quantity_Declaration => 674, - Iir_Kind_Through_Quantity_Declaration => 686, - Iir_Kind_Enumeration_Literal => 697, - Iir_Kind_Function_Declaration => 722, - Iir_Kind_Procedure_Declaration => 746, - Iir_Kind_Function_Body => 756, - Iir_Kind_Procedure_Body => 767, - Iir_Kind_Object_Alias_Declaration => 778, - Iir_Kind_File_Declaration => 792, - Iir_Kind_Guard_Signal_Declaration => 805, - Iir_Kind_Signal_Declaration => 822, - Iir_Kind_Variable_Declaration => 835, - Iir_Kind_Constant_Declaration => 849, - Iir_Kind_Iterator_Declaration => 860, - Iir_Kind_Interface_Constant_Declaration => 876, - Iir_Kind_Interface_Variable_Declaration => 892, - Iir_Kind_Interface_Signal_Declaration => 913, - Iir_Kind_Interface_File_Declaration => 929, - Iir_Kind_Interface_Type_Declaration => 939, - Iir_Kind_Interface_Package_Declaration => 950, - Iir_Kind_Interface_Function_Declaration => 967, - Iir_Kind_Interface_Procedure_Declaration => 980, - Iir_Kind_Signal_Attribute_Declaration => 983, - Iir_Kind_Identity_Operator => 987, - Iir_Kind_Negation_Operator => 991, - Iir_Kind_Absolute_Operator => 995, - Iir_Kind_Not_Operator => 999, - Iir_Kind_Condition_Operator => 1003, - Iir_Kind_Reduction_And_Operator => 1007, - Iir_Kind_Reduction_Or_Operator => 1011, - Iir_Kind_Reduction_Nand_Operator => 1015, - Iir_Kind_Reduction_Nor_Operator => 1019, - Iir_Kind_Reduction_Xor_Operator => 1023, - Iir_Kind_Reduction_Xnor_Operator => 1027, - Iir_Kind_And_Operator => 1032, - Iir_Kind_Or_Operator => 1037, - Iir_Kind_Nand_Operator => 1042, - Iir_Kind_Nor_Operator => 1047, - Iir_Kind_Xor_Operator => 1052, - Iir_Kind_Xnor_Operator => 1057, - Iir_Kind_Equality_Operator => 1062, - Iir_Kind_Inequality_Operator => 1067, - Iir_Kind_Less_Than_Operator => 1072, - Iir_Kind_Less_Than_Or_Equal_Operator => 1077, - Iir_Kind_Greater_Than_Operator => 1082, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1087, - Iir_Kind_Match_Equality_Operator => 1092, - Iir_Kind_Match_Inequality_Operator => 1097, - Iir_Kind_Match_Less_Than_Operator => 1102, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1107, - Iir_Kind_Match_Greater_Than_Operator => 1112, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1117, - Iir_Kind_Sll_Operator => 1122, - Iir_Kind_Sla_Operator => 1127, - Iir_Kind_Srl_Operator => 1132, - Iir_Kind_Sra_Operator => 1137, - Iir_Kind_Rol_Operator => 1142, - Iir_Kind_Ror_Operator => 1147, - Iir_Kind_Addition_Operator => 1152, - Iir_Kind_Substraction_Operator => 1157, - Iir_Kind_Concatenation_Operator => 1162, - Iir_Kind_Multiplication_Operator => 1167, - Iir_Kind_Division_Operator => 1172, - Iir_Kind_Modulus_Operator => 1177, - Iir_Kind_Remainder_Operator => 1182, - Iir_Kind_Exponentiation_Operator => 1187, - Iir_Kind_Function_Call => 1195, - Iir_Kind_Aggregate => 1202, - Iir_Kind_Parenthesis_Expression => 1205, - Iir_Kind_Qualified_Expression => 1209, - Iir_Kind_Type_Conversion => 1214, - Iir_Kind_Allocator_By_Expression => 1218, - Iir_Kind_Allocator_By_Subtype => 1223, - Iir_Kind_Selected_Element => 1229, - Iir_Kind_Dereference => 1234, - Iir_Kind_Implicit_Dereference => 1239, - Iir_Kind_Slice_Name => 1246, - Iir_Kind_Indexed_Name => 1252, - Iir_Kind_Psl_Expression => 1254, - Iir_Kind_Sensitized_Process_Statement => 1275, - Iir_Kind_Process_Statement => 1295, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1307, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1319, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1332, - Iir_Kind_Concurrent_Assertion_Statement => 1340, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1347, - Iir_Kind_Psl_Assert_Statement => 1360, - Iir_Kind_Psl_Cover_Statement => 1373, - Iir_Kind_Block_Statement => 1386, - Iir_Kind_If_Generate_Statement => 1397, - Iir_Kind_Case_Generate_Statement => 1406, - Iir_Kind_For_Generate_Statement => 1415, - Iir_Kind_Component_Instantiation_Statement => 1425, - Iir_Kind_Psl_Default_Clock => 1429, - Iir_Kind_Simple_Simultaneous_Statement => 1436, - Iir_Kind_Generate_Statement_Body => 1447, - Iir_Kind_If_Generate_Else_Clause => 1453, - Iir_Kind_Simple_Signal_Assignment_Statement => 1463, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1473, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1484, - Iir_Kind_Null_Statement => 1488, - Iir_Kind_Assertion_Statement => 1495, - Iir_Kind_Report_Statement => 1501, - Iir_Kind_Wait_Statement => 1509, - Iir_Kind_Variable_Assignment_Statement => 1516, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1523, - Iir_Kind_Return_Statement => 1529, - Iir_Kind_For_Loop_Statement => 1538, - Iir_Kind_While_Loop_Statement => 1547, - Iir_Kind_Next_Statement => 1554, - Iir_Kind_Exit_Statement => 1561, - Iir_Kind_Case_Statement => 1569, - Iir_Kind_Procedure_Call_Statement => 1575, - Iir_Kind_If_Statement => 1585, - Iir_Kind_Elsif => 1591, - Iir_Kind_Character_Literal => 1599, - Iir_Kind_Simple_Name => 1607, - Iir_Kind_Selected_Name => 1616, - Iir_Kind_Operator_Symbol => 1622, - Iir_Kind_Reference_Name => 1625, - Iir_Kind_Selected_By_All_Name => 1631, - Iir_Kind_Parenthesis_Name => 1636, - Iir_Kind_External_Constant_Name => 1644, - Iir_Kind_External_Signal_Name => 1652, - Iir_Kind_External_Variable_Name => 1660, - Iir_Kind_Package_Pathname => 1664, - Iir_Kind_Absolute_Pathname => 1665, - Iir_Kind_Relative_Pathname => 1666, - Iir_Kind_Pathname_Element => 1671, - Iir_Kind_Base_Attribute => 1673, - Iir_Kind_Subtype_Attribute => 1678, - Iir_Kind_Element_Attribute => 1683, - Iir_Kind_Left_Type_Attribute => 1688, - Iir_Kind_Right_Type_Attribute => 1693, - Iir_Kind_High_Type_Attribute => 1698, - Iir_Kind_Low_Type_Attribute => 1703, - Iir_Kind_Ascending_Type_Attribute => 1708, - Iir_Kind_Image_Attribute => 1714, - Iir_Kind_Value_Attribute => 1720, - Iir_Kind_Pos_Attribute => 1726, - Iir_Kind_Val_Attribute => 1732, - Iir_Kind_Succ_Attribute => 1738, - Iir_Kind_Pred_Attribute => 1744, - Iir_Kind_Leftof_Attribute => 1750, - Iir_Kind_Rightof_Attribute => 1756, - Iir_Kind_Delayed_Attribute => 1765, - Iir_Kind_Stable_Attribute => 1774, - Iir_Kind_Quiet_Attribute => 1783, - Iir_Kind_Transaction_Attribute => 1792, - Iir_Kind_Event_Attribute => 1796, - Iir_Kind_Active_Attribute => 1800, - Iir_Kind_Last_Event_Attribute => 1804, - Iir_Kind_Last_Active_Attribute => 1808, - Iir_Kind_Last_Value_Attribute => 1812, - Iir_Kind_Driving_Attribute => 1816, - Iir_Kind_Driving_Value_Attribute => 1820, - Iir_Kind_Behavior_Attribute => 1820, - Iir_Kind_Structure_Attribute => 1820, - Iir_Kind_Simple_Name_Attribute => 1827, - Iir_Kind_Instance_Name_Attribute => 1832, - Iir_Kind_Path_Name_Attribute => 1837, - Iir_Kind_Left_Array_Attribute => 1844, - Iir_Kind_Right_Array_Attribute => 1851, - Iir_Kind_High_Array_Attribute => 1858, - Iir_Kind_Low_Array_Attribute => 1865, - Iir_Kind_Length_Array_Attribute => 1872, - Iir_Kind_Ascending_Array_Attribute => 1879, - Iir_Kind_Range_Array_Attribute => 1886, - Iir_Kind_Reverse_Range_Array_Attribute => 1893, - Iir_Kind_Attribute_Name => 1902 + Iir_Kind_Enumeration_Type_Definition => 400, + Iir_Kind_Integer_Type_Definition => 408, + Iir_Kind_Floating_Type_Definition => 416, + Iir_Kind_Physical_Type_Definition => 427, + Iir_Kind_Range_Expression => 435, + Iir_Kind_Protected_Type_Body => 442, + Iir_Kind_Wildcard_Type_Definition => 447, + Iir_Kind_Subtype_Definition => 452, + Iir_Kind_Scalar_Nature_Definition => 456, + Iir_Kind_Overload_List => 457, + Iir_Kind_Type_Declaration => 464, + Iir_Kind_Anonymous_Type_Declaration => 470, + Iir_Kind_Subtype_Declaration => 477, + Iir_Kind_Nature_Declaration => 483, + Iir_Kind_Subnature_Declaration => 489, + Iir_Kind_Package_Declaration => 503, + Iir_Kind_Package_Instantiation_Declaration => 516, + Iir_Kind_Package_Body => 524, + Iir_Kind_Configuration_Declaration => 533, + Iir_Kind_Entity_Declaration => 545, + Iir_Kind_Architecture_Body => 557, + Iir_Kind_Context_Declaration => 563, + Iir_Kind_Package_Header => 565, + Iir_Kind_Unit_Declaration => 573, + Iir_Kind_Library_Declaration => 580, + Iir_Kind_Component_Declaration => 590, + Iir_Kind_Attribute_Declaration => 597, + Iir_Kind_Group_Template_Declaration => 603, + Iir_Kind_Group_Declaration => 610, + Iir_Kind_Element_Declaration => 618, + Iir_Kind_Non_Object_Alias_Declaration => 626, + Iir_Kind_Psl_Declaration => 634, + Iir_Kind_Psl_Endpoint_Declaration => 648, + Iir_Kind_Terminal_Declaration => 654, + Iir_Kind_Free_Quantity_Declaration => 663, + Iir_Kind_Across_Quantity_Declaration => 675, + Iir_Kind_Through_Quantity_Declaration => 687, + Iir_Kind_Enumeration_Literal => 698, + Iir_Kind_Function_Declaration => 723, + Iir_Kind_Procedure_Declaration => 747, + Iir_Kind_Function_Body => 757, + Iir_Kind_Procedure_Body => 768, + Iir_Kind_Object_Alias_Declaration => 779, + Iir_Kind_File_Declaration => 793, + Iir_Kind_Guard_Signal_Declaration => 806, + Iir_Kind_Signal_Declaration => 823, + Iir_Kind_Variable_Declaration => 836, + Iir_Kind_Constant_Declaration => 850, + Iir_Kind_Iterator_Declaration => 861, + Iir_Kind_Interface_Constant_Declaration => 877, + Iir_Kind_Interface_Variable_Declaration => 893, + Iir_Kind_Interface_Signal_Declaration => 914, + Iir_Kind_Interface_File_Declaration => 930, + Iir_Kind_Interface_Type_Declaration => 940, + Iir_Kind_Interface_Package_Declaration => 951, + Iir_Kind_Interface_Function_Declaration => 968, + Iir_Kind_Interface_Procedure_Declaration => 981, + Iir_Kind_Signal_Attribute_Declaration => 984, + Iir_Kind_Identity_Operator => 988, + Iir_Kind_Negation_Operator => 992, + Iir_Kind_Absolute_Operator => 996, + Iir_Kind_Not_Operator => 1000, + Iir_Kind_Condition_Operator => 1004, + Iir_Kind_Reduction_And_Operator => 1008, + Iir_Kind_Reduction_Or_Operator => 1012, + Iir_Kind_Reduction_Nand_Operator => 1016, + Iir_Kind_Reduction_Nor_Operator => 1020, + Iir_Kind_Reduction_Xor_Operator => 1024, + Iir_Kind_Reduction_Xnor_Operator => 1028, + Iir_Kind_And_Operator => 1033, + Iir_Kind_Or_Operator => 1038, + Iir_Kind_Nand_Operator => 1043, + Iir_Kind_Nor_Operator => 1048, + Iir_Kind_Xor_Operator => 1053, + Iir_Kind_Xnor_Operator => 1058, + Iir_Kind_Equality_Operator => 1063, + Iir_Kind_Inequality_Operator => 1068, + Iir_Kind_Less_Than_Operator => 1073, + Iir_Kind_Less_Than_Or_Equal_Operator => 1078, + Iir_Kind_Greater_Than_Operator => 1083, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1088, + Iir_Kind_Match_Equality_Operator => 1093, + Iir_Kind_Match_Inequality_Operator => 1098, + Iir_Kind_Match_Less_Than_Operator => 1103, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1108, + Iir_Kind_Match_Greater_Than_Operator => 1113, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1118, + Iir_Kind_Sll_Operator => 1123, + Iir_Kind_Sla_Operator => 1128, + Iir_Kind_Srl_Operator => 1133, + Iir_Kind_Sra_Operator => 1138, + Iir_Kind_Rol_Operator => 1143, + Iir_Kind_Ror_Operator => 1148, + Iir_Kind_Addition_Operator => 1153, + Iir_Kind_Substraction_Operator => 1158, + Iir_Kind_Concatenation_Operator => 1163, + Iir_Kind_Multiplication_Operator => 1168, + Iir_Kind_Division_Operator => 1173, + Iir_Kind_Modulus_Operator => 1178, + Iir_Kind_Remainder_Operator => 1183, + Iir_Kind_Exponentiation_Operator => 1188, + Iir_Kind_Function_Call => 1196, + Iir_Kind_Aggregate => 1203, + Iir_Kind_Parenthesis_Expression => 1206, + Iir_Kind_Qualified_Expression => 1210, + Iir_Kind_Type_Conversion => 1215, + Iir_Kind_Allocator_By_Expression => 1219, + Iir_Kind_Allocator_By_Subtype => 1224, + Iir_Kind_Selected_Element => 1230, + Iir_Kind_Dereference => 1235, + Iir_Kind_Implicit_Dereference => 1240, + Iir_Kind_Slice_Name => 1247, + Iir_Kind_Indexed_Name => 1253, + Iir_Kind_Psl_Expression => 1255, + Iir_Kind_Sensitized_Process_Statement => 1276, + Iir_Kind_Process_Statement => 1296, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1308, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1320, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1333, + Iir_Kind_Concurrent_Assertion_Statement => 1341, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1348, + Iir_Kind_Psl_Assert_Statement => 1361, + Iir_Kind_Psl_Cover_Statement => 1374, + Iir_Kind_Block_Statement => 1387, + Iir_Kind_If_Generate_Statement => 1398, + Iir_Kind_Case_Generate_Statement => 1407, + Iir_Kind_For_Generate_Statement => 1416, + Iir_Kind_Component_Instantiation_Statement => 1426, + Iir_Kind_Psl_Default_Clock => 1430, + Iir_Kind_Simple_Simultaneous_Statement => 1437, + Iir_Kind_Generate_Statement_Body => 1448, + Iir_Kind_If_Generate_Else_Clause => 1454, + Iir_Kind_Simple_Signal_Assignment_Statement => 1464, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1474, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1485, + Iir_Kind_Null_Statement => 1489, + Iir_Kind_Assertion_Statement => 1496, + Iir_Kind_Report_Statement => 1502, + Iir_Kind_Wait_Statement => 1510, + Iir_Kind_Variable_Assignment_Statement => 1517, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1524, + Iir_Kind_Return_Statement => 1530, + Iir_Kind_For_Loop_Statement => 1539, + Iir_Kind_While_Loop_Statement => 1548, + Iir_Kind_Next_Statement => 1555, + Iir_Kind_Exit_Statement => 1562, + Iir_Kind_Case_Statement => 1570, + Iir_Kind_Procedure_Call_Statement => 1576, + Iir_Kind_If_Statement => 1586, + Iir_Kind_Elsif => 1592, + Iir_Kind_Character_Literal => 1600, + Iir_Kind_Simple_Name => 1608, + Iir_Kind_Selected_Name => 1617, + Iir_Kind_Operator_Symbol => 1623, + Iir_Kind_Reference_Name => 1626, + Iir_Kind_Selected_By_All_Name => 1632, + Iir_Kind_Parenthesis_Name => 1637, + Iir_Kind_External_Constant_Name => 1645, + Iir_Kind_External_Signal_Name => 1653, + Iir_Kind_External_Variable_Name => 1661, + Iir_Kind_Package_Pathname => 1665, + Iir_Kind_Absolute_Pathname => 1666, + Iir_Kind_Relative_Pathname => 1667, + Iir_Kind_Pathname_Element => 1672, + Iir_Kind_Base_Attribute => 1674, + Iir_Kind_Subtype_Attribute => 1679, + Iir_Kind_Element_Attribute => 1684, + Iir_Kind_Left_Type_Attribute => 1689, + Iir_Kind_Right_Type_Attribute => 1694, + Iir_Kind_High_Type_Attribute => 1699, + Iir_Kind_Low_Type_Attribute => 1704, + Iir_Kind_Ascending_Type_Attribute => 1709, + Iir_Kind_Image_Attribute => 1715, + Iir_Kind_Value_Attribute => 1721, + Iir_Kind_Pos_Attribute => 1727, + Iir_Kind_Val_Attribute => 1733, + Iir_Kind_Succ_Attribute => 1739, + Iir_Kind_Pred_Attribute => 1745, + Iir_Kind_Leftof_Attribute => 1751, + Iir_Kind_Rightof_Attribute => 1757, + Iir_Kind_Delayed_Attribute => 1766, + Iir_Kind_Stable_Attribute => 1775, + Iir_Kind_Quiet_Attribute => 1784, + Iir_Kind_Transaction_Attribute => 1793, + Iir_Kind_Event_Attribute => 1797, + Iir_Kind_Active_Attribute => 1801, + Iir_Kind_Last_Event_Attribute => 1805, + Iir_Kind_Last_Active_Attribute => 1809, + Iir_Kind_Last_Value_Attribute => 1813, + Iir_Kind_Driving_Attribute => 1817, + Iir_Kind_Driving_Value_Attribute => 1821, + Iir_Kind_Behavior_Attribute => 1821, + Iir_Kind_Structure_Attribute => 1821, + Iir_Kind_Simple_Name_Attribute => 1828, + Iir_Kind_Instance_Name_Attribute => 1833, + Iir_Kind_Path_Name_Attribute => 1838, + Iir_Kind_Left_Array_Attribute => 1845, + Iir_Kind_Right_Array_Attribute => 1852, + Iir_Kind_High_Array_Attribute => 1859, + Iir_Kind_Low_Array_Attribute => 1866, + Iir_Kind_Length_Array_Attribute => 1873, + Iir_Kind_Ascending_Array_Attribute => 1880, + Iir_Kind_Range_Array_Attribute => 1887, + Iir_Kind_Reverse_Range_Array_Attribute => 1894, + Iir_Kind_Attribute_Name => 1903 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -4710,6 +4716,8 @@ package body Nodes_Meta is return Get_Text_File_Flag (N); when Field_Only_Characters_Flag => return Get_Only_Characters_Flag (N); + when Field_Is_Character_Type => + return Get_Is_Character_Type (N); when Field_Postponed_Flag => return Get_Postponed_Flag (N); when Field_Passive_Flag => @@ -4838,6 +4846,8 @@ package body Nodes_Meta is Set_Text_File_Flag (N, V); when Field_Only_Characters_Flag => Set_Only_Characters_Flag (N, V); + when Field_Is_Character_Type => + Set_Is_Character_Type (N, V); when Field_Postponed_Flag => Set_Postponed_Flag (N, V); when Field_Passive_Flag => @@ -8337,6 +8347,11 @@ package body Nodes_Meta is return K = Iir_Kind_Enumeration_Type_Definition; end Has_Only_Characters_Flag; + function Has_Is_Character_Type (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Enumeration_Type_Definition; + end Has_Is_Character_Type; + function Has_Type_Staticness (K : Iir_Kind) return Boolean is begin case K is diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads index 62411dbac..f8f91d2c0 100644 --- a/src/vhdl/nodes_meta.ads +++ b/src/vhdl/nodes_meta.ads @@ -208,6 +208,7 @@ package Nodes_Meta is Field_Simultaneous_Right, Field_Text_File_Flag, Field_Only_Characters_Flag, + Field_Is_Character_Type, Field_Type_Staticness, Field_Constraint_State, Field_Index_Subtype_List, @@ -729,6 +730,7 @@ package Nodes_Meta is function Has_Simultaneous_Right (K : Iir_Kind) return Boolean; function Has_Text_File_Flag (K : Iir_Kind) return Boolean; function Has_Only_Characters_Flag (K : Iir_Kind) return Boolean; + function Has_Is_Character_Type (K : Iir_Kind) return Boolean; function Has_Type_Staticness (K : Iir_Kind) return Boolean; function Has_Constraint_State (K : Iir_Kind) return Boolean; function Has_Index_Subtype_List (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb index 70ac576f1..b14a7010b 100644 --- a/src/vhdl/sem_types.adb +++ b/src/vhdl/sem_types.adb @@ -760,8 +760,9 @@ package body Sem_Types is declare El: Iir; Literal_List: Iir_List; - Only_Characters : Boolean := True; + Only_Characters : Boolean; begin + Only_Characters := True; Literal_List := Get_Enumeration_Literal_List (Def); for I in Natural loop El := Get_Nth_Element (Literal_List, I); @@ -773,9 +774,13 @@ package body Sem_Types is Sem_Scopes.Add_Name (El); Name_Visible (El); Xref_Decl (El); - if Only_Characters - and then not Name_Table.Is_Character (Get_Identifier (El)) - then + + -- LRM93 3.1.1 Enumeration types + -- An enumeration type is said to be a character type if at least + -- one of its enumeration literals is a character literal. + if Name_Table.Is_Character (Get_Identifier (El)) then + Set_Is_Character_Type (Def, True); + else Only_Characters := False; end if; end loop; diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb index 63fb46286..3fc1064df 100644 --- a/src/vhdl/std_package.adb +++ b/src/vhdl/std_package.adb @@ -477,6 +477,7 @@ package body Std_Package is Set_Enumeration_Literal_List (Bit_Type_Definition, Create_Iir_List); Set_Base_Type (Bit_Type_Definition, Bit_Type_Definition); + Set_Is_Character_Type (Bit_Type_Definition, True); Bit_0 := Create_Std_Literal (Get_Std_Character ('0'), Bit_Type_Definition); Bit_1 := Create_Std_Literal @@ -513,6 +514,7 @@ package body Std_Package is Character_Type_Definition := Create_Std_Iir (Iir_Kind_Enumeration_Type_Definition); Set_Base_Type (Character_Type_Definition, Character_Type_Definition); + Set_Is_Character_Type (Character_Type_Definition, True); Set_Enumeration_Literal_List (Character_Type_Definition, Create_Iir_List); |