diff options
-rw-r--r-- | pyGHDL/libghdl/vhdl/nodes.py | 26 | ||||
-rw-r--r-- | pyGHDL/libghdl/vhdl/nodes_meta.py | 668 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 3 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 32 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 14 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 635 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.ads | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 17 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_assocs.adb | 209 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_assocs.ads | 15 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 78 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_names.adb | 44 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_names.ads | 15 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 2 |
14 files changed, 1016 insertions, 746 deletions
diff --git a/pyGHDL/libghdl/vhdl/nodes.py b/pyGHDL/libghdl/vhdl/nodes.py index e36675608..a0120e8f4 100644 --- a/pyGHDL/libghdl/vhdl/nodes.py +++ b/pyGHDL/libghdl/vhdl/nodes.py @@ -2637,6 +2637,19 @@ def Set_Actual(obj: Iir, value: Iir) -> None: @export +@BindToLibGHDL("vhdl__nodes__get_open_actual") +def Get_Open_Actual(obj: Iir) -> Iir: + """""" + return 0 + + +@export +@BindToLibGHDL("vhdl__nodes__set_open_actual") +def Set_Open_Actual(obj: Iir, value: Iir) -> None: + """""" + + +@export @BindToLibGHDL("vhdl__nodes__get_actual_conversion") def Get_Actual_Conversion(obj: Iir) -> Iir: """""" @@ -3378,6 +3391,19 @@ def Set_Interface_Declaration_Chain(obj: Iir, value: Iir) -> None: @export +@BindToLibGHDL("vhdl__nodes__get_default_subprogram") +def Get_Default_Subprogram(obj: Iir) -> Iir: + """""" + return 0 + + +@export +@BindToLibGHDL("vhdl__nodes__set_default_subprogram") +def Set_Default_Subprogram(obj: Iir, value: Iir) -> None: + """""" + + +@export @BindToLibGHDL("vhdl__nodes__get_subprogram_specification") def Get_Subprogram_Specification(obj: Iir) -> Iir: """""" diff --git a/pyGHDL/libghdl/vhdl/nodes_meta.py b/pyGHDL/libghdl/vhdl/nodes_meta.py index dd38969a8..b2cf84c88 100644 --- a/pyGHDL/libghdl/vhdl/nodes_meta.py +++ b/pyGHDL/libghdl/vhdl/nodes_meta.py @@ -168,333 +168,335 @@ class fields(IntEnum): Designated_Entity = 48 Formal = 49 Actual = 50 - Actual_Conversion = 51 - Formal_Conversion = 52 - Whole_Association_Flag = 53 - Collapse_Signal_Flag = 54 - Artificial_Flag = 55 - Open_Flag = 56 - After_Drivers_Flag = 57 - We_Value = 58 - Time = 59 - Associated_Expr = 60 - Associated_Block = 61 - Associated_Chain = 62 - Choice_Name = 63 - Choice_Expression = 64 - Choice_Range = 65 - Same_Alternative_Flag = 66 - Element_Type_Flag = 67 - Architecture = 68 - Block_Specification = 69 - Prev_Block_Configuration = 70 - Configuration_Item_Chain = 71 - Attribute_Value_Chain = 72 - Spec_Chain = 73 - Value_Chain = 74 - Attribute_Value_Spec_Chain = 75 - Entity_Name = 76 - Package = 77 - Package_Body = 78 - Instance_Package_Body = 79 - Need_Body = 80 - Macro_Expanded_Flag = 81 - Need_Instance_Bodies = 82 - Hierarchical_Name = 83 - Vunit_Item_Chain = 84 - Bound_Vunit_Chain = 85 - Verification_Block_Configuration = 86 - Block_Configuration = 87 - Concurrent_Statement_Chain = 88 - Chain = 89 - Port_Chain = 90 - Generic_Chain = 91 - Type = 92 - Subtype_Indication = 93 - Discrete_Range = 94 - Type_Definition = 95 - Subtype_Definition = 96 - Incomplete_Type_Declaration = 97 - Interface_Type_Subprograms = 98 - Nature_Definition = 99 - Nature = 100 - Subnature_Indication = 101 - Reference_Terminal_Flag = 102 - Mode = 103 - Guarded_Signal_Flag = 104 - Signal_Kind = 105 - Base_Name = 106 - Interface_Declaration_Chain = 107 - Subprogram_Specification = 108 - Sequential_Statement_Chain = 109 - Simultaneous_Statement_Chain = 110 - Subprogram_Body = 111 - Overload_Number = 112 - Subprogram_Depth = 113 - Subprogram_Hash = 114 - Impure_Depth = 115 - Return_Type = 116 - Implicit_Definition = 117 - Uninstantiated_Subprogram_Name = 118 - Default_Value = 119 - Deferred_Declaration = 120 - Deferred_Declaration_Flag = 121 - Shared_Flag = 122 - Design_Unit = 123 - Block_Statement = 124 - Signal_Driver = 125 - Declaration_Chain = 126 - File_Logical_Name = 127 - File_Open_Kind = 128 - Element_Position = 129 - Use_Clause_Chain = 130 - Context_Reference_Chain = 131 - Inherit_Spec_Chain = 132 - Selected_Name = 133 - Type_Declarator = 134 - Complete_Type_Definition = 135 - Incomplete_Type_Ref_Chain = 136 - Associated_Type = 137 - Enumeration_Literal_List = 138 - Entity_Class_Entry_Chain = 139 - Group_Constituent_List = 140 - Unit_Chain = 141 - Primary_Unit = 142 - Identifier = 143 - Label = 144 - Return_Identifier = 145 - Visible_Flag = 146 - Range_Constraint = 147 - Direction = 148 - Left_Limit = 149 - Right_Limit = 150 - Left_Limit_Expr = 151 - Right_Limit_Expr = 152 - Parent_Type = 153 - Simple_Nature = 154 - Base_Nature = 155 - Resolution_Indication = 156 - Record_Element_Resolution_Chain = 157 - Tolerance = 158 - Plus_Terminal_Name = 159 - Minus_Terminal_Name = 160 - Plus_Terminal = 161 - Minus_Terminal = 162 - Magnitude_Expression = 163 - Phase_Expression = 164 - Power_Expression = 165 - Simultaneous_Left = 166 - Simultaneous_Right = 167 - Text_File_Flag = 168 - Only_Characters_Flag = 169 - Is_Character_Type = 170 - Nature_Staticness = 171 - Type_Staticness = 172 - Constraint_State = 173 - Index_Subtype_List = 174 - Index_Subtype_Definition_List = 175 - Element_Subtype_Indication = 176 - Element_Subtype = 177 - Element_Subnature_Indication = 178 - Element_Subnature = 179 - Index_Constraint_List = 180 - Array_Element_Constraint = 181 - Has_Array_Constraint_Flag = 182 - Has_Element_Constraint_Flag = 183 - Elements_Declaration_List = 184 - Owned_Elements_Chain = 185 - Designated_Type = 186 - Designated_Subtype_Indication = 187 - Index_List = 188 - Reference = 189 - Nature_Declarator = 190 - Across_Type_Mark = 191 - Through_Type_Mark = 192 - Across_Type_Definition = 193 - Through_Type_Definition = 194 - Across_Type = 195 - Through_Type = 196 - Target = 197 - Waveform_Chain = 198 - Guard = 199 - Delay_Mechanism = 200 - Reject_Time_Expression = 201 - Force_Mode = 202 - Has_Force_Mode = 203 - Sensitivity_List = 204 - Process_Origin = 205 - Package_Origin = 206 - Condition_Clause = 207 - Break_Element = 208 - Selector_Quantity = 209 - Break_Quantity = 210 - Timeout_Clause = 211 - Postponed_Flag = 212 - Callees_List = 213 - Passive_Flag = 214 - Resolution_Function_Flag = 215 - Wait_State = 216 - All_Sensitized_State = 217 - Seen_Flag = 218 - Pure_Flag = 219 - Foreign_Flag = 220 - Resolved_Flag = 221 - Signal_Type_Flag = 222 - Has_Signal_Flag = 223 - Purity_State = 224 - Elab_Flag = 225 - Vendor_Library_Flag = 226 - Configuration_Mark_Flag = 227 - Configuration_Done_Flag = 228 - Index_Constraint_Flag = 229 - Hide_Implicit_Flag = 230 - Assertion_Condition = 231 - Report_Expression = 232 - Severity_Expression = 233 - Instantiated_Unit = 234 - Generic_Map_Aspect_Chain = 235 - Port_Map_Aspect_Chain = 236 - Configuration_Name = 237 - Component_Configuration = 238 - Configuration_Specification = 239 - Default_Binding_Indication = 240 - Default_Configuration_Declaration = 241 - Expression = 242 - Conditional_Expression_Chain = 243 - Allocator_Designated_Type = 244 - Selected_Waveform_Chain = 245 - Conditional_Waveform_Chain = 246 - Guard_Expression = 247 - Guard_Decl = 248 - Guard_Sensitivity_List = 249 - Attribute_Implicit_Chain = 250 - Block_Block_Configuration = 251 - Package_Header = 252 - Block_Header = 253 - Uninstantiated_Package_Name = 254 - Uninstantiated_Package_Decl = 255 - Instance_Source_File = 256 - Generate_Block_Configuration = 257 - Generate_Statement_Body = 258 - Alternative_Label = 259 - Generate_Else_Clause = 260 - Condition = 261 - Else_Clause = 262 - Parameter_Specification = 263 - Parent = 264 - Loop_Label = 265 - Exit_Flag = 266 - Next_Flag = 267 - Component_Name = 268 - Instantiation_List = 269 - Entity_Aspect = 270 - Default_Entity_Aspect = 271 - Binding_Indication = 272 - Named_Entity = 273 - Referenced_Name = 274 - Expr_Staticness = 275 - Scalar_Size = 276 - Error_Origin = 277 - Operand = 278 - Left = 279 - Right = 280 - Unit_Name = 281 - Name = 282 - Group_Template_Name = 283 - Name_Staticness = 284 - Prefix = 285 - Signature_Prefix = 286 - External_Pathname = 287 - Pathname_Suffix = 288 - Pathname_Expression = 289 - In_Formal_Flag = 290 - Inertial_Flag = 291 - Slice_Subtype = 292 - Suffix = 293 - Index_Subtype = 294 - Parameter = 295 - Parameter_2 = 296 - Parameter_3 = 297 - Parameter_4 = 298 - Attr_Chain = 299 - Attribute_Implicit_Declaration = 300 - Actual_Type = 301 - Actual_Type_Definition = 302 - Association_Chain = 303 - Individual_Association_Chain = 304 - Subprogram_Association_Chain = 305 - Aggregate_Info = 306 - Sub_Aggregate_Info = 307 - Aggr_Dynamic_Flag = 308 - Aggr_Min_Length = 309 - Aggr_Low_Limit = 310 - Aggr_High_Limit = 311 - Aggr_Others_Flag = 312 - Aggr_Named_Flag = 313 - Aggregate_Expand_Flag = 314 - Association_Choices_Chain = 315 - Case_Statement_Alternative_Chain = 316 - Matching_Flag = 317 - Choice_Staticness = 318 - Procedure_Call = 319 - Implementation = 320 - Parameter_Association_Chain = 321 - Method_Object = 322 - Subtype_Type_Mark = 323 - Subnature_Nature_Mark = 324 - Type_Conversion_Subtype = 325 - Type_Mark = 326 - File_Type_Mark = 327 - Return_Type_Mark = 328 - Has_Disconnect_Flag = 329 - Has_Active_Flag = 330 - Is_Within_Flag = 331 - Type_Marks_List = 332 - Implicit_Alias_Flag = 333 - Alias_Signature = 334 - Attribute_Signature = 335 - Overload_List = 336 - Simple_Name_Identifier = 337 - Simple_Name_Subtype = 338 - Protected_Type_Body = 339 - Protected_Type_Declaration = 340 - Use_Flag = 341 - End_Has_Reserved_Id = 342 - End_Has_Identifier = 343 - End_Has_Postponed = 344 - Has_Label = 345 - Has_Begin = 346 - Has_End = 347 - Has_Is = 348 - Has_Pure = 349 - Has_Body = 350 - Has_Parameter = 351 - Has_Component = 352 - Has_Identifier_List = 353 - Has_Mode = 354 - Has_Class = 355 - Has_Delay_Mechanism = 356 - Suspend_Flag = 357 - Stop_Flag = 358 - Is_Ref = 359 - Is_Forward_Ref = 360 - Psl_Property = 361 - Psl_Sequence = 362 - Psl_Declaration = 363 - Psl_Expression = 364 - Psl_Boolean = 365 - PSL_Clock = 366 - PSL_NFA = 367 - PSL_Nbr_States = 368 - PSL_Clock_Sensitivity = 369 - PSL_EOS_Flag = 370 - PSL_Abort_Flag = 371 - Count_Expression = 372 - Clock_Expression = 373 - Default_Clock = 374 - Foreign_Node = 375 - Suspend_State_Index = 376 - Suspend_State_Chain = 377 + Open_Actual = 51 + Actual_Conversion = 52 + Formal_Conversion = 53 + Whole_Association_Flag = 54 + Collapse_Signal_Flag = 55 + Artificial_Flag = 56 + Open_Flag = 57 + After_Drivers_Flag = 58 + We_Value = 59 + Time = 60 + Associated_Expr = 61 + Associated_Block = 62 + Associated_Chain = 63 + Choice_Name = 64 + Choice_Expression = 65 + Choice_Range = 66 + Same_Alternative_Flag = 67 + Element_Type_Flag = 68 + Architecture = 69 + Block_Specification = 70 + Prev_Block_Configuration = 71 + Configuration_Item_Chain = 72 + Attribute_Value_Chain = 73 + Spec_Chain = 74 + Value_Chain = 75 + Attribute_Value_Spec_Chain = 76 + Entity_Name = 77 + Package = 78 + Package_Body = 79 + Instance_Package_Body = 80 + Need_Body = 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 + Nature_Definition = 100 + Nature = 101 + Subnature_Indication = 102 + Reference_Terminal_Flag = 103 + Mode = 104 + Guarded_Signal_Flag = 105 + Signal_Kind = 106 + Base_Name = 107 + Interface_Declaration_Chain = 108 + Default_Subprogram = 109 + Subprogram_Specification = 110 + Sequential_Statement_Chain = 111 + Simultaneous_Statement_Chain = 112 + Subprogram_Body = 113 + Overload_Number = 114 + Subprogram_Depth = 115 + Subprogram_Hash = 116 + Impure_Depth = 117 + Return_Type = 118 + Implicit_Definition = 119 + Uninstantiated_Subprogram_Name = 120 + Default_Value = 121 + Deferred_Declaration = 122 + Deferred_Declaration_Flag = 123 + Shared_Flag = 124 + Design_Unit = 125 + Block_Statement = 126 + Signal_Driver = 127 + Declaration_Chain = 128 + File_Logical_Name = 129 + File_Open_Kind = 130 + Element_Position = 131 + Use_Clause_Chain = 132 + Context_Reference_Chain = 133 + Inherit_Spec_Chain = 134 + Selected_Name = 135 + Type_Declarator = 136 + Complete_Type_Definition = 137 + Incomplete_Type_Ref_Chain = 138 + Associated_Type = 139 + Enumeration_Literal_List = 140 + Entity_Class_Entry_Chain = 141 + Group_Constituent_List = 142 + Unit_Chain = 143 + Primary_Unit = 144 + Identifier = 145 + Label = 146 + Return_Identifier = 147 + Visible_Flag = 148 + Range_Constraint = 149 + Direction = 150 + Left_Limit = 151 + Right_Limit = 152 + Left_Limit_Expr = 153 + Right_Limit_Expr = 154 + Parent_Type = 155 + Simple_Nature = 156 + Base_Nature = 157 + Resolution_Indication = 158 + Record_Element_Resolution_Chain = 159 + Tolerance = 160 + Plus_Terminal_Name = 161 + Minus_Terminal_Name = 162 + Plus_Terminal = 163 + Minus_Terminal = 164 + Magnitude_Expression = 165 + Phase_Expression = 166 + Power_Expression = 167 + Simultaneous_Left = 168 + Simultaneous_Right = 169 + Text_File_Flag = 170 + Only_Characters_Flag = 171 + Is_Character_Type = 172 + Nature_Staticness = 173 + Type_Staticness = 174 + Constraint_State = 175 + Index_Subtype_List = 176 + Index_Subtype_Definition_List = 177 + Element_Subtype_Indication = 178 + Element_Subtype = 179 + Element_Subnature_Indication = 180 + Element_Subnature = 181 + Index_Constraint_List = 182 + Array_Element_Constraint = 183 + Has_Array_Constraint_Flag = 184 + Has_Element_Constraint_Flag = 185 + Elements_Declaration_List = 186 + Owned_Elements_Chain = 187 + Designated_Type = 188 + Designated_Subtype_Indication = 189 + Index_List = 190 + Reference = 191 + Nature_Declarator = 192 + Across_Type_Mark = 193 + Through_Type_Mark = 194 + Across_Type_Definition = 195 + Through_Type_Definition = 196 + Across_Type = 197 + Through_Type = 198 + Target = 199 + Waveform_Chain = 200 + Guard = 201 + Delay_Mechanism = 202 + Reject_Time_Expression = 203 + Force_Mode = 204 + Has_Force_Mode = 205 + Sensitivity_List = 206 + Process_Origin = 207 + Package_Origin = 208 + Condition_Clause = 209 + Break_Element = 210 + Selector_Quantity = 211 + Break_Quantity = 212 + Timeout_Clause = 213 + Postponed_Flag = 214 + Callees_List = 215 + Passive_Flag = 216 + Resolution_Function_Flag = 217 + Wait_State = 218 + All_Sensitized_State = 219 + Seen_Flag = 220 + Pure_Flag = 221 + Foreign_Flag = 222 + Resolved_Flag = 223 + Signal_Type_Flag = 224 + Has_Signal_Flag = 225 + Purity_State = 226 + Elab_Flag = 227 + Vendor_Library_Flag = 228 + Configuration_Mark_Flag = 229 + Configuration_Done_Flag = 230 + Index_Constraint_Flag = 231 + Hide_Implicit_Flag = 232 + Assertion_Condition = 233 + Report_Expression = 234 + Severity_Expression = 235 + Instantiated_Unit = 236 + Generic_Map_Aspect_Chain = 237 + Port_Map_Aspect_Chain = 238 + Configuration_Name = 239 + Component_Configuration = 240 + Configuration_Specification = 241 + Default_Binding_Indication = 242 + Default_Configuration_Declaration = 243 + Expression = 244 + Conditional_Expression_Chain = 245 + Allocator_Designated_Type = 246 + Selected_Waveform_Chain = 247 + Conditional_Waveform_Chain = 248 + Guard_Expression = 249 + Guard_Decl = 250 + Guard_Sensitivity_List = 251 + Attribute_Implicit_Chain = 252 + Block_Block_Configuration = 253 + Package_Header = 254 + Block_Header = 255 + Uninstantiated_Package_Name = 256 + Uninstantiated_Package_Decl = 257 + Instance_Source_File = 258 + Generate_Block_Configuration = 259 + Generate_Statement_Body = 260 + Alternative_Label = 261 + Generate_Else_Clause = 262 + Condition = 263 + Else_Clause = 264 + Parameter_Specification = 265 + Parent = 266 + Loop_Label = 267 + Exit_Flag = 268 + Next_Flag = 269 + Component_Name = 270 + Instantiation_List = 271 + Entity_Aspect = 272 + Default_Entity_Aspect = 273 + Binding_Indication = 274 + Named_Entity = 275 + Referenced_Name = 276 + Expr_Staticness = 277 + Scalar_Size = 278 + Error_Origin = 279 + Operand = 280 + Left = 281 + Right = 282 + Unit_Name = 283 + Name = 284 + Group_Template_Name = 285 + Name_Staticness = 286 + Prefix = 287 + Signature_Prefix = 288 + External_Pathname = 289 + Pathname_Suffix = 290 + Pathname_Expression = 291 + In_Formal_Flag = 292 + Inertial_Flag = 293 + Slice_Subtype = 294 + Suffix = 295 + Index_Subtype = 296 + Parameter = 297 + Parameter_2 = 298 + Parameter_3 = 299 + Parameter_4 = 300 + Attr_Chain = 301 + Attribute_Implicit_Declaration = 302 + Actual_Type = 303 + Actual_Type_Definition = 304 + Association_Chain = 305 + Individual_Association_Chain = 306 + Subprogram_Association_Chain = 307 + Aggregate_Info = 308 + Sub_Aggregate_Info = 309 + Aggr_Dynamic_Flag = 310 + Aggr_Min_Length = 311 + Aggr_Low_Limit = 312 + Aggr_High_Limit = 313 + Aggr_Others_Flag = 314 + Aggr_Named_Flag = 315 + Aggregate_Expand_Flag = 316 + Association_Choices_Chain = 317 + Case_Statement_Alternative_Chain = 318 + Matching_Flag = 319 + Choice_Staticness = 320 + Procedure_Call = 321 + Implementation = 322 + Parameter_Association_Chain = 323 + Method_Object = 324 + Subtype_Type_Mark = 325 + Subnature_Nature_Mark = 326 + Type_Conversion_Subtype = 327 + Type_Mark = 328 + File_Type_Mark = 329 + Return_Type_Mark = 330 + Has_Disconnect_Flag = 331 + Has_Active_Flag = 332 + Is_Within_Flag = 333 + Type_Marks_List = 334 + Implicit_Alias_Flag = 335 + Alias_Signature = 336 + Attribute_Signature = 337 + Overload_List = 338 + Simple_Name_Identifier = 339 + Simple_Name_Subtype = 340 + Protected_Type_Body = 341 + Protected_Type_Declaration = 342 + Use_Flag = 343 + End_Has_Reserved_Id = 344 + End_Has_Identifier = 345 + End_Has_Postponed = 346 + Has_Label = 347 + Has_Begin = 348 + Has_End = 349 + Has_Is = 350 + Has_Pure = 351 + Has_Body = 352 + Has_Parameter = 353 + Has_Component = 354 + Has_Identifier_List = 355 + Has_Mode = 356 + Has_Class = 357 + Has_Delay_Mechanism = 358 + Suspend_Flag = 359 + Stop_Flag = 360 + Is_Ref = 361 + Is_Forward_Ref = 362 + Psl_Property = 363 + Psl_Sequence = 364 + Psl_Declaration = 365 + Psl_Expression = 366 + Psl_Boolean = 367 + PSL_Clock = 368 + PSL_NFA = 369 + PSL_Nbr_States = 370 + PSL_Clock_Sensitivity = 371 + PSL_EOS_Flag = 372 + PSL_Abort_Flag = 373 + Count_Expression = 374 + Clock_Expression = 375 + Default_Clock = 376 + Foreign_Node = 377 + Suspend_State_Index = 378 + Suspend_State_Chain = 379 def Get_Boolean(node, field): @@ -936,6 +938,12 @@ def Has_Actual(kind: IirKind) -> bool: @export +@BindToLibGHDL("vhdl__nodes_meta__has_open_actual") +def Has_Open_Actual(kind: IirKind) -> bool: + """""" + + +@export @BindToLibGHDL("vhdl__nodes_meta__has_actual_conversion") def Has_Actual_Conversion(kind: IirKind) -> bool: """""" @@ -1278,6 +1286,12 @@ def Has_Interface_Declaration_Chain(kind: IirKind) -> bool: @export +@BindToLibGHDL("vhdl__nodes_meta__has_default_subprogram") +def Has_Default_Subprogram(kind: IirKind) -> bool: + """""" + + +@export @BindToLibGHDL("vhdl__nodes_meta__has_subprogram_specification") def Has_Subprogram_Specification(kind: IirKind) -> bool: """""" diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index e9b11f8eb..8ee426293 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -850,6 +850,9 @@ package body Trans.Chap5 is Set_Map_Env (Formal_Env); Chap2.Elab_Package_Instantiation_Declaration (Formal); Set_Map_Env (Actual_Env); + when Iir_Kinds_Interface_Subprogram_Declaration => + -- Expanded. + null; when others => Error_Kind ("elab_generic_map_aspect(open)", Formal); end case; diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 71914dfd3..9b6329c74 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -2197,6 +2197,22 @@ package body Vhdl.Nodes is Set_Field3 (Target, Actual); end Set_Actual; + function Get_Open_Actual (Target : Iir) return Iir is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Open_Actual (Get_Kind (Target)), + "no field Open_Actual"); + return Get_Field3 (Target); + end Get_Open_Actual; + + procedure Set_Open_Actual (Target : Iir; Actual : Iir) is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Open_Actual (Get_Kind (Target)), + "no field Open_Actual"); + Set_Field3 (Target, Actual); + end Set_Open_Actual; + function Get_Actual_Conversion (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); @@ -3132,6 +3148,22 @@ package body Vhdl.Nodes is Set_Field5 (Target, Chain); end Set_Interface_Declaration_Chain; + function Get_Default_Subprogram (Inter : Iir) return Iir is + begin + pragma Assert (Inter /= Null_Iir); + pragma Assert (Has_Default_Subprogram (Get_Kind (Inter)), + "no field Default_Subprogram"); + return Get_Field9 (Inter); + end Get_Default_Subprogram; + + procedure Set_Default_Subprogram (Inter : Iir; Subprg : Iir) is + begin + pragma Assert (Inter /= Null_Iir); + pragma Assert (Has_Default_Subprogram (Get_Kind (Inter)), + "no field Default_Subprogram"); + Set_Field9 (Inter, Subprg); + end Set_Default_Subprogram; + function Get_Subprogram_Specification (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 0fc291be2..376c99daa 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -449,6 +449,10 @@ package Vhdl.Nodes is -- Only for Iir_Kind_Association_Element_Terminal: -- Get/Set_Actual (Field3) -- + -- For '<>' default interface subprogram. + -- Only for Iir_Kind_Association_Element_Open: + -- Get/Set_Open_Actual (Field3) + -- -- Only for Iir_Kind_Association_Element_By_Individual: -- Get/Set_Individual_Association_Chain (Field4) -- @@ -1772,6 +1776,8 @@ package Vhdl.Nodes is -- -- Get/Set_Return_Type_Mark (Field8) -- + -- Get/Set_Default_Subprogram (Field9) + -- -- Get/Set_Subprogram_Depth (Field10) -- -- Get/Set_Seen_Flag (Flag1) @@ -7909,6 +7915,10 @@ package Vhdl.Nodes is function Get_Actual (Target : Iir) return Iir; procedure Set_Actual (Target : Iir; Actual : Iir); + -- Field: Field3 Ref + function Get_Open_Actual (Target : Iir) return Iir; + procedure Set_Open_Actual (Target : Iir; Actual : Iir); + -- Field: Field4 function Get_Actual_Conversion (Target : Iir) return Iir; procedure Set_Actual_Conversion (Target : Iir; Conv : Iir); @@ -8194,6 +8204,10 @@ package Vhdl.Nodes is procedure Set_Interface_Declaration_Chain (Target : Iir; Chain : Iir); pragma Inline (Get_Interface_Declaration_Chain); + -- Field: Field9 + function Get_Default_Subprogram (Inter : Iir) return Iir; + procedure Set_Default_Subprogram (Inter : Iir; Subprg : Iir); + -- Field: Field6 Ref function Get_Subprogram_Specification (Target : Iir) return Iir; procedure Set_Subprogram_Specification (Target : Iir; Spec : Iir); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 656cc2aef..2d92d3bae 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -68,6 +68,7 @@ package body Vhdl.Nodes_Meta is Field_Designated_Entity => Type_Iir, Field_Formal => Type_Iir, Field_Actual => Type_Iir, + Field_Open_Actual => Type_Iir, Field_Actual_Conversion => Type_Iir, Field_Formal_Conversion => Type_Iir, Field_Whole_Association_Flag => Type_Boolean, @@ -125,6 +126,7 @@ package body Vhdl.Nodes_Meta is Field_Signal_Kind => Type_Iir_Signal_Kind, Field_Base_Name => Type_Iir, Field_Interface_Declaration_Chain => Type_Iir, + Field_Default_Subprogram => Type_Iir, Field_Subprogram_Specification => Type_Iir, Field_Sequential_Statement_Chain => Type_Iir, Field_Simultaneous_Statement_Chain => Type_Iir, @@ -507,6 +509,8 @@ package body Vhdl.Nodes_Meta is return "formal"; when Field_Actual => return "actual"; + when Field_Open_Actual => + return "open_actual"; when Field_Actual_Conversion => return "actual_conversion"; when Field_Formal_Conversion => @@ -621,6 +625,8 @@ package body Vhdl.Nodes_Meta is return "base_name"; when Field_Interface_Declaration_Chain => return "interface_declaration_chain"; + when Field_Default_Subprogram => + return "default_subprogram"; when Field_Subprogram_Specification => return "subprogram_specification"; when Field_Sequential_Statement_Chain => @@ -1919,6 +1925,8 @@ package body Vhdl.Nodes_Meta is return Attr_None; when Field_Actual => return Attr_None; + when Field_Open_Actual => + return Attr_Ref; when Field_Actual_Conversion => return Attr_None; when Field_Formal_Conversion => @@ -2033,6 +2041,8 @@ package body Vhdl.Nodes_Meta is return Attr_Ref; when Field_Interface_Declaration_Chain => return Attr_Chain; + when Field_Default_Subprogram => + return Attr_None; when Field_Subprogram_Specification => return Attr_Ref; when Field_Sequential_Statement_Chain => @@ -2740,6 +2750,7 @@ package body Vhdl.Nodes_Meta is Field_In_Formal_Flag, Field_Formal, Field_Chain, + Field_Open_Actual, -- Iir_Kind_Association_Element_Package Field_Whole_Association_Flag, Field_Collapse_Signal_Flag, @@ -3935,6 +3946,7 @@ package body Vhdl.Nodes_Meta is Field_Chain, Field_Interface_Declaration_Chain, Field_Return_Type_Mark, + Field_Default_Subprogram, -- Iir_Kind_Interface_Procedure_Declaration Field_Subprogram_Depth, Field_Identifier, @@ -3950,6 +3962,7 @@ package body Vhdl.Nodes_Meta is Field_Chain, Field_Interface_Declaration_Chain, Field_Return_Type_Mark, + Field_Default_Subprogram, -- Iir_Kind_Attribute_Implicit_Declaration Field_Parent, Field_Chain, @@ -5328,305 +5341,305 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Association_Element_By_Expression => 114, Iir_Kind_Association_Element_By_Name => 122, Iir_Kind_Association_Element_By_Individual => 131, - Iir_Kind_Association_Element_Open => 137, - Iir_Kind_Association_Element_Package => 143, - Iir_Kind_Association_Element_Type => 151, - Iir_Kind_Association_Element_Subprogram => 157, - Iir_Kind_Association_Element_Terminal => 163, - Iir_Kind_Choice_By_Range => 171, - Iir_Kind_Choice_By_Expression => 179, - Iir_Kind_Choice_By_Others => 185, - Iir_Kind_Choice_By_None => 191, - Iir_Kind_Choice_By_Name => 198, - Iir_Kind_Entity_Aspect_Entity => 200, - Iir_Kind_Entity_Aspect_Configuration => 201, - Iir_Kind_Entity_Aspect_Open => 201, - Iir_Kind_Psl_Hierarchical_Name => 203, - Iir_Kind_Block_Configuration => 209, - Iir_Kind_Block_Header => 213, - Iir_Kind_Component_Configuration => 220, - Iir_Kind_Binding_Indication => 224, - Iir_Kind_Entity_Class => 226, - Iir_Kind_Attribute_Value => 234, - Iir_Kind_Signature => 239, - Iir_Kind_Aggregate_Info => 246, - Iir_Kind_Procedure_Call => 250, - Iir_Kind_Record_Element_Constraint => 258, - Iir_Kind_Array_Element_Resolution => 260, - Iir_Kind_Record_Resolution => 261, - Iir_Kind_Record_Element_Resolution => 264, - Iir_Kind_Break_Element => 268, - Iir_Kind_Attribute_Specification => 277, - Iir_Kind_Disconnection_Specification => 283, - Iir_Kind_Step_Limit_Specification => 289, - Iir_Kind_Configuration_Specification => 295, - Iir_Kind_Access_Type_Definition => 302, - Iir_Kind_Incomplete_Type_Definition => 309, - Iir_Kind_Interface_Type_Definition => 315, - Iir_Kind_File_Type_Definition => 321, - Iir_Kind_Protected_Type_Declaration => 331, - Iir_Kind_Record_Type_Definition => 341, - Iir_Kind_Array_Type_Definition => 352, - Iir_Kind_Array_Subtype_Definition => 369, - Iir_Kind_Record_Subtype_Definition => 382, - Iir_Kind_Access_Subtype_Definition => 390, - Iir_Kind_Physical_Subtype_Definition => 400, - Iir_Kind_Floating_Subtype_Definition => 411, - Iir_Kind_Integer_Subtype_Definition => 421, - Iir_Kind_Enumeration_Subtype_Definition => 431, - Iir_Kind_Enumeration_Type_Definition => 442, - Iir_Kind_Integer_Type_Definition => 450, - Iir_Kind_Floating_Type_Definition => 458, - Iir_Kind_Physical_Type_Definition => 469, - Iir_Kind_Range_Expression => 477, - Iir_Kind_Protected_Type_Body => 485, - Iir_Kind_Wildcard_Type_Definition => 489, - Iir_Kind_Foreign_Vector_Type_Definition => 490, - Iir_Kind_Subtype_Definition => 497, - Iir_Kind_Scalar_Nature_Definition => 505, - Iir_Kind_Record_Nature_Definition => 518, - Iir_Kind_Array_Nature_Definition => 532, - Iir_Kind_Array_Subnature_Definition => 547, - Iir_Kind_Overload_List => 548, - Iir_Kind_Foreign_Module => 553, - Iir_Kind_Entity_Declaration => 566, - Iir_Kind_Configuration_Declaration => 576, - Iir_Kind_Context_Declaration => 582, - Iir_Kind_Package_Declaration => 597, - Iir_Kind_Package_Instantiation_Declaration => 611, - Iir_Kind_Vmode_Declaration => 623, - Iir_Kind_Vprop_Declaration => 635, - Iir_Kind_Vunit_Declaration => 648, - Iir_Kind_Package_Body => 656, - Iir_Kind_Architecture_Body => 669, - Iir_Kind_Type_Declaration => 676, - Iir_Kind_Anonymous_Type_Declaration => 682, - Iir_Kind_Subtype_Declaration => 690, - Iir_Kind_Nature_Declaration => 696, - Iir_Kind_Subnature_Declaration => 703, - Iir_Kind_Package_Header => 705, - Iir_Kind_Unit_Declaration => 714, - Iir_Kind_Library_Declaration => 722, - Iir_Kind_Component_Declaration => 732, - Iir_Kind_Attribute_Declaration => 739, - Iir_Kind_Group_Template_Declaration => 745, - Iir_Kind_Group_Declaration => 752, - Iir_Kind_Element_Declaration => 760, - Iir_Kind_Nature_Element_Declaration => 767, - Iir_Kind_Non_Object_Alias_Declaration => 775, - Iir_Kind_Psl_Declaration => 783, - Iir_Kind_Psl_Endpoint_Declaration => 797, - Iir_Kind_Enumeration_Literal => 809, - Iir_Kind_Function_Declaration => 835, - Iir_Kind_Procedure_Declaration => 858, - Iir_Kind_Function_Body => 868, - Iir_Kind_Procedure_Body => 879, - Iir_Kind_Function_Instantiation_Declaration => 890, - Iir_Kind_Procedure_Instantiation_Declaration => 900, - Iir_Kind_Terminal_Declaration => 910, - Iir_Kind_Object_Alias_Declaration => 922, - Iir_Kind_Free_Quantity_Declaration => 934, - Iir_Kind_Spectrum_Quantity_Declaration => 947, - Iir_Kind_Noise_Quantity_Declaration => 959, - Iir_Kind_Across_Quantity_Declaration => 975, - Iir_Kind_Through_Quantity_Declaration => 991, - Iir_Kind_File_Declaration => 1006, - Iir_Kind_Guard_Signal_Declaration => 1020, - Iir_Kind_Signal_Declaration => 1037, - Iir_Kind_Variable_Declaration => 1050, - Iir_Kind_Constant_Declaration => 1064, - Iir_Kind_Iterator_Declaration => 1076, - Iir_Kind_Interface_Constant_Declaration => 1093, - Iir_Kind_Interface_Variable_Declaration => 1109, - Iir_Kind_Interface_Signal_Declaration => 1130, - Iir_Kind_Interface_File_Declaration => 1146, - Iir_Kind_Interface_Quantity_Declaration => 1162, - Iir_Kind_Interface_Terminal_Declaration => 1174, - Iir_Kind_Interface_Type_Declaration => 1185, - Iir_Kind_Interface_Package_Declaration => 1198, - Iir_Kind_Interface_Function_Declaration => 1216, - Iir_Kind_Interface_Procedure_Declaration => 1230, - Iir_Kind_Attribute_Implicit_Declaration => 1233, - Iir_Kind_Suspend_State_Declaration => 1236, - Iir_Kind_Identity_Operator => 1240, - Iir_Kind_Negation_Operator => 1244, - Iir_Kind_Absolute_Operator => 1248, - Iir_Kind_Not_Operator => 1252, - Iir_Kind_Implicit_Condition_Operator => 1256, - Iir_Kind_Condition_Operator => 1260, - Iir_Kind_Reduction_And_Operator => 1264, - Iir_Kind_Reduction_Or_Operator => 1268, - Iir_Kind_Reduction_Nand_Operator => 1272, - Iir_Kind_Reduction_Nor_Operator => 1276, - Iir_Kind_Reduction_Xor_Operator => 1280, - Iir_Kind_Reduction_Xnor_Operator => 1284, - Iir_Kind_And_Operator => 1289, - Iir_Kind_Or_Operator => 1294, - Iir_Kind_Nand_Operator => 1299, - Iir_Kind_Nor_Operator => 1304, - Iir_Kind_Xor_Operator => 1309, - Iir_Kind_Xnor_Operator => 1314, - Iir_Kind_Equality_Operator => 1319, - Iir_Kind_Inequality_Operator => 1324, - Iir_Kind_Less_Than_Operator => 1329, - Iir_Kind_Less_Than_Or_Equal_Operator => 1334, - Iir_Kind_Greater_Than_Operator => 1339, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1344, - Iir_Kind_Match_Equality_Operator => 1349, - Iir_Kind_Match_Inequality_Operator => 1354, - Iir_Kind_Match_Less_Than_Operator => 1359, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1364, - Iir_Kind_Match_Greater_Than_Operator => 1369, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1374, - Iir_Kind_Sll_Operator => 1379, - Iir_Kind_Sla_Operator => 1384, - Iir_Kind_Srl_Operator => 1389, - Iir_Kind_Sra_Operator => 1394, - Iir_Kind_Rol_Operator => 1399, - Iir_Kind_Ror_Operator => 1404, - Iir_Kind_Addition_Operator => 1409, - Iir_Kind_Substraction_Operator => 1414, - Iir_Kind_Concatenation_Operator => 1419, - Iir_Kind_Multiplication_Operator => 1424, - Iir_Kind_Division_Operator => 1429, - Iir_Kind_Modulus_Operator => 1434, - Iir_Kind_Remainder_Operator => 1439, - Iir_Kind_Exponentiation_Operator => 1444, - Iir_Kind_Function_Call => 1452, - Iir_Kind_Aggregate => 1459, - Iir_Kind_Parenthesis_Expression => 1462, - Iir_Kind_Qualified_Expression => 1466, - Iir_Kind_Type_Conversion => 1471, - Iir_Kind_Allocator_By_Expression => 1476, - Iir_Kind_Allocator_By_Subtype => 1482, - Iir_Kind_Selected_Element => 1490, - Iir_Kind_Dereference => 1495, - Iir_Kind_Implicit_Dereference => 1500, - Iir_Kind_Slice_Name => 1507, - Iir_Kind_Indexed_Name => 1513, - Iir_Kind_Psl_Prev => 1519, - Iir_Kind_Psl_Stable => 1524, - Iir_Kind_Psl_Rose => 1529, - Iir_Kind_Psl_Fell => 1534, - Iir_Kind_Psl_Onehot => 1537, - Iir_Kind_Psl_Onehot0 => 1540, - Iir_Kind_Psl_Expression => 1542, - Iir_Kind_Sensitized_Process_Statement => 1564, - Iir_Kind_Process_Statement => 1585, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1598, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1611, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1625, - Iir_Kind_Concurrent_Assertion_Statement => 1633, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1640, - Iir_Kind_Concurrent_Break_Statement => 1648, - Iir_Kind_Psl_Assert_Directive => 1662, - Iir_Kind_Psl_Assume_Directive => 1674, - Iir_Kind_Psl_Cover_Directive => 1686, - Iir_Kind_Psl_Restrict_Directive => 1697, - Iir_Kind_Block_Statement => 1711, - Iir_Kind_If_Generate_Statement => 1722, - Iir_Kind_Case_Generate_Statement => 1731, - Iir_Kind_For_Generate_Statement => 1740, - Iir_Kind_Component_Instantiation_Statement => 1751, - Iir_Kind_Psl_Default_Clock => 1754, - Iir_Kind_Generate_Statement_Body => 1765, - Iir_Kind_If_Generate_Else_Clause => 1771, - Iir_Kind_Simple_Simultaneous_Statement => 1778, - Iir_Kind_Simultaneous_Null_Statement => 1782, - Iir_Kind_Simultaneous_Procedural_Statement => 1793, - Iir_Kind_Simultaneous_Case_Statement => 1802, - Iir_Kind_Simultaneous_If_Statement => 1811, - Iir_Kind_Simultaneous_Elsif => 1817, - Iir_Kind_Simple_Signal_Assignment_Statement => 1828, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1839, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1851, - Iir_Kind_Signal_Force_Assignment_Statement => 1861, - Iir_Kind_Signal_Release_Assignment_Statement => 1870, - Iir_Kind_Null_Statement => 1874, - Iir_Kind_Assertion_Statement => 1881, - Iir_Kind_Report_Statement => 1887, - Iir_Kind_Wait_Statement => 1895, - Iir_Kind_Variable_Assignment_Statement => 1902, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1909, - Iir_Kind_Return_Statement => 1915, - Iir_Kind_For_Loop_Statement => 1926, - Iir_Kind_While_Loop_Statement => 1937, - Iir_Kind_Next_Statement => 1944, - Iir_Kind_Exit_Statement => 1951, - Iir_Kind_Case_Statement => 1960, - Iir_Kind_Procedure_Call_Statement => 1966, - Iir_Kind_Break_Statement => 1973, - Iir_Kind_If_Statement => 1983, - Iir_Kind_Suspend_State_Statement => 1987, - Iir_Kind_Elsif => 1993, - Iir_Kind_Character_Literal => 2000, - Iir_Kind_Simple_Name => 2007, - Iir_Kind_Selected_Name => 2015, - Iir_Kind_Operator_Symbol => 2020, - Iir_Kind_Reference_Name => 2025, - Iir_Kind_External_Constant_Name => 2034, - Iir_Kind_External_Signal_Name => 2043, - Iir_Kind_External_Variable_Name => 2053, - Iir_Kind_Selected_By_All_Name => 2059, - Iir_Kind_Parenthesis_Name => 2064, - Iir_Kind_Package_Pathname => 2068, - Iir_Kind_Absolute_Pathname => 2069, - Iir_Kind_Relative_Pathname => 2070, - Iir_Kind_Pathname_Element => 2075, - Iir_Kind_Base_Attribute => 2077, - Iir_Kind_Subtype_Attribute => 2082, - Iir_Kind_Element_Attribute => 2087, - Iir_Kind_Across_Attribute => 2092, - Iir_Kind_Through_Attribute => 2097, - Iir_Kind_Nature_Reference_Attribute => 2101, - Iir_Kind_Left_Type_Attribute => 2106, - Iir_Kind_Right_Type_Attribute => 2111, - Iir_Kind_High_Type_Attribute => 2116, - Iir_Kind_Low_Type_Attribute => 2121, - Iir_Kind_Ascending_Type_Attribute => 2126, - Iir_Kind_Image_Attribute => 2132, - Iir_Kind_Value_Attribute => 2138, - Iir_Kind_Pos_Attribute => 2144, - Iir_Kind_Val_Attribute => 2150, - Iir_Kind_Succ_Attribute => 2156, - Iir_Kind_Pred_Attribute => 2162, - Iir_Kind_Leftof_Attribute => 2168, - Iir_Kind_Rightof_Attribute => 2174, - Iir_Kind_Signal_Slew_Attribute => 2182, - Iir_Kind_Quantity_Slew_Attribute => 2190, - Iir_Kind_Ramp_Attribute => 2198, - Iir_Kind_Zoh_Attribute => 2206, - Iir_Kind_Ltf_Attribute => 2214, - Iir_Kind_Ztf_Attribute => 2224, - Iir_Kind_Dot_Attribute => 2231, - Iir_Kind_Integ_Attribute => 2238, - Iir_Kind_Quantity_Delayed_Attribute => 2246, - Iir_Kind_Above_Attribute => 2254, - Iir_Kind_Delayed_Attribute => 2263, - Iir_Kind_Stable_Attribute => 2272, - Iir_Kind_Quiet_Attribute => 2281, - Iir_Kind_Transaction_Attribute => 2290, - Iir_Kind_Event_Attribute => 2294, - Iir_Kind_Active_Attribute => 2298, - Iir_Kind_Last_Event_Attribute => 2302, - Iir_Kind_Last_Active_Attribute => 2306, - Iir_Kind_Last_Value_Attribute => 2310, - Iir_Kind_Driving_Attribute => 2314, - Iir_Kind_Driving_Value_Attribute => 2318, - Iir_Kind_Behavior_Attribute => 2318, - Iir_Kind_Structure_Attribute => 2318, - Iir_Kind_Simple_Name_Attribute => 2325, - Iir_Kind_Instance_Name_Attribute => 2330, - Iir_Kind_Path_Name_Attribute => 2335, - Iir_Kind_Left_Array_Attribute => 2342, - Iir_Kind_Right_Array_Attribute => 2349, - Iir_Kind_High_Array_Attribute => 2356, - Iir_Kind_Low_Array_Attribute => 2363, - Iir_Kind_Length_Array_Attribute => 2370, - Iir_Kind_Ascending_Array_Attribute => 2377, - Iir_Kind_Range_Array_Attribute => 2384, - Iir_Kind_Reverse_Range_Array_Attribute => 2391, - Iir_Kind_Attribute_Name => 2400 + Iir_Kind_Association_Element_Open => 138, + Iir_Kind_Association_Element_Package => 144, + Iir_Kind_Association_Element_Type => 152, + Iir_Kind_Association_Element_Subprogram => 158, + Iir_Kind_Association_Element_Terminal => 164, + Iir_Kind_Choice_By_Range => 172, + Iir_Kind_Choice_By_Expression => 180, + Iir_Kind_Choice_By_Others => 186, + Iir_Kind_Choice_By_None => 192, + Iir_Kind_Choice_By_Name => 199, + Iir_Kind_Entity_Aspect_Entity => 201, + Iir_Kind_Entity_Aspect_Configuration => 202, + Iir_Kind_Entity_Aspect_Open => 202, + Iir_Kind_Psl_Hierarchical_Name => 204, + Iir_Kind_Block_Configuration => 210, + Iir_Kind_Block_Header => 214, + Iir_Kind_Component_Configuration => 221, + Iir_Kind_Binding_Indication => 225, + Iir_Kind_Entity_Class => 227, + Iir_Kind_Attribute_Value => 235, + Iir_Kind_Signature => 240, + Iir_Kind_Aggregate_Info => 247, + Iir_Kind_Procedure_Call => 251, + Iir_Kind_Record_Element_Constraint => 259, + Iir_Kind_Array_Element_Resolution => 261, + Iir_Kind_Record_Resolution => 262, + Iir_Kind_Record_Element_Resolution => 265, + Iir_Kind_Break_Element => 269, + Iir_Kind_Attribute_Specification => 278, + Iir_Kind_Disconnection_Specification => 284, + Iir_Kind_Step_Limit_Specification => 290, + Iir_Kind_Configuration_Specification => 296, + Iir_Kind_Access_Type_Definition => 303, + Iir_Kind_Incomplete_Type_Definition => 310, + Iir_Kind_Interface_Type_Definition => 316, + Iir_Kind_File_Type_Definition => 322, + Iir_Kind_Protected_Type_Declaration => 332, + Iir_Kind_Record_Type_Definition => 342, + Iir_Kind_Array_Type_Definition => 353, + Iir_Kind_Array_Subtype_Definition => 370, + Iir_Kind_Record_Subtype_Definition => 383, + Iir_Kind_Access_Subtype_Definition => 391, + Iir_Kind_Physical_Subtype_Definition => 401, + Iir_Kind_Floating_Subtype_Definition => 412, + Iir_Kind_Integer_Subtype_Definition => 422, + Iir_Kind_Enumeration_Subtype_Definition => 432, + Iir_Kind_Enumeration_Type_Definition => 443, + Iir_Kind_Integer_Type_Definition => 451, + Iir_Kind_Floating_Type_Definition => 459, + Iir_Kind_Physical_Type_Definition => 470, + Iir_Kind_Range_Expression => 478, + Iir_Kind_Protected_Type_Body => 486, + Iir_Kind_Wildcard_Type_Definition => 490, + Iir_Kind_Foreign_Vector_Type_Definition => 491, + Iir_Kind_Subtype_Definition => 498, + Iir_Kind_Scalar_Nature_Definition => 506, + Iir_Kind_Record_Nature_Definition => 519, + Iir_Kind_Array_Nature_Definition => 533, + Iir_Kind_Array_Subnature_Definition => 548, + Iir_Kind_Overload_List => 549, + Iir_Kind_Foreign_Module => 554, + Iir_Kind_Entity_Declaration => 567, + Iir_Kind_Configuration_Declaration => 577, + Iir_Kind_Context_Declaration => 583, + Iir_Kind_Package_Declaration => 598, + Iir_Kind_Package_Instantiation_Declaration => 612, + Iir_Kind_Vmode_Declaration => 624, + Iir_Kind_Vprop_Declaration => 636, + Iir_Kind_Vunit_Declaration => 649, + Iir_Kind_Package_Body => 657, + Iir_Kind_Architecture_Body => 670, + Iir_Kind_Type_Declaration => 677, + Iir_Kind_Anonymous_Type_Declaration => 683, + Iir_Kind_Subtype_Declaration => 691, + Iir_Kind_Nature_Declaration => 697, + Iir_Kind_Subnature_Declaration => 704, + Iir_Kind_Package_Header => 706, + Iir_Kind_Unit_Declaration => 715, + Iir_Kind_Library_Declaration => 723, + Iir_Kind_Component_Declaration => 733, + Iir_Kind_Attribute_Declaration => 740, + Iir_Kind_Group_Template_Declaration => 746, + Iir_Kind_Group_Declaration => 753, + Iir_Kind_Element_Declaration => 761, + Iir_Kind_Nature_Element_Declaration => 768, + Iir_Kind_Non_Object_Alias_Declaration => 776, + Iir_Kind_Psl_Declaration => 784, + Iir_Kind_Psl_Endpoint_Declaration => 798, + Iir_Kind_Enumeration_Literal => 810, + Iir_Kind_Function_Declaration => 836, + Iir_Kind_Procedure_Declaration => 859, + Iir_Kind_Function_Body => 869, + Iir_Kind_Procedure_Body => 880, + Iir_Kind_Function_Instantiation_Declaration => 891, + Iir_Kind_Procedure_Instantiation_Declaration => 901, + Iir_Kind_Terminal_Declaration => 911, + Iir_Kind_Object_Alias_Declaration => 923, + Iir_Kind_Free_Quantity_Declaration => 935, + Iir_Kind_Spectrum_Quantity_Declaration => 948, + Iir_Kind_Noise_Quantity_Declaration => 960, + Iir_Kind_Across_Quantity_Declaration => 976, + Iir_Kind_Through_Quantity_Declaration => 992, + Iir_Kind_File_Declaration => 1007, + Iir_Kind_Guard_Signal_Declaration => 1021, + Iir_Kind_Signal_Declaration => 1038, + Iir_Kind_Variable_Declaration => 1051, + Iir_Kind_Constant_Declaration => 1065, + Iir_Kind_Iterator_Declaration => 1077, + Iir_Kind_Interface_Constant_Declaration => 1094, + Iir_Kind_Interface_Variable_Declaration => 1110, + Iir_Kind_Interface_Signal_Declaration => 1131, + Iir_Kind_Interface_File_Declaration => 1147, + Iir_Kind_Interface_Quantity_Declaration => 1163, + Iir_Kind_Interface_Terminal_Declaration => 1175, + Iir_Kind_Interface_Type_Declaration => 1186, + Iir_Kind_Interface_Package_Declaration => 1199, + Iir_Kind_Interface_Function_Declaration => 1218, + Iir_Kind_Interface_Procedure_Declaration => 1233, + Iir_Kind_Attribute_Implicit_Declaration => 1236, + Iir_Kind_Suspend_State_Declaration => 1239, + Iir_Kind_Identity_Operator => 1243, + Iir_Kind_Negation_Operator => 1247, + Iir_Kind_Absolute_Operator => 1251, + Iir_Kind_Not_Operator => 1255, + Iir_Kind_Implicit_Condition_Operator => 1259, + Iir_Kind_Condition_Operator => 1263, + Iir_Kind_Reduction_And_Operator => 1267, + Iir_Kind_Reduction_Or_Operator => 1271, + Iir_Kind_Reduction_Nand_Operator => 1275, + Iir_Kind_Reduction_Nor_Operator => 1279, + Iir_Kind_Reduction_Xor_Operator => 1283, + Iir_Kind_Reduction_Xnor_Operator => 1287, + Iir_Kind_And_Operator => 1292, + Iir_Kind_Or_Operator => 1297, + Iir_Kind_Nand_Operator => 1302, + Iir_Kind_Nor_Operator => 1307, + Iir_Kind_Xor_Operator => 1312, + Iir_Kind_Xnor_Operator => 1317, + Iir_Kind_Equality_Operator => 1322, + Iir_Kind_Inequality_Operator => 1327, + Iir_Kind_Less_Than_Operator => 1332, + Iir_Kind_Less_Than_Or_Equal_Operator => 1337, + Iir_Kind_Greater_Than_Operator => 1342, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1347, + Iir_Kind_Match_Equality_Operator => 1352, + Iir_Kind_Match_Inequality_Operator => 1357, + Iir_Kind_Match_Less_Than_Operator => 1362, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1367, + Iir_Kind_Match_Greater_Than_Operator => 1372, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1377, + Iir_Kind_Sll_Operator => 1382, + Iir_Kind_Sla_Operator => 1387, + Iir_Kind_Srl_Operator => 1392, + Iir_Kind_Sra_Operator => 1397, + Iir_Kind_Rol_Operator => 1402, + Iir_Kind_Ror_Operator => 1407, + Iir_Kind_Addition_Operator => 1412, + Iir_Kind_Substraction_Operator => 1417, + Iir_Kind_Concatenation_Operator => 1422, + Iir_Kind_Multiplication_Operator => 1427, + Iir_Kind_Division_Operator => 1432, + Iir_Kind_Modulus_Operator => 1437, + Iir_Kind_Remainder_Operator => 1442, + Iir_Kind_Exponentiation_Operator => 1447, + Iir_Kind_Function_Call => 1455, + Iir_Kind_Aggregate => 1462, + Iir_Kind_Parenthesis_Expression => 1465, + Iir_Kind_Qualified_Expression => 1469, + Iir_Kind_Type_Conversion => 1474, + Iir_Kind_Allocator_By_Expression => 1479, + Iir_Kind_Allocator_By_Subtype => 1485, + Iir_Kind_Selected_Element => 1493, + Iir_Kind_Dereference => 1498, + Iir_Kind_Implicit_Dereference => 1503, + Iir_Kind_Slice_Name => 1510, + Iir_Kind_Indexed_Name => 1516, + Iir_Kind_Psl_Prev => 1522, + Iir_Kind_Psl_Stable => 1527, + Iir_Kind_Psl_Rose => 1532, + Iir_Kind_Psl_Fell => 1537, + Iir_Kind_Psl_Onehot => 1540, + Iir_Kind_Psl_Onehot0 => 1543, + Iir_Kind_Psl_Expression => 1545, + Iir_Kind_Sensitized_Process_Statement => 1567, + Iir_Kind_Process_Statement => 1588, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1601, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1614, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1628, + Iir_Kind_Concurrent_Assertion_Statement => 1636, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1643, + Iir_Kind_Concurrent_Break_Statement => 1651, + Iir_Kind_Psl_Assert_Directive => 1665, + Iir_Kind_Psl_Assume_Directive => 1677, + Iir_Kind_Psl_Cover_Directive => 1689, + Iir_Kind_Psl_Restrict_Directive => 1700, + Iir_Kind_Block_Statement => 1714, + Iir_Kind_If_Generate_Statement => 1725, + Iir_Kind_Case_Generate_Statement => 1734, + Iir_Kind_For_Generate_Statement => 1743, + Iir_Kind_Component_Instantiation_Statement => 1754, + Iir_Kind_Psl_Default_Clock => 1757, + Iir_Kind_Generate_Statement_Body => 1768, + Iir_Kind_If_Generate_Else_Clause => 1774, + Iir_Kind_Simple_Simultaneous_Statement => 1781, + Iir_Kind_Simultaneous_Null_Statement => 1785, + Iir_Kind_Simultaneous_Procedural_Statement => 1796, + Iir_Kind_Simultaneous_Case_Statement => 1805, + Iir_Kind_Simultaneous_If_Statement => 1814, + Iir_Kind_Simultaneous_Elsif => 1820, + Iir_Kind_Simple_Signal_Assignment_Statement => 1831, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1842, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1854, + Iir_Kind_Signal_Force_Assignment_Statement => 1864, + Iir_Kind_Signal_Release_Assignment_Statement => 1873, + Iir_Kind_Null_Statement => 1877, + Iir_Kind_Assertion_Statement => 1884, + Iir_Kind_Report_Statement => 1890, + Iir_Kind_Wait_Statement => 1898, + Iir_Kind_Variable_Assignment_Statement => 1905, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1912, + Iir_Kind_Return_Statement => 1918, + Iir_Kind_For_Loop_Statement => 1929, + Iir_Kind_While_Loop_Statement => 1940, + Iir_Kind_Next_Statement => 1947, + Iir_Kind_Exit_Statement => 1954, + Iir_Kind_Case_Statement => 1963, + Iir_Kind_Procedure_Call_Statement => 1969, + Iir_Kind_Break_Statement => 1976, + Iir_Kind_If_Statement => 1986, + Iir_Kind_Suspend_State_Statement => 1990, + Iir_Kind_Elsif => 1996, + Iir_Kind_Character_Literal => 2003, + Iir_Kind_Simple_Name => 2010, + Iir_Kind_Selected_Name => 2018, + Iir_Kind_Operator_Symbol => 2023, + Iir_Kind_Reference_Name => 2028, + Iir_Kind_External_Constant_Name => 2037, + Iir_Kind_External_Signal_Name => 2046, + Iir_Kind_External_Variable_Name => 2056, + Iir_Kind_Selected_By_All_Name => 2062, + Iir_Kind_Parenthesis_Name => 2067, + Iir_Kind_Package_Pathname => 2071, + Iir_Kind_Absolute_Pathname => 2072, + Iir_Kind_Relative_Pathname => 2073, + Iir_Kind_Pathname_Element => 2078, + Iir_Kind_Base_Attribute => 2080, + Iir_Kind_Subtype_Attribute => 2085, + Iir_Kind_Element_Attribute => 2090, + Iir_Kind_Across_Attribute => 2095, + Iir_Kind_Through_Attribute => 2100, + Iir_Kind_Nature_Reference_Attribute => 2104, + Iir_Kind_Left_Type_Attribute => 2109, + Iir_Kind_Right_Type_Attribute => 2114, + Iir_Kind_High_Type_Attribute => 2119, + Iir_Kind_Low_Type_Attribute => 2124, + Iir_Kind_Ascending_Type_Attribute => 2129, + Iir_Kind_Image_Attribute => 2135, + Iir_Kind_Value_Attribute => 2141, + Iir_Kind_Pos_Attribute => 2147, + Iir_Kind_Val_Attribute => 2153, + Iir_Kind_Succ_Attribute => 2159, + Iir_Kind_Pred_Attribute => 2165, + Iir_Kind_Leftof_Attribute => 2171, + Iir_Kind_Rightof_Attribute => 2177, + Iir_Kind_Signal_Slew_Attribute => 2185, + Iir_Kind_Quantity_Slew_Attribute => 2193, + Iir_Kind_Ramp_Attribute => 2201, + Iir_Kind_Zoh_Attribute => 2209, + Iir_Kind_Ltf_Attribute => 2217, + Iir_Kind_Ztf_Attribute => 2227, + Iir_Kind_Dot_Attribute => 2234, + Iir_Kind_Integ_Attribute => 2241, + Iir_Kind_Quantity_Delayed_Attribute => 2249, + Iir_Kind_Above_Attribute => 2257, + Iir_Kind_Delayed_Attribute => 2266, + Iir_Kind_Stable_Attribute => 2275, + Iir_Kind_Quiet_Attribute => 2284, + Iir_Kind_Transaction_Attribute => 2293, + Iir_Kind_Event_Attribute => 2297, + Iir_Kind_Active_Attribute => 2301, + Iir_Kind_Last_Event_Attribute => 2305, + Iir_Kind_Last_Active_Attribute => 2309, + Iir_Kind_Last_Value_Attribute => 2313, + Iir_Kind_Driving_Attribute => 2317, + Iir_Kind_Driving_Value_Attribute => 2321, + Iir_Kind_Behavior_Attribute => 2321, + Iir_Kind_Structure_Attribute => 2321, + Iir_Kind_Simple_Name_Attribute => 2328, + Iir_Kind_Instance_Name_Attribute => 2333, + Iir_Kind_Path_Name_Attribute => 2338, + Iir_Kind_Left_Array_Attribute => 2345, + Iir_Kind_Right_Array_Attribute => 2352, + Iir_Kind_High_Array_Attribute => 2359, + Iir_Kind_Low_Array_Attribute => 2366, + Iir_Kind_Length_Array_Attribute => 2373, + Iir_Kind_Ascending_Array_Attribute => 2380, + Iir_Kind_Range_Array_Attribute => 2387, + Iir_Kind_Reverse_Range_Array_Attribute => 2394, + Iir_Kind_Attribute_Name => 2403 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6141,6 +6154,8 @@ package body Vhdl.Nodes_Meta is return Get_Formal (N); when Field_Actual => return Get_Actual (N); + when Field_Open_Actual => + return Get_Open_Actual (N); when Field_Actual_Conversion => return Get_Actual_Conversion (N); when Field_Formal_Conversion => @@ -6227,6 +6242,8 @@ package body Vhdl.Nodes_Meta is return Get_Base_Name (N); when Field_Interface_Declaration_Chain => return Get_Interface_Declaration_Chain (N); + when Field_Default_Subprogram => + return Get_Default_Subprogram (N); when Field_Subprogram_Specification => return Get_Subprogram_Specification (N); when Field_Sequential_Statement_Chain => @@ -6601,6 +6618,8 @@ package body Vhdl.Nodes_Meta is Set_Formal (N, V); when Field_Actual => Set_Actual (N, V); + when Field_Open_Actual => + Set_Open_Actual (N, V); when Field_Actual_Conversion => Set_Actual_Conversion (N, V); when Field_Formal_Conversion => @@ -6687,6 +6706,8 @@ package body Vhdl.Nodes_Meta is Set_Base_Name (N, V); when Field_Interface_Declaration_Chain => Set_Interface_Declaration_Chain (N, V); + when Field_Default_Subprogram => + Set_Default_Subprogram (N, V); when Field_Subprogram_Specification => Set_Subprogram_Specification (N, V); when Field_Sequential_Statement_Chain => @@ -8177,6 +8198,11 @@ package body Vhdl.Nodes_Meta is end case; end Has_Actual; + function Has_Open_Actual (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Association_Element_Open; + end Has_Open_Actual; + function Has_Actual_Conversion (K : Iir_Kind) return Boolean is begin case K is @@ -9121,6 +9147,17 @@ package body Vhdl.Nodes_Meta is end case; end Has_Interface_Declaration_Chain; + function Has_Default_Subprogram (K : Iir_Kind) return Boolean is + begin + case K is + when Iir_Kind_Interface_Function_Declaration + | Iir_Kind_Interface_Procedure_Declaration => + return True; + when others => + return False; + end case; + end Has_Default_Subprogram; + function Has_Subprogram_Specification (K : Iir_Kind) return Boolean is begin case K is diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads index 538c40910..214f2f067 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -112,6 +112,7 @@ package Vhdl.Nodes_Meta is Field_Designated_Entity, Field_Formal, Field_Actual, + Field_Open_Actual, Field_Actual_Conversion, Field_Formal_Conversion, Field_Whole_Association_Flag, @@ -169,6 +170,7 @@ package Vhdl.Nodes_Meta is Field_Signal_Kind, Field_Base_Name, Field_Interface_Declaration_Chain, + Field_Default_Subprogram, Field_Subprogram_Specification, Field_Sequential_Statement_Chain, Field_Simultaneous_Statement_Chain, @@ -702,6 +704,7 @@ package Vhdl.Nodes_Meta is function Has_Designated_Entity (K : Iir_Kind) return Boolean; function Has_Formal (K : Iir_Kind) return Boolean; function Has_Actual (K : Iir_Kind) return Boolean; + function Has_Open_Actual (K : Iir_Kind) return Boolean; function Has_Actual_Conversion (K : Iir_Kind) return Boolean; function Has_Formal_Conversion (K : Iir_Kind) return Boolean; function Has_Whole_Association_Flag (K : Iir_Kind) return Boolean; @@ -760,6 +763,7 @@ package Vhdl.Nodes_Meta is function Has_Signal_Kind (K : Iir_Kind) return Boolean; function Has_Base_Name (K : Iir_Kind) return Boolean; function Has_Interface_Declaration_Chain (K : Iir_Kind) return Boolean; + function Has_Default_Subprogram (K : Iir_Kind) return Boolean; function Has_Subprogram_Specification (K : Iir_Kind) return Boolean; function Has_Sequential_Statement_Chain (K : Iir_Kind) return Boolean; function Has_Simultaneous_Statement_Chain (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 4f8ac27c0..177d46f88 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -2206,6 +2206,7 @@ package body Vhdl.Parse is Subprg: Iir; Old : Iir; pragma Unreferenced (Old); + Def : Iir; begin -- Create the node. case Current_Token is @@ -2254,6 +2255,22 @@ package body Vhdl.Parse is (Subprg, Kind = Iir_Kind_Interface_Function_Declaration, True); -- TODO: interface_subprogram_default + if Current_Token = Tok_Is then + -- Skip 'is'. + Scan; + + if Current_Token = Tok_Box then + Def := Create_Iir (Iir_Kind_Reference_Name); + Set_Location (Def); + + -- Skip '<>'. + Scan; + else + Def := Parse_Name; + end if; + + Set_Default_Subprogram (Subprg, Def); + end if; return Subprg; end Parse_Interface_Subprogram_Declaration; diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb index 41c93273f..57f3b8815 100644 --- a/src/vhdl/vhdl-sem_assocs.adb +++ b/src/vhdl/vhdl-sem_assocs.adb @@ -150,8 +150,9 @@ package body Vhdl.Sem_Assocs is Inter := Find_Name_In_Chain (Inter_Chain, Get_Identifier (Formal)); if Inter /= Null_Iir - and then - Get_Kind (Inter) not in Iir_Kinds_Interface_Object_Declaration + and then Get_Kind (Assoc) /= Iir_Kind_Association_Element_Open + and then (Get_Kind (Inter) not in + Iir_Kinds_Interface_Object_Declaration) then Assoc := Rewrite_Non_Object_Association (Assoc, Inter); end if; @@ -1811,58 +1812,37 @@ package body Vhdl.Sem_Assocs is return True; end Has_Interface_Subprogram_Profile; - procedure Sem_Association_Subprogram (Assoc : Iir; - Inter : Iir; - Finish : Boolean; - Match : out Compatibility_Level) + -- LOC is the location (usually the association, but could be the + -- instantiation for unassociated interface). + -- RES is set to NULL_IIR in case of error, or the result (in case of + -- overload). + procedure Sem_Association_Subprogram_Check + (Inter : Iir; Res : in out Iir; Loc : Iir) is Discard : Boolean; pragma Unreferenced (Discard); - Actual : Iir; - Res : Iir; begin - if not Finish then - Sem_Association_Package_Type_Not_Finish (Assoc, Inter, Match); - return; - end if; - - Match := Fully_Compatible; - Sem_Association_Package_Type_Finish (Assoc, Inter); - Actual := Get_Actual (Assoc); - - -- LRM08 6.5.7.2 Generic map aspects - -- An actual associated with a formal generic subprogram shall be a name - -- that denotes a subprogram whose profile conforms to that of the - -- formal, or the reserved word OPEN. The actual, if a predefined - -- attribute name that denotes a function, shall be one of the - -- predefined attributes 'IMAGE, 'VALUE, 'POS, 'VAL, 'SUCC, 'PREV, - -- 'LEFTOF, or 'RIGHTOF. - Sem_Name (Actual); - Res := Get_Named_Entity (Actual); - - if Is_Error (Res) then - return; - end if; - case Get_Kind (Res) is when Iir_Kinds_Subprogram_Declaration | Iir_Kinds_Interface_Subprogram_Declaration => if not Has_Interface_Subprogram_Profile (Inter, Res) then Error_Msg_Sem - (+Assoc, "profile of %n doesn't match profile of %n", - (+Actual, +Inter)); + (+Loc, "profile of %n doesn't match profile of %n", + (+Res, +Inter)); -- Explain Discard := Has_Interface_Subprogram_Profile - (Inter, Res, Get_Location (Assoc)); - return; + (Inter, Res, Get_Location (Loc)); + Res := Null_Iir; end if; when Iir_Kind_Overload_List => declare + Orig : Iir; Nbr_Errors : Natural; List : Iir_List; It : List_Iterator; El, R : Iir; begin + Orig := Res; Nbr_Errors := 0; R := Null_Iir; List := Get_Overload_List (Res); @@ -1875,14 +1855,14 @@ package body Vhdl.Sem_Assocs is else if Nbr_Errors = 0 then Error_Msg_Sem - (+Assoc, + (+Loc, "many possible actual subprogram for %n:", +Inter); Error_Msg_Sem - (+Assoc, " %n declared at %l", (+R, + R)); + (+Loc, " %n declared at %l", (+R, + R)); else Error_Msg_Sem - (+Assoc, " %n declared at %l", (+El, +El)); + (+Loc, " %n declared at %l", (+El, +El)); end if; Nbr_Errors := Nbr_Errors + 1; end if; @@ -1890,33 +1870,99 @@ package body Vhdl.Sem_Assocs is Next (It); end loop; if Is_Null (R) then - Error_Msg_Sem - (+Assoc, "no matching name for %n", +Inter); + Error_Msg_Sem (+Loc, "no matching name for %n", +Inter); if True then - Error_Msg_Sem - (+Assoc, " these names were incompatible:"); + Error_Msg_Sem (+Loc, " these names were incompatible:"); It := List_Iterate (List); while Is_Valid (It) loop El := Get_Element (It); Error_Msg_Sem - (+Assoc, " %n declared at %l", (+El, +El)); + (+Loc, " %n declared at %l", (+El, +El)); Next (It); end loop; end if; - return; + Res := Null_Iir; elsif Nbr_Errors > 0 then - return; + Res := Null_Iir; + else + Res := R; end if; - Free_Overload_List (Res); - Res := R; + Free_Overload_List (Orig); end; when others => - Error_Kind ("sem_association_subprogram", Res); + Report_Start_Group; + Error_Msg_Sem + (+Loc, "%n must be associated with a subprogram", +Inter); + Error_Msg_Sem (+Loc, "found %n defined at %l", (+Res, +Res)); + Report_End_Group; + Res := Null_Iir; end case; + end Sem_Association_Subprogram_Check; - Set_Named_Entity (Actual, Res); - Vhdl.Xrefs.Xref_Name (Actual); + function Sem_Association_Subprogram_Open (Inter : Iir; Loc : Iir) + return Iir + is + Res : Iir; + begin + Res := Sem_Identifier_Name + (Get_Identifier (Inter), Loc, False, False); + if Is_Error (Res) then + return Null_Iir; + end if; + Sem_Association_Subprogram_Check (Inter, Res, Loc); + if Res = Null_Iir then + return Null_Iir; + end if; Sem_Decls.Mark_Subprogram_Used (Res); + return Res; + end Sem_Association_Subprogram_Open; + + procedure Sem_Association_Subprogram (Assoc : Iir; + Inter : Iir; + Finish : Boolean; + Match : out Compatibility_Level) + is + Actual : Iir; + Res : Iir; + begin + if not Finish then + -- Common code when not finished. + Sem_Association_Package_Type_Not_Finish (Assoc, Inter, Match); + return; + end if; + + Match := Fully_Compatible; + Sem_Association_Package_Type_Finish (Assoc, Inter); + if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open then + Res := Sem_Association_Subprogram_Open (Inter, Assoc); + Set_Open_Actual (Assoc, Res); + else + Actual := Get_Actual (Assoc); + + -- LRM08 6.5.7.2 Generic map aspects + -- An actual associated with a formal generic subprogram shall be a + -- name that denotes a subprogram whose profile conforms to that of + -- the formal, or the reserved word OPEN. The actual, if a + -- predefined attribute name that denotes a function, shall be one + -- of the predefined attributes 'IMAGE, 'VALUE, 'POS, 'VAL, 'SUCC, + -- 'PREV, 'LEFTOF, or 'RIGHTOF. + Sem_Name (Actual); + Res := Get_Named_Entity (Actual); + + if Is_Error (Res) then + return; + end if; + + Sem_Association_Subprogram_Check (Inter, Res, Assoc); + if Res = Null_Iir then + return; + end if; + + Set_Named_Entity (Actual, Res); + Vhdl.Xrefs.Xref_Name (Actual); + + Sem_Decls.Mark_Subprogram_Used (Res); + end if; end Sem_Association_Subprogram; procedure Sem_Association_Terminal @@ -2296,13 +2342,12 @@ package body Vhdl.Sem_Assocs is end case; end Sem_Association; - procedure Sem_Association_Chain - (Interface_Chain : Iir; - Assoc_Chain: in out Iir; - Finish: Boolean; - Missing : Missing_Type; - Loc : Iir; - Match : out Compatibility_Level) + procedure Sem_Association_Chain (Interface_Chain : Iir; + Assoc_Chain: in out Iir; + Finish: Boolean; + Missing : Missing_Type; + Loc : Iir; + Match : out Compatibility_Level) is Assoc : Iir; Inter : Iir; @@ -2321,6 +2366,7 @@ package body Vhdl.Sem_Assocs is Pos : Integer; Formal : Iir; + Last_Assoc : Iir; First_Named_Assoc : Iir; Last_Named_Assoc : Iir; @@ -2330,6 +2376,7 @@ package body Vhdl.Sem_Assocs is Match := Fully_Compatible; First_Named_Assoc := Null_Iir; Has_Individual := False; + Last_Assoc := Null_Iir; -- Clear associated type of interface type. Inter := Interface_Chain; @@ -2348,6 +2395,7 @@ package body Vhdl.Sem_Assocs is -- First positional associations Assoc := Assoc_Chain; while Assoc /= Null_Iir loop + Last_Assoc := Assoc; Formal := Get_Formal (Assoc); exit when Formal /= Null_Iir; @@ -2429,6 +2477,7 @@ package body Vhdl.Sem_Assocs is -- Last assoc to be cleaned up. Last_Named_Assoc := Assoc; + Last_Assoc := Assoc; if Finish then Sem_Name (Formal); @@ -2624,6 +2673,7 @@ package body Vhdl.Sem_Assocs is Last_Individual := Null_Iir; if Inter_Matched (Pos) = None then if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open + and then Get_Open_Actual (Assoc) = Null_Iir then Inter_Matched (Pos) := Open; else @@ -2730,7 +2780,44 @@ package body Vhdl.Sem_Assocs is Pos := 0; while Inter /= Null_Iir loop if Inter_Matched (Pos) <= Open then - if Sem_Check_Missing_Association + if Get_Kind (Inter) in Iir_Kinds_Interface_Subprogram_Declaration + and then Get_Default_Subprogram (Inter) /= Null_Iir + then + declare + Def : constant Iir := Get_Default_Subprogram (Inter); + Res : Iir; + Ref : Iir; + begin + if Finish + and then Get_Kind (Def) = Iir_Kind_Reference_Name + then + -- Resolve now the default subprogram (as we have the + -- context for that). + Res := Sem_Association_Subprogram_Open (Inter, Loc); + if Res /= Null_Iir then + -- Create an artificial open association to keep it. + Assoc := + Create_Iir (Iir_Kind_Association_Element_Open); + Location_Copy (Assoc, Loc); + Set_Open_Actual (Assoc, Res); + Set_Artificial_Flag (Assoc, True); + Set_Whole_Association_Flag (Assoc, True); + Ref := Create_Iir (Iir_Kind_Reference_Name); + Location_Copy (Ref, Loc); + Set_Named_Entity (Ref, Inter); + Set_Formal (Assoc, Ref); + + -- Append it. + if Last_Assoc /= Null_Iir then + Set_Chain (Last_Assoc, Assoc); + else + Assoc_Chain := Assoc; + end if; + Last_Assoc := Assoc; + end if; + end if; + end; + elsif Sem_Check_Missing_Association (Inter, Missing, Finish, Inter_Matched (Pos) = Open, Loc) then Match := Not_Compatible; @@ -2814,8 +2901,10 @@ package body Vhdl.Sem_Assocs is end if; when Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration => - Error_Msg_Sem (+Loc, "%n must be associated", +Inter); - Err := True; + if Get_Default_Subprogram (Inter) = Null_Iir then + Error_Msg_Sem (+Loc, "%n must be associated", +Inter); + Err := True; + end if; when others => Error_Kind ("sem_association_chain", Inter); end case; diff --git a/src/vhdl/vhdl-sem_assocs.ads b/src/vhdl/vhdl-sem_assocs.ads index fc334d828..509bcf2a1 100644 --- a/src/vhdl/vhdl-sem_assocs.ads +++ b/src/vhdl/vhdl-sem_assocs.ads @@ -32,20 +32,19 @@ package Vhdl.Sem_Assocs is -- Analyze association chain ASSOC_CHAIN with interfaces from -- INTERFACE_CHAIN. -- Return the level of compatibility between the two chains in LEVEL. - -- If FINISH is true, then ASSOC_CHAIN may be modifies (individual assoc + -- If FINISH is true, then ASSOC_CHAIN may be modified (individual assoc -- added), and error messages (if any) are displayed. -- MISSING control unassociated interfaces. -- LOC is the association. -- Sem_Actual_Of_Association_Chain must have been called before. type Missing_Type is (Missing_Parameter, Missing_Port, Missing_Generic, Missing_Allowed); - procedure Sem_Association_Chain - (Interface_Chain : Iir; - Assoc_Chain: in out Iir; - Finish: Boolean; - Missing : Missing_Type; - Loc : Iir; - Match : out Compatibility_Level); + procedure Sem_Association_Chain (Interface_Chain : Iir; + Assoc_Chain: in out Iir; + Finish: Boolean; + Missing : Missing_Type; + Loc : Iir; + Match : out Compatibility_Level); -- Check association for expression ACTUAL to interface FORMAL. -- ASSOC may be null for operator. diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index f51cd960e..d184aa0ea 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -927,7 +927,9 @@ package body Vhdl.Sem_Inst is -- In the instance, replace references (and inner references) to interface -- package declaration to the associated package. - procedure Instantiate_Generic_Map (Assoc : Iir; Inter: Iir) is + procedure Instantiate_Generic_Map (Assoc : Iir; Inter: Iir) + is + Assoc_Formal : Iir; begin -- Replace formal reference to the instance. -- Cf Get_association_Interface @@ -939,7 +941,8 @@ package body Vhdl.Sem_Inst is loop case Get_Kind (Formal) is when Iir_Kind_Simple_Name - | Iir_Kind_Operator_Symbol => + | Iir_Kind_Operator_Symbol + | Iir_Kind_Reference_Name => Set_Named_Entity (Formal, Get_Instance (Get_Named_Entity (Formal))); exit; @@ -954,16 +957,14 @@ package body Vhdl.Sem_Inst is end if; end; - case Get_Kind (Assoc) is - when Iir_Kind_Association_Element_By_Expression - | Iir_Kind_Association_Element_By_Individual - | Iir_Kind_Association_Element_Open => + Assoc_Formal := Get_Association_Interface (Assoc, Inter); + + case Get_Kind (Inter) is + when Iir_Kind_Interface_Constant_Declaration => -- If the type of the formal is an interface type also -- associated by this map, change the type of the formal -- to the associated type. declare - Assoc_Formal : constant Iir := - Get_Association_Interface (Assoc, Inter); Formal_Type : Iir; Formal_Orig : Iir; begin @@ -985,13 +986,13 @@ package body Vhdl.Sem_Inst is end if; end if; end; - when Iir_Kind_Association_Element_Package => + when Iir_Kind_Interface_Package_Declaration => + pragma Assert + (Get_Kind (Assoc) = Iir_Kind_Association_Element_Package); declare Sub_Inst : constant Iir := Get_Named_Entity (Get_Actual (Assoc)); - Sub_Pkg_Inter : constant Iir := - Get_Association_Interface (Assoc, Inter); - Sub_Pkg : constant Iir := Get_Origin (Sub_Pkg_Inter); + Sub_Pkg : constant Iir := Get_Origin (Assoc_Formal); begin -- Replace references of interface package to references -- to the actual package. @@ -1001,27 +1002,32 @@ package body Vhdl.Sem_Inst is Set_Instance_On_Chain (Get_Declaration_Chain (Sub_Pkg), Get_Declaration_Chain (Sub_Inst)); end; - when Iir_Kind_Association_Element_Type => + when Iir_Kind_Interface_Type_Declaration => + pragma Assert + (Get_Kind (Assoc) = Iir_Kind_Association_Element_Type); -- Replace the incomplete interface type by the actual subtype -- indication. declare - Assoc_Inter : constant Iir := - Get_Association_Interface (Assoc, Inter); - Inter_Type_Def : constant Iir := Get_Type (Assoc_Inter); + Inter_Type_Def : constant Iir := Get_Type (Assoc_Formal); Actual_Type : constant Iir := Get_Actual_Type (Assoc); begin Set_Instance (Inter_Type_Def, Actual_Type); end; - when Iir_Kind_Association_Element_Subprogram => - -- Replace the interface subprogram by the subprogram. - declare - Inter_Subprg : constant Iir := - Get_Association_Interface (Assoc, Inter); - Actual_Subprg : constant Iir := - Get_Named_Entity (Get_Actual (Assoc)); - begin - Set_Instance (Get_Origin (Inter_Subprg), Actual_Subprg); - end; + when Iir_Kinds_Interface_Subprogram_Declaration => + if Get_Kind (Assoc) = Iir_Kind_Association_Element_Open then + Set_Instance (Get_Origin (Assoc_Formal), + Get_Open_Actual (Assoc)); + else + pragma Assert + (Get_Kind (Assoc) = Iir_Kind_Association_Element_Subprogram); + -- Replace the interface subprogram by the subprogram. + declare + Actual_Subprg : constant Iir := + Get_Named_Entity (Get_Actual (Assoc)); + begin + Set_Instance (Get_Origin (Assoc_Formal), Actual_Subprg); + end; + end if; when others => Error_Kind ("instantiate_generic_map", Assoc); end case; @@ -1167,8 +1173,8 @@ package body Vhdl.Sem_Inst is Inst_El := Get_Generic_Map_Aspect_Chain (Inst); Inter_El := Get_Generic_Chain (Inst); while Is_Valid (Inst_El) loop - case Get_Kind (Inst_El) is - when Iir_Kind_Association_Element_Type => + case Get_Kind (Inter_El) is + when Iir_Kind_Interface_Type_Declaration => Inter := Get_Association_Interface (Inst_El, Inter_El); Set_Instance (Get_Type (Get_Origin (Inter)), Get_Actual_Type (Inst_El)); @@ -1189,14 +1195,18 @@ package body Vhdl.Sem_Inst is end loop; end; - when Iir_Kind_Association_Element_Subprogram => + when Iir_Kinds_Interface_Subprogram_Declaration => Inter := Get_Association_Interface (Inst_El, Inter_El); - Set_Instance (Get_Origin (Inter), - Get_Named_Entity (Get_Actual (Inst_El))); + if Get_Kind (Inst_El) = Iir_Kind_Association_Element_Open + then + Set_Instance (Get_Origin (Inter), + Get_Open_Actual (Inst_El)); + else + Set_Instance (Get_Origin (Inter), + Get_Named_Entity (Get_Actual (Inst_El))); + end if; - when Iir_Kind_Association_Element_By_Expression - | Iir_Kind_Association_Element_By_Individual - | Iir_Kind_Association_Element_Open => + when Iir_Kind_Interface_Constant_Declaration => null; when others => -- TODO. diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb index 438945faa..b6ed45227 100644 --- a/src/vhdl/vhdl-sem_names.adb +++ b/src/vhdl/vhdl-sem_names.adb @@ -15,15 +15,15 @@ -- along with this program. If not, see <gnu.org/licenses>. with Flags; use Flags; with Name_Table; +with Std_Names; with Libraries; +with Errorout; use Errorout; + with Vhdl.Evaluation; use Vhdl.Evaluation; with Vhdl.Utils; use Vhdl.Utils; -with Errorout; use Errorout; with Vhdl.Errors; use Vhdl.Errors; with Vhdl.Std_Package; use Vhdl.Std_Package; -with Types; use Types; with Vhdl.Nodes_Utils; use Vhdl.Nodes_Utils; -with Std_Names; with Vhdl.Sem; with Vhdl.Sem_Lib; use Vhdl.Sem_Lib; with Vhdl.Sem_Scopes; use Vhdl.Sem_Scopes; @@ -2089,19 +2089,11 @@ package body Vhdl.Sem_Names is return Finish_Sem_Name_1 (Name, Get_Named_Entity (Name)); end Finish_Sem_Name; - -- LRM93 6.2 - -- The evaluation of a simple name has no other effect than to determine - -- the named entity denoted by the name. - -- - -- NAME may be a simple name, a strig literal or a character literal. - -- GHDL: set interpretation of NAME (possibly an overload list) or - -- error_mark for unknown names. - -- If SOFT is TRUE, then no error message is reported in case of failure. - procedure Sem_Simple_Name (Name : Iir; Keep_Alias : Boolean; Soft : Boolean) + function Sem_Identifier_Name + (Id : Name_Id; Loc : Iir; Keep_Alias : Boolean; Soft : Boolean) return Iir is - Id : constant Name_Id := Get_Identifier (Name); Interpretation: Name_Interpretation_Type; - Res: Iir; + Res : Iir; Res_List : Iir_List; Res_It : List_Iterator; N : Natural; @@ -2116,9 +2108,9 @@ package body Vhdl.Sem_Names is and then Is_Conflict_Declaration (Interpretation) then Error_Msg_Sem - (+Name, "no declaration for %i (due to conflicts)", +Name); + (+Loc, "no declaration for %i (due to conflicts)", +Id); else - Error_Msg_Sem (+Name, "no declaration for %i", +Name); + Error_Msg_Sem (+Loc, "no declaration for %i", +Id); end if; end if; Res := Error_Mark; @@ -2130,7 +2122,7 @@ package body Vhdl.Sem_Names is -- For a design unit, return the library unit if Get_Kind (Res) = Iir_Kind_Design_Unit then -- FIXME: should replace interpretation ? - Load_Design_Unit (Res, Name); + Load_Design_Unit (Res, Loc); Sem.Add_Dependence (Res); Res := Get_Library_Unit (Res); end if; @@ -2144,7 +2136,7 @@ package body Vhdl.Sem_Names is Res := Get_Declaration (Get_Under_Interpretation (Id)); else if not Soft then - Error_Msg_Sem (+Name, "%n is not visible here", +Res); + Error_Msg_Sem (+Loc, "%n is not visible here", +Res); end if; -- Even if a named entity was found, return an error_mark. -- Indeed, the named entity found is certainly the one being @@ -2189,7 +2181,23 @@ package body Vhdl.Sem_Names is Res := Create_Overload_List (Res_List); end if; + return Res; + end Sem_Identifier_Name; + -- LRM93 6.2 + -- The evaluation of a simple name has no other effect than to determine + -- the named entity denoted by the name. + -- + -- NAME may be a simple name, a strig literal or a character literal. + -- GHDL: set interpretation of NAME (possibly an overload list) or + -- error_mark for unknown names. + -- If SOFT is TRUE, then no error message is reported in case of failure. + procedure Sem_Simple_Name (Name : Iir; Keep_Alias : Boolean; Soft : Boolean) + is + Id : constant Name_Id := Get_Identifier (Name); + Res : Iir; + begin + Res := Sem_Identifier_Name (Id, Name, Keep_Alias, Soft); Set_Named_Entity (Name, Res); end Sem_Simple_Name; diff --git a/src/vhdl/vhdl-sem_names.ads b/src/vhdl/vhdl-sem_names.ads index 8c8abf488..2ed16a001 100644 --- a/src/vhdl/vhdl-sem_names.ads +++ b/src/vhdl/vhdl-sem_names.ads @@ -13,6 +13,7 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <gnu.org/licenses>. +with Types; use Types; with Vhdl.Nodes; use Vhdl.Nodes; package Vhdl.Sem_Names is @@ -73,6 +74,20 @@ package Vhdl.Sem_Names is -- To be used only for names (weakly) analyzed by sem_name_soft. procedure Sem_Name_Clean (Name : Iir); + -- Return an interpretation for identifier ID. + -- Used mostly by Sem_Simple_Name but also for unassociated interface + -- subprogram whose default is <>. + -- Do not follow aliases is KEEP_ALIAS is true (used for attribute + -- specification), + -- do not report error if SOFT is true (used for associations of + -- overloaded names). + -- + -- Returns either the interpretation, an overload list or a error_mark. + function Sem_Identifier_Name (Id : Name_Id; + Loc : Iir; + Keep_Alias : Boolean; + Soft : Boolean) return Iir; + -- If NAME is a selected name whose prefix is a protected variable, set -- method_object of CALL. procedure Name_To_Method_Object (Call : Iir; Name : Iir); diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index 729e7352b..8c94903a0 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -569,6 +569,7 @@ package body Vhdl.Utils is loop case Get_Kind (El) is when Iir_Kind_Simple_Name + | Iir_Kind_Reference_Name | Iir_Kind_Operator_Symbol => -- Operator is for subprogram interfaces. return Get_Named_Entity (El); @@ -630,6 +631,7 @@ package body Vhdl.Utils is -- Strip denoting name case Get_Kind (Formal) is when Iir_Kind_Simple_Name + | Iir_Kind_Reference_Name | Iir_Kind_Operator_Symbol => return Get_Named_Entity (Formal); when Iir_Kinds_Interface_Declaration => |