diff options
| author | Tristan Gingold <tgingold@free.fr> | 2022-08-07 07:10:49 +0200 | 
|---|---|---|
| committer | Tristan Gingold <tgingold@free.fr> | 2022-08-07 10:00:11 +0200 | 
| commit | 5c8b50f69d70f4e2d0a9910a7914245d0796b758 (patch) | |
| tree | 91959a573b77b22e0af7bc72f1eaa54a835abf24 /src | |
| parent | 23b3cadc1c6b96928f3d0829f8b0c5b7337fcc9c (diff) | |
| download | ghdl-5c8b50f69d70f4e2d0a9910a7914245d0796b758.tar.gz ghdl-5c8b50f69d70f4e2d0a9910a7914245d0796b758.tar.bz2 ghdl-5c8b50f69d70f4e2d0a9910a7914245d0796b758.zip  | |
vhdl: add support for default in interface subprogram.  Fix #2163
Diffstat (limited to 'src')
| -rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 3 | ||||
| -rw-r--r-- | src/vhdl/vhdl-nodes.adb | 32 | ||||
| -rw-r--r-- | src/vhdl/vhdl-nodes.ads | 14 | ||||
| -rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 635 | ||||
| -rw-r--r-- | src/vhdl/vhdl-nodes_meta.ads | 4 | ||||
| -rw-r--r-- | src/vhdl/vhdl-parse.adb | 17 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_assocs.adb | 209 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_assocs.ads | 15 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 78 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_names.adb | 44 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_names.ads | 15 | ||||
| -rw-r--r-- | src/vhdl/vhdl-utils.adb | 2 | 
12 files changed, 649 insertions, 419 deletions
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index e9b11f8eb..8ee426293 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -850,6 +850,9 @@ package body Trans.Chap5 is                       Set_Map_Env (Formal_Env);                       Chap2.Elab_Package_Instantiation_Declaration (Formal);                       Set_Map_Env (Actual_Env); +                  when Iir_Kinds_Interface_Subprogram_Declaration => +                     --  Expanded. +                     null;                    when others =>                       Error_Kind ("elab_generic_map_aspect(open)", Formal);                 end case; diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 71914dfd3..9b6329c74 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -2197,6 +2197,22 @@ package body Vhdl.Nodes is        Set_Field3 (Target, Actual);     end Set_Actual; +   function Get_Open_Actual (Target : Iir) return Iir is +   begin +      pragma Assert (Target /= Null_Iir); +      pragma Assert (Has_Open_Actual (Get_Kind (Target)), +                     "no field Open_Actual"); +      return Get_Field3 (Target); +   end Get_Open_Actual; + +   procedure Set_Open_Actual (Target : Iir; Actual : Iir) is +   begin +      pragma Assert (Target /= Null_Iir); +      pragma Assert (Has_Open_Actual (Get_Kind (Target)), +                     "no field Open_Actual"); +      Set_Field3 (Target, Actual); +   end Set_Open_Actual; +     function Get_Actual_Conversion (Target : Iir) return Iir is     begin        pragma Assert (Target /= Null_Iir); @@ -3132,6 +3148,22 @@ package body Vhdl.Nodes is        Set_Field5 (Target, Chain);     end Set_Interface_Declaration_Chain; +   function Get_Default_Subprogram (Inter : Iir) return Iir is +   begin +      pragma Assert (Inter /= Null_Iir); +      pragma Assert (Has_Default_Subprogram (Get_Kind (Inter)), +                     "no field Default_Subprogram"); +      return Get_Field9 (Inter); +   end Get_Default_Subprogram; + +   procedure Set_Default_Subprogram (Inter : Iir; Subprg : Iir) is +   begin +      pragma Assert (Inter /= Null_Iir); +      pragma Assert (Has_Default_Subprogram (Get_Kind (Inter)), +                     "no field Default_Subprogram"); +      Set_Field9 (Inter, Subprg); +   end Set_Default_Subprogram; +     function Get_Subprogram_Specification (Target : Iir) return Iir is     begin        pragma Assert (Target /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 0fc291be2..376c99daa 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -449,6 +449,10 @@ package Vhdl.Nodes is     -- Only for Iir_Kind_Association_Element_Terminal:     --   Get/Set_Actual (Field3)     -- +   --  For '<>' default interface subprogram. +   -- Only for Iir_Kind_Association_Element_Open: +   --   Get/Set_Open_Actual (Field3) +   --     -- Only for Iir_Kind_Association_Element_By_Individual:     --   Get/Set_Individual_Association_Chain (Field4)     -- @@ -1772,6 +1776,8 @@ package Vhdl.Nodes is     --     --   Get/Set_Return_Type_Mark (Field8)     -- +   --   Get/Set_Default_Subprogram (Field9) +   --     --   Get/Set_Subprogram_Depth (Field10)     --     --   Get/Set_Seen_Flag (Flag1) @@ -7909,6 +7915,10 @@ package Vhdl.Nodes is     function Get_Actual (Target : Iir) return Iir;     procedure Set_Actual (Target : Iir; Actual : Iir); +   --  Field: Field3 Ref +   function Get_Open_Actual (Target : Iir) return Iir; +   procedure Set_Open_Actual (Target : Iir; Actual : Iir); +     --  Field: Field4     function Get_Actual_Conversion (Target : Iir) return Iir;     procedure Set_Actual_Conversion (Target : Iir; Conv : Iir); @@ -8194,6 +8204,10 @@ package Vhdl.Nodes is     procedure Set_Interface_Declaration_Chain (Target : Iir; Chain : Iir);     pragma Inline (Get_Interface_Declaration_Chain); +   --  Field: Field9 +   function Get_Default_Subprogram (Inter : Iir) return Iir; +   procedure Set_Default_Subprogram (Inter : Iir; Subprg : Iir); +     --  Field: Field6 Ref     function Get_Subprogram_Specification (Target : Iir) return Iir;     procedure Set_Subprogram_Specification (Target : Iir; Spec : Iir); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 656cc2aef..2d92d3bae 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -68,6 +68,7 @@ package body Vhdl.Nodes_Meta is        Field_Designated_Entity => Type_Iir,        Field_Formal => Type_Iir,        Field_Actual => Type_Iir, +      Field_Open_Actual => Type_Iir,        Field_Actual_Conversion => Type_Iir,        Field_Formal_Conversion => Type_Iir,        Field_Whole_Association_Flag => Type_Boolean, @@ -125,6 +126,7 @@ package body Vhdl.Nodes_Meta is        Field_Signal_Kind => Type_Iir_Signal_Kind,        Field_Base_Name => Type_Iir,        Field_Interface_Declaration_Chain => Type_Iir, +      Field_Default_Subprogram => Type_Iir,        Field_Subprogram_Specification => Type_Iir,        Field_Sequential_Statement_Chain => Type_Iir,        Field_Simultaneous_Statement_Chain => Type_Iir, @@ -507,6 +509,8 @@ package body Vhdl.Nodes_Meta is              return "formal";           when Field_Actual =>              return "actual"; +         when Field_Open_Actual => +            return "open_actual";           when Field_Actual_Conversion =>              return "actual_conversion";           when Field_Formal_Conversion => @@ -621,6 +625,8 @@ package body Vhdl.Nodes_Meta is              return "base_name";           when Field_Interface_Declaration_Chain =>              return "interface_declaration_chain"; +         when Field_Default_Subprogram => +            return "default_subprogram";           when Field_Subprogram_Specification =>              return "subprogram_specification";           when Field_Sequential_Statement_Chain => @@ -1919,6 +1925,8 @@ package body Vhdl.Nodes_Meta is              return Attr_None;           when Field_Actual =>              return Attr_None; +         when Field_Open_Actual => +            return Attr_Ref;           when Field_Actual_Conversion =>              return Attr_None;           when Field_Formal_Conversion => @@ -2033,6 +2041,8 @@ package body Vhdl.Nodes_Meta is              return Attr_Ref;           when Field_Interface_Declaration_Chain =>              return Attr_Chain; +         when Field_Default_Subprogram => +            return Attr_None;           when Field_Subprogram_Specification =>              return Attr_Ref;           when Field_Sequential_Statement_Chain => @@ -2740,6 +2750,7 @@ package body Vhdl.Nodes_Meta is        Field_In_Formal_Flag,        Field_Formal,        Field_Chain, +      Field_Open_Actual,        --  Iir_Kind_Association_Element_Package        Field_Whole_Association_Flag,        Field_Collapse_Signal_Flag, @@ -3935,6 +3946,7 @@ package body Vhdl.Nodes_Meta is        Field_Chain,        Field_Interface_Declaration_Chain,        Field_Return_Type_Mark, +      Field_Default_Subprogram,        --  Iir_Kind_Interface_Procedure_Declaration        Field_Subprogram_Depth,        Field_Identifier, @@ -3950,6 +3962,7 @@ package body Vhdl.Nodes_Meta is        Field_Chain,        Field_Interface_Declaration_Chain,        Field_Return_Type_Mark, +      Field_Default_Subprogram,        --  Iir_Kind_Attribute_Implicit_Declaration        Field_Parent,        Field_Chain, @@ -5328,305 +5341,305 @@ package body Vhdl.Nodes_Meta is        Iir_Kind_Association_Element_By_Expression => 114,        Iir_Kind_Association_Element_By_Name => 122,        Iir_Kind_Association_Element_By_Individual => 131, -      Iir_Kind_Association_Element_Open => 137, -      Iir_Kind_Association_Element_Package => 143, -      Iir_Kind_Association_Element_Type => 151, -      Iir_Kind_Association_Element_Subprogram => 157, -      Iir_Kind_Association_Element_Terminal => 163, -      Iir_Kind_Choice_By_Range => 171, -      Iir_Kind_Choice_By_Expression => 179, -      Iir_Kind_Choice_By_Others => 185, -      Iir_Kind_Choice_By_None => 191, -      Iir_Kind_Choice_By_Name => 198, -      Iir_Kind_Entity_Aspect_Entity => 200, -      Iir_Kind_Entity_Aspect_Configuration => 201, -      Iir_Kind_Entity_Aspect_Open => 201, -      Iir_Kind_Psl_Hierarchical_Name => 203, -      Iir_Kind_Block_Configuration => 209, -      Iir_Kind_Block_Header => 213, -      Iir_Kind_Component_Configuration => 220, -      Iir_Kind_Binding_Indication => 224, -      Iir_Kind_Entity_Class => 226, -      Iir_Kind_Attribute_Value => 234, -      Iir_Kind_Signature => 239, -      Iir_Kind_Aggregate_Info => 246, -      Iir_Kind_Procedure_Call => 250, -      Iir_Kind_Record_Element_Constraint => 258, -      Iir_Kind_Array_Element_Resolution => 260, -      Iir_Kind_Record_Resolution => 261, -      Iir_Kind_Record_Element_Resolution => 264, -      Iir_Kind_Break_Element => 268, -      Iir_Kind_Attribute_Specification => 277, -      Iir_Kind_Disconnection_Specification => 283, -      Iir_Kind_Step_Limit_Specification => 289, -      Iir_Kind_Configuration_Specification => 295, -      Iir_Kind_Access_Type_Definition => 302, -      Iir_Kind_Incomplete_Type_Definition => 309, -      Iir_Kind_Interface_Type_Definition => 315, -      Iir_Kind_File_Type_Definition => 321, -      Iir_Kind_Protected_Type_Declaration => 331, -      Iir_Kind_Record_Type_Definition => 341, -      Iir_Kind_Array_Type_Definition => 352, -      Iir_Kind_Array_Subtype_Definition => 369, -      Iir_Kind_Record_Subtype_Definition => 382, -      Iir_Kind_Access_Subtype_Definition => 390, -      Iir_Kind_Physical_Subtype_Definition => 400, -      Iir_Kind_Floating_Subtype_Definition => 411, -      Iir_Kind_Integer_Subtype_Definition => 421, -      Iir_Kind_Enumeration_Subtype_Definition => 431, -      Iir_Kind_Enumeration_Type_Definition => 442, -      Iir_Kind_Integer_Type_Definition => 450, -      Iir_Kind_Floating_Type_Definition => 458, -      Iir_Kind_Physical_Type_Definition => 469, -      Iir_Kind_Range_Expression => 477, -      Iir_Kind_Protected_Type_Body => 485, -      Iir_Kind_Wildcard_Type_Definition => 489, -      Iir_Kind_Foreign_Vector_Type_Definition => 490, -      Iir_Kind_Subtype_Definition => 497, -      Iir_Kind_Scalar_Nature_Definition => 505, -      Iir_Kind_Record_Nature_Definition => 518, -      Iir_Kind_Array_Nature_Definition => 532, -      Iir_Kind_Array_Subnature_Definition => 547, -      Iir_Kind_Overload_List => 548, -      Iir_Kind_Foreign_Module => 553, -      Iir_Kind_Entity_Declaration => 566, -      Iir_Kind_Configuration_Declaration => 576, -      Iir_Kind_Context_Declaration => 582, -      Iir_Kind_Package_Declaration => 597, -      Iir_Kind_Package_Instantiation_Declaration => 611, -      Iir_Kind_Vmode_Declaration => 623, -      Iir_Kind_Vprop_Declaration => 635, -      Iir_Kind_Vunit_Declaration => 648, -      Iir_Kind_Package_Body => 656, -      Iir_Kind_Architecture_Body => 669, -      Iir_Kind_Type_Declaration => 676, -      Iir_Kind_Anonymous_Type_Declaration => 682, -      Iir_Kind_Subtype_Declaration => 690, -      Iir_Kind_Nature_Declaration => 696, -      Iir_Kind_Subnature_Declaration => 703, -      Iir_Kind_Package_Header => 705, -      Iir_Kind_Unit_Declaration => 714, -      Iir_Kind_Library_Declaration => 722, -      Iir_Kind_Component_Declaration => 732, -      Iir_Kind_Attribute_Declaration => 739, -      Iir_Kind_Group_Template_Declaration => 745, -      Iir_Kind_Group_Declaration => 752, -      Iir_Kind_Element_Declaration => 760, -      Iir_Kind_Nature_Element_Declaration => 767, -      Iir_Kind_Non_Object_Alias_Declaration => 775, -      Iir_Kind_Psl_Declaration => 783, -      Iir_Kind_Psl_Endpoint_Declaration => 797, -      Iir_Kind_Enumeration_Literal => 809, -      Iir_Kind_Function_Declaration => 835, -      Iir_Kind_Procedure_Declaration => 858, -      Iir_Kind_Function_Body => 868, -      Iir_Kind_Procedure_Body => 879, -      Iir_Kind_Function_Instantiation_Declaration => 890, -      Iir_Kind_Procedure_Instantiation_Declaration => 900, -      Iir_Kind_Terminal_Declaration => 910, -      Iir_Kind_Object_Alias_Declaration => 922, -      Iir_Kind_Free_Quantity_Declaration => 934, -      Iir_Kind_Spectrum_Quantity_Declaration => 947, -      Iir_Kind_Noise_Quantity_Declaration => 959, -      Iir_Kind_Across_Quantity_Declaration => 975, -      Iir_Kind_Through_Quantity_Declaration => 991, -      Iir_Kind_File_Declaration => 1006, -      Iir_Kind_Guard_Signal_Declaration => 1020, -      Iir_Kind_Signal_Declaration => 1037, -      Iir_Kind_Variable_Declaration => 1050, -      Iir_Kind_Constant_Declaration => 1064, -      Iir_Kind_Iterator_Declaration => 1076, -      Iir_Kind_Interface_Constant_Declaration => 1093, -      Iir_Kind_Interface_Variable_Declaration => 1109, -      Iir_Kind_Interface_Signal_Declaration => 1130, -      Iir_Kind_Interface_File_Declaration => 1146, -      Iir_Kind_Interface_Quantity_Declaration => 1162, -      Iir_Kind_Interface_Terminal_Declaration => 1174, -      Iir_Kind_Interface_Type_Declaration => 1185, -      Iir_Kind_Interface_Package_Declaration => 1198, -      Iir_Kind_Interface_Function_Declaration => 1216, -      Iir_Kind_Interface_Procedure_Declaration => 1230, -      Iir_Kind_Attribute_Implicit_Declaration => 1233, -      Iir_Kind_Suspend_State_Declaration => 1236, -      Iir_Kind_Identity_Operator => 1240, -      Iir_Kind_Negation_Operator => 1244, -      Iir_Kind_Absolute_Operator => 1248, -      Iir_Kind_Not_Operator => 1252, -      Iir_Kind_Implicit_Condition_Operator => 1256, -      Iir_Kind_Condition_Operator => 1260, -      Iir_Kind_Reduction_And_Operator => 1264, -      Iir_Kind_Reduction_Or_Operator => 1268, -      Iir_Kind_Reduction_Nand_Operator => 1272, -      Iir_Kind_Reduction_Nor_Operator => 1276, -      Iir_Kind_Reduction_Xor_Operator => 1280, -      Iir_Kind_Reduction_Xnor_Operator => 1284, -      Iir_Kind_And_Operator => 1289, -      Iir_Kind_Or_Operator => 1294, -      Iir_Kind_Nand_Operator => 1299, -      Iir_Kind_Nor_Operator => 1304, -      Iir_Kind_Xor_Operator => 1309, -      Iir_Kind_Xnor_Operator => 1314, -      Iir_Kind_Equality_Operator => 1319, -      Iir_Kind_Inequality_Operator => 1324, -      Iir_Kind_Less_Than_Operator => 1329, -      Iir_Kind_Less_Than_Or_Equal_Operator => 1334, -      Iir_Kind_Greater_Than_Operator => 1339, -      Iir_Kind_Greater_Than_Or_Equal_Operator => 1344, -      Iir_Kind_Match_Equality_Operator => 1349, -      Iir_Kind_Match_Inequality_Operator => 1354, -      Iir_Kind_Match_Less_Than_Operator => 1359, -      Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1364, -      Iir_Kind_Match_Greater_Than_Operator => 1369, -      Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1374, -      Iir_Kind_Sll_Operator => 1379, -      Iir_Kind_Sla_Operator => 1384, -      Iir_Kind_Srl_Operator => 1389, -      Iir_Kind_Sra_Operator => 1394, -      Iir_Kind_Rol_Operator => 1399, -      Iir_Kind_Ror_Operator => 1404, -      Iir_Kind_Addition_Operator => 1409, -      Iir_Kind_Substraction_Operator => 1414, -      Iir_Kind_Concatenation_Operator => 1419, -      Iir_Kind_Multiplication_Operator => 1424, -      Iir_Kind_Division_Operator => 1429, -      Iir_Kind_Modulus_Operator => 1434, -      Iir_Kind_Remainder_Operator => 1439, -      Iir_Kind_Exponentiation_Operator => 1444, -      Iir_Kind_Function_Call => 1452, -      Iir_Kind_Aggregate => 1459, -      Iir_Kind_Parenthesis_Expression => 1462, -      Iir_Kind_Qualified_Expression => 1466, -      Iir_Kind_Type_Conversion => 1471, -      Iir_Kind_Allocator_By_Expression => 1476, -      Iir_Kind_Allocator_By_Subtype => 1482, -      Iir_Kind_Selected_Element => 1490, -      Iir_Kind_Dereference => 1495, -      Iir_Kind_Implicit_Dereference => 1500, -      Iir_Kind_Slice_Name => 1507, -      Iir_Kind_Indexed_Name => 1513, -      Iir_Kind_Psl_Prev => 1519, -      Iir_Kind_Psl_Stable => 1524, -      Iir_Kind_Psl_Rose => 1529, -      Iir_Kind_Psl_Fell => 1534, -      Iir_Kind_Psl_Onehot => 1537, -      Iir_Kind_Psl_Onehot0 => 1540, -      Iir_Kind_Psl_Expression => 1542, -      Iir_Kind_Sensitized_Process_Statement => 1564, -      Iir_Kind_Process_Statement => 1585, -      Iir_Kind_Concurrent_Simple_Signal_Assignment => 1598, -      Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1611, -      Iir_Kind_Concurrent_Selected_Signal_Assignment => 1625, -      Iir_Kind_Concurrent_Assertion_Statement => 1633, -      Iir_Kind_Concurrent_Procedure_Call_Statement => 1640, -      Iir_Kind_Concurrent_Break_Statement => 1648, -      Iir_Kind_Psl_Assert_Directive => 1662, -      Iir_Kind_Psl_Assume_Directive => 1674, -      Iir_Kind_Psl_Cover_Directive => 1686, -      Iir_Kind_Psl_Restrict_Directive => 1697, -      Iir_Kind_Block_Statement => 1711, -      Iir_Kind_If_Generate_Statement => 1722, -      Iir_Kind_Case_Generate_Statement => 1731, -      Iir_Kind_For_Generate_Statement => 1740, -      Iir_Kind_Component_Instantiation_Statement => 1751, -      Iir_Kind_Psl_Default_Clock => 1754, -      Iir_Kind_Generate_Statement_Body => 1765, -      Iir_Kind_If_Generate_Else_Clause => 1771, -      Iir_Kind_Simple_Simultaneous_Statement => 1778, -      Iir_Kind_Simultaneous_Null_Statement => 1782, -      Iir_Kind_Simultaneous_Procedural_Statement => 1793, -      Iir_Kind_Simultaneous_Case_Statement => 1802, -      Iir_Kind_Simultaneous_If_Statement => 1811, -      Iir_Kind_Simultaneous_Elsif => 1817, -      Iir_Kind_Simple_Signal_Assignment_Statement => 1828, -      Iir_Kind_Conditional_Signal_Assignment_Statement => 1839, -      Iir_Kind_Selected_Waveform_Assignment_Statement => 1851, -      Iir_Kind_Signal_Force_Assignment_Statement => 1861, -      Iir_Kind_Signal_Release_Assignment_Statement => 1870, -      Iir_Kind_Null_Statement => 1874, -      Iir_Kind_Assertion_Statement => 1881, -      Iir_Kind_Report_Statement => 1887, -      Iir_Kind_Wait_Statement => 1895, -      Iir_Kind_Variable_Assignment_Statement => 1902, -      Iir_Kind_Conditional_Variable_Assignment_Statement => 1909, -      Iir_Kind_Return_Statement => 1915, -      Iir_Kind_For_Loop_Statement => 1926, -      Iir_Kind_While_Loop_Statement => 1937, -      Iir_Kind_Next_Statement => 1944, -      Iir_Kind_Exit_Statement => 1951, -      Iir_Kind_Case_Statement => 1960, -      Iir_Kind_Procedure_Call_Statement => 1966, -      Iir_Kind_Break_Statement => 1973, -      Iir_Kind_If_Statement => 1983, -      Iir_Kind_Suspend_State_Statement => 1987, -      Iir_Kind_Elsif => 1993, -      Iir_Kind_Character_Literal => 2000, -      Iir_Kind_Simple_Name => 2007, -      Iir_Kind_Selected_Name => 2015, -      Iir_Kind_Operator_Symbol => 2020, -      Iir_Kind_Reference_Name => 2025, -      Iir_Kind_External_Constant_Name => 2034, -      Iir_Kind_External_Signal_Name => 2043, -      Iir_Kind_External_Variable_Name => 2053, -      Iir_Kind_Selected_By_All_Name => 2059, -      Iir_Kind_Parenthesis_Name => 2064, -      Iir_Kind_Package_Pathname => 2068, -      Iir_Kind_Absolute_Pathname => 2069, -      Iir_Kind_Relative_Pathname => 2070, -      Iir_Kind_Pathname_Element => 2075, -      Iir_Kind_Base_Attribute => 2077, -      Iir_Kind_Subtype_Attribute => 2082, -      Iir_Kind_Element_Attribute => 2087, -      Iir_Kind_Across_Attribute => 2092, -      Iir_Kind_Through_Attribute => 2097, -      Iir_Kind_Nature_Reference_Attribute => 2101, -      Iir_Kind_Left_Type_Attribute => 2106, -      Iir_Kind_Right_Type_Attribute => 2111, -      Iir_Kind_High_Type_Attribute => 2116, -      Iir_Kind_Low_Type_Attribute => 2121, -      Iir_Kind_Ascending_Type_Attribute => 2126, -      Iir_Kind_Image_Attribute => 2132, -      Iir_Kind_Value_Attribute => 2138, -      Iir_Kind_Pos_Attribute => 2144, -      Iir_Kind_Val_Attribute => 2150, -      Iir_Kind_Succ_Attribute => 2156, -      Iir_Kind_Pred_Attribute => 2162, -      Iir_Kind_Leftof_Attribute => 2168, -      Iir_Kind_Rightof_Attribute => 2174, -      Iir_Kind_Signal_Slew_Attribute => 2182, -      Iir_Kind_Quantity_Slew_Attribute => 2190, -      Iir_Kind_Ramp_Attribute => 2198, -      Iir_Kind_Zoh_Attribute => 2206, -      Iir_Kind_Ltf_Attribute => 2214, -      Iir_Kind_Ztf_Attribute => 2224, -      Iir_Kind_Dot_Attribute => 2231, -      Iir_Kind_Integ_Attribute => 2238, -      Iir_Kind_Quantity_Delayed_Attribute => 2246, -      Iir_Kind_Above_Attribute => 2254, -      Iir_Kind_Delayed_Attribute => 2263, -      Iir_Kind_Stable_Attribute => 2272, -      Iir_Kind_Quiet_Attribute => 2281, -      Iir_Kind_Transaction_Attribute => 2290, -      Iir_Kind_Event_Attribute => 2294, -      Iir_Kind_Active_Attribute => 2298, -      Iir_Kind_Last_Event_Attribute => 2302, -      Iir_Kind_Last_Active_Attribute => 2306, -      Iir_Kind_Last_Value_Attribute => 2310, -      Iir_Kind_Driving_Attribute => 2314, -      Iir_Kind_Driving_Value_Attribute => 2318, -      Iir_Kind_Behavior_Attribute => 2318, -      Iir_Kind_Structure_Attribute => 2318, -      Iir_Kind_Simple_Name_Attribute => 2325, -      Iir_Kind_Instance_Name_Attribute => 2330, -      Iir_Kind_Path_Name_Attribute => 2335, -      Iir_Kind_Left_Array_Attribute => 2342, -      Iir_Kind_Right_Array_Attribute => 2349, -      Iir_Kind_High_Array_Attribute => 2356, -      Iir_Kind_Low_Array_Attribute => 2363, -      Iir_Kind_Length_Array_Attribute => 2370, -      Iir_Kind_Ascending_Array_Attribute => 2377, -      Iir_Kind_Range_Array_Attribute => 2384, -      Iir_Kind_Reverse_Range_Array_Attribute => 2391, -      Iir_Kind_Attribute_Name => 2400 +      Iir_Kind_Association_Element_Open => 138, +      Iir_Kind_Association_Element_Package => 144, +      Iir_Kind_Association_Element_Type => 152, +      Iir_Kind_Association_Element_Subprogram => 158, +      Iir_Kind_Association_Element_Terminal => 164, +      Iir_Kind_Choice_By_Range => 172, +      Iir_Kind_Choice_By_Expression => 180, +      Iir_Kind_Choice_By_Others => 186, +      Iir_Kind_Choice_By_None => 192, +      Iir_Kind_Choice_By_Name => 199, +      Iir_Kind_Entity_Aspect_Entity => 201, +      Iir_Kind_Entity_Aspect_Configuration => 202, +      Iir_Kind_Entity_Aspect_Open => 202, +      Iir_Kind_Psl_Hierarchical_Name => 204, +      Iir_Kind_Block_Configuration => 210, +      Iir_Kind_Block_Header => 214, +      Iir_Kind_Component_Configuration => 221, +      Iir_Kind_Binding_Indication => 225, +      Iir_Kind_Entity_Class => 227, +      Iir_Kind_Attribute_Value => 235, +      Iir_Kind_Signature => 240, +      Iir_Kind_Aggregate_Info => 247, +      Iir_Kind_Procedure_Call => 251, +      Iir_Kind_Record_Element_Constraint => 259, +      Iir_Kind_Array_Element_Resolution => 261, +      Iir_Kind_Record_Resolution => 262, +      Iir_Kind_Record_Element_Resolution => 265, +      Iir_Kind_Break_Element => 269, +      Iir_Kind_Attribute_Specification => 278, +      Iir_Kind_Disconnection_Specification => 284, +      Iir_Kind_Step_Limit_Specification => 290, +      Iir_Kind_Configuration_Specification => 296, +      Iir_Kind_Access_Type_Definition => 303, +      Iir_Kind_Incomplete_Type_Definition => 310, +      Iir_Kind_Interface_Type_Definition => 316, +      Iir_Kind_File_Type_Definition => 322, +      Iir_Kind_Protected_Type_Declaration => 332, +      Iir_Kind_Record_Type_Definition => 342, +      Iir_Kind_Array_Type_Definition => 353, +      Iir_Kind_Array_Subtype_Definition => 370, +      Iir_Kind_Record_Subtype_Definition => 383, +      Iir_Kind_Access_Subtype_Definition => 391, +      Iir_Kind_Physical_Subtype_Definition => 401, +      Iir_Kind_Floating_Subtype_Definition => 412, +      Iir_Kind_Integer_Subtype_Definition => 422, +      Iir_Kind_Enumeration_Subtype_Definition => 432, +      Iir_Kind_Enumeration_Type_Definition => 443, +      Iir_Kind_Integer_Type_Definition => 451, +      Iir_Kind_Floating_Type_Definition => 459, +      Iir_Kind_Physical_Type_Definition => 470, +      Iir_Kind_Range_Expression => 478, +      Iir_Kind_Protected_Type_Body => 486, +      Iir_Kind_Wildcard_Type_Definition => 490, +      Iir_Kind_Foreign_Vector_Type_Definition => 491, +      Iir_Kind_Subtype_Definition => 498, +      Iir_Kind_Scalar_Nature_Definition => 506, +      Iir_Kind_Record_Nature_Definition => 519, +      Iir_Kind_Array_Nature_Definition => 533, +      Iir_Kind_Array_Subnature_Definition => 548, +      Iir_Kind_Overload_List => 549, +      Iir_Kind_Foreign_Module => 554, +      Iir_Kind_Entity_Declaration => 567, +      Iir_Kind_Configuration_Declaration => 577, +      Iir_Kind_Context_Declaration => 583, +      Iir_Kind_Package_Declaration => 598, +      Iir_Kind_Package_Instantiation_Declaration => 612, +      Iir_Kind_Vmode_Declaration => 624, +      Iir_Kind_Vprop_Declaration => 636, +      Iir_Kind_Vunit_Declaration => 649, +      Iir_Kind_Package_Body => 657, +      Iir_Kind_Architecture_Body => 670, +      Iir_Kind_Type_Declaration => 677, +      Iir_Kind_Anonymous_Type_Declaration => 683, +      Iir_Kind_Subtype_Declaration => 691, +      Iir_Kind_Nature_Declaration => 697, +      Iir_Kind_Subnature_Declaration => 704, +      Iir_Kind_Package_Header => 706, +      Iir_Kind_Unit_Declaration => 715, +      Iir_Kind_Library_Declaration => 723, +      Iir_Kind_Component_Declaration => 733, +      Iir_Kind_Attribute_Declaration => 740, +      Iir_Kind_Group_Template_Declaration => 746, +      Iir_Kind_Group_Declaration => 753, +      Iir_Kind_Element_Declaration => 761, +      Iir_Kind_Nature_Element_Declaration => 768, +      Iir_Kind_Non_Object_Alias_Declaration => 776, +      Iir_Kind_Psl_Declaration => 784, +      Iir_Kind_Psl_Endpoint_Declaration => 798, +      Iir_Kind_Enumeration_Literal => 810, +      Iir_Kind_Function_Declaration => 836, +      Iir_Kind_Procedure_Declaration => 859, +      Iir_Kind_Function_Body => 869, +      Iir_Kind_Procedure_Body => 880, +      Iir_Kind_Function_Instantiation_Declaration => 891, +      Iir_Kind_Procedure_Instantiation_Declaration => 901, +      Iir_Kind_Terminal_Declaration => 911, +      Iir_Kind_Object_Alias_Declaration => 923, +      Iir_Kind_Free_Quantity_Declaration => 935, +      Iir_Kind_Spectrum_Quantity_Declaration => 948, +      Iir_Kind_Noise_Quantity_Declaration => 960, +      Iir_Kind_Across_Quantity_Declaration => 976, +      Iir_Kind_Through_Quantity_Declaration => 992, +      Iir_Kind_File_Declaration => 1007, +      Iir_Kind_Guard_Signal_Declaration => 1021, +      Iir_Kind_Signal_Declaration => 1038, +      Iir_Kind_Variable_Declaration => 1051, +      Iir_Kind_Constant_Declaration => 1065, +      Iir_Kind_Iterator_Declaration => 1077, +      Iir_Kind_Interface_Constant_Declaration => 1094, +      Iir_Kind_Interface_Variable_Declaration => 1110, +      Iir_Kind_Interface_Signal_Declaration => 1131, +      Iir_Kind_Interface_File_Declaration => 1147, +      Iir_Kind_Interface_Quantity_Declaration => 1163, +      Iir_Kind_Interface_Terminal_Declaration => 1175, +      Iir_Kind_Interface_Type_Declaration => 1186, +      Iir_Kind_Interface_Package_Declaration => 1199, +      Iir_Kind_Interface_Function_Declaration => 1218, +      Iir_Kind_Interface_Procedure_Declaration => 1233, +      Iir_Kind_Attribute_Implicit_Declaration => 1236, +      Iir_Kind_Suspend_State_Declaration => 1239, +      Iir_Kind_Identity_Operator => 1243, +      Iir_Kind_Negation_Operator => 1247, +      Iir_Kind_Absolute_Operator => 1251, +      Iir_Kind_Not_Operator => 1255, +      Iir_Kind_Implicit_Condition_Operator => 1259, +      Iir_Kind_Condition_Operator => 1263, +      Iir_Kind_Reduction_And_Operator => 1267, +      Iir_Kind_Reduction_Or_Operator => 1271, +      Iir_Kind_Reduction_Nand_Operator => 1275, +      Iir_Kind_Reduction_Nor_Operator => 1279, +      Iir_Kind_Reduction_Xor_Operator => 1283, +      Iir_Kind_Reduction_Xnor_Operator => 1287, +      Iir_Kind_And_Operator => 1292, +      Iir_Kind_Or_Operator => 1297, +      Iir_Kind_Nand_Operator => 1302, +      Iir_Kind_Nor_Operator => 1307, +      Iir_Kind_Xor_Operator => 1312, +      Iir_Kind_Xnor_Operator => 1317, +      Iir_Kind_Equality_Operator => 1322, +      Iir_Kind_Inequality_Operator => 1327, +      Iir_Kind_Less_Than_Operator => 1332, +      Iir_Kind_Less_Than_Or_Equal_Operator => 1337, +      Iir_Kind_Greater_Than_Operator => 1342, +      Iir_Kind_Greater_Than_Or_Equal_Operator => 1347, +      Iir_Kind_Match_Equality_Operator => 1352, +      Iir_Kind_Match_Inequality_Operator => 1357, +      Iir_Kind_Match_Less_Than_Operator => 1362, +      Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1367, +      Iir_Kind_Match_Greater_Than_Operator => 1372, +      Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1377, +      Iir_Kind_Sll_Operator => 1382, +      Iir_Kind_Sla_Operator => 1387, +      Iir_Kind_Srl_Operator => 1392, +      Iir_Kind_Sra_Operator => 1397, +      Iir_Kind_Rol_Operator => 1402, +      Iir_Kind_Ror_Operator => 1407, +      Iir_Kind_Addition_Operator => 1412, +      Iir_Kind_Substraction_Operator => 1417, +      Iir_Kind_Concatenation_Operator => 1422, +      Iir_Kind_Multiplication_Operator => 1427, +      Iir_Kind_Division_Operator => 1432, +      Iir_Kind_Modulus_Operator => 1437, +      Iir_Kind_Remainder_Operator => 1442, +      Iir_Kind_Exponentiation_Operator => 1447, +      Iir_Kind_Function_Call => 1455, +      Iir_Kind_Aggregate => 1462, +      Iir_Kind_Parenthesis_Expression => 1465, +      Iir_Kind_Qualified_Expression => 1469, +      Iir_Kind_Type_Conversion => 1474, +      Iir_Kind_Allocator_By_Expression => 1479, +      Iir_Kind_Allocator_By_Subtype => 1485, +      Iir_Kind_Selected_Element => 1493, +      Iir_Kind_Dereference => 1498, +      Iir_Kind_Implicit_Dereference => 1503, +      Iir_Kind_Slice_Name => 1510, +      Iir_Kind_Indexed_Name => 1516, +      Iir_Kind_Psl_Prev => 1522, +      Iir_Kind_Psl_Stable => 1527, +      Iir_Kind_Psl_Rose => 1532, +      Iir_Kind_Psl_Fell => 1537, +      Iir_Kind_Psl_Onehot => 1540, +      Iir_Kind_Psl_Onehot0 => 1543, +      Iir_Kind_Psl_Expression => 1545, +      Iir_Kind_Sensitized_Process_Statement => 1567, +      Iir_Kind_Process_Statement => 1588, +      Iir_Kind_Concurrent_Simple_Signal_Assignment => 1601, +      Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1614, +      Iir_Kind_Concurrent_Selected_Signal_Assignment => 1628, +      Iir_Kind_Concurrent_Assertion_Statement => 1636, +      Iir_Kind_Concurrent_Procedure_Call_Statement => 1643, +      Iir_Kind_Concurrent_Break_Statement => 1651, +      Iir_Kind_Psl_Assert_Directive => 1665, +      Iir_Kind_Psl_Assume_Directive => 1677, +      Iir_Kind_Psl_Cover_Directive => 1689, +      Iir_Kind_Psl_Restrict_Directive => 1700, +      Iir_Kind_Block_Statement => 1714, +      Iir_Kind_If_Generate_Statement => 1725, +      Iir_Kind_Case_Generate_Statement => 1734, +      Iir_Kind_For_Generate_Statement => 1743, +      Iir_Kind_Component_Instantiation_Statement => 1754, +      Iir_Kind_Psl_Default_Clock => 1757, +      Iir_Kind_Generate_Statement_Body => 1768, +      Iir_Kind_If_Generate_Else_Clause => 1774, +      Iir_Kind_Simple_Simultaneous_Statement => 1781, +      Iir_Kind_Simultaneous_Null_Statement => 1785, +      Iir_Kind_Simultaneous_Procedural_Statement => 1796, +      Iir_Kind_Simultaneous_Case_Statement => 1805, +      Iir_Kind_Simultaneous_If_Statement => 1814, +      Iir_Kind_Simultaneous_Elsif => 1820, +      Iir_Kind_Simple_Signal_Assignment_Statement => 1831, +      Iir_Kind_Conditional_Signal_Assignment_Statement => 1842, +      Iir_Kind_Selected_Waveform_Assignment_Statement => 1854, +      Iir_Kind_Signal_Force_Assignment_Statement => 1864, +      Iir_Kind_Signal_Release_Assignment_Statement => 1873, +      Iir_Kind_Null_Statement => 1877, +      Iir_Kind_Assertion_Statement => 1884, +      Iir_Kind_Report_Statement => 1890, +      Iir_Kind_Wait_Statement => 1898, +      Iir_Kind_Variable_Assignment_Statement => 1905, +      Iir_Kind_Conditional_Variable_Assignment_Statement => 1912, +      Iir_Kind_Return_Statement => 1918, +      Iir_Kind_For_Loop_Statement => 1929, +      Iir_Kind_While_Loop_Statement => 1940, +      Iir_Kind_Next_Statement => 1947, +      Iir_Kind_Exit_Statement => 1954, +      Iir_Kind_Case_Statement => 1963, +      Iir_Kind_Procedure_Call_Statement => 1969, +      Iir_Kind_Break_Statement => 1976, +      Iir_Kind_If_Statement => 1986, +      Iir_Kind_Suspend_State_Statement => 1990, +      Iir_Kind_Elsif => 1996, +      Iir_Kind_Character_Literal => 2003, +      Iir_Kind_Simple_Name => 2010, +      Iir_Kind_Selected_Name => 2018, +      Iir_Kind_Operator_Symbol => 2023, +      Iir_Kind_Reference_Name => 2028, +      Iir_Kind_External_Constant_Name => 2037, +      Iir_Kind_External_Signal_Name => 2046, +      Iir_Kind_External_Variable_Name => 2056, +      Iir_Kind_Selected_By_All_Name => 2062, +      Iir_Kind_Parenthesis_Name => 2067, +      Iir_Kind_Package_Pathname => 2071, +      Iir_Kind_Absolute_Pathname => 2072, +      Iir_Kind_Relative_Pathname => 2073, +      Iir_Kind_Pathname_Element => 2078, +      Iir_Kind_Base_Attribute => 2080, +      Iir_Kind_Subtype_Attribute => 2085, +      Iir_Kind_Element_Attribute => 2090, +      Iir_Kind_Across_Attribute => 2095, +      Iir_Kind_Through_Attribute => 2100, +      Iir_Kind_Nature_Reference_Attribute => 2104, +      Iir_Kind_Left_Type_Attribute => 2109, +      Iir_Kind_Right_Type_Attribute => 2114, +      Iir_Kind_High_Type_Attribute => 2119, +      Iir_Kind_Low_Type_Attribute => 2124, +      Iir_Kind_Ascending_Type_Attribute => 2129, +      Iir_Kind_Image_Attribute => 2135, +      Iir_Kind_Value_Attribute => 2141, +      Iir_Kind_Pos_Attribute => 2147, +      Iir_Kind_Val_Attribute => 2153, +      Iir_Kind_Succ_Attribute => 2159, +      Iir_Kind_Pred_Attribute => 2165, +      Iir_Kind_Leftof_Attribute => 2171, +      Iir_Kind_Rightof_Attribute => 2177, +      Iir_Kind_Signal_Slew_Attribute => 2185, +      Iir_Kind_Quantity_Slew_Attribute => 2193, +      Iir_Kind_Ramp_Attribute => 2201, +      Iir_Kind_Zoh_Attribute => 2209, +      Iir_Kind_Ltf_Attribute => 2217, +      Iir_Kind_Ztf_Attribute => 2227, +      Iir_Kind_Dot_Attribute => 2234, +      Iir_Kind_Integ_Attribute => 2241, +      Iir_Kind_Quantity_Delayed_Attribute => 2249, +      Iir_Kind_Above_Attribute => 2257, +      Iir_Kind_Delayed_Attribute => 2266, +      Iir_Kind_Stable_Attribute => 2275, +      Iir_Kind_Quiet_Attribute => 2284, +      Iir_Kind_Transaction_Attribute => 2293, +      Iir_Kind_Event_Attribute => 2297, +      Iir_Kind_Active_Attribute => 2301, +      Iir_Kind_Last_Event_Attribute => 2305, +      Iir_Kind_Last_Active_Attribute => 2309, +      Iir_Kind_Last_Value_Attribute => 2313, +      Iir_Kind_Driving_Attribute => 2317, +      Iir_Kind_Driving_Value_Attribute => 2321, +      Iir_Kind_Behavior_Attribute => 2321, +      Iir_Kind_Structure_Attribute => 2321, +      Iir_Kind_Simple_Name_Attribute => 2328, +      Iir_Kind_Instance_Name_Attribute => 2333, +      Iir_Kind_Path_Name_Attribute => 2338, +      Iir_Kind_Left_Array_Attribute => 2345, +      Iir_Kind_Right_Array_Attribute => 2352, +      Iir_Kind_High_Array_Attribute => 2359, +      Iir_Kind_Low_Array_Attribute => 2366, +      Iir_Kind_Length_Array_Attribute => 2373, +      Iir_Kind_Ascending_Array_Attribute => 2380, +      Iir_Kind_Range_Array_Attribute => 2387, +      Iir_Kind_Reverse_Range_Array_Attribute => 2394, +      Iir_Kind_Attribute_Name => 2403       );     function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6141,6 +6154,8 @@ package body Vhdl.Nodes_Meta is              return Get_Formal (N);           when Field_Actual =>              return Get_Actual (N); +         when Field_Open_Actual => +            return Get_Open_Actual (N);           when Field_Actual_Conversion =>              return Get_Actual_Conversion (N);           when Field_Formal_Conversion => @@ -6227,6 +6242,8 @@ package body Vhdl.Nodes_Meta is              return Get_Base_Name (N);           when Field_Interface_Declaration_Chain =>              return Get_Interface_Declaration_Chain (N); +         when Field_Default_Subprogram => +            return Get_Default_Subprogram (N);           when Field_Subprogram_Specification =>              return Get_Subprogram_Specification (N);           when Field_Sequential_Statement_Chain => @@ -6601,6 +6618,8 @@ package body Vhdl.Nodes_Meta is              Set_Formal (N, V);           when Field_Actual =>              Set_Actual (N, V); +         when Field_Open_Actual => +            Set_Open_Actual (N, V);           when Field_Actual_Conversion =>              Set_Actual_Conversion (N, V);           when Field_Formal_Conversion => @@ -6687,6 +6706,8 @@ package body Vhdl.Nodes_Meta is              Set_Base_Name (N, V);           when Field_Interface_Declaration_Chain =>              Set_Interface_Declaration_Chain (N, V); +         when Field_Default_Subprogram => +            Set_Default_Subprogram (N, V);           when Field_Subprogram_Specification =>              Set_Subprogram_Specification (N, V);           when Field_Sequential_Statement_Chain => @@ -8177,6 +8198,11 @@ package body Vhdl.Nodes_Meta is        end case;     end Has_Actual; +   function Has_Open_Actual (K : Iir_Kind) return Boolean is +   begin +      return K = Iir_Kind_Association_Element_Open; +   end Has_Open_Actual; +     function Has_Actual_Conversion (K : Iir_Kind) return Boolean is     begin        case K is @@ -9121,6 +9147,17 @@ package body Vhdl.Nodes_Meta is        end case;     end Has_Interface_Declaration_Chain; +   function Has_Default_Subprogram (K : Iir_Kind) return Boolean is +   begin +      case K is +         when Iir_Kind_Interface_Function_Declaration +           | Iir_Kind_Interface_Procedure_Declaration => +            return True; +         when others => +            return False; +      end case; +   end Has_Default_Subprogram; +     function Has_Subprogram_Specification (K : Iir_Kind) return Boolean is     begin        case K is diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads index 538c40910..214f2f067 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -112,6 +112,7 @@ package Vhdl.Nodes_Meta is        Field_Designated_Entity,        Field_Formal,        Field_Actual, +      Field_Open_Actual,        Field_Actual_Conversion,        Field_Formal_Conversion,        Field_Whole_Association_Flag, @@ -169,6 +170,7 @@ package Vhdl.Nodes_Meta is        Field_Signal_Kind,        Field_Base_Name,        Field_Interface_Declaration_Chain, +      Field_Default_Subprogram,        Field_Subprogram_Specification,        Field_Sequential_Statement_Chain,        Field_Simultaneous_Statement_Chain, @@ -702,6 +704,7 @@ package Vhdl.Nodes_Meta is     function Has_Designated_Entity (K : Iir_Kind) return Boolean;     function Has_Formal (K : Iir_Kind) return Boolean;     function Has_Actual (K : Iir_Kind) return Boolean; +   function Has_Open_Actual (K : Iir_Kind) return Boolean;     function Has_Actual_Conversion (K : Iir_Kind) return Boolean;     function Has_Formal_Conversion (K : Iir_Kind) return Boolean;     function Has_Whole_Association_Flag (K : Iir_Kind) return Boolean; @@ -760,6 +763,7 @@ package Vhdl.Nodes_Meta is     function Has_Signal_Kind (K : Iir_Kind) return Boolean;     function Has_Base_Name (K : Iir_Kind) return Boolean;     function Has_Interface_Declaration_Chain (K : Iir_Kind) return Boolean; +   function Has_Default_Subprogram (K : Iir_Kind) return Boolean;     function Has_Subprogram_Specification (K : Iir_Kind) return Boolean;     function Has_Sequential_Statement_Chain (K : Iir_Kind) return Boolean;     function Has_Simultaneous_Statement_Chain (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 4f8ac27c0..177d46f88 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -2206,6 +2206,7 @@ package body Vhdl.Parse is        Subprg: Iir;        Old : Iir;        pragma Unreferenced (Old); +      Def : Iir;     begin        --  Create the node.        case Current_Token is @@ -2254,6 +2255,22 @@ package body Vhdl.Parse is          (Subprg, Kind = Iir_Kind_Interface_Function_Declaration, True);        --  TODO: interface_subprogram_default +      if Current_Token = Tok_Is then +         --  Skip 'is'. +         Scan; + +         if Current_Token = Tok_Box then +            Def := Create_Iir (Iir_Kind_Reference_Name); +            Set_Location (Def); + +            --  Skip '<>'. +            Scan; +         else +            Def := Parse_Name; +         end if; + +         Set_Default_Subprogram (Subprg, Def); +      end if;        return Subprg;     end Parse_Interface_Subprogram_Declaration; diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb index 41c93273f..57f3b8815 100644 --- a/src/vhdl/vhdl-sem_assocs.adb +++ b/src/vhdl/vhdl-sem_assocs.adb @@ -150,8 +150,9 @@ package body Vhdl.Sem_Assocs is                 Inter := Find_Name_In_Chain                   (Inter_Chain, Get_Identifier (Formal));                 if Inter /= Null_Iir -                 and then -                 Get_Kind (Inter) not in Iir_Kinds_Interface_Object_Declaration +                 and then Get_Kind (Assoc) /= Iir_Kind_Association_Element_Open +                 and then (Get_Kind (Inter) not in +                             Iir_Kinds_Interface_Object_Declaration)                 then                    Assoc := Rewrite_Non_Object_Association (Assoc, Inter);                 end if; @@ -1811,58 +1812,37 @@ package body Vhdl.Sem_Assocs is        return True;     end Has_Interface_Subprogram_Profile; -   procedure Sem_Association_Subprogram (Assoc : Iir; -                                         Inter : Iir; -                                         Finish : Boolean; -                                         Match : out Compatibility_Level) +   --  LOC is the location (usually the association, but could be the +   --  instantiation for unassociated interface). +   --  RES is set to NULL_IIR in case of error, or the result (in case of +   --  overload). +   procedure Sem_Association_Subprogram_Check +     (Inter : Iir; Res : in out Iir; Loc : Iir)     is        Discard : Boolean;        pragma Unreferenced (Discard); -      Actual : Iir; -      Res : Iir;     begin -      if not Finish then -         Sem_Association_Package_Type_Not_Finish (Assoc, Inter, Match); -         return; -      end if; - -      Match := Fully_Compatible; -      Sem_Association_Package_Type_Finish (Assoc, Inter); -      Actual := Get_Actual (Assoc); - -      --  LRM08 6.5.7.2 Generic map aspects -      --  An actual associated with a formal generic subprogram shall be a name -      --  that denotes a subprogram whose profile conforms to that of the -      --  formal, or the reserved word OPEN.  The actual, if a predefined -      --  attribute name that denotes a function, shall be one of the -      --  predefined attributes 'IMAGE, 'VALUE, 'POS, 'VAL, 'SUCC, 'PREV, -      --  'LEFTOF, or 'RIGHTOF. -      Sem_Name (Actual); -      Res := Get_Named_Entity (Actual); - -      if Is_Error (Res) then -         return; -      end if; -        case Get_Kind (Res) is           when Iir_Kinds_Subprogram_Declaration             | Iir_Kinds_Interface_Subprogram_Declaration =>              if not Has_Interface_Subprogram_Profile (Inter, Res) then                 Error_Msg_Sem -                 (+Assoc, "profile of %n doesn't match profile of %n", -                  (+Actual, +Inter)); +                 (+Loc, "profile of %n doesn't match profile of %n", +                  (+Res, +Inter));                 --  Explain                 Discard := Has_Interface_Subprogram_Profile -                 (Inter, Res, Get_Location (Assoc)); -               return; +                 (Inter, Res, Get_Location (Loc)); +               Res := Null_Iir;              end if;           when Iir_Kind_Overload_List =>              declare +               Orig : Iir;                 Nbr_Errors : Natural;                 List : Iir_List;                 It : List_Iterator;                 El, R : Iir;              begin +               Orig := Res;                 Nbr_Errors := 0;                 R := Null_Iir;                 List := Get_Overload_List (Res); @@ -1875,14 +1855,14 @@ package body Vhdl.Sem_Assocs is                       else                          if Nbr_Errors = 0 then                             Error_Msg_Sem -                             (+Assoc, +                             (+Loc,                                "many possible actual subprogram for %n:",                                +Inter);                             Error_Msg_Sem -                             (+Assoc, " %n declared at %l", (+R, + R)); +                             (+Loc, " %n declared at %l", (+R, + R));                          else                             Error_Msg_Sem -                             (+Assoc, " %n declared at %l", (+El, +El)); +                             (+Loc, " %n declared at %l", (+El, +El));                          end if;                          Nbr_Errors := Nbr_Errors + 1;                       end if; @@ -1890,33 +1870,99 @@ package body Vhdl.Sem_Assocs is                    Next (It);                 end loop;                 if Is_Null (R) then -                  Error_Msg_Sem -                    (+Assoc, "no matching name for %n", +Inter); +                  Error_Msg_Sem (+Loc, "no matching name for %n", +Inter);                    if True then -                     Error_Msg_Sem -                       (+Assoc, " these names were incompatible:"); +                     Error_Msg_Sem (+Loc, " these names were incompatible:");                       It := List_Iterate (List);                       while Is_Valid (It) loop                          El := Get_Element (It);                          Error_Msg_Sem -                          (+Assoc, " %n declared at %l", (+El, +El)); +                          (+Loc, " %n declared at %l", (+El, +El));                          Next (It);                       end loop;                    end if; -                  return; +                  Res := Null_Iir;                 elsif Nbr_Errors > 0 then -                  return; +                  Res := Null_Iir; +               else +                  Res := R;                 end if; -               Free_Overload_List (Res); -               Res := R; +               Free_Overload_List (Orig);              end;           when others => -            Error_Kind ("sem_association_subprogram", Res); +            Report_Start_Group; +            Error_Msg_Sem +              (+Loc, "%n must be associated with a subprogram", +Inter); +            Error_Msg_Sem (+Loc, "found %n defined at %l", (+Res, +Res)); +            Report_End_Group; +            Res := Null_Iir;        end case; +   end Sem_Association_Subprogram_Check; -      Set_Named_Entity (Actual, Res); -      Vhdl.Xrefs.Xref_Name (Actual); +   function Sem_Association_Subprogram_Open (Inter : Iir; Loc : Iir) +                                            return Iir +   is +      Res : Iir; +   begin +      Res := Sem_Identifier_Name +        (Get_Identifier (Inter), Loc, False, False); +      if Is_Error (Res) then +         return Null_Iir; +      end if; +      Sem_Association_Subprogram_Check (Inter, Res, Loc); +      if Res = Null_Iir then +         return Null_Iir; +      end if;        Sem_Decls.Mark_Subprogram_Used (Res); +      return Res; +   end Sem_Association_Subprogram_Open; + +   procedure Sem_Association_Subprogram (Assoc : Iir; +                                         Inter : Iir; +                                         Finish : Boolean; +                                         Match : out Compatibility_Level) +   is +      Actual : Iir; +      Res : Iir; +   begin +      if not Finish then +         --  Common code when not finished. +         Sem_Association_Package_Type_Not_Finish (Assoc, Inter, Match); +         return; +      end if; + +      Match := Fully_Compatible; +      Sem_Association_Package_Type_Finish (Assoc, Inter); +      if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open then +         Res := Sem_Association_Subprogram_Open (Inter, Assoc); +         Set_Open_Actual (Assoc, Res); +      else +         Actual := Get_Actual (Assoc); + +         --  LRM08 6.5.7.2 Generic map aspects +         --  An actual associated with a formal generic subprogram shall be a +         --  name that denotes a subprogram whose profile conforms to that of +         --  the formal, or the reserved word OPEN.  The actual, if a +         --  predefined attribute name that denotes a function, shall be one +         --  of the predefined attributes 'IMAGE, 'VALUE, 'POS, 'VAL, 'SUCC, +         --  'PREV, 'LEFTOF, or 'RIGHTOF. +         Sem_Name (Actual); +         Res := Get_Named_Entity (Actual); + +         if Is_Error (Res) then +            return; +         end if; + +         Sem_Association_Subprogram_Check (Inter, Res, Assoc); +         if Res = Null_Iir then +            return; +         end if; + +         Set_Named_Entity (Actual, Res); +         Vhdl.Xrefs.Xref_Name (Actual); + +         Sem_Decls.Mark_Subprogram_Used (Res); +      end if;     end Sem_Association_Subprogram;     procedure Sem_Association_Terminal @@ -2296,13 +2342,12 @@ package body Vhdl.Sem_Assocs is        end case;     end Sem_Association; -   procedure Sem_Association_Chain -     (Interface_Chain : Iir; -      Assoc_Chain: in out Iir; -      Finish: Boolean; -      Missing : Missing_Type; -      Loc : Iir; -      Match : out Compatibility_Level) +   procedure Sem_Association_Chain (Interface_Chain : Iir; +                                    Assoc_Chain: in out Iir; +                                    Finish: Boolean; +                                    Missing : Missing_Type; +                                    Loc : Iir; +                                    Match : out Compatibility_Level)     is        Assoc : Iir;        Inter : Iir; @@ -2321,6 +2366,7 @@ package body Vhdl.Sem_Assocs is        Pos : Integer;        Formal : Iir; +      Last_Assoc : Iir;        First_Named_Assoc : Iir;        Last_Named_Assoc : Iir; @@ -2330,6 +2376,7 @@ package body Vhdl.Sem_Assocs is        Match := Fully_Compatible;        First_Named_Assoc := Null_Iir;        Has_Individual := False; +      Last_Assoc := Null_Iir;        --  Clear associated type of interface type.        Inter := Interface_Chain; @@ -2348,6 +2395,7 @@ package body Vhdl.Sem_Assocs is        --  First positional associations        Assoc := Assoc_Chain;        while Assoc /= Null_Iir loop +         Last_Assoc := Assoc;           Formal := Get_Formal (Assoc);           exit when Formal /= Null_Iir; @@ -2429,6 +2477,7 @@ package body Vhdl.Sem_Assocs is              --  Last assoc to be cleaned up.              Last_Named_Assoc := Assoc; +            Last_Assoc := Assoc;              if Finish then                 Sem_Name (Formal); @@ -2624,6 +2673,7 @@ package body Vhdl.Sem_Assocs is                    Last_Individual := Null_Iir;                    if Inter_Matched (Pos) = None then                       if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open +                       and then Get_Open_Actual (Assoc) = Null_Iir                       then                          Inter_Matched (Pos) := Open;                       else @@ -2730,7 +2780,44 @@ package body Vhdl.Sem_Assocs is        Pos := 0;        while Inter /= Null_Iir loop           if Inter_Matched (Pos) <= Open then -            if Sem_Check_Missing_Association +            if Get_Kind (Inter) in Iir_Kinds_Interface_Subprogram_Declaration +              and then Get_Default_Subprogram (Inter) /= Null_Iir +            then +               declare +                  Def : constant Iir := Get_Default_Subprogram (Inter); +                  Res : Iir; +                  Ref : Iir; +               begin +                  if Finish +                    and then Get_Kind (Def) = Iir_Kind_Reference_Name +                  then +                     --  Resolve now the default subprogram (as we have the +                     --  context for that). +                     Res := Sem_Association_Subprogram_Open (Inter, Loc); +                     if Res /= Null_Iir then +                        --  Create an artificial open association to keep it. +                        Assoc := +                          Create_Iir (Iir_Kind_Association_Element_Open); +                        Location_Copy (Assoc, Loc); +                        Set_Open_Actual (Assoc, Res); +                        Set_Artificial_Flag (Assoc, True); +                        Set_Whole_Association_Flag (Assoc, True); +                        Ref := Create_Iir (Iir_Kind_Reference_Name); +                        Location_Copy (Ref, Loc); +                        Set_Named_Entity (Ref, Inter); +                        Set_Formal (Assoc, Ref); + +                        --  Append it. +                        if Last_Assoc /= Null_Iir then +                           Set_Chain (Last_Assoc, Assoc); +                        else +                           Assoc_Chain := Assoc; +                        end if; +                        Last_Assoc := Assoc; +                     end if; +                  end if; +               end; +            elsif Sem_Check_Missing_Association                (Inter, Missing, Finish, Inter_Matched (Pos) = Open, Loc)              then                 Match := Not_Compatible; @@ -2814,8 +2901,10 @@ package body Vhdl.Sem_Assocs is              end if;           when Iir_Kind_Interface_Function_Declaration              | Iir_Kind_Interface_Procedure_Declaration => -            Error_Msg_Sem (+Loc, "%n must be associated", +Inter); -            Err := True; +            if Get_Default_Subprogram (Inter) = Null_Iir then +               Error_Msg_Sem (+Loc, "%n must be associated", +Inter); +               Err := True; +            end if;           when others =>              Error_Kind ("sem_association_chain", Inter);        end case; diff --git a/src/vhdl/vhdl-sem_assocs.ads b/src/vhdl/vhdl-sem_assocs.ads index fc334d828..509bcf2a1 100644 --- a/src/vhdl/vhdl-sem_assocs.ads +++ b/src/vhdl/vhdl-sem_assocs.ads @@ -32,20 +32,19 @@ package Vhdl.Sem_Assocs is     --  Analyze association chain ASSOC_CHAIN with interfaces from     --  INTERFACE_CHAIN.     --  Return the level of compatibility between the two chains in LEVEL. -   --  If FINISH is true, then ASSOC_CHAIN may be modifies (individual assoc +   --  If FINISH is true, then ASSOC_CHAIN may be modified (individual assoc     --  added), and error messages (if any) are displayed.     --  MISSING control unassociated interfaces.     -- LOC is the association.     -- Sem_Actual_Of_Association_Chain must have been called before.     type Missing_Type is (Missing_Parameter, Missing_Port, Missing_Generic,                           Missing_Allowed); -   procedure Sem_Association_Chain -     (Interface_Chain : Iir; -      Assoc_Chain: in out Iir; -      Finish: Boolean; -      Missing : Missing_Type; -      Loc : Iir; -      Match : out Compatibility_Level); +   procedure Sem_Association_Chain (Interface_Chain : Iir; +                                    Assoc_Chain: in out Iir; +                                    Finish: Boolean; +                                    Missing : Missing_Type; +                                    Loc : Iir; +                                    Match : out Compatibility_Level);     --  Check association for expression ACTUAL to interface FORMAL.     --  ASSOC may be null for operator. diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index f51cd960e..d184aa0ea 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -927,7 +927,9 @@ package body Vhdl.Sem_Inst is     --  In the instance, replace references (and inner references) to interface     --  package declaration to the associated package. -   procedure Instantiate_Generic_Map (Assoc : Iir; Inter: Iir) is +   procedure Instantiate_Generic_Map (Assoc : Iir; Inter: Iir) +   is +      Assoc_Formal : Iir;     begin        --  Replace formal reference to the instance.        --  Cf Get_association_Interface @@ -939,7 +941,8 @@ package body Vhdl.Sem_Inst is              loop                 case Get_Kind (Formal) is                    when Iir_Kind_Simple_Name -                    | Iir_Kind_Operator_Symbol => +                    | Iir_Kind_Operator_Symbol +                    | Iir_Kind_Reference_Name =>                       Set_Named_Entity                         (Formal, Get_Instance (Get_Named_Entity (Formal)));                       exit; @@ -954,16 +957,14 @@ package body Vhdl.Sem_Inst is           end if;        end; -      case Get_Kind (Assoc) is -         when Iir_Kind_Association_Element_By_Expression -           | Iir_Kind_Association_Element_By_Individual -           | Iir_Kind_Association_Element_Open => +      Assoc_Formal := Get_Association_Interface (Assoc, Inter); + +      case Get_Kind (Inter) is +         when Iir_Kind_Interface_Constant_Declaration =>              --  If the type of the formal is an interface type also              --  associated by this map, change the type of the formal              --  to the associated type.              declare -               Assoc_Formal : constant Iir := -                 Get_Association_Interface (Assoc, Inter);                 Formal_Type : Iir;                 Formal_Orig : Iir;              begin @@ -985,13 +986,13 @@ package body Vhdl.Sem_Inst is                    end if;                 end if;              end; -         when Iir_Kind_Association_Element_Package => +         when Iir_Kind_Interface_Package_Declaration => +            pragma Assert +              (Get_Kind (Assoc) = Iir_Kind_Association_Element_Package);              declare                 Sub_Inst : constant Iir :=                   Get_Named_Entity (Get_Actual (Assoc)); -               Sub_Pkg_Inter : constant Iir := -                 Get_Association_Interface (Assoc, Inter); -               Sub_Pkg : constant Iir := Get_Origin (Sub_Pkg_Inter); +               Sub_Pkg : constant Iir := Get_Origin (Assoc_Formal);              begin                 --  Replace references of interface package to references                 --  to the actual package. @@ -1001,27 +1002,32 @@ package body Vhdl.Sem_Inst is                 Set_Instance_On_Chain (Get_Declaration_Chain (Sub_Pkg),                                        Get_Declaration_Chain (Sub_Inst));              end; -         when Iir_Kind_Association_Element_Type => +         when Iir_Kind_Interface_Type_Declaration => +            pragma Assert +              (Get_Kind (Assoc) = Iir_Kind_Association_Element_Type);              --  Replace the incomplete interface type by the actual subtype              --  indication.              declare -               Assoc_Inter : constant Iir := -                 Get_Association_Interface (Assoc, Inter); -               Inter_Type_Def : constant Iir := Get_Type (Assoc_Inter); +               Inter_Type_Def : constant Iir := Get_Type (Assoc_Formal);                 Actual_Type : constant Iir := Get_Actual_Type (Assoc);              begin                 Set_Instance (Inter_Type_Def, Actual_Type);              end; -         when Iir_Kind_Association_Element_Subprogram => -            --  Replace the interface subprogram by the subprogram. -            declare -               Inter_Subprg : constant Iir := -                 Get_Association_Interface (Assoc, Inter); -               Actual_Subprg : constant Iir := -                 Get_Named_Entity (Get_Actual (Assoc)); -            begin -               Set_Instance (Get_Origin (Inter_Subprg), Actual_Subprg); -            end; +         when Iir_Kinds_Interface_Subprogram_Declaration => +            if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open then +               Set_Instance (Get_Origin (Assoc_Formal), +                             Get_Open_Actual (Assoc)); +            else +               pragma Assert +                 (Get_Kind (Assoc) = Iir_Kind_Association_Element_Subprogram); +               --  Replace the interface subprogram by the subprogram. +               declare +                  Actual_Subprg : constant Iir := +                    Get_Named_Entity (Get_Actual (Assoc)); +               begin +                  Set_Instance (Get_Origin (Assoc_Formal), Actual_Subprg); +               end; +            end if;           when others =>              Error_Kind ("instantiate_generic_map", Assoc);        end case; @@ -1167,8 +1173,8 @@ package body Vhdl.Sem_Inst is           Inst_El := Get_Generic_Map_Aspect_Chain (Inst);           Inter_El := Get_Generic_Chain (Inst);           while Is_Valid (Inst_El) loop -            case Get_Kind (Inst_El) is -               when Iir_Kind_Association_Element_Type => +            case Get_Kind (Inter_El) is +               when Iir_Kind_Interface_Type_Declaration =>                    Inter := Get_Association_Interface (Inst_El, Inter_El);                    Set_Instance (Get_Type (Get_Origin (Inter)),                                  Get_Actual_Type (Inst_El)); @@ -1189,14 +1195,18 @@ package body Vhdl.Sem_Inst is                       end loop;                    end; -               when Iir_Kind_Association_Element_Subprogram => +               when Iir_Kinds_Interface_Subprogram_Declaration =>                    Inter := Get_Association_Interface (Inst_El, Inter_El); -                  Set_Instance (Get_Origin (Inter), -                                Get_Named_Entity (Get_Actual (Inst_El))); +                  if Get_Kind (Inst_El) = Iir_Kind_Association_Element_Open +                  then +                     Set_Instance (Get_Origin (Inter), +                                   Get_Open_Actual (Inst_El)); +                  else +                     Set_Instance (Get_Origin (Inter), +                                   Get_Named_Entity (Get_Actual (Inst_El))); +                  end if; -               when Iir_Kind_Association_Element_By_Expression -                 | Iir_Kind_Association_Element_By_Individual -                 | Iir_Kind_Association_Element_Open => +               when Iir_Kind_Interface_Constant_Declaration =>                    null;                 when others =>                    --  TODO. diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb index 438945faa..b6ed45227 100644 --- a/src/vhdl/vhdl-sem_names.adb +++ b/src/vhdl/vhdl-sem_names.adb @@ -15,15 +15,15 @@  --  along with this program.  If not, see <gnu.org/licenses>.  with Flags; use Flags;  with Name_Table; +with Std_Names;  with Libraries; +with Errorout; use Errorout; +  with Vhdl.Evaluation; use Vhdl.Evaluation;  with Vhdl.Utils; use Vhdl.Utils; -with Errorout; use Errorout;  with Vhdl.Errors; use Vhdl.Errors;  with Vhdl.Std_Package; use Vhdl.Std_Package; -with Types; use Types;  with Vhdl.Nodes_Utils; use Vhdl.Nodes_Utils; -with Std_Names;  with Vhdl.Sem;  with Vhdl.Sem_Lib; use Vhdl.Sem_Lib;  with Vhdl.Sem_Scopes; use Vhdl.Sem_Scopes; @@ -2089,19 +2089,11 @@ package body Vhdl.Sem_Names is        return Finish_Sem_Name_1 (Name, Get_Named_Entity (Name));     end Finish_Sem_Name; -   --  LRM93 6.2 -   --  The evaluation of a simple name has no other effect than to determine -   --  the named entity denoted by the name. -   -- -   --  NAME may be a simple name, a strig literal or a character literal. -   --  GHDL: set interpretation of NAME (possibly an overload list) or -   --  error_mark for unknown names. -   --  If SOFT is TRUE, then no error message is reported in case of failure. -   procedure Sem_Simple_Name (Name : Iir; Keep_Alias : Boolean; Soft : Boolean) +   function Sem_Identifier_Name +     (Id : Name_Id; Loc : Iir; Keep_Alias : Boolean; Soft : Boolean) return Iir     is -      Id : constant Name_Id := Get_Identifier (Name);        Interpretation: Name_Interpretation_Type; -      Res: Iir; +      Res : Iir;        Res_List : Iir_List;        Res_It : List_Iterator;        N : Natural; @@ -2116,9 +2108,9 @@ package body Vhdl.Sem_Names is                and then Is_Conflict_Declaration (Interpretation)              then                 Error_Msg_Sem -                 (+Name, "no declaration for %i (due to conflicts)", +Name); +                 (+Loc, "no declaration for %i (due to conflicts)", +Id);              else -               Error_Msg_Sem (+Name, "no declaration for %i", +Name); +               Error_Msg_Sem (+Loc, "no declaration for %i", +Id);              end if;           end if;           Res := Error_Mark; @@ -2130,7 +2122,7 @@ package body Vhdl.Sem_Names is           --  For a design unit, return the library unit           if Get_Kind (Res) = Iir_Kind_Design_Unit then              --  FIXME: should replace interpretation ? -            Load_Design_Unit (Res, Name); +            Load_Design_Unit (Res, Loc);              Sem.Add_Dependence (Res);              Res := Get_Library_Unit (Res);           end if; @@ -2144,7 +2136,7 @@ package body Vhdl.Sem_Names is                 Res := Get_Declaration (Get_Under_Interpretation (Id));              else                 if not Soft then -                  Error_Msg_Sem (+Name, "%n is not visible here", +Res); +                  Error_Msg_Sem (+Loc, "%n is not visible here", +Res);                 end if;                 --  Even if a named entity was found, return an error_mark.                 --  Indeed, the named entity found is certainly the one being @@ -2189,7 +2181,23 @@ package body Vhdl.Sem_Names is           Res := Create_Overload_List (Res_List);        end if; +      return Res; +   end Sem_Identifier_Name; +   --  LRM93 6.2 +   --  The evaluation of a simple name has no other effect than to determine +   --  the named entity denoted by the name. +   -- +   --  NAME may be a simple name, a strig literal or a character literal. +   --  GHDL: set interpretation of NAME (possibly an overload list) or +   --  error_mark for unknown names. +   --  If SOFT is TRUE, then no error message is reported in case of failure. +   procedure Sem_Simple_Name (Name : Iir; Keep_Alias : Boolean; Soft : Boolean) +   is +      Id : constant Name_Id := Get_Identifier (Name); +      Res : Iir; +   begin +      Res := Sem_Identifier_Name (Id, Name, Keep_Alias, Soft);        Set_Named_Entity (Name, Res);     end Sem_Simple_Name; diff --git a/src/vhdl/vhdl-sem_names.ads b/src/vhdl/vhdl-sem_names.ads index 8c8abf488..2ed16a001 100644 --- a/src/vhdl/vhdl-sem_names.ads +++ b/src/vhdl/vhdl-sem_names.ads @@ -13,6 +13,7 @@  --  --  You should have received a copy of the GNU General Public License  --  along with this program.  If not, see <gnu.org/licenses>. +with Types; use Types;  with Vhdl.Nodes; use Vhdl.Nodes;  package Vhdl.Sem_Names is @@ -73,6 +74,20 @@ package Vhdl.Sem_Names is     --  To be used only for names (weakly) analyzed by sem_name_soft.     procedure Sem_Name_Clean (Name : Iir); +   --  Return an interpretation for identifier ID. +   --  Used mostly by Sem_Simple_Name but also for unassociated interface +   --  subprogram whose default is <>. +   --  Do not follow aliases is KEEP_ALIAS is true (used for attribute +   --  specification), +   --  do not report error if SOFT is true (used for associations of +   --  overloaded names). +   -- +   --  Returns either the interpretation, an overload list or a error_mark. +   function Sem_Identifier_Name (Id : Name_Id; +                                 Loc : Iir; +                                 Keep_Alias : Boolean; +                                 Soft : Boolean) return Iir; +     --  If NAME is a selected name whose prefix is a protected variable, set     --  method_object of CALL.     procedure Name_To_Method_Object (Call : Iir; Name : Iir); diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index 729e7352b..8c94903a0 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -569,6 +569,7 @@ package body Vhdl.Utils is        loop           case Get_Kind (El) is              when Iir_Kind_Simple_Name +              | Iir_Kind_Reference_Name                | Iir_Kind_Operator_Symbol =>                 --  Operator is for subprogram interfaces.                 return Get_Named_Entity (El); @@ -630,6 +631,7 @@ package body Vhdl.Utils is           --  Strip denoting name           case Get_Kind (Formal) is              when Iir_Kind_Simple_Name +              | Iir_Kind_Reference_Name                | Iir_Kind_Operator_Symbol =>                 return Get_Named_Entity (Formal);              when Iir_Kinds_Interface_Declaration =>  | 
