summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/ieee-vital_timing.adb2
-rw-r--r--src/vhdl/iirs.adb4
-rw-r--r--src/vhdl/iirs.ads15
-rw-r--r--src/vhdl/nodes_meta.adb418
-rw-r--r--src/vhdl/sem_assocs.adb21
-rw-r--r--src/vhdl/sem_decls.adb64
-rw-r--r--src/vhdl/sem_decls.ads6
-rw-r--r--src/vhdl/sem_names.adb16
-rw-r--r--src/vhdl/sem_specs.adb19
-rw-r--r--src/vhdl/translate/trans-chap5.adb21
10 files changed, 318 insertions, 268 deletions
diff --git a/src/vhdl/ieee-vital_timing.adb b/src/vhdl/ieee-vital_timing.adb
index 4b5c178..915ad00 100644
--- a/src/vhdl/ieee-vital_timing.adb
+++ b/src/vhdl/ieee-vital_timing.adb
@@ -1239,7 +1239,7 @@ package body Ieee.Vital_Timing is
end if;
if Id = InstancePath_Id then
- if Get_Type (Decl) /= String_Type_Definition then
+ if Get_Base_Type (Get_Type (Decl)) /= String_Type_Definition then
Error_Vital
("InstancePath VITAL generic must be of type String", Decl);
end if;
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index 010d48d..d6cd6eb 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -1156,7 +1156,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Entity_Name_List (Get_Kind (Target)),
"no field Entity_Name_List");
- return Iir_To_Iir_List (Get_Field1 (Target));
+ return Iir_To_Iir_List (Get_Field8 (Target));
end Get_Entity_Name_List;
procedure Set_Entity_Name_List (Target : Iir; Names : Iir_List) is
@@ -1164,7 +1164,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Entity_Name_List (Get_Kind (Target)),
"no field Entity_Name_List");
- Set_Field1 (Target, Iir_List_To_Iir (Names));
+ Set_Field8 (Target, Iir_List_To_Iir (Names));
end Set_Entity_Name_List;
function Get_Attribute_Designator (Target : Iir) return Iir is
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index ba22be9..d3522af 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -401,7 +401,7 @@ package Iirs is
-- Get/Set_Actual_Type (Field3)
--
-- Only for Iir_Kind_Association_Element_By_Individual:
- -- Must be Locally unless there is an error on one choice.
+ -- Must be Locally unless there is an error on one choice.
-- Get/Set_Choice_Staticness (State2)
--
-- Only for Iir_Kind_Association_Element_By_Individual:
@@ -652,7 +652,8 @@ package Iirs is
--
-- Get/Set_Parent (Field0)
--
- -- Get/Set_Entity_Name_List (Field1)
+ -- The type can be constrained due to the expression.
+ -- Get/Set_Type (Field1)
--
-- Get/Set_Chain (Field2)
--
@@ -666,6 +667,8 @@ package Iirs is
-- Get/Set_Attribute_Designator (Field6)
--
-- Get/Set_Attribute_Specification_Chain (Field7)
+ --
+ -- Get/Set_Entity_Name_List (Field8)
-- Iir_Kind_Attribute_Value (Short)
-- An attribute value is the element of the chain of attribute of an
@@ -2969,7 +2972,7 @@ package Iirs is
-- Function declaration corresponding to the function to call.
-- Get/Set_Implementation (Field3)
--
- -- Expr_staticness is defined by §7.4
+ -- Expr_staticness is defined by LRM93 7.4
-- Get/Set_Expr_Staticness (State1)
-- Iir_Kinds_Dyadic_Operator (Short)
@@ -4201,10 +4204,10 @@ package Iirs is
Iir_Predefined_None ..
Iir_Predefined_Functions'Last;
- -- Staticness as defined by LRM93 §6.1 and §7.4
+ -- Staticness as defined by LRM93 6.1 and 7.4
type Iir_Staticness is (Unknown, None, Globally, Locally);
- -- Staticness as defined by LRM93 §6.1 and §7.4
+ -- Staticness as defined by LRM93 6.1 and 7.4
function Min (L,R: Iir_Staticness) return Iir_Staticness renames
Iir_Staticness'Min;
@@ -5259,7 +5262,7 @@ package Iirs is
function Get_Entity_Class (Target : Iir) return Token_Type;
procedure Set_Entity_Class (Target : Iir; Kind : Token_Type);
- -- Field: Field1 (uc)
+ -- Field: Field8 (uc)
function Get_Entity_Name_List (Target : Iir) return Iir_List;
procedure Set_Entity_Name_List (Target : Iir; Names : Iir_List);
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index 16fb1f4..0f8b5bf 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -2278,13 +2278,14 @@ package body Nodes_Meta is
Field_Resolution_Indication,
-- Iir_Kind_Attribute_Specification
Field_Entity_Class,
- Field_Entity_Name_List,
Field_Chain,
Field_Attribute_Value_Spec_Chain,
Field_Expression,
Field_Attribute_Designator,
Field_Attribute_Specification_Chain,
+ Field_Entity_Name_List,
Field_Parent,
+ Field_Type,
-- Iir_Kind_Disconnection_Specification
Field_Chain,
Field_Signal_List,
@@ -4009,213 +4010,213 @@ package body Nodes_Meta is
Iir_Kind_Array_Element_Resolution => 200,
Iir_Kind_Record_Resolution => 201,
Iir_Kind_Record_Element_Resolution => 204,
- Iir_Kind_Attribute_Specification => 212,
- Iir_Kind_Disconnection_Specification => 217,
- Iir_Kind_Configuration_Specification => 222,
- Iir_Kind_Access_Type_Definition => 229,
- Iir_Kind_Incomplete_Type_Definition => 236,
- Iir_Kind_File_Type_Definition => 243,
- Iir_Kind_Protected_Type_Declaration => 252,
- Iir_Kind_Record_Type_Definition => 262,
- Iir_Kind_Array_Type_Definition => 274,
- Iir_Kind_Array_Subtype_Definition => 289,
- Iir_Kind_Record_Subtype_Definition => 300,
- Iir_Kind_Access_Subtype_Definition => 308,
- Iir_Kind_Physical_Subtype_Definition => 317,
- Iir_Kind_Floating_Subtype_Definition => 327,
- Iir_Kind_Integer_Subtype_Definition => 336,
- Iir_Kind_Enumeration_Subtype_Definition => 345,
- Iir_Kind_Enumeration_Type_Definition => 354,
- Iir_Kind_Integer_Type_Definition => 360,
- Iir_Kind_Floating_Type_Definition => 366,
- Iir_Kind_Physical_Type_Definition => 375,
- Iir_Kind_Range_Expression => 381,
- Iir_Kind_Protected_Type_Body => 388,
- Iir_Kind_Subtype_Definition => 392,
- Iir_Kind_Scalar_Nature_Definition => 396,
- Iir_Kind_Overload_List => 397,
- Iir_Kind_Type_Declaration => 403,
- Iir_Kind_Anonymous_Type_Declaration => 408,
- Iir_Kind_Subtype_Declaration => 416,
- Iir_Kind_Nature_Declaration => 422,
- Iir_Kind_Subnature_Declaration => 428,
- Iir_Kind_Package_Declaration => 438,
- Iir_Kind_Package_Instantiation_Declaration => 449,
- Iir_Kind_Package_Body => 456,
- Iir_Kind_Configuration_Declaration => 465,
- Iir_Kind_Entity_Declaration => 477,
- Iir_Kind_Architecture_Body => 489,
- Iir_Kind_Context_Declaration => 495,
- Iir_Kind_Package_Header => 497,
- Iir_Kind_Unit_Declaration => 506,
- Iir_Kind_Library_Declaration => 513,
- Iir_Kind_Component_Declaration => 523,
- Iir_Kind_Attribute_Declaration => 530,
- Iir_Kind_Group_Template_Declaration => 536,
- Iir_Kind_Group_Declaration => 543,
- Iir_Kind_Element_Declaration => 550,
- Iir_Kind_Non_Object_Alias_Declaration => 558,
- Iir_Kind_Psl_Declaration => 566,
- Iir_Kind_Terminal_Declaration => 572,
- Iir_Kind_Free_Quantity_Declaration => 581,
- Iir_Kind_Across_Quantity_Declaration => 593,
- Iir_Kind_Through_Quantity_Declaration => 605,
- Iir_Kind_Enumeration_Literal => 616,
- Iir_Kind_Function_Declaration => 640,
- Iir_Kind_Procedure_Declaration => 663,
- Iir_Kind_Function_Body => 673,
- Iir_Kind_Procedure_Body => 684,
- Iir_Kind_Object_Alias_Declaration => 696,
- Iir_Kind_File_Declaration => 711,
- Iir_Kind_Guard_Signal_Declaration => 724,
- Iir_Kind_Signal_Declaration => 741,
- Iir_Kind_Variable_Declaration => 754,
- Iir_Kind_Constant_Declaration => 768,
- Iir_Kind_Iterator_Declaration => 780,
- Iir_Kind_Interface_Constant_Declaration => 796,
- Iir_Kind_Interface_Variable_Declaration => 812,
- Iir_Kind_Interface_Signal_Declaration => 833,
- Iir_Kind_Interface_File_Declaration => 849,
- Iir_Kind_Interface_Package_Declaration => 858,
- Iir_Kind_Identity_Operator => 862,
- Iir_Kind_Negation_Operator => 866,
- Iir_Kind_Absolute_Operator => 870,
- Iir_Kind_Not_Operator => 874,
- Iir_Kind_Condition_Operator => 878,
- Iir_Kind_Reduction_And_Operator => 882,
- Iir_Kind_Reduction_Or_Operator => 886,
- Iir_Kind_Reduction_Nand_Operator => 890,
- Iir_Kind_Reduction_Nor_Operator => 894,
- Iir_Kind_Reduction_Xor_Operator => 898,
- Iir_Kind_Reduction_Xnor_Operator => 902,
- Iir_Kind_And_Operator => 907,
- Iir_Kind_Or_Operator => 912,
- Iir_Kind_Nand_Operator => 917,
- Iir_Kind_Nor_Operator => 922,
- Iir_Kind_Xor_Operator => 927,
- Iir_Kind_Xnor_Operator => 932,
- Iir_Kind_Equality_Operator => 937,
- Iir_Kind_Inequality_Operator => 942,
- Iir_Kind_Less_Than_Operator => 947,
- Iir_Kind_Less_Than_Or_Equal_Operator => 952,
- Iir_Kind_Greater_Than_Operator => 957,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 962,
- Iir_Kind_Match_Equality_Operator => 967,
- Iir_Kind_Match_Inequality_Operator => 972,
- Iir_Kind_Match_Less_Than_Operator => 977,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 982,
- Iir_Kind_Match_Greater_Than_Operator => 987,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 992,
- Iir_Kind_Sll_Operator => 997,
- Iir_Kind_Sla_Operator => 1002,
- Iir_Kind_Srl_Operator => 1007,
- Iir_Kind_Sra_Operator => 1012,
- Iir_Kind_Rol_Operator => 1017,
- Iir_Kind_Ror_Operator => 1022,
- Iir_Kind_Addition_Operator => 1027,
- Iir_Kind_Substraction_Operator => 1032,
- Iir_Kind_Concatenation_Operator => 1037,
- Iir_Kind_Multiplication_Operator => 1042,
- Iir_Kind_Division_Operator => 1047,
- Iir_Kind_Modulus_Operator => 1052,
- Iir_Kind_Remainder_Operator => 1057,
- Iir_Kind_Exponentiation_Operator => 1062,
- Iir_Kind_Function_Call => 1070,
- Iir_Kind_Aggregate => 1076,
- Iir_Kind_Parenthesis_Expression => 1079,
- Iir_Kind_Qualified_Expression => 1083,
- Iir_Kind_Type_Conversion => 1088,
- Iir_Kind_Allocator_By_Expression => 1092,
- Iir_Kind_Allocator_By_Subtype => 1098,
- Iir_Kind_Selected_Element => 1104,
- Iir_Kind_Dereference => 1109,
- Iir_Kind_Implicit_Dereference => 1114,
- Iir_Kind_Slice_Name => 1121,
- Iir_Kind_Indexed_Name => 1127,
- Iir_Kind_Psl_Expression => 1129,
- Iir_Kind_Sensitized_Process_Statement => 1149,
- Iir_Kind_Process_Statement => 1169,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1180,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1192,
- Iir_Kind_Concurrent_Assertion_Statement => 1200,
- Iir_Kind_Psl_Default_Clock => 1204,
- Iir_Kind_Psl_Assert_Statement => 1213,
- Iir_Kind_Psl_Cover_Statement => 1222,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1229,
- Iir_Kind_Block_Statement => 1242,
- Iir_Kind_If_Generate_Statement => 1252,
- Iir_Kind_For_Generate_Statement => 1261,
- Iir_Kind_Component_Instantiation_Statement => 1271,
- Iir_Kind_Simple_Simultaneous_Statement => 1278,
- Iir_Kind_Generate_Statement_Body => 1289,
- Iir_Kind_If_Generate_Else_Clause => 1294,
- Iir_Kind_Signal_Assignment_Statement => 1303,
- Iir_Kind_Null_Statement => 1307,
- Iir_Kind_Assertion_Statement => 1314,
- Iir_Kind_Report_Statement => 1320,
- Iir_Kind_Wait_Statement => 1327,
- Iir_Kind_Variable_Assignment_Statement => 1333,
- Iir_Kind_Return_Statement => 1339,
- Iir_Kind_For_Loop_Statement => 1348,
- Iir_Kind_While_Loop_Statement => 1356,
- Iir_Kind_Next_Statement => 1362,
- Iir_Kind_Exit_Statement => 1368,
- Iir_Kind_Case_Statement => 1376,
- Iir_Kind_Procedure_Call_Statement => 1382,
- Iir_Kind_If_Statement => 1391,
- Iir_Kind_Elsif => 1396,
- Iir_Kind_Character_Literal => 1403,
- Iir_Kind_Simple_Name => 1410,
- Iir_Kind_Selected_Name => 1418,
- Iir_Kind_Operator_Symbol => 1423,
- Iir_Kind_Selected_By_All_Name => 1428,
- Iir_Kind_Parenthesis_Name => 1432,
- Iir_Kind_External_Constant_Name => 1441,
- Iir_Kind_External_Signal_Name => 1450,
- Iir_Kind_External_Variable_Name => 1459,
- Iir_Kind_Package_Pathname => 1462,
- Iir_Kind_Absolute_Pathname => 1463,
- Iir_Kind_Relative_Pathname => 1464,
- Iir_Kind_Pathname_Element => 1468,
- Iir_Kind_Base_Attribute => 1470,
- Iir_Kind_Left_Type_Attribute => 1475,
- Iir_Kind_Right_Type_Attribute => 1480,
- Iir_Kind_High_Type_Attribute => 1485,
- Iir_Kind_Low_Type_Attribute => 1490,
- Iir_Kind_Ascending_Type_Attribute => 1495,
- Iir_Kind_Image_Attribute => 1501,
- Iir_Kind_Value_Attribute => 1507,
- Iir_Kind_Pos_Attribute => 1513,
- Iir_Kind_Val_Attribute => 1519,
- Iir_Kind_Succ_Attribute => 1525,
- Iir_Kind_Pred_Attribute => 1531,
- Iir_Kind_Leftof_Attribute => 1537,
- Iir_Kind_Rightof_Attribute => 1543,
- Iir_Kind_Delayed_Attribute => 1551,
- Iir_Kind_Stable_Attribute => 1559,
- Iir_Kind_Quiet_Attribute => 1567,
- Iir_Kind_Transaction_Attribute => 1575,
- Iir_Kind_Event_Attribute => 1579,
- Iir_Kind_Active_Attribute => 1583,
- Iir_Kind_Last_Event_Attribute => 1587,
- Iir_Kind_Last_Active_Attribute => 1591,
- Iir_Kind_Last_Value_Attribute => 1595,
- Iir_Kind_Driving_Attribute => 1599,
- Iir_Kind_Driving_Value_Attribute => 1603,
- Iir_Kind_Behavior_Attribute => 1603,
- Iir_Kind_Structure_Attribute => 1603,
- Iir_Kind_Simple_Name_Attribute => 1610,
- Iir_Kind_Instance_Name_Attribute => 1615,
- Iir_Kind_Path_Name_Attribute => 1620,
- Iir_Kind_Left_Array_Attribute => 1627,
- Iir_Kind_Right_Array_Attribute => 1634,
- Iir_Kind_High_Array_Attribute => 1641,
- Iir_Kind_Low_Array_Attribute => 1648,
- Iir_Kind_Length_Array_Attribute => 1655,
- Iir_Kind_Ascending_Array_Attribute => 1662,
- Iir_Kind_Range_Array_Attribute => 1669,
- Iir_Kind_Reverse_Range_Array_Attribute => 1676,
- Iir_Kind_Attribute_Name => 1684
+ Iir_Kind_Attribute_Specification => 213,
+ Iir_Kind_Disconnection_Specification => 218,
+ Iir_Kind_Configuration_Specification => 223,
+ Iir_Kind_Access_Type_Definition => 230,
+ Iir_Kind_Incomplete_Type_Definition => 237,
+ Iir_Kind_File_Type_Definition => 244,
+ Iir_Kind_Protected_Type_Declaration => 253,
+ Iir_Kind_Record_Type_Definition => 263,
+ Iir_Kind_Array_Type_Definition => 275,
+ Iir_Kind_Array_Subtype_Definition => 290,
+ Iir_Kind_Record_Subtype_Definition => 301,
+ Iir_Kind_Access_Subtype_Definition => 309,
+ Iir_Kind_Physical_Subtype_Definition => 318,
+ Iir_Kind_Floating_Subtype_Definition => 328,
+ Iir_Kind_Integer_Subtype_Definition => 337,
+ Iir_Kind_Enumeration_Subtype_Definition => 346,
+ Iir_Kind_Enumeration_Type_Definition => 355,
+ Iir_Kind_Integer_Type_Definition => 361,
+ Iir_Kind_Floating_Type_Definition => 367,
+ Iir_Kind_Physical_Type_Definition => 376,
+ Iir_Kind_Range_Expression => 382,
+ Iir_Kind_Protected_Type_Body => 389,
+ Iir_Kind_Subtype_Definition => 393,
+ Iir_Kind_Scalar_Nature_Definition => 397,
+ Iir_Kind_Overload_List => 398,
+ Iir_Kind_Type_Declaration => 404,
+ Iir_Kind_Anonymous_Type_Declaration => 409,
+ Iir_Kind_Subtype_Declaration => 417,
+ Iir_Kind_Nature_Declaration => 423,
+ Iir_Kind_Subnature_Declaration => 429,
+ Iir_Kind_Package_Declaration => 439,
+ Iir_Kind_Package_Instantiation_Declaration => 450,
+ Iir_Kind_Package_Body => 457,
+ Iir_Kind_Configuration_Declaration => 466,
+ Iir_Kind_Entity_Declaration => 478,
+ Iir_Kind_Architecture_Body => 490,
+ Iir_Kind_Context_Declaration => 496,
+ Iir_Kind_Package_Header => 498,
+ Iir_Kind_Unit_Declaration => 507,
+ Iir_Kind_Library_Declaration => 514,
+ Iir_Kind_Component_Declaration => 524,
+ Iir_Kind_Attribute_Declaration => 531,
+ Iir_Kind_Group_Template_Declaration => 537,
+ Iir_Kind_Group_Declaration => 544,
+ Iir_Kind_Element_Declaration => 551,
+ Iir_Kind_Non_Object_Alias_Declaration => 559,
+ Iir_Kind_Psl_Declaration => 567,
+ Iir_Kind_Terminal_Declaration => 573,
+ Iir_Kind_Free_Quantity_Declaration => 582,
+ Iir_Kind_Across_Quantity_Declaration => 594,
+ Iir_Kind_Through_Quantity_Declaration => 606,
+ Iir_Kind_Enumeration_Literal => 617,
+ Iir_Kind_Function_Declaration => 641,
+ Iir_Kind_Procedure_Declaration => 664,
+ Iir_Kind_Function_Body => 674,
+ Iir_Kind_Procedure_Body => 685,
+ Iir_Kind_Object_Alias_Declaration => 697,
+ Iir_Kind_File_Declaration => 712,
+ Iir_Kind_Guard_Signal_Declaration => 725,
+ Iir_Kind_Signal_Declaration => 742,
+ Iir_Kind_Variable_Declaration => 755,
+ Iir_Kind_Constant_Declaration => 769,
+ Iir_Kind_Iterator_Declaration => 781,
+ Iir_Kind_Interface_Constant_Declaration => 797,
+ Iir_Kind_Interface_Variable_Declaration => 813,
+ Iir_Kind_Interface_Signal_Declaration => 834,
+ Iir_Kind_Interface_File_Declaration => 850,
+ Iir_Kind_Interface_Package_Declaration => 859,
+ Iir_Kind_Identity_Operator => 863,
+ Iir_Kind_Negation_Operator => 867,
+ Iir_Kind_Absolute_Operator => 871,
+ Iir_Kind_Not_Operator => 875,
+ Iir_Kind_Condition_Operator => 879,
+ Iir_Kind_Reduction_And_Operator => 883,
+ Iir_Kind_Reduction_Or_Operator => 887,
+ Iir_Kind_Reduction_Nand_Operator => 891,
+ Iir_Kind_Reduction_Nor_Operator => 895,
+ Iir_Kind_Reduction_Xor_Operator => 899,
+ Iir_Kind_Reduction_Xnor_Operator => 903,
+ Iir_Kind_And_Operator => 908,
+ Iir_Kind_Or_Operator => 913,
+ Iir_Kind_Nand_Operator => 918,
+ Iir_Kind_Nor_Operator => 923,
+ Iir_Kind_Xor_Operator => 928,
+ Iir_Kind_Xnor_Operator => 933,
+ Iir_Kind_Equality_Operator => 938,
+ Iir_Kind_Inequality_Operator => 943,
+ Iir_Kind_Less_Than_Operator => 948,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 953,
+ Iir_Kind_Greater_Than_Operator => 958,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 963,
+ Iir_Kind_Match_Equality_Operator => 968,
+ Iir_Kind_Match_Inequality_Operator => 973,
+ Iir_Kind_Match_Less_Than_Operator => 978,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 983,
+ Iir_Kind_Match_Greater_Than_Operator => 988,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 993,
+ Iir_Kind_Sll_Operator => 998,
+ Iir_Kind_Sla_Operator => 1003,
+ Iir_Kind_Srl_Operator => 1008,
+ Iir_Kind_Sra_Operator => 1013,
+ Iir_Kind_Rol_Operator => 1018,
+ Iir_Kind_Ror_Operator => 1023,
+ Iir_Kind_Addition_Operator => 1028,
+ Iir_Kind_Substraction_Operator => 1033,
+ Iir_Kind_Concatenation_Operator => 1038,
+ Iir_Kind_Multiplication_Operator => 1043,
+ Iir_Kind_Division_Operator => 1048,
+ Iir_Kind_Modulus_Operator => 1053,
+ Iir_Kind_Remainder_Operator => 1058,
+ Iir_Kind_Exponentiation_Operator => 1063,
+ Iir_Kind_Function_Call => 1071,
+ Iir_Kind_Aggregate => 1077,
+ Iir_Kind_Parenthesis_Expression => 1080,
+ Iir_Kind_Qualified_Expression => 1084,
+ Iir_Kind_Type_Conversion => 1089,
+ Iir_Kind_Allocator_By_Expression => 1093,
+ Iir_Kind_Allocator_By_Subtype => 1099,
+ Iir_Kind_Selected_Element => 1105,
+ Iir_Kind_Dereference => 1110,
+ Iir_Kind_Implicit_Dereference => 1115,
+ Iir_Kind_Slice_Name => 1122,
+ Iir_Kind_Indexed_Name => 1128,
+ Iir_Kind_Psl_Expression => 1130,
+ Iir_Kind_Sensitized_Process_Statement => 1150,
+ Iir_Kind_Process_Statement => 1170,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1181,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1193,
+ Iir_Kind_Concurrent_Assertion_Statement => 1201,
+ Iir_Kind_Psl_Default_Clock => 1205,
+ Iir_Kind_Psl_Assert_Statement => 1214,
+ Iir_Kind_Psl_Cover_Statement => 1223,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1230,
+ Iir_Kind_Block_Statement => 1243,
+ Iir_Kind_If_Generate_Statement => 1253,
+ Iir_Kind_For_Generate_Statement => 1262,
+ Iir_Kind_Component_Instantiation_Statement => 1272,
+ Iir_Kind_Simple_Simultaneous_Statement => 1279,
+ Iir_Kind_Generate_Statement_Body => 1290,
+ Iir_Kind_If_Generate_Else_Clause => 1295,
+ Iir_Kind_Signal_Assignment_Statement => 1304,
+ Iir_Kind_Null_Statement => 1308,
+ Iir_Kind_Assertion_Statement => 1315,
+ Iir_Kind_Report_Statement => 1321,
+ Iir_Kind_Wait_Statement => 1328,
+ Iir_Kind_Variable_Assignment_Statement => 1334,
+ Iir_Kind_Return_Statement => 1340,
+ Iir_Kind_For_Loop_Statement => 1349,
+ Iir_Kind_While_Loop_Statement => 1357,
+ Iir_Kind_Next_Statement => 1363,
+ Iir_Kind_Exit_Statement => 1369,
+ Iir_Kind_Case_Statement => 1377,
+ Iir_Kind_Procedure_Call_Statement => 1383,
+ Iir_Kind_If_Statement => 1392,
+ Iir_Kind_Elsif => 1397,
+ Iir_Kind_Character_Literal => 1404,
+ Iir_Kind_Simple_Name => 1411,
+ Iir_Kind_Selected_Name => 1419,
+ Iir_Kind_Operator_Symbol => 1424,
+ Iir_Kind_Selected_By_All_Name => 1429,
+ Iir_Kind_Parenthesis_Name => 1433,
+ Iir_Kind_External_Constant_Name => 1442,
+ Iir_Kind_External_Signal_Name => 1451,
+ Iir_Kind_External_Variable_Name => 1460,
+ Iir_Kind_Package_Pathname => 1463,
+ Iir_Kind_Absolute_Pathname => 1464,
+ Iir_Kind_Relative_Pathname => 1465,
+ Iir_Kind_Pathname_Element => 1469,
+ Iir_Kind_Base_Attribute => 1471,
+ Iir_Kind_Left_Type_Attribute => 1476,
+ Iir_Kind_Right_Type_Attribute => 1481,
+ Iir_Kind_High_Type_Attribute => 1486,
+ Iir_Kind_Low_Type_Attribute => 1491,
+ Iir_Kind_Ascending_Type_Attribute => 1496,
+ Iir_Kind_Image_Attribute => 1502,
+ Iir_Kind_Value_Attribute => 1508,
+ Iir_Kind_Pos_Attribute => 1514,
+ Iir_Kind_Val_Attribute => 1520,
+ Iir_Kind_Succ_Attribute => 1526,
+ Iir_Kind_Pred_Attribute => 1532,
+ Iir_Kind_Leftof_Attribute => 1538,
+ Iir_Kind_Rightof_Attribute => 1544,
+ Iir_Kind_Delayed_Attribute => 1552,
+ Iir_Kind_Stable_Attribute => 1560,
+ Iir_Kind_Quiet_Attribute => 1568,
+ Iir_Kind_Transaction_Attribute => 1576,
+ Iir_Kind_Event_Attribute => 1580,
+ Iir_Kind_Active_Attribute => 1584,
+ Iir_Kind_Last_Event_Attribute => 1588,
+ Iir_Kind_Last_Active_Attribute => 1592,
+ Iir_Kind_Last_Value_Attribute => 1596,
+ Iir_Kind_Driving_Attribute => 1600,
+ Iir_Kind_Driving_Value_Attribute => 1604,
+ Iir_Kind_Behavior_Attribute => 1604,
+ Iir_Kind_Structure_Attribute => 1604,
+ Iir_Kind_Simple_Name_Attribute => 1611,
+ Iir_Kind_Instance_Name_Attribute => 1616,
+ Iir_Kind_Path_Name_Attribute => 1621,
+ Iir_Kind_Left_Array_Attribute => 1628,
+ Iir_Kind_Right_Array_Attribute => 1635,
+ Iir_Kind_High_Array_Attribute => 1642,
+ Iir_Kind_Low_Array_Attribute => 1649,
+ Iir_Kind_Length_Array_Attribute => 1656,
+ Iir_Kind_Ascending_Array_Attribute => 1663,
+ Iir_Kind_Range_Array_Attribute => 1670,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1677,
+ Iir_Kind_Attribute_Name => 1685
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -6712,6 +6713,7 @@ package body Nodes_Meta is
| Iir_Kind_Overflow_Literal
| Iir_Kind_Attribute_Value
| Iir_Kind_Record_Element_Constraint
+ | Iir_Kind_Attribute_Specification
| Iir_Kind_Range_Expression
| Iir_Kind_Type_Declaration
| Iir_Kind_Subtype_Declaration
diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb
index 6856097..683a8c6 100644
--- a/src/vhdl/sem_assocs.adb
+++ b/src/vhdl/sem_assocs.adb
@@ -798,15 +798,18 @@ package body Sem_Assocs is
Set_Whole_Association_Flag (Assoc, True);
case Get_Kind (Atype) is
- when Iir_Kind_Array_Subtype_Definition =>
- Finish_Individual_Assoc_Array_Subtype (Assoc, Atype, 1);
- Set_Actual_Type (Assoc, Atype);
- when Iir_Kind_Array_Type_Definition =>
- Atype := Create_Array_Subtype (Atype, Get_Location (Assoc));
- Set_Index_Constraint_Flag (Atype, True);
- Set_Constraint_State (Atype, Fully_Constrained);
- Set_Actual_Type (Assoc, Atype);
- Finish_Individual_Assoc_Array (Assoc, Assoc, 1);
+ when Iir_Kind_Array_Subtype_Definition
+ | Iir_Kind_Array_Type_Definition =>
+ if Get_Constraint_State (Atype) = Fully_Constrained then
+ Finish_Individual_Assoc_Array_Subtype (Assoc, Atype, 1);
+ Set_Actual_Type (Assoc, Atype);
+ else
+ Atype := Create_Array_Subtype (Atype, Get_Location (Assoc));
+ Set_Index_Constraint_Flag (Atype, True);
+ Set_Constraint_State (Atype, Fully_Constrained);
+ Set_Actual_Type (Assoc, Atype);
+ Finish_Individual_Assoc_Array (Assoc, Assoc, 1);
+ end if;
when Iir_Kind_Record_Type_Definition
| Iir_Kind_Record_Subtype_Definition =>
Finish_Individual_Assoc_Record (Assoc, Atype);
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index a2475c4..a155b6f 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -107,6 +107,25 @@ package body Sem_Decls is
end if;
end Check_Signal_Type;
+ -- Create a globally static subtype.
+ procedure Sem_Force_Static_Type (Decl : Iir; Atype : Iir)
+ is
+ Base_Type : constant Iir := Get_Base_Type (Atype);
+ Res : Iir;
+ begin
+ pragma Assert (Get_Kind (Base_Type) = Iir_Kind_Array_Type_Definition);
+ Res := Create_Iir (Iir_Kind_Array_Subtype_Definition);
+ Set_Location (Res, Get_Location (Decl));
+ Set_Element_Subtype (Res, Get_Element_Subtype (Atype));
+ Set_Base_Type (Res, Base_Type);
+ Set_Index_Subtype_List (Res, Get_Index_Subtype_List (Atype));
+ Set_Type_Staticness (Res, Globally);
+ Set_Constraint_State (Res, Get_Constraint_State (Atype));
+ Set_Index_Constraint_Flag (Res, Get_Index_Constraint_Flag (Atype));
+ Set_Signal_Type_Flag (Res, Get_Signal_Type_Flag (Atype));
+ Set_Type (Decl, Res);
+ end Sem_Force_Static_Type;
+
procedure Sem_Interface_Object_Declaration
(Inter, Last : Iir; Interface_Kind : Interface_Kind_Type)
is
@@ -284,6 +303,14 @@ package body Sem_Decls is
-- LRM93 7.4.2 (Globally static primaries)
-- 3. a generic constant.
Set_Expr_Staticness (Inter, Globally);
+
+ if A_Type /= Null_Iir
+ and then (Get_Kind (A_Type)
+ in Iir_Kinds_Composite_Type_Definition)
+ and then Get_Type_Staticness (A_Type) = None
+ then
+ Sem_Force_Static_Type (Inter, A_Type);
+ end if;
end if;
when Port_Interface_List =>
if Get_Kind (Inter) /= Iir_Kind_Interface_Signal_Declaration then
@@ -1580,6 +1607,22 @@ package body Sem_Decls is
return Deferred_Const;
end Get_Deferred_Constant;
+ procedure Sem_Object_Type_From_Value (Decl : Iir; Value : Iir)
+ is
+ Atype : constant Iir := Get_Type (Decl);
+ Value_Type : constant Iir := Get_Type (Value);
+ begin
+ if not Is_Fully_Constrained_Type (Atype)
+ and then not Is_Error (Value_Type)
+ then
+ if Get_Type_Staticness (Value_Type) >= Globally then
+ Set_Type (Decl, Value_Type);
+ else
+ Sem_Force_Static_Type (Decl, Value_Type);
+ end if;
+ end if;
+ end Sem_Object_Type_From_Value;
+
procedure Sem_Object_Declaration (Decl: Iir; Parent : Iir; Last_Decl : Iir)
is
Deferred_Const : constant Iir := Get_Deferred_Constant (Decl);
@@ -1640,16 +1683,16 @@ package body Sem_Decls is
Decl);
end if;
- -- LRM 4.3.1.3
+ -- LRM93 4.3.1.3
-- It is an error if a variable declaration declares a variable that is
-- of a file type.
--
- -- LRM 4.3.1.1
+ -- LRM93 4.3.1.1
-- It is an error if a constant declaration declares a constant that is
-- of a file type, or an access type, or a composite type which has
-- subelement that is a file type of an access type.
--
- -- LRM 4.3.1.2
+ -- LRM93 4.3.1.2
-- It is an error if a signal declaration declares a signal that is of
-- a file type [or an access type].
case Get_Kind (Atype) is
@@ -1817,21 +1860,14 @@ package body Sem_Decls is
case Get_Kind (Decl) is
when Iir_Kind_Constant_Declaration =>
- -- LRM93 §3.2.1.1
+ -- LRM93 3.2.1.1
-- For a constant declared by an object declaration, the index
-- ranges are defined by the initial value, if the subtype of the
-- constant is unconstrained; otherwise they are defined by this
-- subtype.
- --if Default_Value = Null_Iir
- -- and then not Sem_Is_Constrained (Atype)
- --then
- -- Error_Msg_Sem ("constant declaration of unconstrained "
- -- & Disp_Node (Atype) & " is not allowed", Decl);
- --end if;
- null;
- --if Deferred_Const = Null_Iir then
- -- Name_Visible (Decl);
- --end if;
+ if Default_Value /= Null_Iir then
+ Sem_Object_Type_From_Value (Decl, Default_Value);
+ end if;
when Iir_Kind_Variable_Declaration
| Iir_Kind_Signal_Declaration =>
diff --git a/src/vhdl/sem_decls.ads b/src/vhdl/sem_decls.ads
index 49ba43a..659e80b 100644
--- a/src/vhdl/sem_decls.ads
+++ b/src/vhdl/sem_decls.ads
@@ -50,6 +50,12 @@ package Sem_Decls is
-- is an overload list, it is destroyed.
function Sem_Signature (Name : Iir; Sig : Iir_Signature) return Iir;
+ -- If the type of DECL is unconstrained, create a contrained subtype
+ -- either locally or globally static (according to VALUE).
+ -- This is to apply rules of LRM93 3.2.1.1 Index constraints and
+ -- discrete ranges.
+ procedure Sem_Object_Type_From_Value (Decl : Iir; Value : Iir);
+
-- The attribute signals ('stable, 'quiet and 'transaction) are
-- implicitely declared.
-- Note: guard signals are also implicitly declared but with a guard
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 1ffb51e..114bb68 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -897,7 +897,6 @@ package body Sem_Names is
Index_Type : Iir;
Prefix : Iir;
Prefix_Name : Iir;
- Staticness : Iir_Staticness;
begin
-- LRM93 14.1
-- Parameter: A locally static expression of type universal_integer, the
@@ -999,18 +998,7 @@ package body Sem_Names is
-- formed by imposing on an unconstrained array type a globally static
-- index constraint.
- Staticness := Get_Type_Staticness (Prefix_Type);
-
- -- In relaxed mode, also consider that globally static expressions have
- -- a globally static subtype.
- if Is_Type_Name (Prefix_Name) = Null_Iir
- and then Staticness = None
- and then (Flag_Relaxed_Rules or Vhdl_Std = Vhdl_93c)
- then
- Staticness := Iir_Staticness'Min (Globally,
- Get_Expr_Staticness (Prefix));
- end if;
- Set_Expr_Staticness (Attr, Staticness);
+ Set_Expr_Staticness (Attr, Get_Type_Staticness (Prefix_Type));
end Finish_Sem_Array_Attribute;
procedure Finish_Sem_Scalar_Type_Attribute
@@ -2905,9 +2893,9 @@ package body Sem_Names is
function Sem_Array_Attribute_Name (Attr : Iir_Attribute_Name) return Iir
is
use Std_Names;
- Prefix: Iir;
Prefix_Name : constant Iir := Get_Prefix (Attr);
Prefix_Type : Iir;
+ Prefix : Iir;
Res : Iir;
Res_Type : Iir;
begin
diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb
index 911b778..c6bb1e9 100644
--- a/src/vhdl/sem_specs.adb
+++ b/src/vhdl/sem_specs.adb
@@ -320,7 +320,7 @@ package body Sem_Specs is
end if;
end;
Set_Designated_Entity (El, Decl);
- Set_Type (El, Get_Type (Attr_Decl));
+ Set_Type (El, Get_Type (Attr));
Set_Base_Name (El, El);
-- Put the attribute value in the attribute_value_chain.
@@ -713,6 +713,7 @@ package body Sem_Specs is
Name : Iir;
Attr : Iir_Attribute_Declaration;
+ Attr_Type : Iir;
List : Iir_List;
Expr : Iir;
Res : Boolean;
@@ -732,10 +733,13 @@ package body Sem_Specs is
-- The type of the expression in the attribute specification must be
-- the same as (or implicitly convertible to) the type mark in the
-- corresponding attribute declaration.
- Expr := Sem_Expression (Get_Expression (Spec), Get_Type (Attr));
+ Attr_Type := Get_Type (Attr);
+ Set_Type (Spec, Attr_Type);
+ Expr := Sem_Expression (Get_Expression (Spec), Attr_Type);
if Expr /= Null_Iir then
Check_Read (Expr);
- Set_Expression (Spec, Eval_Expr_If_Static (Expr));
+ Expr := Eval_Expr_If_Static (Expr);
+ Set_Expression (Spec, Expr);
-- LRM 5.1
-- If the entity name list denotes an entity declaration,
@@ -757,9 +761,16 @@ package body Sem_Specs is
end case;
else
Set_Expression
- (Spec, Create_Error_Expr (Get_Expression (Spec), Get_Type (Attr)));
+ (Spec, Create_Error_Expr (Get_Expression (Spec), Attr_Type));
end if;
+ -- LRM93 3.2.1.1 Index constraints and discrete ranges
+ -- - For an attribtue whose value is specified by an attribute
+ -- specification, the index ranges are defined by the expression
+ -- given in the specification, if the subtype of the attribute is
+ -- unconstrained [...]
+ Sem_Decls.Sem_Object_Type_From_Value (Spec, Get_Expression (Spec));
+
-- LRM 5.1
-- The entity name list identifies those named entities, both
-- implicitly and explicitly defined, that inherit the attribute, as
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb
index f51e3c0..f52de48 100644
--- a/src/vhdl/translate/trans-chap5.adb
+++ b/src/vhdl/translate/trans-chap5.adb
@@ -33,31 +33,32 @@ package body Trans.Chap5 is
procedure Translate_Attribute_Specification
(Spec : Iir_Attribute_Specification)
is
+ Spec_Type : constant Iir := Get_Type (Spec);
Attr : constant Iir_Attribute_Declaration :=
Get_Named_Entity (Get_Attribute_Designator (Spec));
- Atinfo : constant Type_Info_Acc := Get_Info (Get_Type (Attr));
Mark : Id_Mark_Type;
+ Mark2 : Id_Mark_Type;
Info : Object_Info_Acc;
begin
Push_Identifier_Prefix_Uniq (Mark);
+ if Is_Anonymous_Type_Definition (Spec_Type) then
+ Push_Identifier_Prefix (Mark2, "OT");
+ Chap3.Translate_Type_Definition (Spec_Type, True);
+ Pop_Identifier_Prefix (Mark2);
+ end if;
Info := Add_Info (Spec, Kind_Object);
Info.Object_Var := Create_Var
(Create_Var_Identifier (Attr),
- Chap4.Get_Object_Type (Atinfo, Mode_Value),
+ Chap4.Get_Object_Type (Get_Info (Spec_Type), Mode_Value),
Global_Storage);
Pop_Identifier_Prefix (Mark);
end Translate_Attribute_Specification;
procedure Elab_Attribute_Specification
- (Spec : Iir_Attribute_Specification)
- is
- Attr : constant Iir_Attribute_Declaration :=
- Get_Named_Entity (Get_Attribute_Designator (Spec));
+ (Spec : Iir_Attribute_Specification) is
begin
- -- Kludge
- Set_Info (Attr, Get_Info (Spec));
- Chap4.Elab_Object_Value (Attr, Get_Expression (Spec));
- Clear_Info (Attr);
+ Chap3.Elab_Object_Subtype (Get_Type (Spec));
+ Chap4.Elab_Object_Value (Spec, Get_Expression (Spec));
end Elab_Attribute_Specification;
procedure Gen_Elab_Disconnect_Non_Composite (Targ : Mnode;