From b95cc40ac667768cd0ae03adb8c9c8c21ad35a30 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 24 Mar 2023 19:28:04 +0100 Subject: vhdl: add Owned_Instance_Package_Body to handle ownership of package body. --- pyGHDL/libghdl/vhdl/nodes.py | 13 + pyGHDL/libghdl/vhdl/nodes_meta.py | 623 +++++++++++++++++++------------------- src/vhdl/vhdl-canon.adb | 1 + src/vhdl/vhdl-nodes.adb | 16 + src/vhdl/vhdl-nodes.ads | 8 + src/vhdl/vhdl-nodes_meta.adb | 487 ++++++++++++++--------------- src/vhdl/vhdl-nodes_meta.ads | 2 + src/vhdl/vhdl-sem_inst.adb | 26 +- 8 files changed, 625 insertions(+), 551 deletions(-) diff --git a/pyGHDL/libghdl/vhdl/nodes.py b/pyGHDL/libghdl/vhdl/nodes.py index 5700e5df6..72c2c57f6 100644 --- a/pyGHDL/libghdl/vhdl/nodes.py +++ b/pyGHDL/libghdl/vhdl/nodes.py @@ -3030,6 +3030,19 @@ def Set_Instance_Package_Body(obj: Iir, value: Iir) -> None: """""" +@export +@BindToLibGHDL("vhdl__nodes__get_owned_instance_package_body") +def Get_Owned_Instance_Package_Body(obj: Iir) -> Iir: + """""" + return 0 + + +@export +@BindToLibGHDL("vhdl__nodes__set_owned_instance_package_body") +def Set_Owned_Instance_Package_Body(obj: Iir, value: Iir) -> None: + """""" + + @export @BindToLibGHDL("vhdl__nodes__get_need_body") def Get_Need_Body(obj: Iir) -> Boolean: diff --git a/pyGHDL/libghdl/vhdl/nodes_meta.py b/pyGHDL/libghdl/vhdl/nodes_meta.py index 42154df63..3dbf715e1 100644 --- a/pyGHDL/libghdl/vhdl/nodes_meta.py +++ b/pyGHDL/libghdl/vhdl/nodes_meta.py @@ -197,314 +197,315 @@ class fields(IntEnum): Package = 77 Package_Body = 78 Instance_Package_Body = 79 - Need_Body = 80 - Immediate_Body_Flag = 81 - Macro_Expanded_Flag = 82 - Need_Instance_Bodies = 83 - Hierarchical_Name = 84 - Vunit_Item_Chain = 85 - Bound_Vunit_Chain = 86 - Verification_Block_Configuration = 87 - Block_Configuration = 88 - Concurrent_Statement_Chain = 89 - Chain = 90 - Port_Chain = 91 - Generic_Chain = 92 - Type = 93 - Subtype_Indication = 94 - Discrete_Range = 95 - Type_Definition = 96 - Subtype_Definition = 97 - Incomplete_Type_Declaration = 98 - Interface_Type_Subprograms = 99 - Interface_Type_Definition = 100 - Nature_Definition = 101 - Nature = 102 - Subnature_Indication = 103 - Reference_Terminal_Flag = 104 - Mode = 105 - Guarded_Signal_Flag = 106 - Signal_Kind = 107 - Base_Name = 108 - Interface_Declaration_Chain = 109 - Default_Subprogram = 110 - Associated_Subprogram = 111 - Subprogram_Specification = 112 - Sequential_Statement_Chain = 113 - Simultaneous_Statement_Chain = 114 - Subprogram_Body = 115 - Overload_Number = 116 - Subprogram_Depth = 117 - Subprogram_Hash = 118 - Impure_Depth = 119 - Return_Type = 120 - Implicit_Definition = 121 - Uninstantiated_Subprogram_Name = 122 - Default_Value = 123 - Deferred_Declaration = 124 - Deferred_Declaration_Flag = 125 - Shared_Flag = 126 - Design_Unit = 127 - Block_Statement = 128 - Signal_Driver = 129 - Declaration_Chain = 130 - File_Logical_Name = 131 - File_Open_Kind = 132 - Element_Position = 133 - Use_Clause_Chain = 134 - Context_Reference_Chain = 135 - Inherit_Spec_Chain = 136 - Selected_Name = 137 - Type_Declarator = 138 - Complete_Type_Definition = 139 - Incomplete_Type_Ref_Chain = 140 - Associated_Type = 141 - Enumeration_Literal_List = 142 - Entity_Class_Entry_Chain = 143 - Group_Constituent_List = 144 - Unit_Chain = 145 - Primary_Unit = 146 - Identifier = 147 - Label = 148 - Return_Identifier = 149 - Visible_Flag = 150 - Range_Constraint = 151 - Direction = 152 - Left_Limit = 153 - Right_Limit = 154 - Left_Limit_Expr = 155 - Right_Limit_Expr = 156 - Parent_Type = 157 - Simple_Nature = 158 - Base_Nature = 159 - Resolution_Indication = 160 - Record_Element_Resolution_Chain = 161 - Tolerance = 162 - Plus_Terminal_Name = 163 - Minus_Terminal_Name = 164 - Plus_Terminal = 165 - Minus_Terminal = 166 - Magnitude_Expression = 167 - Phase_Expression = 168 - Power_Expression = 169 - Simultaneous_Left = 170 - Simultaneous_Right = 171 - Text_File_Flag = 172 - Only_Characters_Flag = 173 - Is_Character_Type = 174 - Nature_Staticness = 175 - Type_Staticness = 176 - Constraint_State = 177 - Index_Subtype_List = 178 - Index_Subtype_Definition_List = 179 - Element_Subtype_Indication = 180 - Element_Subtype = 181 - Element_Subnature_Indication = 182 - Element_Subnature = 183 - Index_Constraint_List = 184 - Array_Element_Constraint = 185 - Has_Array_Constraint_Flag = 186 - Has_Element_Constraint_Flag = 187 - Elements_Declaration_List = 188 - Owned_Elements_Chain = 189 - Designated_Type = 190 - Designated_Subtype_Indication = 191 - Index_List = 192 - Reference = 193 - Nature_Declarator = 194 - Across_Type_Mark = 195 - Through_Type_Mark = 196 - Across_Type_Definition = 197 - Through_Type_Definition = 198 - Across_Type = 199 - Through_Type = 200 - Target = 201 - Waveform_Chain = 202 - Guard = 203 - Delay_Mechanism = 204 - Reject_Time_Expression = 205 - Force_Mode = 206 - Has_Force_Mode = 207 - Sensitivity_List = 208 - Process_Origin = 209 - Package_Origin = 210 - Condition_Clause = 211 - Break_Element = 212 - Selector_Quantity = 213 - Break_Quantity = 214 - Timeout_Clause = 215 - Postponed_Flag = 216 - Callees_List = 217 - Passive_Flag = 218 - Resolution_Function_Flag = 219 - Wait_State = 220 - All_Sensitized_State = 221 - Seen_Flag = 222 - Pure_Flag = 223 - Foreign_Flag = 224 - Resolved_Flag = 225 - Signal_Type_Flag = 226 - Has_Signal_Flag = 227 - Purity_State = 228 - Elab_Flag = 229 - Vendor_Library_Flag = 230 - Configuration_Mark_Flag = 231 - Configuration_Done_Flag = 232 - Index_Constraint_Flag = 233 - Hide_Implicit_Flag = 234 - Assertion_Condition = 235 - Report_Expression = 236 - Severity_Expression = 237 - Instantiated_Unit = 238 - Instantiated_Header = 239 - Generic_Map_Aspect_Chain = 240 - Port_Map_Aspect_Chain = 241 - Configuration_Name = 242 - Component_Configuration = 243 - Configuration_Specification = 244 - Default_Binding_Indication = 245 - Default_Configuration_Declaration = 246 - Expression = 247 - Conditional_Expression_Chain = 248 - Allocator_Designated_Type = 249 - Selected_Waveform_Chain = 250 - Conditional_Waveform_Chain = 251 - Guard_Expression = 252 - Guard_Decl = 253 - Guard_Sensitivity_List = 254 - Attribute_Implicit_Chain = 255 - Block_Block_Configuration = 256 - Package_Header = 257 - Block_Header = 258 - Uninstantiated_Package_Name = 259 - Uninstantiated_Package_Decl = 260 - Associated_Package = 261 - Instance_Source_File = 262 - Generate_Block_Configuration = 263 - Generate_Statement_Body = 264 - Alternative_Label = 265 - Generate_Else_Clause = 266 - Condition = 267 - Else_Clause = 268 - Parameter_Specification = 269 - Parent = 270 - Loop_Label = 271 - Exit_Flag = 272 - Next_Flag = 273 - Component_Name = 274 - Instantiation_List = 275 - Entity_Aspect = 276 - Default_Entity_Aspect = 277 - Binding_Indication = 278 - Named_Entity = 279 - Referenced_Name = 280 - Expr_Staticness = 281 - Scalar_Size = 282 - Error_Origin = 283 - Operand = 284 - Left = 285 - Right = 286 - Unit_Name = 287 - Name = 288 - Group_Template_Name = 289 - Name_Staticness = 290 - Prefix = 291 - Signature_Prefix = 292 - External_Pathname = 293 - Pathname_Suffix = 294 - Pathname_Expression = 295 - In_Formal_Flag = 296 - Inertial_Flag = 297 - Slice_Subtype = 298 - Suffix = 299 - Index_Subtype = 300 - Parameter = 301 - Parameter_2 = 302 - Parameter_3 = 303 - Parameter_4 = 304 - Attr_Chain = 305 - Attribute_Implicit_Declaration = 306 - Actual_Type = 307 - Actual_Type_Definition = 308 - Association_Chain = 309 - Individual_Association_Chain = 310 - Subprogram_Association_Chain = 311 - Aggregate_Info = 312 - Sub_Aggregate_Info = 313 - Aggr_Dynamic_Flag = 314 - Aggr_Min_Length = 315 - Aggr_Low_Limit = 316 - Aggr_High_Limit = 317 - Aggr_Others_Flag = 318 - Aggr_Named_Flag = 319 - Aggregate_Expand_Flag = 320 - Determined_Aggregate_Flag = 321 - Association_Choices_Chain = 322 - Case_Statement_Alternative_Chain = 323 - Matching_Flag = 324 - Choice_Staticness = 325 - Procedure_Call = 326 - Implementation = 327 - Parameter_Association_Chain = 328 - Method_Object = 329 - Subtype_Type_Mark = 330 - Subnature_Nature_Mark = 331 - Type_Conversion_Subtype = 332 - Type_Mark = 333 - File_Type_Mark = 334 - Return_Type_Mark = 335 - Has_Disconnect_Flag = 336 - Has_Active_Flag = 337 - Is_Within_Flag = 338 - Type_Marks_List = 339 - Implicit_Alias_Flag = 340 - Alias_Signature = 341 - Attribute_Signature = 342 - Overload_List = 343 - Simple_Name_Identifier = 344 - Simple_Name_Subtype = 345 - Protected_Type_Body = 346 - Protected_Type_Declaration = 347 - Use_Flag = 348 - Elaborated_Flag = 349 - End_Has_Reserved_Id = 350 - End_Has_Identifier = 351 - End_Has_Postponed = 352 - Has_Label = 353 - Has_Begin = 354 - Has_End = 355 - Has_Is = 356 - Has_Pure = 357 - Has_Body = 358 - Has_Parameter = 359 - Has_Component = 360 - Has_Identifier_List = 361 - Has_Mode = 362 - Has_Class = 363 - Has_Delay_Mechanism = 364 - Suspend_Flag = 365 - Stop_Flag = 366 - Is_Ref = 367 - Is_Forward_Ref = 368 - Psl_Property = 369 - Psl_Sequence = 370 - Psl_Declaration = 371 - Psl_Expression = 372 - Psl_Boolean = 373 - PSL_Clock = 374 - PSL_NFA = 375 - PSL_Nbr_States = 376 - PSL_Clock_Sensitivity = 377 - PSL_EOS_Flag = 378 - PSL_Abort_Flag = 379 - Count_Expression = 380 - Clock_Expression = 381 - Default_Clock = 382 - Foreign_Node = 383 - Suspend_State_Index = 384 - Suspend_State_Chain = 385 - Suspend_State_Last = 386 - Suspend_State_Decl = 387 + Owned_Instance_Package_Body = 80 + Need_Body = 81 + Immediate_Body_Flag = 82 + Macro_Expanded_Flag = 83 + Need_Instance_Bodies = 84 + Hierarchical_Name = 85 + Vunit_Item_Chain = 86 + Bound_Vunit_Chain = 87 + Verification_Block_Configuration = 88 + Block_Configuration = 89 + Concurrent_Statement_Chain = 90 + Chain = 91 + Port_Chain = 92 + Generic_Chain = 93 + Type = 94 + Subtype_Indication = 95 + Discrete_Range = 96 + Type_Definition = 97 + Subtype_Definition = 98 + Incomplete_Type_Declaration = 99 + Interface_Type_Subprograms = 100 + Interface_Type_Definition = 101 + Nature_Definition = 102 + Nature = 103 + Subnature_Indication = 104 + Reference_Terminal_Flag = 105 + Mode = 106 + Guarded_Signal_Flag = 107 + Signal_Kind = 108 + Base_Name = 109 + Interface_Declaration_Chain = 110 + Default_Subprogram = 111 + Associated_Subprogram = 112 + Subprogram_Specification = 113 + Sequential_Statement_Chain = 114 + Simultaneous_Statement_Chain = 115 + Subprogram_Body = 116 + Overload_Number = 117 + Subprogram_Depth = 118 + Subprogram_Hash = 119 + Impure_Depth = 120 + Return_Type = 121 + Implicit_Definition = 122 + Uninstantiated_Subprogram_Name = 123 + Default_Value = 124 + Deferred_Declaration = 125 + Deferred_Declaration_Flag = 126 + Shared_Flag = 127 + Design_Unit = 128 + Block_Statement = 129 + Signal_Driver = 130 + Declaration_Chain = 131 + File_Logical_Name = 132 + File_Open_Kind = 133 + Element_Position = 134 + Use_Clause_Chain = 135 + Context_Reference_Chain = 136 + Inherit_Spec_Chain = 137 + Selected_Name = 138 + Type_Declarator = 139 + Complete_Type_Definition = 140 + Incomplete_Type_Ref_Chain = 141 + Associated_Type = 142 + Enumeration_Literal_List = 143 + Entity_Class_Entry_Chain = 144 + Group_Constituent_List = 145 + Unit_Chain = 146 + Primary_Unit = 147 + Identifier = 148 + Label = 149 + Return_Identifier = 150 + Visible_Flag = 151 + Range_Constraint = 152 + Direction = 153 + Left_Limit = 154 + Right_Limit = 155 + Left_Limit_Expr = 156 + Right_Limit_Expr = 157 + Parent_Type = 158 + Simple_Nature = 159 + Base_Nature = 160 + Resolution_Indication = 161 + Record_Element_Resolution_Chain = 162 + Tolerance = 163 + Plus_Terminal_Name = 164 + Minus_Terminal_Name = 165 + Plus_Terminal = 166 + Minus_Terminal = 167 + Magnitude_Expression = 168 + Phase_Expression = 169 + Power_Expression = 170 + Simultaneous_Left = 171 + Simultaneous_Right = 172 + Text_File_Flag = 173 + Only_Characters_Flag = 174 + Is_Character_Type = 175 + Nature_Staticness = 176 + Type_Staticness = 177 + Constraint_State = 178 + Index_Subtype_List = 179 + Index_Subtype_Definition_List = 180 + Element_Subtype_Indication = 181 + Element_Subtype = 182 + Element_Subnature_Indication = 183 + Element_Subnature = 184 + Index_Constraint_List = 185 + Array_Element_Constraint = 186 + Has_Array_Constraint_Flag = 187 + Has_Element_Constraint_Flag = 188 + Elements_Declaration_List = 189 + Owned_Elements_Chain = 190 + Designated_Type = 191 + Designated_Subtype_Indication = 192 + Index_List = 193 + Reference = 194 + Nature_Declarator = 195 + Across_Type_Mark = 196 + Through_Type_Mark = 197 + Across_Type_Definition = 198 + Through_Type_Definition = 199 + Across_Type = 200 + Through_Type = 201 + Target = 202 + Waveform_Chain = 203 + Guard = 204 + Delay_Mechanism = 205 + Reject_Time_Expression = 206 + Force_Mode = 207 + Has_Force_Mode = 208 + Sensitivity_List = 209 + Process_Origin = 210 + Package_Origin = 211 + Condition_Clause = 212 + Break_Element = 213 + Selector_Quantity = 214 + Break_Quantity = 215 + Timeout_Clause = 216 + Postponed_Flag = 217 + Callees_List = 218 + Passive_Flag = 219 + Resolution_Function_Flag = 220 + Wait_State = 221 + All_Sensitized_State = 222 + Seen_Flag = 223 + Pure_Flag = 224 + Foreign_Flag = 225 + Resolved_Flag = 226 + Signal_Type_Flag = 227 + Has_Signal_Flag = 228 + Purity_State = 229 + Elab_Flag = 230 + Vendor_Library_Flag = 231 + Configuration_Mark_Flag = 232 + Configuration_Done_Flag = 233 + Index_Constraint_Flag = 234 + Hide_Implicit_Flag = 235 + Assertion_Condition = 236 + Report_Expression = 237 + Severity_Expression = 238 + Instantiated_Unit = 239 + Instantiated_Header = 240 + Generic_Map_Aspect_Chain = 241 + Port_Map_Aspect_Chain = 242 + Configuration_Name = 243 + Component_Configuration = 244 + Configuration_Specification = 245 + Default_Binding_Indication = 246 + Default_Configuration_Declaration = 247 + Expression = 248 + Conditional_Expression_Chain = 249 + Allocator_Designated_Type = 250 + Selected_Waveform_Chain = 251 + Conditional_Waveform_Chain = 252 + Guard_Expression = 253 + Guard_Decl = 254 + Guard_Sensitivity_List = 255 + Attribute_Implicit_Chain = 256 + Block_Block_Configuration = 257 + Package_Header = 258 + Block_Header = 259 + Uninstantiated_Package_Name = 260 + Uninstantiated_Package_Decl = 261 + Associated_Package = 262 + Instance_Source_File = 263 + Generate_Block_Configuration = 264 + Generate_Statement_Body = 265 + Alternative_Label = 266 + Generate_Else_Clause = 267 + Condition = 268 + Else_Clause = 269 + Parameter_Specification = 270 + Parent = 271 + Loop_Label = 272 + Exit_Flag = 273 + Next_Flag = 274 + Component_Name = 275 + Instantiation_List = 276 + Entity_Aspect = 277 + Default_Entity_Aspect = 278 + Binding_Indication = 279 + Named_Entity = 280 + Referenced_Name = 281 + Expr_Staticness = 282 + Scalar_Size = 283 + Error_Origin = 284 + Operand = 285 + Left = 286 + Right = 287 + Unit_Name = 288 + Name = 289 + Group_Template_Name = 290 + Name_Staticness = 291 + Prefix = 292 + Signature_Prefix = 293 + External_Pathname = 294 + Pathname_Suffix = 295 + Pathname_Expression = 296 + In_Formal_Flag = 297 + Inertial_Flag = 298 + Slice_Subtype = 299 + Suffix = 300 + Index_Subtype = 301 + Parameter = 302 + Parameter_2 = 303 + Parameter_3 = 304 + Parameter_4 = 305 + Attr_Chain = 306 + Attribute_Implicit_Declaration = 307 + Actual_Type = 308 + Actual_Type_Definition = 309 + Association_Chain = 310 + Individual_Association_Chain = 311 + Subprogram_Association_Chain = 312 + Aggregate_Info = 313 + Sub_Aggregate_Info = 314 + Aggr_Dynamic_Flag = 315 + Aggr_Min_Length = 316 + Aggr_Low_Limit = 317 + Aggr_High_Limit = 318 + Aggr_Others_Flag = 319 + Aggr_Named_Flag = 320 + Aggregate_Expand_Flag = 321 + Determined_Aggregate_Flag = 322 + Association_Choices_Chain = 323 + Case_Statement_Alternative_Chain = 324 + Matching_Flag = 325 + Choice_Staticness = 326 + Procedure_Call = 327 + Implementation = 328 + Parameter_Association_Chain = 329 + Method_Object = 330 + Subtype_Type_Mark = 331 + Subnature_Nature_Mark = 332 + Type_Conversion_Subtype = 333 + Type_Mark = 334 + File_Type_Mark = 335 + Return_Type_Mark = 336 + Has_Disconnect_Flag = 337 + Has_Active_Flag = 338 + Is_Within_Flag = 339 + Type_Marks_List = 340 + Implicit_Alias_Flag = 341 + Alias_Signature = 342 + Attribute_Signature = 343 + Overload_List = 344 + Simple_Name_Identifier = 345 + Simple_Name_Subtype = 346 + Protected_Type_Body = 347 + Protected_Type_Declaration = 348 + Use_Flag = 349 + Elaborated_Flag = 350 + End_Has_Reserved_Id = 351 + End_Has_Identifier = 352 + End_Has_Postponed = 353 + Has_Label = 354 + Has_Begin = 355 + Has_End = 356 + Has_Is = 357 + Has_Pure = 358 + Has_Body = 359 + Has_Parameter = 360 + Has_Component = 361 + Has_Identifier_List = 362 + Has_Mode = 363 + Has_Class = 364 + Has_Delay_Mechanism = 365 + Suspend_Flag = 366 + Stop_Flag = 367 + Is_Ref = 368 + Is_Forward_Ref = 369 + Psl_Property = 370 + Psl_Sequence = 371 + Psl_Declaration = 372 + Psl_Expression = 373 + Psl_Boolean = 374 + PSL_Clock = 375 + PSL_NFA = 376 + PSL_Nbr_States = 377 + PSL_Clock_Sensitivity = 378 + PSL_EOS_Flag = 379 + PSL_Abort_Flag = 380 + Count_Expression = 381 + Clock_Expression = 382 + Default_Clock = 383 + Foreign_Node = 384 + Suspend_State_Index = 385 + Suspend_State_Chain = 386 + Suspend_State_Last = 387 + Suspend_State_Decl = 388 def Get_Boolean(node, field): @@ -1119,6 +1120,12 @@ def Has_Instance_Package_Body(kind: IirKind) -> bool: """""" +@export +@BindToLibGHDL("vhdl__nodes_meta__has_owned_instance_package_body") +def Has_Owned_Instance_Package_Body(kind: IirKind) -> bool: + """""" + + @export @BindToLibGHDL("vhdl__nodes_meta__has_need_body") def Has_Need_Body(kind: IirKind) -> bool: 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; -- cgit v1.2.3