diff options
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 16 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 13 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 385 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.ads | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 57 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_inst.ads | 4 |
6 files changed, 275 insertions, 202 deletions
diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index c69bf2682..afeb675cc 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -5591,6 +5591,22 @@ package body Vhdl.Nodes is Set_Field9 (Inst, Pkg); end Set_Uninstantiated_Package_Decl; + function Get_Associated_Package (Inter : Iir) return Iir is + begin + pragma Assert (Inter /= Null_Iir); + pragma Assert (Has_Associated_Package (Get_Kind (Inter)), + "no field Associated_Package"); + return Get_Field4 (Inter); + end Get_Associated_Package; + + procedure Set_Associated_Package (Inter : Iir; Pkg : Iir) is + begin + pragma Assert (Inter /= Null_Iir); + pragma Assert (Has_Associated_Package (Get_Kind (Inter)), + "no field Associated_Package"); + Set_Field4 (Inter, Pkg); + end Set_Associated_Package; + function Get_Instance_Source_File (Inst : Iir) return Source_File_Entry is begin pragma Assert (Inst /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 65aadfa76..a791c532c 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -1542,6 +1542,8 @@ package Vhdl.Nodes is -- -- Get/Set_Identifier (Field3) -- + -- Those fields are set only for the interface package in uninstantiated + -- units. -- Get/Set_Uninstantiated_Package_Name (Field7) -- -- Get/Set_Uninstantiated_Package_Decl (Field9) @@ -1554,10 +1556,13 @@ package Vhdl.Nodes is -- -- Get/Set_Declaration_Chain (Field1) -- - -- Get/Set_Chain (Field2) - -- -- Get/Set_Attribute_Value_Chain (Field5) -- + -- This field is set only for interface package that has been associated. + -- Get/Set_Associated_Package (Field4) + -- + -- Get/Set_Chain (Field2) + -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_Is_Within_Flag (Flag5) @@ -9029,6 +9034,10 @@ package Vhdl.Nodes is function Get_Uninstantiated_Package_Decl (Inst : Iir) return Iir; procedure Set_Uninstantiated_Package_Decl (Inst : Iir; Pkg : Iir); + -- Field: Field4 Ref + function Get_Associated_Package (Inter : Iir) return Iir; + procedure Set_Associated_Package (Inter : Iir; Pkg : Iir); + -- The created pseudo-file for relocating the instantiated nodes -- (generics and declarations). -- Field: Field10 (uc) diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 47bffb7b3..49cb0253c 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -278,6 +278,7 @@ package body Vhdl.Nodes_Meta is Field_Block_Header => Type_Iir, Field_Uninstantiated_Package_Name => Type_Iir, Field_Uninstantiated_Package_Decl => Type_Iir, + Field_Associated_Package => Type_Iir, Field_Instance_Source_File => Type_Source_File_Entry, Field_Generate_Block_Configuration => Type_Iir, Field_Generate_Statement_Body => Type_Iir, @@ -933,6 +934,8 @@ package body Vhdl.Nodes_Meta is return "uninstantiated_package_name"; when Field_Uninstantiated_Package_Decl => return "uninstantiated_package_decl"; + when Field_Associated_Package => + return "associated_package"; when Field_Instance_Source_File => return "instance_source_file"; when Field_Generate_Block_Configuration => @@ -2361,6 +2364,8 @@ package body Vhdl.Nodes_Meta is return Attr_None; when Field_Uninstantiated_Package_Decl => return Attr_Ref; + when Field_Associated_Package => + return Attr_Ref; when Field_Instance_Source_File => return Attr_None; when Field_Generate_Block_Configuration => @@ -3967,8 +3972,9 @@ package body Vhdl.Nodes_Meta is Field_Generic_Chain, Field_Generic_Map_Aspect_Chain, Field_Declaration_Chain, - Field_Chain, Field_Attribute_Value_Chain, + Field_Associated_Package, + Field_Chain, -- Iir_Kind_Interface_Function_Declaration Field_Subprogram_Depth, Field_Identifier, @@ -5505,190 +5511,190 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Interface_Quantity_Declaration => 1178, Iir_Kind_Interface_Terminal_Declaration => 1190, Iir_Kind_Interface_Type_Declaration => 1202, - Iir_Kind_Interface_Package_Declaration => 1215, - Iir_Kind_Interface_Function_Declaration => 1235, - Iir_Kind_Interface_Procedure_Declaration => 1251, - Iir_Kind_Attribute_Implicit_Declaration => 1254, - Iir_Kind_Suspend_State_Declaration => 1257, - Iir_Kind_Identity_Operator => 1261, - Iir_Kind_Negation_Operator => 1265, - Iir_Kind_Absolute_Operator => 1269, - Iir_Kind_Not_Operator => 1273, - Iir_Kind_Implicit_Condition_Operator => 1277, - Iir_Kind_Condition_Operator => 1281, - Iir_Kind_Reduction_And_Operator => 1285, - Iir_Kind_Reduction_Or_Operator => 1289, - Iir_Kind_Reduction_Nand_Operator => 1293, - Iir_Kind_Reduction_Nor_Operator => 1297, - Iir_Kind_Reduction_Xor_Operator => 1301, - Iir_Kind_Reduction_Xnor_Operator => 1305, - Iir_Kind_And_Operator => 1310, - Iir_Kind_Or_Operator => 1315, - Iir_Kind_Nand_Operator => 1320, - Iir_Kind_Nor_Operator => 1325, - Iir_Kind_Xor_Operator => 1330, - Iir_Kind_Xnor_Operator => 1335, - Iir_Kind_Equality_Operator => 1340, - Iir_Kind_Inequality_Operator => 1345, - Iir_Kind_Less_Than_Operator => 1350, - Iir_Kind_Less_Than_Or_Equal_Operator => 1355, - Iir_Kind_Greater_Than_Operator => 1360, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1365, - Iir_Kind_Match_Equality_Operator => 1370, - Iir_Kind_Match_Inequality_Operator => 1375, - Iir_Kind_Match_Less_Than_Operator => 1380, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1385, - Iir_Kind_Match_Greater_Than_Operator => 1390, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1395, - Iir_Kind_Sll_Operator => 1400, - Iir_Kind_Sla_Operator => 1405, - Iir_Kind_Srl_Operator => 1410, - Iir_Kind_Sra_Operator => 1415, - Iir_Kind_Rol_Operator => 1420, - Iir_Kind_Ror_Operator => 1425, - Iir_Kind_Addition_Operator => 1430, - Iir_Kind_Substraction_Operator => 1435, - Iir_Kind_Concatenation_Operator => 1440, - Iir_Kind_Multiplication_Operator => 1445, - Iir_Kind_Division_Operator => 1450, - Iir_Kind_Modulus_Operator => 1455, - Iir_Kind_Remainder_Operator => 1460, - Iir_Kind_Exponentiation_Operator => 1465, - Iir_Kind_Function_Call => 1473, - Iir_Kind_Aggregate => 1481, - Iir_Kind_Parenthesis_Expression => 1484, - Iir_Kind_Qualified_Expression => 1488, - Iir_Kind_Type_Conversion => 1493, - Iir_Kind_Allocator_By_Expression => 1498, - Iir_Kind_Allocator_By_Subtype => 1504, - Iir_Kind_Selected_Element => 1512, - Iir_Kind_Dereference => 1517, - Iir_Kind_Implicit_Dereference => 1522, - Iir_Kind_Slice_Name => 1529, - Iir_Kind_Indexed_Name => 1535, - Iir_Kind_Psl_Prev => 1541, - Iir_Kind_Psl_Stable => 1546, - Iir_Kind_Psl_Rose => 1551, - Iir_Kind_Psl_Fell => 1556, - Iir_Kind_Psl_Onehot => 1559, - Iir_Kind_Psl_Onehot0 => 1562, - Iir_Kind_Psl_Expression => 1564, - Iir_Kind_Sensitized_Process_Statement => 1586, - Iir_Kind_Process_Statement => 1607, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1620, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1633, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1647, - Iir_Kind_Concurrent_Assertion_Statement => 1655, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1662, - Iir_Kind_Concurrent_Break_Statement => 1670, - Iir_Kind_Psl_Assert_Directive => 1684, - Iir_Kind_Psl_Assume_Directive => 1696, - Iir_Kind_Psl_Cover_Directive => 1708, - Iir_Kind_Psl_Restrict_Directive => 1719, - Iir_Kind_Block_Statement => 1733, - Iir_Kind_If_Generate_Statement => 1744, - Iir_Kind_Case_Generate_Statement => 1753, - Iir_Kind_For_Generate_Statement => 1762, - Iir_Kind_Component_Instantiation_Statement => 1774, - Iir_Kind_Psl_Default_Clock => 1777, - Iir_Kind_Generate_Statement_Body => 1788, - Iir_Kind_If_Generate_Else_Clause => 1794, - Iir_Kind_Simple_Simultaneous_Statement => 1801, - Iir_Kind_Simultaneous_Null_Statement => 1805, - Iir_Kind_Simultaneous_Procedural_Statement => 1816, - Iir_Kind_Simultaneous_Case_Statement => 1825, - Iir_Kind_Simultaneous_If_Statement => 1834, - Iir_Kind_Simultaneous_Elsif => 1840, - Iir_Kind_Simple_Signal_Assignment_Statement => 1851, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1862, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1874, - Iir_Kind_Signal_Force_Assignment_Statement => 1884, - Iir_Kind_Signal_Release_Assignment_Statement => 1893, - Iir_Kind_Null_Statement => 1897, - Iir_Kind_Assertion_Statement => 1904, - Iir_Kind_Report_Statement => 1910, - Iir_Kind_Wait_Statement => 1918, - Iir_Kind_Variable_Assignment_Statement => 1925, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1932, - Iir_Kind_Return_Statement => 1938, - Iir_Kind_For_Loop_Statement => 1949, - Iir_Kind_While_Loop_Statement => 1960, - Iir_Kind_Next_Statement => 1967, - Iir_Kind_Exit_Statement => 1974, - Iir_Kind_Case_Statement => 1983, - Iir_Kind_Procedure_Call_Statement => 1989, - Iir_Kind_Break_Statement => 1996, - Iir_Kind_If_Statement => 2006, - Iir_Kind_Suspend_State_Statement => 2010, - Iir_Kind_Elsif => 2016, - Iir_Kind_Character_Literal => 2023, - Iir_Kind_Simple_Name => 2030, - Iir_Kind_Selected_Name => 2038, - Iir_Kind_Operator_Symbol => 2043, - Iir_Kind_Reference_Name => 2048, - Iir_Kind_External_Constant_Name => 2057, - Iir_Kind_External_Signal_Name => 2067, - Iir_Kind_External_Variable_Name => 2077, - Iir_Kind_Selected_By_All_Name => 2083, - Iir_Kind_Parenthesis_Name => 2088, - Iir_Kind_Package_Pathname => 2092, - Iir_Kind_Absolute_Pathname => 2093, - Iir_Kind_Relative_Pathname => 2094, - Iir_Kind_Pathname_Element => 2099, - Iir_Kind_Base_Attribute => 2101, - Iir_Kind_Subtype_Attribute => 2106, - Iir_Kind_Element_Attribute => 2111, - Iir_Kind_Across_Attribute => 2116, - Iir_Kind_Through_Attribute => 2121, - Iir_Kind_Nature_Reference_Attribute => 2125, - Iir_Kind_Left_Type_Attribute => 2130, - Iir_Kind_Right_Type_Attribute => 2135, - Iir_Kind_High_Type_Attribute => 2140, - Iir_Kind_Low_Type_Attribute => 2145, - Iir_Kind_Ascending_Type_Attribute => 2150, - Iir_Kind_Image_Attribute => 2156, - Iir_Kind_Value_Attribute => 2162, - Iir_Kind_Pos_Attribute => 2168, - Iir_Kind_Val_Attribute => 2174, - Iir_Kind_Succ_Attribute => 2180, - Iir_Kind_Pred_Attribute => 2186, - Iir_Kind_Leftof_Attribute => 2192, - Iir_Kind_Rightof_Attribute => 2198, - Iir_Kind_Signal_Slew_Attribute => 2206, - Iir_Kind_Quantity_Slew_Attribute => 2214, - Iir_Kind_Ramp_Attribute => 2222, - Iir_Kind_Zoh_Attribute => 2230, - Iir_Kind_Ltf_Attribute => 2238, - Iir_Kind_Ztf_Attribute => 2248, - Iir_Kind_Dot_Attribute => 2255, - Iir_Kind_Integ_Attribute => 2262, - Iir_Kind_Quantity_Delayed_Attribute => 2270, - Iir_Kind_Above_Attribute => 2278, - Iir_Kind_Delayed_Attribute => 2287, - Iir_Kind_Stable_Attribute => 2296, - Iir_Kind_Quiet_Attribute => 2305, - Iir_Kind_Transaction_Attribute => 2314, - Iir_Kind_Event_Attribute => 2318, - Iir_Kind_Active_Attribute => 2322, - Iir_Kind_Last_Event_Attribute => 2326, - Iir_Kind_Last_Active_Attribute => 2330, - Iir_Kind_Last_Value_Attribute => 2334, - Iir_Kind_Driving_Attribute => 2338, - Iir_Kind_Driving_Value_Attribute => 2342, - Iir_Kind_Behavior_Attribute => 2342, - Iir_Kind_Structure_Attribute => 2342, - Iir_Kind_Simple_Name_Attribute => 2349, - Iir_Kind_Instance_Name_Attribute => 2354, - Iir_Kind_Path_Name_Attribute => 2359, - Iir_Kind_Left_Array_Attribute => 2366, - Iir_Kind_Right_Array_Attribute => 2373, - Iir_Kind_High_Array_Attribute => 2380, - Iir_Kind_Low_Array_Attribute => 2387, - Iir_Kind_Length_Array_Attribute => 2394, - Iir_Kind_Ascending_Array_Attribute => 2401, - Iir_Kind_Range_Array_Attribute => 2408, - Iir_Kind_Reverse_Range_Array_Attribute => 2415, - Iir_Kind_Attribute_Name => 2424 + Iir_Kind_Interface_Package_Declaration => 1216, + Iir_Kind_Interface_Function_Declaration => 1236, + Iir_Kind_Interface_Procedure_Declaration => 1252, + Iir_Kind_Attribute_Implicit_Declaration => 1255, + Iir_Kind_Suspend_State_Declaration => 1258, + Iir_Kind_Identity_Operator => 1262, + Iir_Kind_Negation_Operator => 1266, + Iir_Kind_Absolute_Operator => 1270, + Iir_Kind_Not_Operator => 1274, + Iir_Kind_Implicit_Condition_Operator => 1278, + Iir_Kind_Condition_Operator => 1282, + Iir_Kind_Reduction_And_Operator => 1286, + Iir_Kind_Reduction_Or_Operator => 1290, + Iir_Kind_Reduction_Nand_Operator => 1294, + Iir_Kind_Reduction_Nor_Operator => 1298, + Iir_Kind_Reduction_Xor_Operator => 1302, + Iir_Kind_Reduction_Xnor_Operator => 1306, + Iir_Kind_And_Operator => 1311, + Iir_Kind_Or_Operator => 1316, + Iir_Kind_Nand_Operator => 1321, + Iir_Kind_Nor_Operator => 1326, + Iir_Kind_Xor_Operator => 1331, + Iir_Kind_Xnor_Operator => 1336, + Iir_Kind_Equality_Operator => 1341, + Iir_Kind_Inequality_Operator => 1346, + Iir_Kind_Less_Than_Operator => 1351, + Iir_Kind_Less_Than_Or_Equal_Operator => 1356, + Iir_Kind_Greater_Than_Operator => 1361, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1366, + Iir_Kind_Match_Equality_Operator => 1371, + Iir_Kind_Match_Inequality_Operator => 1376, + Iir_Kind_Match_Less_Than_Operator => 1381, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1386, + Iir_Kind_Match_Greater_Than_Operator => 1391, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1396, + Iir_Kind_Sll_Operator => 1401, + Iir_Kind_Sla_Operator => 1406, + Iir_Kind_Srl_Operator => 1411, + Iir_Kind_Sra_Operator => 1416, + Iir_Kind_Rol_Operator => 1421, + Iir_Kind_Ror_Operator => 1426, + Iir_Kind_Addition_Operator => 1431, + Iir_Kind_Substraction_Operator => 1436, + Iir_Kind_Concatenation_Operator => 1441, + Iir_Kind_Multiplication_Operator => 1446, + Iir_Kind_Division_Operator => 1451, + Iir_Kind_Modulus_Operator => 1456, + Iir_Kind_Remainder_Operator => 1461, + Iir_Kind_Exponentiation_Operator => 1466, + Iir_Kind_Function_Call => 1474, + Iir_Kind_Aggregate => 1482, + Iir_Kind_Parenthesis_Expression => 1485, + Iir_Kind_Qualified_Expression => 1489, + Iir_Kind_Type_Conversion => 1494, + Iir_Kind_Allocator_By_Expression => 1499, + Iir_Kind_Allocator_By_Subtype => 1505, + Iir_Kind_Selected_Element => 1513, + Iir_Kind_Dereference => 1518, + Iir_Kind_Implicit_Dereference => 1523, + Iir_Kind_Slice_Name => 1530, + Iir_Kind_Indexed_Name => 1536, + Iir_Kind_Psl_Prev => 1542, + Iir_Kind_Psl_Stable => 1547, + Iir_Kind_Psl_Rose => 1552, + Iir_Kind_Psl_Fell => 1557, + Iir_Kind_Psl_Onehot => 1560, + Iir_Kind_Psl_Onehot0 => 1563, + Iir_Kind_Psl_Expression => 1565, + Iir_Kind_Sensitized_Process_Statement => 1587, + Iir_Kind_Process_Statement => 1608, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1621, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1634, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1648, + Iir_Kind_Concurrent_Assertion_Statement => 1656, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1663, + Iir_Kind_Concurrent_Break_Statement => 1671, + Iir_Kind_Psl_Assert_Directive => 1685, + Iir_Kind_Psl_Assume_Directive => 1697, + Iir_Kind_Psl_Cover_Directive => 1709, + Iir_Kind_Psl_Restrict_Directive => 1720, + Iir_Kind_Block_Statement => 1734, + Iir_Kind_If_Generate_Statement => 1745, + Iir_Kind_Case_Generate_Statement => 1754, + Iir_Kind_For_Generate_Statement => 1763, + Iir_Kind_Component_Instantiation_Statement => 1775, + Iir_Kind_Psl_Default_Clock => 1778, + Iir_Kind_Generate_Statement_Body => 1789, + Iir_Kind_If_Generate_Else_Clause => 1795, + Iir_Kind_Simple_Simultaneous_Statement => 1802, + Iir_Kind_Simultaneous_Null_Statement => 1806, + Iir_Kind_Simultaneous_Procedural_Statement => 1817, + Iir_Kind_Simultaneous_Case_Statement => 1826, + Iir_Kind_Simultaneous_If_Statement => 1835, + Iir_Kind_Simultaneous_Elsif => 1841, + Iir_Kind_Simple_Signal_Assignment_Statement => 1852, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1863, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1875, + Iir_Kind_Signal_Force_Assignment_Statement => 1885, + Iir_Kind_Signal_Release_Assignment_Statement => 1894, + Iir_Kind_Null_Statement => 1898, + Iir_Kind_Assertion_Statement => 1905, + Iir_Kind_Report_Statement => 1911, + Iir_Kind_Wait_Statement => 1919, + Iir_Kind_Variable_Assignment_Statement => 1926, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1933, + Iir_Kind_Return_Statement => 1939, + Iir_Kind_For_Loop_Statement => 1950, + Iir_Kind_While_Loop_Statement => 1961, + Iir_Kind_Next_Statement => 1968, + Iir_Kind_Exit_Statement => 1975, + Iir_Kind_Case_Statement => 1984, + Iir_Kind_Procedure_Call_Statement => 1990, + Iir_Kind_Break_Statement => 1997, + Iir_Kind_If_Statement => 2007, + Iir_Kind_Suspend_State_Statement => 2011, + Iir_Kind_Elsif => 2017, + Iir_Kind_Character_Literal => 2024, + Iir_Kind_Simple_Name => 2031, + Iir_Kind_Selected_Name => 2039, + Iir_Kind_Operator_Symbol => 2044, + Iir_Kind_Reference_Name => 2049, + Iir_Kind_External_Constant_Name => 2058, + Iir_Kind_External_Signal_Name => 2068, + Iir_Kind_External_Variable_Name => 2078, + Iir_Kind_Selected_By_All_Name => 2084, + Iir_Kind_Parenthesis_Name => 2089, + Iir_Kind_Package_Pathname => 2093, + Iir_Kind_Absolute_Pathname => 2094, + Iir_Kind_Relative_Pathname => 2095, + Iir_Kind_Pathname_Element => 2100, + Iir_Kind_Base_Attribute => 2102, + Iir_Kind_Subtype_Attribute => 2107, + Iir_Kind_Element_Attribute => 2112, + Iir_Kind_Across_Attribute => 2117, + Iir_Kind_Through_Attribute => 2122, + Iir_Kind_Nature_Reference_Attribute => 2126, + Iir_Kind_Left_Type_Attribute => 2131, + Iir_Kind_Right_Type_Attribute => 2136, + Iir_Kind_High_Type_Attribute => 2141, + Iir_Kind_Low_Type_Attribute => 2146, + Iir_Kind_Ascending_Type_Attribute => 2151, + Iir_Kind_Image_Attribute => 2157, + Iir_Kind_Value_Attribute => 2163, + Iir_Kind_Pos_Attribute => 2169, + Iir_Kind_Val_Attribute => 2175, + Iir_Kind_Succ_Attribute => 2181, + Iir_Kind_Pred_Attribute => 2187, + Iir_Kind_Leftof_Attribute => 2193, + Iir_Kind_Rightof_Attribute => 2199, + Iir_Kind_Signal_Slew_Attribute => 2207, + Iir_Kind_Quantity_Slew_Attribute => 2215, + Iir_Kind_Ramp_Attribute => 2223, + Iir_Kind_Zoh_Attribute => 2231, + Iir_Kind_Ltf_Attribute => 2239, + Iir_Kind_Ztf_Attribute => 2249, + Iir_Kind_Dot_Attribute => 2256, + Iir_Kind_Integ_Attribute => 2263, + Iir_Kind_Quantity_Delayed_Attribute => 2271, + Iir_Kind_Above_Attribute => 2279, + Iir_Kind_Delayed_Attribute => 2288, + Iir_Kind_Stable_Attribute => 2297, + Iir_Kind_Quiet_Attribute => 2306, + Iir_Kind_Transaction_Attribute => 2315, + Iir_Kind_Event_Attribute => 2319, + Iir_Kind_Active_Attribute => 2323, + Iir_Kind_Last_Event_Attribute => 2327, + Iir_Kind_Last_Active_Attribute => 2331, + Iir_Kind_Last_Value_Attribute => 2335, + Iir_Kind_Driving_Attribute => 2339, + Iir_Kind_Driving_Value_Attribute => 2343, + Iir_Kind_Behavior_Attribute => 2343, + Iir_Kind_Structure_Attribute => 2343, + Iir_Kind_Simple_Name_Attribute => 2350, + Iir_Kind_Instance_Name_Attribute => 2355, + Iir_Kind_Path_Name_Attribute => 2360, + Iir_Kind_Left_Array_Attribute => 2367, + Iir_Kind_Right_Array_Attribute => 2374, + Iir_Kind_High_Array_Attribute => 2381, + Iir_Kind_Low_Array_Attribute => 2388, + Iir_Kind_Length_Array_Attribute => 2395, + Iir_Kind_Ascending_Array_Attribute => 2402, + Iir_Kind_Range_Array_Attribute => 2409, + Iir_Kind_Reverse_Range_Array_Attribute => 2416, + Iir_Kind_Attribute_Name => 2425 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6497,6 +6503,8 @@ package body Vhdl.Nodes_Meta is return Get_Uninstantiated_Package_Name (N); when Field_Uninstantiated_Package_Decl => return Get_Uninstantiated_Package_Decl (N); + when Field_Associated_Package => + return Get_Associated_Package (N); when Field_Generate_Block_Configuration => return Get_Generate_Block_Configuration (N); when Field_Generate_Statement_Body => @@ -6967,6 +6975,8 @@ package body Vhdl.Nodes_Meta is Set_Uninstantiated_Package_Name (N, V); when Field_Uninstantiated_Package_Decl => Set_Uninstantiated_Package_Decl (N, V); + when Field_Associated_Package => + Set_Associated_Package (N, V); when Field_Generate_Block_Configuration => Set_Generate_Block_Configuration (N, V); when Field_Generate_Statement_Body => @@ -11030,6 +11040,11 @@ package body Vhdl.Nodes_Meta is end case; end Has_Uninstantiated_Package_Decl; + function Has_Associated_Package (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Interface_Package_Declaration; + end Has_Associated_Package; + function Has_Instance_Source_File (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 965fba9e6..27d897a1b 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -322,6 +322,7 @@ package Vhdl.Nodes_Meta is Field_Block_Header, Field_Uninstantiated_Package_Name, Field_Uninstantiated_Package_Decl, + Field_Associated_Package, Field_Instance_Source_File, Field_Generate_Block_Configuration, Field_Generate_Statement_Body, @@ -924,6 +925,7 @@ package Vhdl.Nodes_Meta is function Has_Block_Header (K : Iir_Kind) return Boolean; function Has_Uninstantiated_Package_Name (K : Iir_Kind) return Boolean; function Has_Uninstantiated_Package_Decl (K : Iir_Kind) return Boolean; + function Has_Associated_Package (K : Iir_Kind) return Boolean; function Has_Instance_Source_File (K : Iir_Kind) return Boolean; function Has_Generate_Block_Configuration (K : Iir_Kind) return Boolean; function Has_Generate_Statement_Body (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index db34e5f39..4b0ca0279 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -684,7 +684,8 @@ package body Vhdl.Sem_Inst is -- As the scope generic interfaces extends beyond the immediate scope (see -- LRM08 12.2 Scope of declarations), they must be instantiated. - function Instantiate_Generic_Chain (Inst : Iir; Inters : Iir) return Iir + function Instantiate_Generic_Chain + (Inst : Iir; Inters : Iir; In_Interface : Boolean) return Iir is Inter : Iir; First : Iir; @@ -722,11 +723,17 @@ package body Vhdl.Sem_Inst is when Iir_Kind_Interface_Package_Declaration => Set_Uninstantiated_Package_Decl (Res, Get_Uninstantiated_Package_Decl (Inter)); - Set_Generic_Chain - (Res, - Instantiate_Generic_Chain (Res, Get_Generic_Chain (Inter))); - Set_Declaration_Chain - (Res, Instantiate_Iir_Chain (Get_Declaration_Chain (Inter))); + if In_Interface then + -- Only set generics and declarations when instantiating + -- for an uninstantiated unit. + Set_Generic_Chain + (Res, + Instantiate_Generic_Chain + (Res, Get_Generic_Chain (Inter), True)); + Set_Declaration_Chain + (Res, + Instantiate_Iir_Chain (Get_Declaration_Chain (Inter))); + end if; when Iir_Kind_Interface_Type_Declaration => Set_Type (Res, Get_Type (Inter)); when Iir_Kinds_Interface_Subprogram_Declaration => @@ -780,6 +787,23 @@ package body Vhdl.Sem_Inst is -- pragma Assert (Get_Instance (N) = Null_Iir); Set_Instance (N, Inst); + if Kind = Iir_Kind_Interface_Package_Declaration then + -- For interface package, this is not symetric. + -- The nodes to set instance on are in the interface package, + -- while the instances are in the associated package. + declare + Pkg_Actual : constant Iir := Get_Associated_Package (Inst); + begin + Set_Instance_On_Chain (Get_Generic_Chain (N), + Get_Generic_Chain (Pkg_Actual)); + Set_Instance_On_Chain (Get_Declaration_Chain (N), + Get_Declaration_Chain (Pkg_Actual)); + Set_Instance_On_Chain (Get_Attribute_Value_Chain (N), + Get_Attribute_Value_Chain (Pkg_Actual)); + end; + return; + end if; + for I in Fields'Range loop F := Fields (I); @@ -928,6 +952,7 @@ package body Vhdl.Sem_Inst is -- In ASSOC (which is the association for interface INTER), adjust -- references to the instance. + -- INTER is the interface of the uninstantiated unit. procedure Instantiate_Generic_Map (Assoc : Iir; Inter: Iir) is Assoc_Formal : Iir; @@ -987,19 +1012,22 @@ package body Vhdl.Sem_Inst is end if; end; when Iir_Kind_Interface_Package_Declaration => + -- INTER is an instantiation, without generic nor declaration + -- chains. pragma Assert (Get_Kind (Assoc) = Iir_Kind_Association_Element_Package); declare Sub_Inst : constant Iir := Get_Named_Entity (Get_Actual (Assoc)); - Sub_Pkg : constant Iir := Get_Origin (Assoc_Formal); + Pkg_Inter : constant Iir := Get_Origin (Assoc_Formal); begin -- Replace references of interface package to references -- to the actual package. - Set_Instance (Sub_Pkg, Sub_Inst); - Set_Instance_On_Chain (Get_Generic_Chain (Sub_Pkg), + Set_Instance (Pkg_Inter, Sub_Inst); + Set_Associated_Package (Assoc_Formal, Sub_Inst); + Set_Instance_On_Chain (Get_Generic_Chain (Pkg_Inter), Get_Generic_Chain (Sub_Inst)); - Set_Instance_On_Chain (Get_Declaration_Chain (Sub_Pkg), + Set_Instance_On_Chain (Get_Declaration_Chain (Pkg_Inter), Get_Declaration_Chain (Sub_Inst)); end; when Iir_Kind_Interface_Type_Declaration => @@ -1085,7 +1113,8 @@ package body Vhdl.Sem_Inst is -- Manually instantiate the package declaration. Set_Generic_Chain - (Inst, Instantiate_Generic_Chain (Inst, Get_Generic_Chain (Subprg))); + (Inst, + Instantiate_Generic_Chain (Inst, Get_Generic_Chain (Subprg), True)); Instantiate_Generic_Map_Chain (Inst, Subprg); if Get_Kind (Subprg) = Iir_Kind_Function_Instantiation_Declaration then Set_Return_Type (Inst, Instantiate_Iir (Subprg, True)); @@ -1121,7 +1150,8 @@ package body Vhdl.Sem_Inst is -- Manually instantiate the package declaration. Set_Generic_Chain - (Inter, Instantiate_Generic_Chain (Inter, Get_Generic_Chain (Header))); + (Inter, + Instantiate_Generic_Chain (Inter, Get_Generic_Chain (Header), True)); Instantiate_Generic_Map_Chain (Inter, Pkg); Set_Declaration_Chain (Inter, Instantiate_Iir_Chain (Get_Declaration_Chain (Pkg))); @@ -1158,7 +1188,8 @@ package body Vhdl.Sem_Inst is -- Manually instantiate the package declaration. Set_Generic_Chain - (Inst, Instantiate_Generic_Chain (Inst, Get_Generic_Chain (Header))); + (Inst, + Instantiate_Generic_Chain (Inst, Get_Generic_Chain (Header), False)); Instantiate_Generic_Map_Chain (Inst, Pkg); Set_Declaration_Chain (Inst, Instantiate_Iir_Chain (Get_Declaration_Chain (Pkg))); diff --git a/src/vhdl/vhdl-sem_inst.ads b/src/vhdl/vhdl-sem_inst.ads index 1099479de..c9585d0c7 100644 --- a/src/vhdl/vhdl-sem_inst.ads +++ b/src/vhdl/vhdl-sem_inst.ads @@ -29,8 +29,8 @@ package Vhdl.Sem_Inst is procedure Instantiate_Interface_Package_Declaration (Inter : Iir; Pkg : Iir); - -- - package instantiations - -- instantiate each node. + -- Instantiate each node of PKG to INST. + -- A generic interface package points to the actual. procedure Instantiate_Package_Declaration (Inst : Iir; Pkg : Iir); -- Create interface parameters of INST from SUBPRG. |