aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-09-20 06:16:00 +0200
committerTristan Gingold <tgingold@free.fr>2018-09-20 06:16:00 +0200
commit1f4e4525f08588cab5e1ecc6357dfe2ebc333ae2 (patch)
tree5706f066505ea113eaf576909c9724f9c1f70776
parentb057afdadd69ad2d6bac49f22e53e884cdadab74 (diff)
downloadghdl-1f4e4525f08588cab5e1ecc6357dfe2ebc333ae2.tar.gz
ghdl-1f4e4525f08588cab5e1ecc6357dfe2ebc333ae2.tar.bz2
ghdl-1f4e4525f08588cab5e1ecc6357dfe2ebc333ae2.zip
Add Get/Set_Choice_Position (WIP).
-rw-r--r--src/vhdl/iirs.adb16
-rw-r--r--src/vhdl/iirs.ads8
-rw-r--r--src/vhdl/nodes_meta.adb516
-rw-r--r--src/vhdl/nodes_meta.ads2
-rw-r--r--src/vhdl/parse.adb39
-rw-r--r--src/vhdl/translate/trans-chap7.adb1
6 files changed, 326 insertions, 256 deletions
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index 6d78e9714..70fea3be9 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -1490,6 +1490,22 @@ package body Iirs is
Set_Field3 (We, An_Iir);
end Set_Time;
+ function Get_Choice_Position (Choice : Iir) return Int32 is
+ begin
+ pragma Assert (Choice /= Null_Iir);
+ pragma Assert (Has_Choice_Position (Get_Kind (Choice)),
+ "no field Choice_Position");
+ return Int32'Val (Get_Field1 (Choice));
+ end Get_Choice_Position;
+
+ procedure Set_Choice_Position (Choice : Iir; Pos : Int32) is
+ begin
+ pragma Assert (Choice /= Null_Iir);
+ pragma Assert (Has_Choice_Position (Get_Kind (Choice)),
+ "no field Choice_Position");
+ Set_Field1 (Choice, Int32'Pos (Pos));
+ end Set_Choice_Position;
+
function Get_Associated_Expr (Target : Iir) return Iir is
begin
pragma Assert (Target /= Null_Iir);
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 528818824..912d4a006 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -533,6 +533,10 @@ package Iirs is
-- associations have the same_alternative_flag set.
-- Get/Set_Chain (Field2)
--
+ -- Lexical order of appareance. Choices are sorted during analysis. This
+ -- field can be used to display the choices in the original order.
+ -- Get/Set_Choice_Position (Field1)
+ --
-- Get/Set what is associated with the choice. There are two different
-- nodes, one for simple association and the other for chain association.
-- They don't have the same properties (normal vs chain), so the right
@@ -6131,6 +6135,10 @@ package Iirs is
function Get_Time (We : Iir_Waveform_Element) return Iir;
procedure Set_Time (We : Iir_Waveform_Element; An_Iir : Iir);
+ -- Field: Field1 (pos)
+ function Get_Choice_Position (Choice : Iir) return Int32;
+ procedure Set_Choice_Position (Choice : Iir; Pos : Int32);
+
-- Node associated with a choice.
-- Field: Field3
function Get_Associated_Expr (Target : Iir) return Iir;
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index e0ba87aac..69e1a4ef6 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -75,6 +75,7 @@ package body Nodes_Meta is
Field_After_Drivers_Flag => Type_Boolean,
Field_We_Value => Type_Iir,
Field_Time => Type_Iir,
+ Field_Choice_Position => Type_Int32,
Field_Associated_Expr => Type_Iir,
Field_Associated_Block => Type_Iir,
Field_Associated_Chain => Type_Iir,
@@ -467,6 +468,8 @@ package body Nodes_Meta is
return "we_value";
when Field_Time =>
return "time";
+ when Field_Choice_Position =>
+ return "choice_position";
when Field_Associated_Expr =>
return "associated_expr";
when Field_Associated_Block =>
@@ -1669,6 +1672,8 @@ package body Nodes_Meta is
return Attr_None;
when Field_Time =>
return Attr_None;
+ when Field_Choice_Position =>
+ return Attr_None;
when Field_Associated_Expr =>
return Attr_None;
when Field_Associated_Block =>
@@ -2382,6 +2387,7 @@ package body Nodes_Meta is
Field_Chain,
Field_Actual,
-- Iir_Kind_Choice_By_Range
+ Field_Choice_Position,
Field_Same_Alternative_Flag,
Field_Element_Type_Flag,
Field_Choice_Staticness,
@@ -2391,6 +2397,7 @@ package body Nodes_Meta is
Field_Associated_Chain,
Field_Choice_Range,
-- Iir_Kind_Choice_By_Expression
+ Field_Choice_Position,
Field_Same_Alternative_Flag,
Field_Element_Type_Flag,
Field_Choice_Staticness,
@@ -2400,6 +2407,7 @@ package body Nodes_Meta is
Field_Associated_Chain,
Field_Choice_Expression,
-- Iir_Kind_Choice_By_Others
+ Field_Choice_Position,
Field_Same_Alternative_Flag,
Field_Element_Type_Flag,
Field_Parent,
@@ -2407,6 +2415,7 @@ package body Nodes_Meta is
Field_Associated_Expr,
Field_Associated_Chain,
-- Iir_Kind_Choice_By_None
+ Field_Choice_Position,
Field_Same_Alternative_Flag,
Field_Element_Type_Flag,
Field_Parent,
@@ -2414,6 +2423,7 @@ package body Nodes_Meta is
Field_Associated_Expr,
Field_Associated_Chain,
-- Iir_Kind_Choice_By_Name
+ Field_Choice_Position,
Field_Same_Alternative_Flag,
Field_Element_Type_Flag,
Field_Parent,
@@ -4432,250 +4442,250 @@ package body Nodes_Meta is
Iir_Kind_Association_Element_Package => 127,
Iir_Kind_Association_Element_Type => 135,
Iir_Kind_Association_Element_Subprogram => 141,
- Iir_Kind_Choice_By_Range => 149,
- Iir_Kind_Choice_By_Expression => 157,
- Iir_Kind_Choice_By_Others => 163,
- Iir_Kind_Choice_By_None => 169,
- Iir_Kind_Choice_By_Name => 176,
- Iir_Kind_Entity_Aspect_Entity => 178,
- Iir_Kind_Entity_Aspect_Configuration => 179,
- Iir_Kind_Entity_Aspect_Open => 179,
- Iir_Kind_Block_Configuration => 185,
- Iir_Kind_Block_Header => 189,
- Iir_Kind_Component_Configuration => 196,
- Iir_Kind_Binding_Indication => 200,
- Iir_Kind_Entity_Class => 202,
- Iir_Kind_Attribute_Value => 210,
- Iir_Kind_Signature => 213,
- Iir_Kind_Aggregate_Info => 220,
- Iir_Kind_Procedure_Call => 224,
- Iir_Kind_Record_Element_Constraint => 231,
- Iir_Kind_Array_Element_Resolution => 233,
- Iir_Kind_Record_Resolution => 234,
- Iir_Kind_Record_Element_Resolution => 237,
- Iir_Kind_Attribute_Specification => 245,
- Iir_Kind_Disconnection_Specification => 251,
- Iir_Kind_Configuration_Specification => 257,
- Iir_Kind_Access_Type_Definition => 265,
- Iir_Kind_Incomplete_Type_Definition => 273,
- Iir_Kind_Interface_Type_Definition => 280,
- Iir_Kind_File_Type_Definition => 287,
- Iir_Kind_Protected_Type_Declaration => 296,
- Iir_Kind_Record_Type_Definition => 306,
- Iir_Kind_Array_Type_Definition => 318,
- Iir_Kind_Array_Subtype_Definition => 333,
- Iir_Kind_Record_Subtype_Definition => 344,
- Iir_Kind_Access_Subtype_Definition => 352,
- Iir_Kind_Physical_Subtype_Definition => 362,
- Iir_Kind_Floating_Subtype_Definition => 373,
- Iir_Kind_Integer_Subtype_Definition => 383,
- Iir_Kind_Enumeration_Subtype_Definition => 393,
- Iir_Kind_Enumeration_Type_Definition => 404,
- Iir_Kind_Integer_Type_Definition => 412,
- Iir_Kind_Floating_Type_Definition => 420,
- Iir_Kind_Physical_Type_Definition => 431,
- Iir_Kind_Range_Expression => 439,
- Iir_Kind_Protected_Type_Body => 446,
- Iir_Kind_Wildcard_Type_Definition => 451,
- Iir_Kind_Subtype_Definition => 456,
- Iir_Kind_Scalar_Nature_Definition => 460,
- Iir_Kind_Overload_List => 461,
- Iir_Kind_Type_Declaration => 468,
- Iir_Kind_Anonymous_Type_Declaration => 474,
- Iir_Kind_Subtype_Declaration => 481,
- Iir_Kind_Nature_Declaration => 487,
- Iir_Kind_Subnature_Declaration => 493,
- Iir_Kind_Entity_Declaration => 505,
- Iir_Kind_Configuration_Declaration => 514,
- Iir_Kind_Context_Declaration => 520,
- Iir_Kind_Package_Declaration => 534,
- Iir_Kind_Package_Instantiation_Declaration => 548,
- Iir_Kind_Package_Body => 556,
- Iir_Kind_Architecture_Body => 568,
- Iir_Kind_Package_Header => 570,
- Iir_Kind_Unit_Declaration => 579,
- Iir_Kind_Library_Declaration => 586,
- Iir_Kind_Component_Declaration => 596,
- Iir_Kind_Attribute_Declaration => 603,
- Iir_Kind_Group_Template_Declaration => 609,
- Iir_Kind_Group_Declaration => 616,
- Iir_Kind_Element_Declaration => 624,
- Iir_Kind_Non_Object_Alias_Declaration => 632,
- Iir_Kind_Psl_Declaration => 640,
- Iir_Kind_Psl_Endpoint_Declaration => 654,
- Iir_Kind_Terminal_Declaration => 660,
- Iir_Kind_Free_Quantity_Declaration => 669,
- Iir_Kind_Across_Quantity_Declaration => 681,
- Iir_Kind_Through_Quantity_Declaration => 693,
- Iir_Kind_Enumeration_Literal => 704,
- Iir_Kind_Function_Declaration => 729,
- Iir_Kind_Procedure_Declaration => 753,
- Iir_Kind_Function_Body => 763,
- Iir_Kind_Procedure_Body => 774,
- Iir_Kind_Object_Alias_Declaration => 785,
- Iir_Kind_File_Declaration => 799,
- Iir_Kind_Guard_Signal_Declaration => 812,
- Iir_Kind_Signal_Declaration => 829,
- Iir_Kind_Variable_Declaration => 842,
- Iir_Kind_Constant_Declaration => 856,
- Iir_Kind_Iterator_Declaration => 867,
- Iir_Kind_Interface_Constant_Declaration => 883,
- Iir_Kind_Interface_Variable_Declaration => 899,
- Iir_Kind_Interface_Signal_Declaration => 920,
- Iir_Kind_Interface_File_Declaration => 936,
- Iir_Kind_Interface_Type_Declaration => 946,
- Iir_Kind_Interface_Package_Declaration => 958,
- Iir_Kind_Interface_Function_Declaration => 975,
- Iir_Kind_Interface_Procedure_Declaration => 988,
- Iir_Kind_Signal_Attribute_Declaration => 991,
- Iir_Kind_Identity_Operator => 995,
- Iir_Kind_Negation_Operator => 999,
- Iir_Kind_Absolute_Operator => 1003,
- Iir_Kind_Not_Operator => 1007,
- Iir_Kind_Implicit_Condition_Operator => 1011,
- Iir_Kind_Condition_Operator => 1015,
- Iir_Kind_Reduction_And_Operator => 1019,
- Iir_Kind_Reduction_Or_Operator => 1023,
- Iir_Kind_Reduction_Nand_Operator => 1027,
- Iir_Kind_Reduction_Nor_Operator => 1031,
- Iir_Kind_Reduction_Xor_Operator => 1035,
- Iir_Kind_Reduction_Xnor_Operator => 1039,
- Iir_Kind_And_Operator => 1044,
- Iir_Kind_Or_Operator => 1049,
- Iir_Kind_Nand_Operator => 1054,
- Iir_Kind_Nor_Operator => 1059,
- Iir_Kind_Xor_Operator => 1064,
- Iir_Kind_Xnor_Operator => 1069,
- Iir_Kind_Equality_Operator => 1074,
- Iir_Kind_Inequality_Operator => 1079,
- Iir_Kind_Less_Than_Operator => 1084,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1089,
- Iir_Kind_Greater_Than_Operator => 1094,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1099,
- Iir_Kind_Match_Equality_Operator => 1104,
- Iir_Kind_Match_Inequality_Operator => 1109,
- Iir_Kind_Match_Less_Than_Operator => 1114,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1119,
- Iir_Kind_Match_Greater_Than_Operator => 1124,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1129,
- Iir_Kind_Sll_Operator => 1134,
- Iir_Kind_Sla_Operator => 1139,
- Iir_Kind_Srl_Operator => 1144,
- Iir_Kind_Sra_Operator => 1149,
- Iir_Kind_Rol_Operator => 1154,
- Iir_Kind_Ror_Operator => 1159,
- Iir_Kind_Addition_Operator => 1164,
- Iir_Kind_Substraction_Operator => 1169,
- Iir_Kind_Concatenation_Operator => 1174,
- Iir_Kind_Multiplication_Operator => 1179,
- Iir_Kind_Division_Operator => 1184,
- Iir_Kind_Modulus_Operator => 1189,
- Iir_Kind_Remainder_Operator => 1194,
- Iir_Kind_Exponentiation_Operator => 1199,
- Iir_Kind_Function_Call => 1207,
- Iir_Kind_Aggregate => 1214,
- Iir_Kind_Parenthesis_Expression => 1217,
- Iir_Kind_Qualified_Expression => 1221,
- Iir_Kind_Type_Conversion => 1226,
- Iir_Kind_Allocator_By_Expression => 1230,
- Iir_Kind_Allocator_By_Subtype => 1235,
- Iir_Kind_Selected_Element => 1242,
- Iir_Kind_Dereference => 1247,
- Iir_Kind_Implicit_Dereference => 1252,
- Iir_Kind_Slice_Name => 1259,
- Iir_Kind_Indexed_Name => 1265,
- Iir_Kind_Psl_Expression => 1267,
- Iir_Kind_Sensitized_Process_Statement => 1288,
- Iir_Kind_Process_Statement => 1308,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1320,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1332,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1345,
- Iir_Kind_Concurrent_Assertion_Statement => 1353,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1360,
- Iir_Kind_Psl_Assert_Statement => 1373,
- Iir_Kind_Psl_Cover_Statement => 1386,
- Iir_Kind_Block_Statement => 1399,
- Iir_Kind_If_Generate_Statement => 1410,
- Iir_Kind_Case_Generate_Statement => 1419,
- Iir_Kind_For_Generate_Statement => 1428,
- Iir_Kind_Component_Instantiation_Statement => 1439,
- Iir_Kind_Psl_Default_Clock => 1443,
- Iir_Kind_Simple_Simultaneous_Statement => 1450,
- Iir_Kind_Generate_Statement_Body => 1461,
- Iir_Kind_If_Generate_Else_Clause => 1467,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1477,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1487,
- Iir_Kind_Selected_Waveform_Assignment_Statement => 1498,
- Iir_Kind_Null_Statement => 1502,
- Iir_Kind_Assertion_Statement => 1509,
- Iir_Kind_Report_Statement => 1515,
- Iir_Kind_Wait_Statement => 1523,
- Iir_Kind_Variable_Assignment_Statement => 1530,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1537,
- Iir_Kind_Return_Statement => 1543,
- Iir_Kind_For_Loop_Statement => 1552,
- Iir_Kind_While_Loop_Statement => 1561,
- Iir_Kind_Next_Statement => 1568,
- Iir_Kind_Exit_Statement => 1575,
- Iir_Kind_Case_Statement => 1583,
- Iir_Kind_Procedure_Call_Statement => 1589,
- Iir_Kind_If_Statement => 1599,
- Iir_Kind_Elsif => 1605,
- Iir_Kind_Character_Literal => 1613,
- Iir_Kind_Simple_Name => 1621,
- Iir_Kind_Selected_Name => 1630,
- Iir_Kind_Operator_Symbol => 1636,
- Iir_Kind_Reference_Name => 1639,
- Iir_Kind_External_Constant_Name => 1648,
- Iir_Kind_External_Signal_Name => 1657,
- Iir_Kind_External_Variable_Name => 1666,
- Iir_Kind_Selected_By_All_Name => 1672,
- Iir_Kind_Parenthesis_Name => 1677,
- Iir_Kind_Package_Pathname => 1681,
- Iir_Kind_Absolute_Pathname => 1682,
- Iir_Kind_Relative_Pathname => 1683,
- Iir_Kind_Pathname_Element => 1688,
- Iir_Kind_Base_Attribute => 1690,
- Iir_Kind_Subtype_Attribute => 1695,
- Iir_Kind_Element_Attribute => 1700,
- Iir_Kind_Left_Type_Attribute => 1705,
- Iir_Kind_Right_Type_Attribute => 1710,
- Iir_Kind_High_Type_Attribute => 1715,
- Iir_Kind_Low_Type_Attribute => 1720,
- Iir_Kind_Ascending_Type_Attribute => 1725,
- Iir_Kind_Image_Attribute => 1731,
- Iir_Kind_Value_Attribute => 1737,
- Iir_Kind_Pos_Attribute => 1743,
- Iir_Kind_Val_Attribute => 1749,
- Iir_Kind_Succ_Attribute => 1755,
- Iir_Kind_Pred_Attribute => 1761,
- Iir_Kind_Leftof_Attribute => 1767,
- Iir_Kind_Rightof_Attribute => 1773,
- Iir_Kind_Delayed_Attribute => 1782,
- Iir_Kind_Stable_Attribute => 1791,
- Iir_Kind_Quiet_Attribute => 1800,
- Iir_Kind_Transaction_Attribute => 1809,
- Iir_Kind_Event_Attribute => 1813,
- Iir_Kind_Active_Attribute => 1817,
- Iir_Kind_Last_Event_Attribute => 1821,
- Iir_Kind_Last_Active_Attribute => 1825,
- Iir_Kind_Last_Value_Attribute => 1829,
- Iir_Kind_Driving_Attribute => 1833,
- Iir_Kind_Driving_Value_Attribute => 1837,
- Iir_Kind_Behavior_Attribute => 1837,
- Iir_Kind_Structure_Attribute => 1837,
- Iir_Kind_Simple_Name_Attribute => 1844,
- Iir_Kind_Instance_Name_Attribute => 1849,
- Iir_Kind_Path_Name_Attribute => 1854,
- Iir_Kind_Left_Array_Attribute => 1861,
- Iir_Kind_Right_Array_Attribute => 1868,
- Iir_Kind_High_Array_Attribute => 1875,
- Iir_Kind_Low_Array_Attribute => 1882,
- Iir_Kind_Length_Array_Attribute => 1889,
- Iir_Kind_Ascending_Array_Attribute => 1896,
- Iir_Kind_Range_Array_Attribute => 1903,
- Iir_Kind_Reverse_Range_Array_Attribute => 1910,
- Iir_Kind_Attribute_Name => 1919
+ Iir_Kind_Choice_By_Range => 150,
+ Iir_Kind_Choice_By_Expression => 159,
+ Iir_Kind_Choice_By_Others => 166,
+ Iir_Kind_Choice_By_None => 173,
+ Iir_Kind_Choice_By_Name => 181,
+ Iir_Kind_Entity_Aspect_Entity => 183,
+ Iir_Kind_Entity_Aspect_Configuration => 184,
+ Iir_Kind_Entity_Aspect_Open => 184,
+ Iir_Kind_Block_Configuration => 190,
+ Iir_Kind_Block_Header => 194,
+ Iir_Kind_Component_Configuration => 201,
+ Iir_Kind_Binding_Indication => 205,
+ Iir_Kind_Entity_Class => 207,
+ Iir_Kind_Attribute_Value => 215,
+ Iir_Kind_Signature => 218,
+ Iir_Kind_Aggregate_Info => 225,
+ Iir_Kind_Procedure_Call => 229,
+ Iir_Kind_Record_Element_Constraint => 236,
+ Iir_Kind_Array_Element_Resolution => 238,
+ Iir_Kind_Record_Resolution => 239,
+ Iir_Kind_Record_Element_Resolution => 242,
+ Iir_Kind_Attribute_Specification => 250,
+ Iir_Kind_Disconnection_Specification => 256,
+ Iir_Kind_Configuration_Specification => 262,
+ Iir_Kind_Access_Type_Definition => 270,
+ Iir_Kind_Incomplete_Type_Definition => 278,
+ Iir_Kind_Interface_Type_Definition => 285,
+ Iir_Kind_File_Type_Definition => 292,
+ Iir_Kind_Protected_Type_Declaration => 301,
+ Iir_Kind_Record_Type_Definition => 311,
+ Iir_Kind_Array_Type_Definition => 323,
+ Iir_Kind_Array_Subtype_Definition => 338,
+ Iir_Kind_Record_Subtype_Definition => 349,
+ Iir_Kind_Access_Subtype_Definition => 357,
+ Iir_Kind_Physical_Subtype_Definition => 367,
+ Iir_Kind_Floating_Subtype_Definition => 378,
+ Iir_Kind_Integer_Subtype_Definition => 388,
+ Iir_Kind_Enumeration_Subtype_Definition => 398,
+ Iir_Kind_Enumeration_Type_Definition => 409,
+ Iir_Kind_Integer_Type_Definition => 417,
+ Iir_Kind_Floating_Type_Definition => 425,
+ Iir_Kind_Physical_Type_Definition => 436,
+ Iir_Kind_Range_Expression => 444,
+ Iir_Kind_Protected_Type_Body => 451,
+ Iir_Kind_Wildcard_Type_Definition => 456,
+ Iir_Kind_Subtype_Definition => 461,
+ Iir_Kind_Scalar_Nature_Definition => 465,
+ Iir_Kind_Overload_List => 466,
+ Iir_Kind_Type_Declaration => 473,
+ Iir_Kind_Anonymous_Type_Declaration => 479,
+ Iir_Kind_Subtype_Declaration => 486,
+ Iir_Kind_Nature_Declaration => 492,
+ Iir_Kind_Subnature_Declaration => 498,
+ Iir_Kind_Entity_Declaration => 510,
+ Iir_Kind_Configuration_Declaration => 519,
+ Iir_Kind_Context_Declaration => 525,
+ Iir_Kind_Package_Declaration => 539,
+ Iir_Kind_Package_Instantiation_Declaration => 553,
+ Iir_Kind_Package_Body => 561,
+ Iir_Kind_Architecture_Body => 573,
+ Iir_Kind_Package_Header => 575,
+ Iir_Kind_Unit_Declaration => 584,
+ Iir_Kind_Library_Declaration => 591,
+ Iir_Kind_Component_Declaration => 601,
+ Iir_Kind_Attribute_Declaration => 608,
+ Iir_Kind_Group_Template_Declaration => 614,
+ Iir_Kind_Group_Declaration => 621,
+ Iir_Kind_Element_Declaration => 629,
+ Iir_Kind_Non_Object_Alias_Declaration => 637,
+ Iir_Kind_Psl_Declaration => 645,
+ Iir_Kind_Psl_Endpoint_Declaration => 659,
+ Iir_Kind_Terminal_Declaration => 665,
+ Iir_Kind_Free_Quantity_Declaration => 674,
+ Iir_Kind_Across_Quantity_Declaration => 686,
+ Iir_Kind_Through_Quantity_Declaration => 698,
+ Iir_Kind_Enumeration_Literal => 709,
+ Iir_Kind_Function_Declaration => 734,
+ Iir_Kind_Procedure_Declaration => 758,
+ Iir_Kind_Function_Body => 768,
+ Iir_Kind_Procedure_Body => 779,
+ Iir_Kind_Object_Alias_Declaration => 790,
+ Iir_Kind_File_Declaration => 804,
+ Iir_Kind_Guard_Signal_Declaration => 817,
+ Iir_Kind_Signal_Declaration => 834,
+ Iir_Kind_Variable_Declaration => 847,
+ Iir_Kind_Constant_Declaration => 861,
+ Iir_Kind_Iterator_Declaration => 872,
+ Iir_Kind_Interface_Constant_Declaration => 888,
+ Iir_Kind_Interface_Variable_Declaration => 904,
+ Iir_Kind_Interface_Signal_Declaration => 925,
+ Iir_Kind_Interface_File_Declaration => 941,
+ Iir_Kind_Interface_Type_Declaration => 951,
+ Iir_Kind_Interface_Package_Declaration => 963,
+ Iir_Kind_Interface_Function_Declaration => 980,
+ Iir_Kind_Interface_Procedure_Declaration => 993,
+ Iir_Kind_Signal_Attribute_Declaration => 996,
+ Iir_Kind_Identity_Operator => 1000,
+ Iir_Kind_Negation_Operator => 1004,
+ Iir_Kind_Absolute_Operator => 1008,
+ Iir_Kind_Not_Operator => 1012,
+ Iir_Kind_Implicit_Condition_Operator => 1016,
+ Iir_Kind_Condition_Operator => 1020,
+ Iir_Kind_Reduction_And_Operator => 1024,
+ Iir_Kind_Reduction_Or_Operator => 1028,
+ Iir_Kind_Reduction_Nand_Operator => 1032,
+ Iir_Kind_Reduction_Nor_Operator => 1036,
+ Iir_Kind_Reduction_Xor_Operator => 1040,
+ Iir_Kind_Reduction_Xnor_Operator => 1044,
+ Iir_Kind_And_Operator => 1049,
+ Iir_Kind_Or_Operator => 1054,
+ Iir_Kind_Nand_Operator => 1059,
+ Iir_Kind_Nor_Operator => 1064,
+ Iir_Kind_Xor_Operator => 1069,
+ Iir_Kind_Xnor_Operator => 1074,
+ Iir_Kind_Equality_Operator => 1079,
+ Iir_Kind_Inequality_Operator => 1084,
+ Iir_Kind_Less_Than_Operator => 1089,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1094,
+ Iir_Kind_Greater_Than_Operator => 1099,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1104,
+ Iir_Kind_Match_Equality_Operator => 1109,
+ Iir_Kind_Match_Inequality_Operator => 1114,
+ Iir_Kind_Match_Less_Than_Operator => 1119,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1124,
+ Iir_Kind_Match_Greater_Than_Operator => 1129,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1134,
+ Iir_Kind_Sll_Operator => 1139,
+ Iir_Kind_Sla_Operator => 1144,
+ Iir_Kind_Srl_Operator => 1149,
+ Iir_Kind_Sra_Operator => 1154,
+ Iir_Kind_Rol_Operator => 1159,
+ Iir_Kind_Ror_Operator => 1164,
+ Iir_Kind_Addition_Operator => 1169,
+ Iir_Kind_Substraction_Operator => 1174,
+ Iir_Kind_Concatenation_Operator => 1179,
+ Iir_Kind_Multiplication_Operator => 1184,
+ Iir_Kind_Division_Operator => 1189,
+ Iir_Kind_Modulus_Operator => 1194,
+ Iir_Kind_Remainder_Operator => 1199,
+ Iir_Kind_Exponentiation_Operator => 1204,
+ Iir_Kind_Function_Call => 1212,
+ Iir_Kind_Aggregate => 1219,
+ Iir_Kind_Parenthesis_Expression => 1222,
+ Iir_Kind_Qualified_Expression => 1226,
+ Iir_Kind_Type_Conversion => 1231,
+ Iir_Kind_Allocator_By_Expression => 1235,
+ Iir_Kind_Allocator_By_Subtype => 1240,
+ Iir_Kind_Selected_Element => 1247,
+ Iir_Kind_Dereference => 1252,
+ Iir_Kind_Implicit_Dereference => 1257,
+ Iir_Kind_Slice_Name => 1264,
+ Iir_Kind_Indexed_Name => 1270,
+ Iir_Kind_Psl_Expression => 1272,
+ Iir_Kind_Sensitized_Process_Statement => 1293,
+ Iir_Kind_Process_Statement => 1313,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1325,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1337,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1350,
+ Iir_Kind_Concurrent_Assertion_Statement => 1358,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1365,
+ Iir_Kind_Psl_Assert_Statement => 1378,
+ Iir_Kind_Psl_Cover_Statement => 1391,
+ Iir_Kind_Block_Statement => 1404,
+ Iir_Kind_If_Generate_Statement => 1415,
+ Iir_Kind_Case_Generate_Statement => 1424,
+ Iir_Kind_For_Generate_Statement => 1433,
+ Iir_Kind_Component_Instantiation_Statement => 1444,
+ Iir_Kind_Psl_Default_Clock => 1448,
+ Iir_Kind_Simple_Simultaneous_Statement => 1455,
+ Iir_Kind_Generate_Statement_Body => 1466,
+ Iir_Kind_If_Generate_Else_Clause => 1472,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1482,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1492,
+ Iir_Kind_Selected_Waveform_Assignment_Statement => 1503,
+ Iir_Kind_Null_Statement => 1507,
+ Iir_Kind_Assertion_Statement => 1514,
+ Iir_Kind_Report_Statement => 1520,
+ Iir_Kind_Wait_Statement => 1528,
+ Iir_Kind_Variable_Assignment_Statement => 1535,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1542,
+ Iir_Kind_Return_Statement => 1548,
+ Iir_Kind_For_Loop_Statement => 1557,
+ Iir_Kind_While_Loop_Statement => 1566,
+ Iir_Kind_Next_Statement => 1573,
+ Iir_Kind_Exit_Statement => 1580,
+ Iir_Kind_Case_Statement => 1588,
+ Iir_Kind_Procedure_Call_Statement => 1594,
+ Iir_Kind_If_Statement => 1604,
+ Iir_Kind_Elsif => 1610,
+ Iir_Kind_Character_Literal => 1618,
+ Iir_Kind_Simple_Name => 1626,
+ Iir_Kind_Selected_Name => 1635,
+ Iir_Kind_Operator_Symbol => 1641,
+ Iir_Kind_Reference_Name => 1644,
+ Iir_Kind_External_Constant_Name => 1653,
+ Iir_Kind_External_Signal_Name => 1662,
+ Iir_Kind_External_Variable_Name => 1671,
+ Iir_Kind_Selected_By_All_Name => 1677,
+ Iir_Kind_Parenthesis_Name => 1682,
+ Iir_Kind_Package_Pathname => 1686,
+ Iir_Kind_Absolute_Pathname => 1687,
+ Iir_Kind_Relative_Pathname => 1688,
+ Iir_Kind_Pathname_Element => 1693,
+ Iir_Kind_Base_Attribute => 1695,
+ Iir_Kind_Subtype_Attribute => 1700,
+ Iir_Kind_Element_Attribute => 1705,
+ Iir_Kind_Left_Type_Attribute => 1710,
+ Iir_Kind_Right_Type_Attribute => 1715,
+ Iir_Kind_High_Type_Attribute => 1720,
+ Iir_Kind_Low_Type_Attribute => 1725,
+ Iir_Kind_Ascending_Type_Attribute => 1730,
+ Iir_Kind_Image_Attribute => 1736,
+ Iir_Kind_Value_Attribute => 1742,
+ Iir_Kind_Pos_Attribute => 1748,
+ Iir_Kind_Val_Attribute => 1754,
+ Iir_Kind_Succ_Attribute => 1760,
+ Iir_Kind_Pred_Attribute => 1766,
+ Iir_Kind_Leftof_Attribute => 1772,
+ Iir_Kind_Rightof_Attribute => 1778,
+ Iir_Kind_Delayed_Attribute => 1787,
+ Iir_Kind_Stable_Attribute => 1796,
+ Iir_Kind_Quiet_Attribute => 1805,
+ Iir_Kind_Transaction_Attribute => 1814,
+ Iir_Kind_Event_Attribute => 1818,
+ Iir_Kind_Active_Attribute => 1822,
+ Iir_Kind_Last_Event_Attribute => 1826,
+ Iir_Kind_Last_Active_Attribute => 1830,
+ Iir_Kind_Last_Value_Attribute => 1834,
+ Iir_Kind_Driving_Attribute => 1838,
+ Iir_Kind_Driving_Value_Attribute => 1842,
+ Iir_Kind_Behavior_Attribute => 1842,
+ Iir_Kind_Structure_Attribute => 1842,
+ Iir_Kind_Simple_Name_Attribute => 1849,
+ Iir_Kind_Instance_Name_Attribute => 1854,
+ Iir_Kind_Path_Name_Attribute => 1859,
+ Iir_Kind_Left_Array_Attribute => 1866,
+ Iir_Kind_Right_Array_Attribute => 1873,
+ Iir_Kind_High_Array_Attribute => 1880,
+ Iir_Kind_Low_Array_Attribute => 1887,
+ Iir_Kind_Length_Array_Attribute => 1894,
+ Iir_Kind_Ascending_Array_Attribute => 1901,
+ Iir_Kind_Range_Array_Attribute => 1908,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1915,
+ Iir_Kind_Attribute_Name => 1924
);
function Get_Fields_First (K : Iir_Kind) return Fields_Index is
@@ -6316,6 +6326,8 @@ package body Nodes_Meta is
return Get_Design_Unit_Source_Col (N);
when Field_String_Length =>
return Get_String_Length (N);
+ when Field_Choice_Position =>
+ return Get_Choice_Position (N);
when Field_PSL_Nbr_States =>
return Get_PSL_Nbr_States (N);
when others =>
@@ -6334,6 +6346,8 @@ package body Nodes_Meta is
Set_Design_Unit_Source_Col (N, V);
when Field_String_Length =>
Set_String_Length (N, V);
+ when Field_Choice_Position =>
+ Set_Choice_Position (N, V);
when Field_PSL_Nbr_States =>
Set_PSL_Nbr_States (N, V);
when others =>
@@ -7018,6 +7032,20 @@ package body Nodes_Meta is
return K = Iir_Kind_Waveform_Element;
end Has_Time;
+ function Has_Choice_Position (K : Iir_Kind) return Boolean is
+ begin
+ case K is
+ when Iir_Kind_Choice_By_Range
+ | Iir_Kind_Choice_By_Expression
+ | Iir_Kind_Choice_By_Others
+ | Iir_Kind_Choice_By_None
+ | Iir_Kind_Choice_By_Name =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Has_Choice_Position;
+
function Has_Associated_Expr (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 29bedbf54..4181b1661 100644
--- a/src/vhdl/nodes_meta.ads
+++ b/src/vhdl/nodes_meta.ads
@@ -116,6 +116,7 @@ package Nodes_Meta is
Field_After_Drivers_Flag,
Field_We_Value,
Field_Time,
+ Field_Choice_Position,
Field_Associated_Expr,
Field_Associated_Block,
Field_Associated_Chain,
@@ -644,6 +645,7 @@ package Nodes_Meta is
function Has_After_Drivers_Flag (K : Iir_Kind) return Boolean;
function Has_We_Value (K : Iir_Kind) return Boolean;
function Has_Time (K : Iir_Kind) return Boolean;
+ function Has_Choice_Position (K : Iir_Kind) return Boolean;
function Has_Associated_Expr (K : Iir_Kind) return Boolean;
function Has_Associated_Block (K : Iir_Kind) return Boolean;
function Has_Associated_Chain (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 7c840de4f..637e404fa 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -4754,7 +4754,8 @@ package body Parse is
-- choices ::= choice { | choice }
--
-- Leave tok_double_arrow as current token.
- function Parse_Choices (Expr: Iir; First_Loc : Location_Type) return Iir
+ function Parse_Choices
+ (Expr: Iir; First_Loc : Location_Type; Pos : in out Int32) return Iir
is
First, Last : Iir;
A_Choice: Iir;
@@ -4766,6 +4767,8 @@ package body Parse is
Loc := First_Loc;
loop
A_Choice := Parse_A_Choice (Expr1, Loc);
+ Set_Choice_Position (A_Choice, Pos);
+ Pos := Pos + 1;
if First /= Null_Iir then
Set_Same_Alternative_Flag (A_Choice, True);
@@ -4806,6 +4809,7 @@ package body Parse is
Last : Iir;
Assoc: Iir;
Loc, Right_Loc : Location_Type;
+ Pos : Int32;
begin
Loc := Get_Token_Location;
@@ -4869,9 +4873,12 @@ package body Parse is
Res := Create_Iir (Iir_Kind_Aggregate);
Set_Location (Res, Loc);
Build_Init (Last);
+ Pos := 0;
loop
if Current_Token = Tok_Others then
Assoc := Parse_A_Choice (Null_Iir, Loc);
+ Set_Choice_Position (Assoc, Pos);
+ Pos := Pos + 1;
Expect (Tok_Double_Arrow);
-- Eat '=>'
@@ -4892,8 +4899,10 @@ package body Parse is
| Tok_Right_Paren =>
Assoc := Create_Iir (Iir_Kind_Choice_By_None);
Set_Location (Assoc, Loc);
+ Set_Choice_Position (Assoc, Pos);
+ Pos := Pos + 1;
when others =>
- Assoc := Parse_Choices (Expr, Loc);
+ Assoc := Parse_Choices (Expr, Loc, Pos);
Expect (Tok_Double_Arrow);
-- Eat '=>'.
@@ -5822,6 +5831,7 @@ package body Parse is
Target : Iir;
Last : Iir;
When_Loc : Location_Type;
+ Pos : Int32;
begin
Scan; -- accept 'with' token.
Res := Create_Iir (Iir_Kind_Concurrent_Selected_Signal_Assignment);
@@ -5842,6 +5852,7 @@ package body Parse is
Parse_Options (Res);
Build_Init (Last);
+ Pos := 0;
loop
Wf_Chain := Parse_Waveform;
Expect (Tok_When, "'when' expected after waveform");
@@ -5850,7 +5861,7 @@ package body Parse is
-- Eat 'when'.
Scan;
- Assoc := Parse_Choices (Null_Iir, When_Loc);
+ Assoc := Parse_Choices (Null_Iir, When_Loc, Pos);
Set_Associated_Chain (Assoc, Wf_Chain);
Append_Subchain (Last, Res, Assoc);
exit when Current_Token = Tok_Semi_Colon;
@@ -6363,6 +6374,7 @@ package body Parse is
Assoc: Iir;
Last_Assoc : Iir;
When_Loc : Location_Type;
+ Pos : Int32;
begin
Stmt := Create_Iir (Iir_Kind_Case_Statement);
Set_Label (Stmt, Label);
@@ -6382,6 +6394,7 @@ package body Parse is
end if;
Build_Init (Last_Assoc);
+ Pos := 0;
while Current_Token /= Tok_End loop
Expect (Tok_When);
When_Loc := Get_Token_Location;
@@ -6393,8 +6406,10 @@ package body Parse is
Error_Msg_Parse ("missing expression in alternative");
Assoc := Create_Iir (Iir_Kind_Choice_By_Expression);
Set_Location (Assoc, When_Loc);
+ Set_Choice_Position (Assoc, Pos);
+ Pos := Pos + 1;
else
- Assoc := Parse_Choices (Null_Iir, When_Loc);
+ Assoc := Parse_Choices (Null_Iir, When_Loc, Pos);
end if;
-- Skip '=>'.
@@ -7836,12 +7851,12 @@ package body Parse is
-- case_generate_alternative ::=
-- WHEN [ /alternative/_label : ] choices =>
-- generate_statement_body
- function Parse_Case_Generate_Alternative (Parent : Iir) return Iir
+ procedure Parse_Case_Generate_Alternative
+ (Parent : Iir; Assoc : out Iir; Pos : in out Int32)
is
Loc : Location_Type;
Alt_Label : Name_Id;
Bod : Iir;
- Assoc : Iir;
Expr : Iir;
End_Loc : Location_Type;
begin
@@ -7856,9 +7871,11 @@ package body Parse is
Error_Msg_Parse ("missing expression in alternative");
Assoc := Create_Iir (Iir_Kind_Choice_By_Expression);
Set_Location (Assoc);
+ Set_Choice_Position (Assoc, Pos);
+ Pos := Pos + 1;
elsif Current_Token = Tok_Others then
-- 'others' is not an expression!
- Assoc := Parse_Choices (Null_Iir, Loc);
+ Assoc := Parse_Choices (Null_Iir, Loc, Pos);
else
Expr := Parse_Expression;
@@ -7879,7 +7896,7 @@ package body Parse is
Scan;
end if;
- Assoc := Parse_Choices (Expr, Loc);
+ Assoc := Parse_Choices (Expr, Loc, Pos);
end if;
-- Set location of label (if any, for xref) or location of 'when'.
@@ -7895,8 +7912,6 @@ package body Parse is
-- Set location on the label, for xrefs.
Set_Location (Bod, Loc);
end if;
-
- return Assoc;
end Parse_Case_Generate_Alternative;
-- precond : CASE
@@ -7915,6 +7930,7 @@ package body Parse is
Res : Iir;
Alt : Iir;
Last_Alt : Iir;
+ Pos : Int32;
begin
if Label = Null_Identifier then
Error_Msg_Parse ("a generate statement must have a label");
@@ -7938,8 +7954,9 @@ package body Parse is
end if;
Last_Alt := Null_Iir;
+ Pos := 0;
while Current_Token = Tok_When loop
- Alt := Parse_Case_Generate_Alternative (Res);
+ Parse_Case_Generate_Alternative (Res, Alt, Pos);
if Last_Alt = Null_Iir then
Set_Case_Statement_Alternative_Chain (Res, Alt);
else
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index aeff43bf0..2351f77bf 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -2858,7 +2858,6 @@ package body Trans.Chap7 is
Ghdl_Bool_Type));
El_Node := Chap3.Index_Base (Base_Ptr, Target_Type,
New_Obj_Value (It));
- --New_Assign_Stmt (El_Node, Chap7.Translate_Expression (El));
Translate_Assign (El_Node, El, Get_Element_Subtype (Target_Type));
Inc_Var (It);
Finish_Loop_Stmt (Label);