diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-03-24 19:28:04 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-03-26 16:53:50 +0200 |
commit | b95cc40ac667768cd0ae03adb8c9c8c21ad35a30 (patch) | |
tree | 3d71143278ef285a66107e3dd4861f21358ce562 /src | |
parent | cff00f7c56fe0bdcc05c302c679e22ad04c097f7 (diff) | |
download | ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.tar.gz ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.tar.bz2 ghdl-b95cc40ac667768cd0ae03adb8c9c8c21ad35a30.zip |
vhdl: add Owned_Instance_Package_Body to handle ownership
of package body.
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/vhdl-canon.adb | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 16 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 8 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 487 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.ads | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 26 |
6 files changed, 297 insertions, 243 deletions
diff --git a/src/vhdl/vhdl-canon.adb b/src/vhdl/vhdl-canon.adb index 575d39c39..30a88df6a 100644 --- a/src/vhdl/vhdl-canon.adb +++ b/src/vhdl/vhdl-canon.adb @@ -3263,6 +3263,7 @@ package body Vhdl.Canon is Bod := Sem_Inst.Instantiate_Package_Body (Decl); Set_Parent (Bod, Get_Parent (Decl)); Set_Instance_Package_Body (Decl, Bod); + Set_Owned_Instance_Package_Body (Decl, Bod); end if; end Canon_Package_Instantiation_Declaration; diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index beff8b527..b61dae179 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -2663,6 +2663,22 @@ package body Vhdl.Nodes is Set_Field4 (Pkg, Decl); end Set_Instance_Package_Body; + function Get_Owned_Instance_Package_Body (Pkg : Iir) return Iir is + begin + pragma Assert (Pkg /= Null_Iir); + pragma Assert (Has_Owned_Instance_Package_Body (Get_Kind (Pkg)), + "no field Owned_Instance_Package_Body"); + return Get_Field11 (Pkg); + end Get_Owned_Instance_Package_Body; + + procedure Set_Owned_Instance_Package_Body (Pkg : Iir; Decl : Iir) is + begin + pragma Assert (Pkg /= Null_Iir); + pragma Assert (Has_Owned_Instance_Package_Body (Get_Kind (Pkg)), + "no field Owned_Instance_Package_Body"); + Set_Field11 (Pkg, Decl); + end Set_Owned_Instance_Package_Body; + function Get_Need_Body (Decl : Iir_Package_Declaration) return Boolean is begin pragma Assert (Decl /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 7b1f476e1..3d9561662 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -1123,6 +1123,10 @@ package Vhdl.Nodes is -- -- Get/Set_Attribute_Value_Chain (Field5) -- + -- For macro-expanded packages: the body, if owned. + -- Set only iff Immediate_Body_Flag is true. + -- Get/Set_Owned_Instance_Package_Body (Field11) + -- -- For macro-expanded packages: the body. -- Get/Set_Instance_Package_Body (Field4) -- @@ -8153,6 +8157,10 @@ package Vhdl.Nodes is function Get_Instance_Package_Body (Pkg : Iir) return Iir; procedure Set_Instance_Package_Body (Pkg : Iir; Decl : Iir); + -- Field: Field11 + function Get_Owned_Instance_Package_Body (Pkg : Iir) return Iir; + procedure Set_Owned_Instance_Package_Body (Pkg : Iir; Decl : Iir); + -- Field: Flag1 function Get_Need_Body (Decl : Iir_Package_Declaration) return Boolean; procedure Set_Need_Body (Decl : Iir_Package_Declaration; Flag : Boolean); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 61b9cff37..4a1796a8d 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -97,6 +97,7 @@ package body Vhdl.Nodes_Meta is Field_Package => Type_Iir, Field_Package_Body => Type_Iir, Field_Instance_Package_Body => Type_Iir, + Field_Owned_Instance_Package_Body => Type_Iir, Field_Need_Body => Type_Boolean, Field_Immediate_Body_Flag => Type_Boolean, Field_Macro_Expanded_Flag => Type_Boolean, @@ -575,6 +576,8 @@ package body Vhdl.Nodes_Meta is return "package_body"; when Field_Instance_Package_Body => return "instance_package_body"; + when Field_Owned_Instance_Package_Body => + return "owned_instance_package_body"; when Field_Need_Body => return "need_body"; when Field_Immediate_Body_Flag => @@ -2013,6 +2016,8 @@ package body Vhdl.Nodes_Meta is return Attr_Forward_Ref; when Field_Instance_Package_Body => return Attr_Forward_Ref; + when Field_Owned_Instance_Package_Body => + return Attr_None; when Field_Need_Body => return Attr_None; when Field_Immediate_Body_Flag => @@ -3346,6 +3351,7 @@ package body Vhdl.Nodes_Meta is Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, + Field_Owned_Instance_Package_Body, Field_Instance_Package_Body, -- Iir_Kind_Vmode_Declaration Field_Identifier, @@ -5494,242 +5500,242 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Configuration_Declaration => 586, Iir_Kind_Context_Declaration => 592, Iir_Kind_Package_Declaration => 607, - Iir_Kind_Package_Instantiation_Declaration => 622, - Iir_Kind_Vmode_Declaration => 634, - Iir_Kind_Vprop_Declaration => 646, - Iir_Kind_Vunit_Declaration => 659, - Iir_Kind_Package_Body => 667, - Iir_Kind_Architecture_Body => 680, - Iir_Kind_Package_Instantiation_Body => 688, - Iir_Kind_Type_Declaration => 695, - Iir_Kind_Anonymous_Type_Declaration => 701, - Iir_Kind_Subtype_Declaration => 709, - Iir_Kind_Nature_Declaration => 715, - Iir_Kind_Subnature_Declaration => 722, - Iir_Kind_Package_Header => 724, - Iir_Kind_Unit_Declaration => 733, - Iir_Kind_Library_Declaration => 741, - Iir_Kind_Component_Declaration => 751, - Iir_Kind_Attribute_Declaration => 758, - Iir_Kind_Group_Template_Declaration => 764, - Iir_Kind_Group_Declaration => 771, - Iir_Kind_Element_Declaration => 779, - Iir_Kind_Nature_Element_Declaration => 786, - Iir_Kind_Non_Object_Alias_Declaration => 794, - Iir_Kind_Psl_Declaration => 802, - Iir_Kind_Psl_Boolean_Parameter => 810, - Iir_Kind_Psl_Endpoint_Declaration => 824, - Iir_Kind_Enumeration_Literal => 836, - Iir_Kind_Function_Declaration => 863, - Iir_Kind_Procedure_Declaration => 887, - Iir_Kind_Function_Body => 897, - Iir_Kind_Procedure_Body => 908, - Iir_Kind_Function_Instantiation_Declaration => 919, - Iir_Kind_Procedure_Instantiation_Declaration => 929, - Iir_Kind_Terminal_Declaration => 939, - Iir_Kind_Object_Alias_Declaration => 951, - Iir_Kind_Free_Quantity_Declaration => 963, - Iir_Kind_Spectrum_Quantity_Declaration => 976, - Iir_Kind_Noise_Quantity_Declaration => 988, - Iir_Kind_Across_Quantity_Declaration => 1004, - Iir_Kind_Through_Quantity_Declaration => 1020, - Iir_Kind_File_Declaration => 1035, - Iir_Kind_Guard_Signal_Declaration => 1049, - Iir_Kind_Signal_Declaration => 1066, - Iir_Kind_Variable_Declaration => 1079, - Iir_Kind_Constant_Declaration => 1094, - Iir_Kind_Iterator_Declaration => 1106, - Iir_Kind_Interface_Constant_Declaration => 1123, - Iir_Kind_Interface_Variable_Declaration => 1139, - Iir_Kind_Interface_Signal_Declaration => 1160, - Iir_Kind_Interface_File_Declaration => 1176, - Iir_Kind_Interface_Quantity_Declaration => 1192, - Iir_Kind_Interface_Terminal_Declaration => 1204, - Iir_Kind_Interface_Type_Declaration => 1216, - Iir_Kind_Interface_Package_Declaration => 1230, - Iir_Kind_Interface_Function_Declaration => 1250, - Iir_Kind_Interface_Procedure_Declaration => 1266, - Iir_Kind_Attribute_Implicit_Declaration => 1269, - Iir_Kind_Suspend_State_Declaration => 1273, - Iir_Kind_Identity_Operator => 1277, - Iir_Kind_Negation_Operator => 1281, - Iir_Kind_Absolute_Operator => 1285, - Iir_Kind_Not_Operator => 1289, - Iir_Kind_Implicit_Condition_Operator => 1293, - Iir_Kind_Condition_Operator => 1297, - Iir_Kind_Reduction_And_Operator => 1301, - Iir_Kind_Reduction_Or_Operator => 1305, - Iir_Kind_Reduction_Nand_Operator => 1309, - Iir_Kind_Reduction_Nor_Operator => 1313, - Iir_Kind_Reduction_Xor_Operator => 1317, - Iir_Kind_Reduction_Xnor_Operator => 1321, - Iir_Kind_And_Operator => 1326, - Iir_Kind_Or_Operator => 1331, - Iir_Kind_Nand_Operator => 1336, - Iir_Kind_Nor_Operator => 1341, - Iir_Kind_Xor_Operator => 1346, - Iir_Kind_Xnor_Operator => 1351, - Iir_Kind_Equality_Operator => 1356, - Iir_Kind_Inequality_Operator => 1361, - Iir_Kind_Less_Than_Operator => 1366, - Iir_Kind_Less_Than_Or_Equal_Operator => 1371, - Iir_Kind_Greater_Than_Operator => 1376, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1381, - Iir_Kind_Match_Equality_Operator => 1386, - Iir_Kind_Match_Inequality_Operator => 1391, - Iir_Kind_Match_Less_Than_Operator => 1396, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1401, - Iir_Kind_Match_Greater_Than_Operator => 1406, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1411, - Iir_Kind_Sll_Operator => 1416, - Iir_Kind_Sla_Operator => 1421, - Iir_Kind_Srl_Operator => 1426, - Iir_Kind_Sra_Operator => 1431, - Iir_Kind_Rol_Operator => 1436, - Iir_Kind_Ror_Operator => 1441, - Iir_Kind_Addition_Operator => 1446, - Iir_Kind_Substraction_Operator => 1451, - Iir_Kind_Concatenation_Operator => 1456, - Iir_Kind_Multiplication_Operator => 1461, - Iir_Kind_Division_Operator => 1466, - Iir_Kind_Modulus_Operator => 1471, - Iir_Kind_Remainder_Operator => 1476, - Iir_Kind_Exponentiation_Operator => 1481, - Iir_Kind_Function_Call => 1489, - Iir_Kind_Aggregate => 1497, - Iir_Kind_Parenthesis_Expression => 1500, - Iir_Kind_Qualified_Expression => 1504, - Iir_Kind_Type_Conversion => 1509, - Iir_Kind_Allocator_By_Expression => 1514, - Iir_Kind_Allocator_By_Subtype => 1520, - Iir_Kind_Selected_Element => 1528, - Iir_Kind_Dereference => 1533, - Iir_Kind_Implicit_Dereference => 1538, - Iir_Kind_Slice_Name => 1545, - Iir_Kind_Indexed_Name => 1551, - Iir_Kind_Psl_Prev => 1557, - Iir_Kind_Psl_Stable => 1562, - Iir_Kind_Psl_Rose => 1567, - Iir_Kind_Psl_Fell => 1572, - Iir_Kind_Psl_Onehot => 1575, - Iir_Kind_Psl_Onehot0 => 1578, - Iir_Kind_Psl_Expression => 1580, - Iir_Kind_Sensitized_Process_Statement => 1602, - Iir_Kind_Process_Statement => 1623, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1636, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1649, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1663, - Iir_Kind_Concurrent_Assertion_Statement => 1671, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1678, - Iir_Kind_Concurrent_Break_Statement => 1686, - Iir_Kind_Psl_Assert_Directive => 1700, - Iir_Kind_Psl_Assume_Directive => 1712, - Iir_Kind_Psl_Cover_Directive => 1724, - Iir_Kind_Psl_Restrict_Directive => 1735, - Iir_Kind_Block_Statement => 1749, - Iir_Kind_If_Generate_Statement => 1760, - Iir_Kind_Case_Generate_Statement => 1769, - Iir_Kind_For_Generate_Statement => 1778, - Iir_Kind_Component_Instantiation_Statement => 1790, - Iir_Kind_Psl_Default_Clock => 1793, - Iir_Kind_Generate_Statement_Body => 1804, - Iir_Kind_If_Generate_Else_Clause => 1810, - Iir_Kind_Simple_Simultaneous_Statement => 1817, - Iir_Kind_Simultaneous_Null_Statement => 1821, - Iir_Kind_Simultaneous_Procedural_Statement => 1832, - Iir_Kind_Simultaneous_Case_Statement => 1841, - Iir_Kind_Simultaneous_If_Statement => 1850, - Iir_Kind_Simultaneous_Elsif => 1856, - Iir_Kind_Simple_Signal_Assignment_Statement => 1867, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1878, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1890, - Iir_Kind_Signal_Force_Assignment_Statement => 1900, - Iir_Kind_Signal_Release_Assignment_Statement => 1909, - Iir_Kind_Null_Statement => 1913, - Iir_Kind_Assertion_Statement => 1920, - Iir_Kind_Report_Statement => 1926, - Iir_Kind_Wait_Statement => 1934, - Iir_Kind_Variable_Assignment_Statement => 1941, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1948, - Iir_Kind_Return_Statement => 1954, - Iir_Kind_For_Loop_Statement => 1965, - Iir_Kind_While_Loop_Statement => 1976, - Iir_Kind_Next_Statement => 1983, - Iir_Kind_Exit_Statement => 1990, - Iir_Kind_Case_Statement => 1999, - Iir_Kind_Procedure_Call_Statement => 2005, - Iir_Kind_Break_Statement => 2012, - Iir_Kind_If_Statement => 2022, - Iir_Kind_Suspend_State_Statement => 2027, - Iir_Kind_Elsif => 2033, - Iir_Kind_Character_Literal => 2040, - Iir_Kind_Simple_Name => 2047, - Iir_Kind_Selected_Name => 2055, - Iir_Kind_Operator_Symbol => 2060, - Iir_Kind_Reference_Name => 2065, - Iir_Kind_External_Constant_Name => 2074, - Iir_Kind_External_Signal_Name => 2084, - Iir_Kind_External_Variable_Name => 2094, - Iir_Kind_Selected_By_All_Name => 2100, - Iir_Kind_Parenthesis_Name => 2105, - Iir_Kind_Package_Pathname => 2109, - Iir_Kind_Absolute_Pathname => 2110, - Iir_Kind_Relative_Pathname => 2111, - Iir_Kind_Pathname_Element => 2116, - Iir_Kind_Base_Attribute => 2118, - Iir_Kind_Subtype_Attribute => 2123, - Iir_Kind_Element_Attribute => 2128, - Iir_Kind_Across_Attribute => 2133, - Iir_Kind_Through_Attribute => 2138, - Iir_Kind_Nature_Reference_Attribute => 2142, - Iir_Kind_Left_Type_Attribute => 2147, - Iir_Kind_Right_Type_Attribute => 2152, - Iir_Kind_High_Type_Attribute => 2157, - Iir_Kind_Low_Type_Attribute => 2162, - Iir_Kind_Ascending_Type_Attribute => 2167, - Iir_Kind_Image_Attribute => 2173, - Iir_Kind_Value_Attribute => 2179, - Iir_Kind_Pos_Attribute => 2185, - Iir_Kind_Val_Attribute => 2191, - Iir_Kind_Succ_Attribute => 2197, - Iir_Kind_Pred_Attribute => 2203, - Iir_Kind_Leftof_Attribute => 2209, - Iir_Kind_Rightof_Attribute => 2215, - Iir_Kind_Signal_Slew_Attribute => 2223, - Iir_Kind_Quantity_Slew_Attribute => 2231, - Iir_Kind_Ramp_Attribute => 2239, - Iir_Kind_Zoh_Attribute => 2247, - Iir_Kind_Ltf_Attribute => 2255, - Iir_Kind_Ztf_Attribute => 2265, - Iir_Kind_Dot_Attribute => 2272, - Iir_Kind_Integ_Attribute => 2279, - Iir_Kind_Quantity_Delayed_Attribute => 2287, - Iir_Kind_Above_Attribute => 2295, - Iir_Kind_Delayed_Attribute => 2304, - Iir_Kind_Stable_Attribute => 2313, - Iir_Kind_Quiet_Attribute => 2322, - Iir_Kind_Transaction_Attribute => 2331, - Iir_Kind_Event_Attribute => 2335, - Iir_Kind_Active_Attribute => 2339, - Iir_Kind_Last_Event_Attribute => 2343, - Iir_Kind_Last_Active_Attribute => 2347, - Iir_Kind_Last_Value_Attribute => 2351, - Iir_Kind_Driving_Attribute => 2355, - Iir_Kind_Driving_Value_Attribute => 2359, - Iir_Kind_Behavior_Attribute => 2359, - Iir_Kind_Structure_Attribute => 2359, - Iir_Kind_Simple_Name_Attribute => 2366, - Iir_Kind_Instance_Name_Attribute => 2371, - Iir_Kind_Path_Name_Attribute => 2376, - Iir_Kind_Left_Array_Attribute => 2383, - Iir_Kind_Right_Array_Attribute => 2390, - Iir_Kind_High_Array_Attribute => 2397, - Iir_Kind_Low_Array_Attribute => 2404, - Iir_Kind_Length_Array_Attribute => 2411, - Iir_Kind_Ascending_Array_Attribute => 2418, - Iir_Kind_Range_Array_Attribute => 2425, - Iir_Kind_Reverse_Range_Array_Attribute => 2432, - Iir_Kind_Attribute_Name => 2441 + Iir_Kind_Package_Instantiation_Declaration => 623, + Iir_Kind_Vmode_Declaration => 635, + Iir_Kind_Vprop_Declaration => 647, + Iir_Kind_Vunit_Declaration => 660, + Iir_Kind_Package_Body => 668, + Iir_Kind_Architecture_Body => 681, + Iir_Kind_Package_Instantiation_Body => 689, + Iir_Kind_Type_Declaration => 696, + Iir_Kind_Anonymous_Type_Declaration => 702, + Iir_Kind_Subtype_Declaration => 710, + Iir_Kind_Nature_Declaration => 716, + Iir_Kind_Subnature_Declaration => 723, + Iir_Kind_Package_Header => 725, + Iir_Kind_Unit_Declaration => 734, + Iir_Kind_Library_Declaration => 742, + Iir_Kind_Component_Declaration => 752, + Iir_Kind_Attribute_Declaration => 759, + Iir_Kind_Group_Template_Declaration => 765, + Iir_Kind_Group_Declaration => 772, + Iir_Kind_Element_Declaration => 780, + Iir_Kind_Nature_Element_Declaration => 787, + Iir_Kind_Non_Object_Alias_Declaration => 795, + Iir_Kind_Psl_Declaration => 803, + Iir_Kind_Psl_Boolean_Parameter => 811, + Iir_Kind_Psl_Endpoint_Declaration => 825, + Iir_Kind_Enumeration_Literal => 837, + Iir_Kind_Function_Declaration => 864, + Iir_Kind_Procedure_Declaration => 888, + Iir_Kind_Function_Body => 898, + Iir_Kind_Procedure_Body => 909, + Iir_Kind_Function_Instantiation_Declaration => 920, + Iir_Kind_Procedure_Instantiation_Declaration => 930, + Iir_Kind_Terminal_Declaration => 940, + Iir_Kind_Object_Alias_Declaration => 952, + Iir_Kind_Free_Quantity_Declaration => 964, + Iir_Kind_Spectrum_Quantity_Declaration => 977, + Iir_Kind_Noise_Quantity_Declaration => 989, + Iir_Kind_Across_Quantity_Declaration => 1005, + Iir_Kind_Through_Quantity_Declaration => 1021, + Iir_Kind_File_Declaration => 1036, + Iir_Kind_Guard_Signal_Declaration => 1050, + Iir_Kind_Signal_Declaration => 1067, + Iir_Kind_Variable_Declaration => 1080, + Iir_Kind_Constant_Declaration => 1095, + Iir_Kind_Iterator_Declaration => 1107, + Iir_Kind_Interface_Constant_Declaration => 1124, + Iir_Kind_Interface_Variable_Declaration => 1140, + Iir_Kind_Interface_Signal_Declaration => 1161, + Iir_Kind_Interface_File_Declaration => 1177, + Iir_Kind_Interface_Quantity_Declaration => 1193, + Iir_Kind_Interface_Terminal_Declaration => 1205, + Iir_Kind_Interface_Type_Declaration => 1217, + Iir_Kind_Interface_Package_Declaration => 1231, + Iir_Kind_Interface_Function_Declaration => 1251, + Iir_Kind_Interface_Procedure_Declaration => 1267, + Iir_Kind_Attribute_Implicit_Declaration => 1270, + Iir_Kind_Suspend_State_Declaration => 1274, + Iir_Kind_Identity_Operator => 1278, + Iir_Kind_Negation_Operator => 1282, + Iir_Kind_Absolute_Operator => 1286, + Iir_Kind_Not_Operator => 1290, + Iir_Kind_Implicit_Condition_Operator => 1294, + Iir_Kind_Condition_Operator => 1298, + Iir_Kind_Reduction_And_Operator => 1302, + Iir_Kind_Reduction_Or_Operator => 1306, + Iir_Kind_Reduction_Nand_Operator => 1310, + Iir_Kind_Reduction_Nor_Operator => 1314, + Iir_Kind_Reduction_Xor_Operator => 1318, + Iir_Kind_Reduction_Xnor_Operator => 1322, + Iir_Kind_And_Operator => 1327, + Iir_Kind_Or_Operator => 1332, + Iir_Kind_Nand_Operator => 1337, + Iir_Kind_Nor_Operator => 1342, + Iir_Kind_Xor_Operator => 1347, + Iir_Kind_Xnor_Operator => 1352, + Iir_Kind_Equality_Operator => 1357, + Iir_Kind_Inequality_Operator => 1362, + Iir_Kind_Less_Than_Operator => 1367, + Iir_Kind_Less_Than_Or_Equal_Operator => 1372, + Iir_Kind_Greater_Than_Operator => 1377, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1382, + Iir_Kind_Match_Equality_Operator => 1387, + Iir_Kind_Match_Inequality_Operator => 1392, + Iir_Kind_Match_Less_Than_Operator => 1397, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1402, + Iir_Kind_Match_Greater_Than_Operator => 1407, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1412, + Iir_Kind_Sll_Operator => 1417, + Iir_Kind_Sla_Operator => 1422, + Iir_Kind_Srl_Operator => 1427, + Iir_Kind_Sra_Operator => 1432, + Iir_Kind_Rol_Operator => 1437, + Iir_Kind_Ror_Operator => 1442, + Iir_Kind_Addition_Operator => 1447, + Iir_Kind_Substraction_Operator => 1452, + Iir_Kind_Concatenation_Operator => 1457, + Iir_Kind_Multiplication_Operator => 1462, + Iir_Kind_Division_Operator => 1467, + Iir_Kind_Modulus_Operator => 1472, + Iir_Kind_Remainder_Operator => 1477, + Iir_Kind_Exponentiation_Operator => 1482, + Iir_Kind_Function_Call => 1490, + Iir_Kind_Aggregate => 1498, + Iir_Kind_Parenthesis_Expression => 1501, + Iir_Kind_Qualified_Expression => 1505, + Iir_Kind_Type_Conversion => 1510, + Iir_Kind_Allocator_By_Expression => 1515, + Iir_Kind_Allocator_By_Subtype => 1521, + Iir_Kind_Selected_Element => 1529, + Iir_Kind_Dereference => 1534, + Iir_Kind_Implicit_Dereference => 1539, + Iir_Kind_Slice_Name => 1546, + Iir_Kind_Indexed_Name => 1552, + Iir_Kind_Psl_Prev => 1558, + Iir_Kind_Psl_Stable => 1563, + Iir_Kind_Psl_Rose => 1568, + Iir_Kind_Psl_Fell => 1573, + Iir_Kind_Psl_Onehot => 1576, + Iir_Kind_Psl_Onehot0 => 1579, + Iir_Kind_Psl_Expression => 1581, + Iir_Kind_Sensitized_Process_Statement => 1603, + Iir_Kind_Process_Statement => 1624, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1637, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1650, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1664, + Iir_Kind_Concurrent_Assertion_Statement => 1672, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1679, + Iir_Kind_Concurrent_Break_Statement => 1687, + Iir_Kind_Psl_Assert_Directive => 1701, + Iir_Kind_Psl_Assume_Directive => 1713, + Iir_Kind_Psl_Cover_Directive => 1725, + Iir_Kind_Psl_Restrict_Directive => 1736, + Iir_Kind_Block_Statement => 1750, + Iir_Kind_If_Generate_Statement => 1761, + Iir_Kind_Case_Generate_Statement => 1770, + Iir_Kind_For_Generate_Statement => 1779, + Iir_Kind_Component_Instantiation_Statement => 1791, + Iir_Kind_Psl_Default_Clock => 1794, + Iir_Kind_Generate_Statement_Body => 1805, + Iir_Kind_If_Generate_Else_Clause => 1811, + Iir_Kind_Simple_Simultaneous_Statement => 1818, + Iir_Kind_Simultaneous_Null_Statement => 1822, + Iir_Kind_Simultaneous_Procedural_Statement => 1833, + Iir_Kind_Simultaneous_Case_Statement => 1842, + Iir_Kind_Simultaneous_If_Statement => 1851, + Iir_Kind_Simultaneous_Elsif => 1857, + Iir_Kind_Simple_Signal_Assignment_Statement => 1868, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1879, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1891, + Iir_Kind_Signal_Force_Assignment_Statement => 1901, + Iir_Kind_Signal_Release_Assignment_Statement => 1910, + Iir_Kind_Null_Statement => 1914, + Iir_Kind_Assertion_Statement => 1921, + Iir_Kind_Report_Statement => 1927, + Iir_Kind_Wait_Statement => 1935, + Iir_Kind_Variable_Assignment_Statement => 1942, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1949, + Iir_Kind_Return_Statement => 1955, + Iir_Kind_For_Loop_Statement => 1966, + Iir_Kind_While_Loop_Statement => 1977, + Iir_Kind_Next_Statement => 1984, + Iir_Kind_Exit_Statement => 1991, + Iir_Kind_Case_Statement => 2000, + Iir_Kind_Procedure_Call_Statement => 2006, + Iir_Kind_Break_Statement => 2013, + Iir_Kind_If_Statement => 2023, + Iir_Kind_Suspend_State_Statement => 2028, + Iir_Kind_Elsif => 2034, + Iir_Kind_Character_Literal => 2041, + Iir_Kind_Simple_Name => 2048, + Iir_Kind_Selected_Name => 2056, + Iir_Kind_Operator_Symbol => 2061, + Iir_Kind_Reference_Name => 2066, + Iir_Kind_External_Constant_Name => 2075, + Iir_Kind_External_Signal_Name => 2085, + Iir_Kind_External_Variable_Name => 2095, + Iir_Kind_Selected_By_All_Name => 2101, + Iir_Kind_Parenthesis_Name => 2106, + Iir_Kind_Package_Pathname => 2110, + Iir_Kind_Absolute_Pathname => 2111, + Iir_Kind_Relative_Pathname => 2112, + Iir_Kind_Pathname_Element => 2117, + Iir_Kind_Base_Attribute => 2119, + Iir_Kind_Subtype_Attribute => 2124, + Iir_Kind_Element_Attribute => 2129, + Iir_Kind_Across_Attribute => 2134, + Iir_Kind_Through_Attribute => 2139, + Iir_Kind_Nature_Reference_Attribute => 2143, + Iir_Kind_Left_Type_Attribute => 2148, + Iir_Kind_Right_Type_Attribute => 2153, + Iir_Kind_High_Type_Attribute => 2158, + Iir_Kind_Low_Type_Attribute => 2163, + Iir_Kind_Ascending_Type_Attribute => 2168, + Iir_Kind_Image_Attribute => 2174, + Iir_Kind_Value_Attribute => 2180, + Iir_Kind_Pos_Attribute => 2186, + Iir_Kind_Val_Attribute => 2192, + Iir_Kind_Succ_Attribute => 2198, + Iir_Kind_Pred_Attribute => 2204, + Iir_Kind_Leftof_Attribute => 2210, + Iir_Kind_Rightof_Attribute => 2216, + Iir_Kind_Signal_Slew_Attribute => 2224, + Iir_Kind_Quantity_Slew_Attribute => 2232, + Iir_Kind_Ramp_Attribute => 2240, + Iir_Kind_Zoh_Attribute => 2248, + Iir_Kind_Ltf_Attribute => 2256, + Iir_Kind_Ztf_Attribute => 2266, + Iir_Kind_Dot_Attribute => 2273, + Iir_Kind_Integ_Attribute => 2280, + Iir_Kind_Quantity_Delayed_Attribute => 2288, + Iir_Kind_Above_Attribute => 2296, + Iir_Kind_Delayed_Attribute => 2305, + Iir_Kind_Stable_Attribute => 2314, + Iir_Kind_Quiet_Attribute => 2323, + Iir_Kind_Transaction_Attribute => 2332, + Iir_Kind_Event_Attribute => 2336, + Iir_Kind_Active_Attribute => 2340, + Iir_Kind_Last_Event_Attribute => 2344, + Iir_Kind_Last_Active_Attribute => 2348, + Iir_Kind_Last_Value_Attribute => 2352, + Iir_Kind_Driving_Attribute => 2356, + Iir_Kind_Driving_Value_Attribute => 2360, + Iir_Kind_Behavior_Attribute => 2360, + Iir_Kind_Structure_Attribute => 2360, + Iir_Kind_Simple_Name_Attribute => 2367, + Iir_Kind_Instance_Name_Attribute => 2372, + Iir_Kind_Path_Name_Attribute => 2377, + Iir_Kind_Left_Array_Attribute => 2384, + Iir_Kind_Right_Array_Attribute => 2391, + Iir_Kind_High_Array_Attribute => 2398, + Iir_Kind_Low_Array_Attribute => 2405, + Iir_Kind_Length_Array_Attribute => 2412, + Iir_Kind_Ascending_Array_Attribute => 2419, + Iir_Kind_Range_Array_Attribute => 2426, + Iir_Kind_Reverse_Range_Array_Attribute => 2433, + Iir_Kind_Attribute_Name => 2442 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6302,6 +6308,8 @@ package body Vhdl.Nodes_Meta is return Get_Package_Body (N); when Field_Instance_Package_Body => return Get_Instance_Package_Body (N); + when Field_Owned_Instance_Package_Body => + return Get_Owned_Instance_Package_Body (N); when Field_Hierarchical_Name => return Get_Hierarchical_Name (N); when Field_Vunit_Item_Chain => @@ -6778,6 +6786,8 @@ package body Vhdl.Nodes_Meta is Set_Package_Body (N, V); when Field_Instance_Package_Body => Set_Instance_Package_Body (N, V); + when Field_Owned_Instance_Package_Body => + Set_Owned_Instance_Package_Body (N, V); when Field_Hierarchical_Name => Set_Hierarchical_Name (N, V); when Field_Vunit_Item_Chain => @@ -8611,6 +8621,11 @@ package body Vhdl.Nodes_Meta is return K = Iir_Kind_Package_Instantiation_Declaration; end Has_Instance_Package_Body; + function Has_Owned_Instance_Package_Body (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Package_Instantiation_Declaration; + end Has_Owned_Instance_Package_Body; + function Has_Need_Body (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Package_Declaration; diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads index e75fdf1c2..cafa4ca5d 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -141,6 +141,7 @@ package Vhdl.Nodes_Meta is Field_Package, Field_Package_Body, Field_Instance_Package_Body, + Field_Owned_Instance_Package_Body, Field_Need_Body, Field_Immediate_Body_Flag, Field_Macro_Expanded_Flag, @@ -741,6 +742,7 @@ package Vhdl.Nodes_Meta is function Has_Package (K : Iir_Kind) return Boolean; function Has_Package_Body (K : Iir_Kind) return Boolean; function Has_Instance_Package_Body (K : Iir_Kind) return Boolean; + function Has_Owned_Instance_Package_Body (K : Iir_Kind) return Boolean; function Has_Need_Body (K : Iir_Kind) return Boolean; function Has_Immediate_Body_Flag (K : Iir_Kind) return Boolean; function Has_Macro_Expanded_Flag (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index 02e63836d..75d0cc678 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -605,20 +605,32 @@ package body Vhdl.Sem_Inst is -- case set the forward link. -- Or it can be the body of an instantiated package; in -- that case there is no forward link. - if Get_Kind (Pkg) = Iir_Kind_Package_Declaration then - Set_Package_Body (Get_Package (Res), Res); - end if; + case Get_Kind (Pkg) is + when Iir_Kind_Package_Declaration => + Set_Package_Body (Pkg, Res); + when Iir_Kind_Package_Instantiation_Declaration => + Set_Instance_Package_Body (Pkg, Res); + when others => + raise Internal_Error; + end case; end; - when Field_Instance_Package_Body => + when Field_Owned_Instance_Package_Body => -- Do not instantiate the body of a package while -- instantiating a shared package. if not Is_Within_Shared_Instance then - Set_Instance_Package_Body - (Res, Instantiate_Iir (Get_Instance_Package_Body (N), - False)); + declare + Bod : Iir; + begin + Bod := Instantiate_Iir (Get_Instance_Package_Body (N), + False); + Set_Owned_Instance_Package_Body (Res, Bod); + end; end if; + when Field_Instance_Package_Body => + null; + when Field_Subtype_Definition => -- TODO null; |