diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-12-30 06:28:26 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-12-30 06:28:26 +0100 |
commit | a6a74017fd6b467627f23ff733218af1062d139f (patch) | |
tree | 70facbde8de4dab2ff32d5f626ca51f15198f4bf | |
parent | 2d835b7e171093b894aae52f54e1b3cfd373a5fe (diff) | |
download | ghdl-a6a74017fd6b467627f23ff733218af1062d139f.tar.gz ghdl-a6a74017fd6b467627f23ff733218af1062d139f.tar.bz2 ghdl-a6a74017fd6b467627f23ff733218af1062d139f.zip |
ams-vhdl: check nature for record natures and terminals.
-rw-r--r-- | python/libghdl/thin/vhdl/nodes.py | 68 | ||||
-rw-r--r-- | python/libghdl/thin/vhdl/nodes_meta.py | 416 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 16 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 16 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 472 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.ads | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_decls.adb | 68 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_types.adb | 41 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_types.ads | 13 |
9 files changed, 646 insertions, 466 deletions
diff --git a/python/libghdl/thin/vhdl/nodes.py b/python/libghdl/thin/vhdl/nodes.py index 985b8fdef..06c9a750b 100644 --- a/python/libghdl/thin/vhdl/nodes.py +++ b/python/libghdl/thin/vhdl/nodes.py @@ -320,10 +320,12 @@ class Iir_Kinds: Iir_Kind.Variable_Assignment_Statement, Iir_Kind.Conditional_Variable_Assignment_Statement] - Simultaneous_Statement = [ - Iir_Kind.Simple_Simultaneous_Statement, - Iir_Kind.Simultaneous_Procedural_Statement, - Iir_Kind.Simultaneous_If_Statement] + Denoting_Name = [ + Iir_Kind.Character_Literal, + Iir_Kind.Simple_Name, + Iir_Kind.Selected_Name, + Iir_Kind.Operator_Symbol, + Iir_Kind.Reference_Name] Case_Choice = [ Iir_Kind.Choice_By_Range, @@ -378,6 +380,12 @@ class Iir_Kinds: Iir_Kind.Physical_Int_Literal, Iir_Kind.Physical_Fp_Literal] + Nature_Indication = [ + Iir_Kind.Scalar_Nature_Definition, + Iir_Kind.Record_Nature_Definition, + Iir_Kind.Array_Nature_Definition, + Iir_Kind.Array_Subnature_Definition] + Process_Statement = [ Iir_Kind.Sensitized_Process_Statement, Iir_Kind.Process_Statement] @@ -754,22 +762,6 @@ class Iir_Kinds: Iir_Kind.Interface_Function_Declaration, Iir_Kind.Interface_Procedure_Declaration] - Nonoverloadable_Declaration = [ - Iir_Kind.Type_Declaration, - Iir_Kind.Anonymous_Type_Declaration, - Iir_Kind.Subtype_Declaration, - Iir_Kind.Nature_Declaration, - Iir_Kind.Subnature_Declaration, - Iir_Kind.Package_Header, - Iir_Kind.Unit_Declaration, - Iir_Kind.Library_Declaration, - Iir_Kind.Component_Declaration, - Iir_Kind.Attribute_Declaration, - Iir_Kind.Group_Template_Declaration, - Iir_Kind.Group_Declaration, - Iir_Kind.Element_Declaration, - Iir_Kind.Nature_Element_Declaration] - Branch_Quantity_Declaration = [ Iir_Kind.Across_Quantity_Declaration, Iir_Kind.Through_Quantity_Declaration] @@ -797,9 +789,21 @@ class Iir_Kinds: Iir_Kind.Across_Quantity_Declaration, Iir_Kind.Through_Quantity_Declaration] - Physical_Literal = [ - Iir_Kind.Physical_Int_Literal, - Iir_Kind.Physical_Fp_Literal] + Nonoverloadable_Declaration = [ + Iir_Kind.Type_Declaration, + Iir_Kind.Anonymous_Type_Declaration, + Iir_Kind.Subtype_Declaration, + Iir_Kind.Nature_Declaration, + Iir_Kind.Subnature_Declaration, + Iir_Kind.Package_Header, + Iir_Kind.Unit_Declaration, + Iir_Kind.Library_Declaration, + Iir_Kind.Component_Declaration, + Iir_Kind.Attribute_Declaration, + Iir_Kind.Group_Template_Declaration, + Iir_Kind.Group_Declaration, + Iir_Kind.Element_Declaration, + Iir_Kind.Nature_Element_Declaration] Scalar_Type_And_Subtype_Definition = [ Iir_Kind.Physical_Subtype_Definition, @@ -862,12 +866,14 @@ class Iir_Kinds: Iir_Kind.Range_Array_Attribute, Iir_Kind.Reverse_Range_Array_Attribute] - Denoting_Name = [ - Iir_Kind.Character_Literal, - Iir_Kind.Simple_Name, - Iir_Kind.Selected_Name, - Iir_Kind.Operator_Symbol, - Iir_Kind.Reference_Name] + Physical_Literal = [ + Iir_Kind.Physical_Int_Literal, + Iir_Kind.Physical_Fp_Literal] + + Simultaneous_Statement = [ + Iir_Kind.Simple_Simultaneous_Statement, + Iir_Kind.Simultaneous_Procedural_Statement, + Iir_Kind.Simultaneous_If_Statement] Concurrent_Signal_Assignment = [ Iir_Kind.Concurrent_Simple_Signal_Assignment, @@ -1910,6 +1916,10 @@ Get_Base_Type = libghdl.vhdl__nodes__get_base_type Set_Base_Type = libghdl.vhdl__nodes__set_base_type +Get_Simple_Nature = libghdl.vhdl__nodes__get_simple_nature + +Set_Simple_Nature = libghdl.vhdl__nodes__set_simple_nature + Get_Base_Nature = libghdl.vhdl__nodes__get_base_nature Set_Base_Nature = libghdl.vhdl__nodes__set_base_nature diff --git a/python/libghdl/thin/vhdl/nodes_meta.py b/python/libghdl/thin/vhdl/nodes_meta.py index 12cc144e0..aff2f14d0 100644 --- a/python/libghdl/thin/vhdl/nodes_meta.py +++ b/python/libghdl/thin/vhdl/nodes_meta.py @@ -210,212 +210,213 @@ class fields: Left_Limit_Expr = 146 Right_Limit_Expr = 147 Base_Type = 148 - Base_Nature = 149 - Resolution_Indication = 150 - Record_Element_Resolution_Chain = 151 - Tolerance = 152 - Plus_Terminal_Name = 153 - Minus_Terminal_Name = 154 - Plus_Terminal = 155 - Minus_Terminal = 156 - Magnitude_Expression = 157 - Phase_Expression = 158 - Power_Expression = 159 - Simultaneous_Left = 160 - Simultaneous_Right = 161 - Text_File_Flag = 162 - Only_Characters_Flag = 163 - Is_Character_Type = 164 - Nature_Staticness = 165 - Type_Staticness = 166 - Constraint_State = 167 - Index_Subtype_List = 168 - Index_Subtype_Definition_List = 169 - Element_Subtype_Indication = 170 - Element_Subtype = 171 - Element_Subnature_Indication = 172 - Element_Subnature = 173 - Index_Constraint_List = 174 - Array_Element_Constraint = 175 - Elements_Declaration_List = 176 - Owned_Elements_Chain = 177 - Designated_Type = 178 - Designated_Subtype_Indication = 179 - Index_List = 180 - Reference = 181 - Nature_Declarator = 182 - Across_Type_Mark = 183 - Through_Type_Mark = 184 - Across_Type_Definition = 185 - Through_Type_Definition = 186 - Across_Type = 187 - Through_Type = 188 - Target = 189 - Waveform_Chain = 190 - Guard = 191 - Delay_Mechanism = 192 - Reject_Time_Expression = 193 - Sensitivity_List = 194 - Process_Origin = 195 - Package_Origin = 196 - Condition_Clause = 197 - Break_Element = 198 - Selector_Quantity = 199 - Break_Quantity = 200 - Timeout_Clause = 201 - Postponed_Flag = 202 - Callees_List = 203 - Passive_Flag = 204 - Resolution_Function_Flag = 205 - Wait_State = 206 - All_Sensitized_State = 207 - Seen_Flag = 208 - Pure_Flag = 209 - Foreign_Flag = 210 - Resolved_Flag = 211 - Signal_Type_Flag = 212 - Has_Signal_Flag = 213 - Purity_State = 214 - Elab_Flag = 215 - Configuration_Mark_Flag = 216 - Configuration_Done_Flag = 217 - Index_Constraint_Flag = 218 - Hide_Implicit_Flag = 219 - Assertion_Condition = 220 - Report_Expression = 221 - Severity_Expression = 222 - Instantiated_Unit = 223 - Generic_Map_Aspect_Chain = 224 - Port_Map_Aspect_Chain = 225 - Configuration_Name = 226 - Component_Configuration = 227 - Configuration_Specification = 228 - Default_Binding_Indication = 229 - Default_Configuration_Declaration = 230 - Expression = 231 - Conditional_Expression_Chain = 232 - Allocator_Designated_Type = 233 - Selected_Waveform_Chain = 234 - Conditional_Waveform_Chain = 235 - Guard_Expression = 236 - Guard_Decl = 237 - Guard_Sensitivity_List = 238 - Signal_Attribute_Chain = 239 - Block_Block_Configuration = 240 - Package_Header = 241 - Block_Header = 242 - Uninstantiated_Package_Name = 243 - Uninstantiated_Package_Decl = 244 - Instance_Source_File = 245 - Generate_Block_Configuration = 246 - Generate_Statement_Body = 247 - Alternative_Label = 248 - Generate_Else_Clause = 249 - Condition = 250 - Else_Clause = 251 - Parameter_Specification = 252 - Parent = 253 - Loop_Label = 254 - Exit_Flag = 255 - Next_Flag = 256 - Component_Name = 257 - Instantiation_List = 258 - Entity_Aspect = 259 - Default_Entity_Aspect = 260 - Binding_Indication = 261 - Named_Entity = 262 - Alias_Declaration = 263 - Referenced_Name = 264 - Expr_Staticness = 265 - Error_Origin = 266 - Operand = 267 - Left = 268 - Right = 269 - Unit_Name = 270 - Name = 271 - Group_Template_Name = 272 - Name_Staticness = 273 - Prefix = 274 - Signature_Prefix = 275 - External_Pathname = 276 - Pathname_Suffix = 277 - Pathname_Expression = 278 - In_Formal_Flag = 279 - Slice_Subtype = 280 - Suffix = 281 - Index_Subtype = 282 - Parameter = 283 - Parameter_2 = 284 - Attr_Chain = 285 - Signal_Attribute_Declaration = 286 - Actual_Type = 287 - Actual_Type_Definition = 288 - Association_Chain = 289 - Individual_Association_Chain = 290 - Subprogram_Association_Chain = 291 - Aggregate_Info = 292 - Sub_Aggregate_Info = 293 - Aggr_Dynamic_Flag = 294 - Aggr_Min_Length = 295 - Aggr_Low_Limit = 296 - Aggr_High_Limit = 297 - Aggr_Others_Flag = 298 - Aggr_Named_Flag = 299 - Aggregate_Expand_Flag = 300 - Association_Choices_Chain = 301 - Case_Statement_Alternative_Chain = 302 - Choice_Staticness = 303 - Procedure_Call = 304 - Implementation = 305 - Parameter_Association_Chain = 306 - Method_Object = 307 - Subtype_Type_Mark = 308 - Subnature_Nature_Mark = 309 - Type_Conversion_Subtype = 310 - Type_Mark = 311 - File_Type_Mark = 312 - Return_Type_Mark = 313 - Has_Disconnect_Flag = 314 - Has_Active_Flag = 315 - Is_Within_Flag = 316 - Type_Marks_List = 317 - Implicit_Alias_Flag = 318 - Alias_Signature = 319 - Attribute_Signature = 320 - Overload_List = 321 - Simple_Name_Identifier = 322 - Simple_Name_Subtype = 323 - Protected_Type_Body = 324 - Protected_Type_Declaration = 325 - Use_Flag = 326 - End_Has_Reserved_Id = 327 - End_Has_Identifier = 328 - End_Has_Postponed = 329 - Has_Label = 330 - Has_Begin = 331 - Has_End = 332 - Has_Is = 333 - Has_Pure = 334 - Has_Body = 335 - Has_Parameter = 336 - Has_Component = 337 - Has_Identifier_List = 338 - Has_Mode = 339 - Has_Class = 340 - Has_Delay_Mechanism = 341 - Suspend_Flag = 342 - Is_Ref = 343 - Is_Forward_Ref = 344 - Psl_Property = 345 - Psl_Sequence = 346 - Psl_Declaration = 347 - Psl_Expression = 348 - Psl_Boolean = 349 - PSL_Clock = 350 - PSL_NFA = 351 - PSL_Nbr_States = 352 - PSL_Clock_Sensitivity = 353 - PSL_EOS_Flag = 354 + Simple_Nature = 149 + Base_Nature = 150 + Resolution_Indication = 151 + Record_Element_Resolution_Chain = 152 + Tolerance = 153 + Plus_Terminal_Name = 154 + Minus_Terminal_Name = 155 + Plus_Terminal = 156 + Minus_Terminal = 157 + Magnitude_Expression = 158 + Phase_Expression = 159 + Power_Expression = 160 + Simultaneous_Left = 161 + Simultaneous_Right = 162 + Text_File_Flag = 163 + Only_Characters_Flag = 164 + Is_Character_Type = 165 + Nature_Staticness = 166 + Type_Staticness = 167 + Constraint_State = 168 + Index_Subtype_List = 169 + Index_Subtype_Definition_List = 170 + Element_Subtype_Indication = 171 + Element_Subtype = 172 + Element_Subnature_Indication = 173 + Element_Subnature = 174 + Index_Constraint_List = 175 + Array_Element_Constraint = 176 + Elements_Declaration_List = 177 + Owned_Elements_Chain = 178 + Designated_Type = 179 + Designated_Subtype_Indication = 180 + Index_List = 181 + Reference = 182 + Nature_Declarator = 183 + Across_Type_Mark = 184 + Through_Type_Mark = 185 + Across_Type_Definition = 186 + Through_Type_Definition = 187 + Across_Type = 188 + Through_Type = 189 + Target = 190 + Waveform_Chain = 191 + Guard = 192 + Delay_Mechanism = 193 + Reject_Time_Expression = 194 + Sensitivity_List = 195 + Process_Origin = 196 + Package_Origin = 197 + Condition_Clause = 198 + Break_Element = 199 + Selector_Quantity = 200 + Break_Quantity = 201 + Timeout_Clause = 202 + Postponed_Flag = 203 + Callees_List = 204 + Passive_Flag = 205 + Resolution_Function_Flag = 206 + Wait_State = 207 + All_Sensitized_State = 208 + Seen_Flag = 209 + Pure_Flag = 210 + Foreign_Flag = 211 + Resolved_Flag = 212 + Signal_Type_Flag = 213 + Has_Signal_Flag = 214 + Purity_State = 215 + Elab_Flag = 216 + Configuration_Mark_Flag = 217 + Configuration_Done_Flag = 218 + Index_Constraint_Flag = 219 + Hide_Implicit_Flag = 220 + Assertion_Condition = 221 + Report_Expression = 222 + Severity_Expression = 223 + Instantiated_Unit = 224 + Generic_Map_Aspect_Chain = 225 + Port_Map_Aspect_Chain = 226 + Configuration_Name = 227 + Component_Configuration = 228 + Configuration_Specification = 229 + Default_Binding_Indication = 230 + Default_Configuration_Declaration = 231 + Expression = 232 + Conditional_Expression_Chain = 233 + Allocator_Designated_Type = 234 + Selected_Waveform_Chain = 235 + Conditional_Waveform_Chain = 236 + Guard_Expression = 237 + Guard_Decl = 238 + Guard_Sensitivity_List = 239 + Signal_Attribute_Chain = 240 + Block_Block_Configuration = 241 + Package_Header = 242 + Block_Header = 243 + Uninstantiated_Package_Name = 244 + Uninstantiated_Package_Decl = 245 + Instance_Source_File = 246 + Generate_Block_Configuration = 247 + Generate_Statement_Body = 248 + Alternative_Label = 249 + Generate_Else_Clause = 250 + Condition = 251 + Else_Clause = 252 + Parameter_Specification = 253 + Parent = 254 + Loop_Label = 255 + Exit_Flag = 256 + Next_Flag = 257 + Component_Name = 258 + Instantiation_List = 259 + Entity_Aspect = 260 + Default_Entity_Aspect = 261 + Binding_Indication = 262 + Named_Entity = 263 + Alias_Declaration = 264 + Referenced_Name = 265 + Expr_Staticness = 266 + Error_Origin = 267 + Operand = 268 + Left = 269 + Right = 270 + Unit_Name = 271 + Name = 272 + Group_Template_Name = 273 + Name_Staticness = 274 + Prefix = 275 + Signature_Prefix = 276 + External_Pathname = 277 + Pathname_Suffix = 278 + Pathname_Expression = 279 + In_Formal_Flag = 280 + Slice_Subtype = 281 + Suffix = 282 + Index_Subtype = 283 + Parameter = 284 + Parameter_2 = 285 + Attr_Chain = 286 + Signal_Attribute_Declaration = 287 + Actual_Type = 288 + Actual_Type_Definition = 289 + Association_Chain = 290 + Individual_Association_Chain = 291 + Subprogram_Association_Chain = 292 + Aggregate_Info = 293 + Sub_Aggregate_Info = 294 + Aggr_Dynamic_Flag = 295 + Aggr_Min_Length = 296 + Aggr_Low_Limit = 297 + Aggr_High_Limit = 298 + Aggr_Others_Flag = 299 + Aggr_Named_Flag = 300 + Aggregate_Expand_Flag = 301 + Association_Choices_Chain = 302 + Case_Statement_Alternative_Chain = 303 + Choice_Staticness = 304 + Procedure_Call = 305 + Implementation = 306 + Parameter_Association_Chain = 307 + Method_Object = 308 + Subtype_Type_Mark = 309 + Subnature_Nature_Mark = 310 + Type_Conversion_Subtype = 311 + Type_Mark = 312 + File_Type_Mark = 313 + Return_Type_Mark = 314 + Has_Disconnect_Flag = 315 + Has_Active_Flag = 316 + Is_Within_Flag = 317 + Type_Marks_List = 318 + Implicit_Alias_Flag = 319 + Alias_Signature = 320 + Attribute_Signature = 321 + Overload_List = 322 + Simple_Name_Identifier = 323 + Simple_Name_Subtype = 324 + Protected_Type_Body = 325 + Protected_Type_Declaration = 326 + Use_Flag = 327 + End_Has_Reserved_Id = 328 + End_Has_Identifier = 329 + End_Has_Postponed = 330 + Has_Label = 331 + Has_Begin = 332 + Has_End = 333 + Has_Is = 334 + Has_Pure = 335 + Has_Body = 336 + Has_Parameter = 337 + Has_Component = 338 + Has_Identifier_List = 339 + Has_Mode = 340 + Has_Class = 341 + Has_Delay_Mechanism = 342 + Suspend_Flag = 343 + Is_Ref = 344 + Is_Forward_Ref = 345 + Psl_Property = 346 + Psl_Sequence = 347 + Psl_Declaration = 348 + Psl_Expression = 349 + Psl_Boolean = 350 + PSL_Clock = 351 + PSL_NFA = 352 + PSL_Nbr_States = 353 + PSL_Clock_Sensitivity = 354 + PSL_EOS_Flag = 355 Get_Boolean = libghdl.vhdl__nodes_meta__get_boolean @@ -928,6 +929,9 @@ Has_Right_Limit_Expr =\ Has_Base_Type =\ libghdl.vhdl__nodes_meta__has_base_type +Has_Simple_Nature =\ + libghdl.vhdl__nodes_meta__has_simple_nature + Has_Base_Nature =\ libghdl.vhdl__nodes_meta__has_base_nature diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 84b56c4f7..7d62b2104 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -3761,6 +3761,22 @@ package body Vhdl.Nodes is Set_Field4 (Decl, Base_Type); end Set_Base_Type; + function Get_Simple_Nature (Def : Iir) return Iir is + begin + pragma Assert (Def /= Null_Iir); + pragma Assert (Has_Simple_Nature (Get_Kind (Def)), + "no field Simple_Nature"); + return Get_Field7 (Def); + end Get_Simple_Nature; + + procedure Set_Simple_Nature (Def : Iir; Nature : Iir) is + begin + pragma Assert (Def /= Null_Iir); + pragma Assert (Has_Simple_Nature (Get_Kind (Def)), + "no field Simple_Nature"); + Set_Field7 (Def, Nature); + end Set_Simple_Nature; + function Get_Base_Nature (Decl : Iir) return Iir is begin pragma Assert (Decl /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 4ea591e52..a2e2502eb 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -2969,6 +2969,8 @@ package Vhdl.Nodes is -- -- Get/Set_Base_Nature (Field4) -- + -- Get/Set_Simple_Nature (Field7) + -- -- Get/Set_Nature_Staticness (State1) -- -- Get/Set_Constraint_State (State2) @@ -3043,6 +3045,8 @@ package Vhdl.Nodes is -- -- Get/Set_Through_Type (Field12) -- + -- Get/Set_Simple_Nature (Field7) + -- -- Get/Set_Nature_Staticness (State1) -- -- Get/Set_Constraint_State (State2) @@ -3054,7 +3058,6 @@ package Vhdl.Nodes is -- Always false for record type: elements are owned by this node. -- Get/Set_Is_Ref (Flag12) - -- Iir_Kind_Nature_Element_Declaration (Short) -- -- AMS-LRM17 5.8.3.3 Record natures @@ -5896,6 +5899,12 @@ package Vhdl.Nodes is Iir_Kind_Array_Subnature_Definition .. Iir_Kind_Array_Subnature_Definition; + subtype Iir_Kinds_Nature_Indication is Iir_Kind range + Iir_Kind_Scalar_Nature_Definition .. + --Iir_Kind_Record_Nature_Definition + --Iir_Kind_Array_Nature_Definition + Iir_Kind_Array_Subnature_Definition; + subtype Iir_Kinds_Nonoverloadable_Declaration is Iir_Kind range Iir_Kind_Type_Declaration .. --Iir_Kind_Anonymous_Type_Declaration @@ -7532,6 +7541,11 @@ package Vhdl.Nodes is procedure Set_Base_Type (Decl : Iir; Base_Type : Iir); pragma Inline (Get_Base_Type); + -- Only for composite base nature: the simple nature. + -- Field: Field7 Ref + function Get_Simple_Nature (Def : Iir) return Iir; + procedure Set_Simple_Nature (Def : Iir; Nature : Iir); + -- Field: Field4 Ref function Get_Base_Nature (Decl : Iir) return Iir; procedure Set_Base_Nature (Decl : Iir; Base_Nature : Iir); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 6ba34e060..76fa0cf84 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -168,6 +168,7 @@ package body Vhdl.Nodes_Meta is Field_Left_Limit_Expr => Type_Iir, Field_Right_Limit_Expr => Type_Iir, Field_Base_Type => Type_Iir, + Field_Simple_Nature => Type_Iir, Field_Base_Nature => Type_Iir, Field_Resolution_Indication => Type_Iir, Field_Record_Element_Resolution_Chain => Type_Iir, @@ -682,6 +683,8 @@ package body Vhdl.Nodes_Meta is return "right_limit_expr"; when Field_Base_Type => return "base_type"; + when Field_Simple_Nature => + return "simple_nature"; when Field_Base_Nature => return "base_nature"; when Field_Resolution_Indication => @@ -2006,6 +2009,8 @@ package body Vhdl.Nodes_Meta is return Attr_None; when Field_Base_Type => return Attr_Ref; + when Field_Simple_Nature => + return Attr_Ref; when Field_Base_Nature => return Attr_Ref; when Field_Resolution_Indication => @@ -3003,6 +3008,7 @@ package body Vhdl.Nodes_Meta is Field_Through_Type_Definition, Field_Across_Type, Field_Through_Type, + Field_Simple_Nature, -- Iir_Kind_Array_Nature_Definition Field_Index_Constraint_Flag, Field_Nature_Staticness, @@ -3013,6 +3019,7 @@ package body Vhdl.Nodes_Meta is Field_Element_Subnature, Field_Nature_Declarator, Field_Base_Nature, + Field_Simple_Nature, Field_Across_Type_Definition, Field_Through_Type_Definition, Field_Across_Type, @@ -5045,231 +5052,231 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Wildcard_Type_Definition => 475, Iir_Kind_Subtype_Definition => 482, Iir_Kind_Scalar_Nature_Definition => 490, - Iir_Kind_Record_Nature_Definition => 502, - Iir_Kind_Array_Nature_Definition => 515, - Iir_Kind_Array_Subnature_Definition => 530, - Iir_Kind_Overload_List => 531, - Iir_Kind_Entity_Declaration => 544, - Iir_Kind_Configuration_Declaration => 553, - Iir_Kind_Context_Declaration => 559, - Iir_Kind_Package_Declaration => 574, - Iir_Kind_Package_Instantiation_Declaration => 588, - Iir_Kind_Vmode_Declaration => 599, - Iir_Kind_Vprop_Declaration => 610, - Iir_Kind_Vunit_Declaration => 622, - Iir_Kind_Package_Body => 630, - Iir_Kind_Architecture_Body => 643, - Iir_Kind_Type_Declaration => 650, - Iir_Kind_Anonymous_Type_Declaration => 656, - Iir_Kind_Subtype_Declaration => 663, - Iir_Kind_Nature_Declaration => 669, - Iir_Kind_Subnature_Declaration => 676, - Iir_Kind_Package_Header => 678, - Iir_Kind_Unit_Declaration => 687, - Iir_Kind_Library_Declaration => 694, - Iir_Kind_Component_Declaration => 704, - Iir_Kind_Attribute_Declaration => 711, - Iir_Kind_Group_Template_Declaration => 717, - Iir_Kind_Group_Declaration => 724, - Iir_Kind_Element_Declaration => 731, - Iir_Kind_Nature_Element_Declaration => 738, - Iir_Kind_Non_Object_Alias_Declaration => 746, - Iir_Kind_Psl_Declaration => 754, - Iir_Kind_Psl_Endpoint_Declaration => 768, - Iir_Kind_Enumeration_Literal => 779, - Iir_Kind_Function_Declaration => 804, - Iir_Kind_Procedure_Declaration => 828, - Iir_Kind_Function_Body => 838, - Iir_Kind_Procedure_Body => 849, - Iir_Kind_Terminal_Declaration => 858, - Iir_Kind_Object_Alias_Declaration => 869, - Iir_Kind_Free_Quantity_Declaration => 881, - Iir_Kind_Spectrum_Quantity_Declaration => 894, - Iir_Kind_Noise_Quantity_Declaration => 906, - Iir_Kind_Across_Quantity_Declaration => 922, - Iir_Kind_Through_Quantity_Declaration => 938, - Iir_Kind_File_Declaration => 952, - Iir_Kind_Guard_Signal_Declaration => 965, - Iir_Kind_Signal_Declaration => 982, - Iir_Kind_Variable_Declaration => 995, - Iir_Kind_Constant_Declaration => 1009, - Iir_Kind_Iterator_Declaration => 1020, - Iir_Kind_Interface_Constant_Declaration => 1036, - Iir_Kind_Interface_Variable_Declaration => 1052, - Iir_Kind_Interface_Signal_Declaration => 1073, - Iir_Kind_Interface_File_Declaration => 1089, - Iir_Kind_Interface_Quantity_Declaration => 1105, - Iir_Kind_Interface_Terminal_Declaration => 1117, - Iir_Kind_Interface_Type_Declaration => 1127, - Iir_Kind_Interface_Package_Declaration => 1139, - Iir_Kind_Interface_Function_Declaration => 1156, - Iir_Kind_Interface_Procedure_Declaration => 1169, - Iir_Kind_Anonymous_Signal_Declaration => 1178, - Iir_Kind_Signal_Attribute_Declaration => 1181, - Iir_Kind_Identity_Operator => 1185, - Iir_Kind_Negation_Operator => 1189, - Iir_Kind_Absolute_Operator => 1193, - Iir_Kind_Not_Operator => 1197, - Iir_Kind_Implicit_Condition_Operator => 1201, - Iir_Kind_Condition_Operator => 1205, - Iir_Kind_Reduction_And_Operator => 1209, - Iir_Kind_Reduction_Or_Operator => 1213, - Iir_Kind_Reduction_Nand_Operator => 1217, - Iir_Kind_Reduction_Nor_Operator => 1221, - Iir_Kind_Reduction_Xor_Operator => 1225, - Iir_Kind_Reduction_Xnor_Operator => 1229, - Iir_Kind_And_Operator => 1234, - Iir_Kind_Or_Operator => 1239, - Iir_Kind_Nand_Operator => 1244, - Iir_Kind_Nor_Operator => 1249, - Iir_Kind_Xor_Operator => 1254, - Iir_Kind_Xnor_Operator => 1259, - Iir_Kind_Equality_Operator => 1264, - Iir_Kind_Inequality_Operator => 1269, - Iir_Kind_Less_Than_Operator => 1274, - Iir_Kind_Less_Than_Or_Equal_Operator => 1279, - Iir_Kind_Greater_Than_Operator => 1284, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1289, - Iir_Kind_Match_Equality_Operator => 1294, - Iir_Kind_Match_Inequality_Operator => 1299, - Iir_Kind_Match_Less_Than_Operator => 1304, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1309, - Iir_Kind_Match_Greater_Than_Operator => 1314, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1319, - Iir_Kind_Sll_Operator => 1324, - Iir_Kind_Sla_Operator => 1329, - Iir_Kind_Srl_Operator => 1334, - Iir_Kind_Sra_Operator => 1339, - Iir_Kind_Rol_Operator => 1344, - Iir_Kind_Ror_Operator => 1349, - Iir_Kind_Addition_Operator => 1354, - Iir_Kind_Substraction_Operator => 1359, - Iir_Kind_Concatenation_Operator => 1364, - Iir_Kind_Multiplication_Operator => 1369, - Iir_Kind_Division_Operator => 1374, - Iir_Kind_Modulus_Operator => 1379, - Iir_Kind_Remainder_Operator => 1384, - Iir_Kind_Exponentiation_Operator => 1389, - Iir_Kind_Function_Call => 1397, - Iir_Kind_Aggregate => 1404, - Iir_Kind_Parenthesis_Expression => 1407, - Iir_Kind_Qualified_Expression => 1411, - Iir_Kind_Type_Conversion => 1416, - Iir_Kind_Allocator_By_Expression => 1420, - Iir_Kind_Allocator_By_Subtype => 1425, - Iir_Kind_Selected_Element => 1433, - Iir_Kind_Dereference => 1438, - Iir_Kind_Implicit_Dereference => 1443, - Iir_Kind_Slice_Name => 1450, - Iir_Kind_Indexed_Name => 1456, - Iir_Kind_Psl_Expression => 1458, - Iir_Kind_Sensitized_Process_Statement => 1479, - Iir_Kind_Process_Statement => 1499, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1512, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1525, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1539, - Iir_Kind_Concurrent_Assertion_Statement => 1547, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1554, - Iir_Kind_Concurrent_Break_Statement => 1562, - Iir_Kind_Psl_Assert_Directive => 1575, - Iir_Kind_Psl_Assume_Directive => 1586, - Iir_Kind_Psl_Cover_Directive => 1598, - Iir_Kind_Psl_Restrict_Directive => 1609, - Iir_Kind_Block_Statement => 1623, - Iir_Kind_If_Generate_Statement => 1634, - Iir_Kind_Case_Generate_Statement => 1643, - Iir_Kind_For_Generate_Statement => 1652, - Iir_Kind_Component_Instantiation_Statement => 1663, - Iir_Kind_Psl_Default_Clock => 1667, - Iir_Kind_Generate_Statement_Body => 1678, - Iir_Kind_If_Generate_Else_Clause => 1684, - Iir_Kind_Simple_Simultaneous_Statement => 1691, - Iir_Kind_Simultaneous_Procedural_Statement => 1699, - Iir_Kind_Simultaneous_If_Statement => 1708, - Iir_Kind_Simultaneous_Elsif => 1714, - Iir_Kind_Simple_Signal_Assignment_Statement => 1725, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1736, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1748, - Iir_Kind_Null_Statement => 1752, - Iir_Kind_Assertion_Statement => 1759, - Iir_Kind_Report_Statement => 1765, - Iir_Kind_Wait_Statement => 1773, - Iir_Kind_Variable_Assignment_Statement => 1780, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1787, - Iir_Kind_Return_Statement => 1793, - Iir_Kind_For_Loop_Statement => 1804, - Iir_Kind_While_Loop_Statement => 1815, - Iir_Kind_Next_Statement => 1822, - Iir_Kind_Exit_Statement => 1829, - Iir_Kind_Case_Statement => 1837, - Iir_Kind_Procedure_Call_Statement => 1843, - Iir_Kind_Break_Statement => 1850, - Iir_Kind_If_Statement => 1860, - Iir_Kind_Elsif => 1866, - Iir_Kind_Character_Literal => 1874, - Iir_Kind_Simple_Name => 1882, - Iir_Kind_Selected_Name => 1891, - Iir_Kind_Operator_Symbol => 1897, - Iir_Kind_Reference_Name => 1902, - Iir_Kind_External_Constant_Name => 1910, - Iir_Kind_External_Signal_Name => 1918, - Iir_Kind_External_Variable_Name => 1927, - Iir_Kind_Selected_By_All_Name => 1933, - Iir_Kind_Parenthesis_Name => 1938, - Iir_Kind_Package_Pathname => 1942, - Iir_Kind_Absolute_Pathname => 1943, - Iir_Kind_Relative_Pathname => 1944, - Iir_Kind_Pathname_Element => 1949, - Iir_Kind_Base_Attribute => 1951, - Iir_Kind_Subtype_Attribute => 1956, - Iir_Kind_Element_Attribute => 1961, - Iir_Kind_Across_Attribute => 1966, - Iir_Kind_Through_Attribute => 1971, - Iir_Kind_Nature_Reference_Attribute => 1975, - Iir_Kind_Left_Type_Attribute => 1980, - Iir_Kind_Right_Type_Attribute => 1985, - Iir_Kind_High_Type_Attribute => 1990, - Iir_Kind_Low_Type_Attribute => 1995, - Iir_Kind_Ascending_Type_Attribute => 2000, - Iir_Kind_Image_Attribute => 2006, - Iir_Kind_Value_Attribute => 2012, - Iir_Kind_Pos_Attribute => 2018, - Iir_Kind_Val_Attribute => 2024, - Iir_Kind_Succ_Attribute => 2030, - Iir_Kind_Pred_Attribute => 2036, - Iir_Kind_Leftof_Attribute => 2042, - Iir_Kind_Rightof_Attribute => 2048, - Iir_Kind_Signal_Slew_Attribute => 2056, - Iir_Kind_Quantity_Slew_Attribute => 2064, - Iir_Kind_Ramp_Attribute => 2072, - Iir_Kind_Dot_Attribute => 2079, - Iir_Kind_Integ_Attribute => 2086, - Iir_Kind_Above_Attribute => 2094, - Iir_Kind_Delayed_Attribute => 2103, - Iir_Kind_Stable_Attribute => 2112, - Iir_Kind_Quiet_Attribute => 2121, - Iir_Kind_Transaction_Attribute => 2130, - Iir_Kind_Event_Attribute => 2134, - Iir_Kind_Active_Attribute => 2138, - Iir_Kind_Last_Event_Attribute => 2142, - Iir_Kind_Last_Active_Attribute => 2146, - Iir_Kind_Last_Value_Attribute => 2150, - Iir_Kind_Driving_Attribute => 2154, - Iir_Kind_Driving_Value_Attribute => 2158, - Iir_Kind_Behavior_Attribute => 2158, - Iir_Kind_Structure_Attribute => 2158, - Iir_Kind_Simple_Name_Attribute => 2165, - Iir_Kind_Instance_Name_Attribute => 2170, - Iir_Kind_Path_Name_Attribute => 2175, - Iir_Kind_Left_Array_Attribute => 2182, - Iir_Kind_Right_Array_Attribute => 2189, - Iir_Kind_High_Array_Attribute => 2196, - Iir_Kind_Low_Array_Attribute => 2203, - Iir_Kind_Length_Array_Attribute => 2210, - Iir_Kind_Ascending_Array_Attribute => 2217, - Iir_Kind_Range_Array_Attribute => 2224, - Iir_Kind_Reverse_Range_Array_Attribute => 2231, - Iir_Kind_Attribute_Name => 2240 + Iir_Kind_Record_Nature_Definition => 503, + Iir_Kind_Array_Nature_Definition => 517, + Iir_Kind_Array_Subnature_Definition => 532, + Iir_Kind_Overload_List => 533, + Iir_Kind_Entity_Declaration => 546, + Iir_Kind_Configuration_Declaration => 555, + Iir_Kind_Context_Declaration => 561, + Iir_Kind_Package_Declaration => 576, + Iir_Kind_Package_Instantiation_Declaration => 590, + Iir_Kind_Vmode_Declaration => 601, + Iir_Kind_Vprop_Declaration => 612, + Iir_Kind_Vunit_Declaration => 624, + Iir_Kind_Package_Body => 632, + Iir_Kind_Architecture_Body => 645, + Iir_Kind_Type_Declaration => 652, + Iir_Kind_Anonymous_Type_Declaration => 658, + Iir_Kind_Subtype_Declaration => 665, + Iir_Kind_Nature_Declaration => 671, + Iir_Kind_Subnature_Declaration => 678, + Iir_Kind_Package_Header => 680, + Iir_Kind_Unit_Declaration => 689, + Iir_Kind_Library_Declaration => 696, + Iir_Kind_Component_Declaration => 706, + Iir_Kind_Attribute_Declaration => 713, + Iir_Kind_Group_Template_Declaration => 719, + Iir_Kind_Group_Declaration => 726, + Iir_Kind_Element_Declaration => 733, + Iir_Kind_Nature_Element_Declaration => 740, + Iir_Kind_Non_Object_Alias_Declaration => 748, + Iir_Kind_Psl_Declaration => 756, + Iir_Kind_Psl_Endpoint_Declaration => 770, + Iir_Kind_Enumeration_Literal => 781, + Iir_Kind_Function_Declaration => 806, + Iir_Kind_Procedure_Declaration => 830, + Iir_Kind_Function_Body => 840, + Iir_Kind_Procedure_Body => 851, + Iir_Kind_Terminal_Declaration => 860, + Iir_Kind_Object_Alias_Declaration => 871, + Iir_Kind_Free_Quantity_Declaration => 883, + Iir_Kind_Spectrum_Quantity_Declaration => 896, + Iir_Kind_Noise_Quantity_Declaration => 908, + Iir_Kind_Across_Quantity_Declaration => 924, + Iir_Kind_Through_Quantity_Declaration => 940, + Iir_Kind_File_Declaration => 954, + Iir_Kind_Guard_Signal_Declaration => 967, + Iir_Kind_Signal_Declaration => 984, + Iir_Kind_Variable_Declaration => 997, + Iir_Kind_Constant_Declaration => 1011, + Iir_Kind_Iterator_Declaration => 1022, + Iir_Kind_Interface_Constant_Declaration => 1038, + Iir_Kind_Interface_Variable_Declaration => 1054, + Iir_Kind_Interface_Signal_Declaration => 1075, + Iir_Kind_Interface_File_Declaration => 1091, + Iir_Kind_Interface_Quantity_Declaration => 1107, + Iir_Kind_Interface_Terminal_Declaration => 1119, + Iir_Kind_Interface_Type_Declaration => 1129, + Iir_Kind_Interface_Package_Declaration => 1141, + Iir_Kind_Interface_Function_Declaration => 1158, + Iir_Kind_Interface_Procedure_Declaration => 1171, + Iir_Kind_Anonymous_Signal_Declaration => 1180, + Iir_Kind_Signal_Attribute_Declaration => 1183, + Iir_Kind_Identity_Operator => 1187, + Iir_Kind_Negation_Operator => 1191, + Iir_Kind_Absolute_Operator => 1195, + Iir_Kind_Not_Operator => 1199, + Iir_Kind_Implicit_Condition_Operator => 1203, + Iir_Kind_Condition_Operator => 1207, + Iir_Kind_Reduction_And_Operator => 1211, + Iir_Kind_Reduction_Or_Operator => 1215, + Iir_Kind_Reduction_Nand_Operator => 1219, + Iir_Kind_Reduction_Nor_Operator => 1223, + Iir_Kind_Reduction_Xor_Operator => 1227, + Iir_Kind_Reduction_Xnor_Operator => 1231, + Iir_Kind_And_Operator => 1236, + Iir_Kind_Or_Operator => 1241, + Iir_Kind_Nand_Operator => 1246, + Iir_Kind_Nor_Operator => 1251, + Iir_Kind_Xor_Operator => 1256, + Iir_Kind_Xnor_Operator => 1261, + Iir_Kind_Equality_Operator => 1266, + Iir_Kind_Inequality_Operator => 1271, + Iir_Kind_Less_Than_Operator => 1276, + Iir_Kind_Less_Than_Or_Equal_Operator => 1281, + Iir_Kind_Greater_Than_Operator => 1286, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1291, + Iir_Kind_Match_Equality_Operator => 1296, + Iir_Kind_Match_Inequality_Operator => 1301, + Iir_Kind_Match_Less_Than_Operator => 1306, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1311, + Iir_Kind_Match_Greater_Than_Operator => 1316, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1321, + Iir_Kind_Sll_Operator => 1326, + Iir_Kind_Sla_Operator => 1331, + Iir_Kind_Srl_Operator => 1336, + Iir_Kind_Sra_Operator => 1341, + Iir_Kind_Rol_Operator => 1346, + Iir_Kind_Ror_Operator => 1351, + Iir_Kind_Addition_Operator => 1356, + Iir_Kind_Substraction_Operator => 1361, + Iir_Kind_Concatenation_Operator => 1366, + Iir_Kind_Multiplication_Operator => 1371, + Iir_Kind_Division_Operator => 1376, + Iir_Kind_Modulus_Operator => 1381, + Iir_Kind_Remainder_Operator => 1386, + Iir_Kind_Exponentiation_Operator => 1391, + Iir_Kind_Function_Call => 1399, + Iir_Kind_Aggregate => 1406, + Iir_Kind_Parenthesis_Expression => 1409, + Iir_Kind_Qualified_Expression => 1413, + Iir_Kind_Type_Conversion => 1418, + Iir_Kind_Allocator_By_Expression => 1422, + Iir_Kind_Allocator_By_Subtype => 1427, + Iir_Kind_Selected_Element => 1435, + Iir_Kind_Dereference => 1440, + Iir_Kind_Implicit_Dereference => 1445, + Iir_Kind_Slice_Name => 1452, + Iir_Kind_Indexed_Name => 1458, + Iir_Kind_Psl_Expression => 1460, + Iir_Kind_Sensitized_Process_Statement => 1481, + Iir_Kind_Process_Statement => 1501, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1514, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1527, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1541, + Iir_Kind_Concurrent_Assertion_Statement => 1549, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1556, + Iir_Kind_Concurrent_Break_Statement => 1564, + Iir_Kind_Psl_Assert_Directive => 1577, + Iir_Kind_Psl_Assume_Directive => 1588, + Iir_Kind_Psl_Cover_Directive => 1600, + Iir_Kind_Psl_Restrict_Directive => 1611, + Iir_Kind_Block_Statement => 1625, + Iir_Kind_If_Generate_Statement => 1636, + Iir_Kind_Case_Generate_Statement => 1645, + Iir_Kind_For_Generate_Statement => 1654, + Iir_Kind_Component_Instantiation_Statement => 1665, + Iir_Kind_Psl_Default_Clock => 1669, + Iir_Kind_Generate_Statement_Body => 1680, + Iir_Kind_If_Generate_Else_Clause => 1686, + Iir_Kind_Simple_Simultaneous_Statement => 1693, + Iir_Kind_Simultaneous_Procedural_Statement => 1701, + Iir_Kind_Simultaneous_If_Statement => 1710, + Iir_Kind_Simultaneous_Elsif => 1716, + Iir_Kind_Simple_Signal_Assignment_Statement => 1727, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1738, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1750, + Iir_Kind_Null_Statement => 1754, + Iir_Kind_Assertion_Statement => 1761, + Iir_Kind_Report_Statement => 1767, + Iir_Kind_Wait_Statement => 1775, + Iir_Kind_Variable_Assignment_Statement => 1782, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1789, + Iir_Kind_Return_Statement => 1795, + Iir_Kind_For_Loop_Statement => 1806, + Iir_Kind_While_Loop_Statement => 1817, + Iir_Kind_Next_Statement => 1824, + Iir_Kind_Exit_Statement => 1831, + Iir_Kind_Case_Statement => 1839, + Iir_Kind_Procedure_Call_Statement => 1845, + Iir_Kind_Break_Statement => 1852, + Iir_Kind_If_Statement => 1862, + Iir_Kind_Elsif => 1868, + Iir_Kind_Character_Literal => 1876, + Iir_Kind_Simple_Name => 1884, + Iir_Kind_Selected_Name => 1893, + Iir_Kind_Operator_Symbol => 1899, + Iir_Kind_Reference_Name => 1904, + Iir_Kind_External_Constant_Name => 1912, + Iir_Kind_External_Signal_Name => 1920, + Iir_Kind_External_Variable_Name => 1929, + Iir_Kind_Selected_By_All_Name => 1935, + Iir_Kind_Parenthesis_Name => 1940, + Iir_Kind_Package_Pathname => 1944, + Iir_Kind_Absolute_Pathname => 1945, + Iir_Kind_Relative_Pathname => 1946, + Iir_Kind_Pathname_Element => 1951, + Iir_Kind_Base_Attribute => 1953, + Iir_Kind_Subtype_Attribute => 1958, + Iir_Kind_Element_Attribute => 1963, + Iir_Kind_Across_Attribute => 1968, + Iir_Kind_Through_Attribute => 1973, + Iir_Kind_Nature_Reference_Attribute => 1977, + Iir_Kind_Left_Type_Attribute => 1982, + Iir_Kind_Right_Type_Attribute => 1987, + Iir_Kind_High_Type_Attribute => 1992, + Iir_Kind_Low_Type_Attribute => 1997, + Iir_Kind_Ascending_Type_Attribute => 2002, + Iir_Kind_Image_Attribute => 2008, + Iir_Kind_Value_Attribute => 2014, + Iir_Kind_Pos_Attribute => 2020, + Iir_Kind_Val_Attribute => 2026, + Iir_Kind_Succ_Attribute => 2032, + Iir_Kind_Pred_Attribute => 2038, + Iir_Kind_Leftof_Attribute => 2044, + Iir_Kind_Rightof_Attribute => 2050, + Iir_Kind_Signal_Slew_Attribute => 2058, + Iir_Kind_Quantity_Slew_Attribute => 2066, + Iir_Kind_Ramp_Attribute => 2074, + Iir_Kind_Dot_Attribute => 2081, + Iir_Kind_Integ_Attribute => 2088, + Iir_Kind_Above_Attribute => 2096, + Iir_Kind_Delayed_Attribute => 2105, + Iir_Kind_Stable_Attribute => 2114, + Iir_Kind_Quiet_Attribute => 2123, + Iir_Kind_Transaction_Attribute => 2132, + Iir_Kind_Event_Attribute => 2136, + Iir_Kind_Active_Attribute => 2140, + Iir_Kind_Last_Event_Attribute => 2144, + Iir_Kind_Last_Active_Attribute => 2148, + Iir_Kind_Last_Value_Attribute => 2152, + Iir_Kind_Driving_Attribute => 2156, + Iir_Kind_Driving_Value_Attribute => 2160, + Iir_Kind_Behavior_Attribute => 2160, + Iir_Kind_Structure_Attribute => 2160, + Iir_Kind_Simple_Name_Attribute => 2167, + Iir_Kind_Instance_Name_Attribute => 2172, + Iir_Kind_Path_Name_Attribute => 2177, + Iir_Kind_Left_Array_Attribute => 2184, + Iir_Kind_Right_Array_Attribute => 2191, + Iir_Kind_High_Array_Attribute => 2198, + Iir_Kind_Low_Array_Attribute => 2205, + Iir_Kind_Length_Array_Attribute => 2212, + Iir_Kind_Ascending_Array_Attribute => 2219, + Iir_Kind_Range_Array_Attribute => 2226, + Iir_Kind_Reverse_Range_Array_Attribute => 2233, + Iir_Kind_Attribute_Name => 2242 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -5864,6 +5871,8 @@ package body Vhdl.Nodes_Meta is return Get_Right_Limit_Expr (N); when Field_Base_Type => return Get_Base_Type (N); + when Field_Simple_Nature => + return Get_Simple_Nature (N); when Field_Base_Nature => return Get_Base_Nature (N); when Field_Resolution_Indication => @@ -6306,6 +6315,8 @@ package body Vhdl.Nodes_Meta is Set_Right_Limit_Expr (N, V); when Field_Base_Type => Set_Base_Type (N, V); + when Field_Simple_Nature => + Set_Simple_Nature (N, V); when Field_Base_Nature => Set_Base_Nature (N, V); when Field_Resolution_Indication => @@ -9231,6 +9242,17 @@ package body Vhdl.Nodes_Meta is end case; end Has_Base_Type; + function Has_Simple_Nature (K : Iir_Kind) return Boolean is + begin + case K is + when Iir_Kind_Record_Nature_Definition + | Iir_Kind_Array_Nature_Definition => + return True; + when others => + return False; + end case; + end Has_Simple_Nature; + function Has_Base_Nature (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 3e1ee37b7..a3a9c66c6 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -210,6 +210,7 @@ package Vhdl.Nodes_Meta is Field_Left_Limit_Expr, Field_Right_Limit_Expr, Field_Base_Type, + Field_Simple_Nature, Field_Base_Nature, Field_Resolution_Indication, Field_Record_Element_Resolution_Chain, @@ -767,6 +768,7 @@ package Vhdl.Nodes_Meta is function Has_Left_Limit_Expr (K : Iir_Kind) return Boolean; function Has_Right_Limit_Expr (K : Iir_Kind) return Boolean; function Has_Base_Type (K : Iir_Kind) return Boolean; + function Has_Simple_Nature (K : Iir_Kind) return Boolean; function Has_Base_Nature (K : Iir_Kind) return Boolean; function Has_Resolution_Indication (K : Iir_Kind) return Boolean; function Has_Record_Element_Resolution_Chain (K : Iir_Kind) diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb index 0ca43ddf1..23458bd35 100644 --- a/src/vhdl/vhdl-sem_decls.adb +++ b/src/vhdl/vhdl-sem_decls.adb @@ -2093,11 +2093,11 @@ package body Vhdl.Sem_Decls is procedure Sem_Branch_Quantity_Declaration (Decl : Iir; Last_Decl : Iir) is Plus_Name : Iir; - Plus_Ref : Iir; Minus_Name : Iir; Branch_Type : Iir; Value : Iir; Is_Second : Boolean; + Nat : Iir; begin Sem_Scopes.Add_Name (Decl); Xref_Decl (Decl); @@ -2119,22 +2119,82 @@ package body Vhdl.Sem_Decls is Minus_Name := Sem_Terminal_Name (Minus_Name); Set_Minus_Terminal_Name (Decl, Minus_Name); Minus_Name := Strip_Denoting_Name (Minus_Name); + else + -- AMS-LRM17 6.4.2.7 Quantity declarations + -- A terminal aspect that does not include an explicit minus + -- terminal name is equivalent to a terminal aspect with the + -- given plus terminal name and the name of the reference + -- terminal of the simple nature of its nature as the minus + -- terminal name. + -- + -- GHDL: FIXME: isn't it self-referential with the definition of + -- the terminal nature ? + Minus_Name := Get_Reference + (Get_Nature_Simple_Nature (Get_Nature (Plus_Name))); end if; Value := Get_Default_Value (Decl); end if; Set_Plus_Terminal (Decl, Plus_Name); Set_Minus_Terminal (Decl, Minus_Name); - Plus_Ref := Get_Nature (Plus_Name); + + declare + Plus_Nature : constant Iir := Get_Nature (Plus_Name); + Minus_Nature : constant Iir := Get_Nature (Minus_Name); + Plus_Composite : constant Boolean := + Is_Composite_Nature (Plus_Nature); + Minus_Composite : constant Boolean := + Is_Composite_Nature (Minus_Nature); + begin + -- AMS-LRM17 6.4.2.7 Quantity declarations + -- If the terminals denoted by the terminal names of a terminal + -- aspect are both of composite natures, then they shall be of the + -- same nature, [and for each element of the plus terminal there + -- shall be a matching element of the minus terminal.] + -- If one terminal is a terminal of a composite nature and the + -- other of a scalar nature, then the scalar nature nature shall be + -- the nature of the scalar subelements of the composite terminal. + if (Plus_Composite and Minus_Composite) + or else (not Plus_Composite and not Minus_Composite) + then + if Get_Base_Nature (Plus_Nature) /= Get_Base_Nature (Minus_Nature) + then + Error_Msg_Sem + (+Decl, "terminals must be of the same nature"); + end if; + Nat := Plus_Nature; + elsif Plus_Composite then + pragma Assert (not Minus_Composite); + if (Get_Nature_Simple_Nature (Plus_Nature) + /= Get_Base_Nature (Minus_Nature)) + then + Error_Msg_Sem + (+Decl, "minus terminal must be of the nature of " + & "plus subelements"); + end if; + Nat := Plus_Nature; + else + pragma Assert (Minus_Composite and not Plus_Composite); + if (Get_Nature_Simple_Nature (Minus_Nature) + /= Get_Base_Nature (Plus_Nature)) + then + Error_Msg_Sem + (+Decl, "plus terminal must be of the nature of " + & "minus subelements"); + end if; + Nat := Minus_Nature; + end if; + end; case Iir_Kinds_Branch_Quantity_Declaration (Get_Kind (Decl)) is when Iir_Kind_Across_Quantity_Declaration => - Branch_Type := Get_Across_Type (Plus_Ref); + Branch_Type := Get_Across_Type (Nat); when Iir_Kind_Through_Quantity_Declaration => - Branch_Type := Get_Through_Type (Plus_Ref); + Branch_Type := Get_Through_Type (Nat); end case; pragma Assert (Branch_Type /= Null_Iir); Set_Type (Decl, Branch_Type); Set_Name_Staticness (Decl, Locally); + Set_Expr_Staticness (Decl, None); if not Is_Second and then Value /= Null_Iir then Value := Sem_Expression (Value, Branch_Type); diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb index a72a3b4ad..6e9b87928 100644 --- a/src/vhdl/vhdl-sem_types.adb +++ b/src/vhdl/vhdl-sem_types.adb @@ -2447,7 +2447,7 @@ package body Vhdl.Sem_Types is St_Def := Create_Iir (Iir_Kind_Array_Subtype_Definition); Location_Copy (St_Def, Def); Set_Index_Subtype_List (St_Def, Get_Index_Subtype_List (Def)); - Set_Element_Subtype (St_Def, Get_Element_Subtype (St_Def)); + Set_Element_Subtype (St_Def, Get_Element_Subtype (Br_Def)); Set_Base_Type (St_Def, Get_Base_Type (Br_Def)); Set_Type_Staticness (St_Def, Get_Nature_Staticness (Def)); Set_Constraint_State (St_Def, Get_Constraint_State (Def)); @@ -2543,6 +2543,8 @@ package body Vhdl.Sem_Types is El_Nat := Get_Named_Entity (El_Nat); El_Nat := Get_Nature (El_Nat); Set_Element_Subnature (Def, El_Nat); + + Set_Simple_Nature (Def, Get_Nature_Simple_Nature (El_Nat)); end if; Set_Base_Nature (Def, Def); @@ -2575,6 +2577,7 @@ package body Vhdl.Sem_Types is Nature_Staticness : Iir_Staticness; Constraint : Iir_Constraint; Composite_Found : Boolean; + Simple_Nature : Iir; begin -- AMS-LRM17 12.1 Declarative region -- f) A record nature declaration @@ -2584,6 +2587,7 @@ package body Vhdl.Sem_Types is Nature_Staticness := Locally; Constraint := Fully_Constrained; Composite_Found := False; + Simple_Nature := Null_Iir; for I in Flist_First .. Flist_Last (El_List) loop El := Get_Nth_Element (El_List, I); @@ -2600,6 +2604,17 @@ package body Vhdl.Sem_Types is if El_Nat /= Null_Iir then Set_Nature (El, El_Nat); + -- AMS-LRM17 5.8.3 Composite natures + -- The scalar subelements of a composite nature shall all have + -- the same simple nature, [...] + if Simple_Nature = Null_Iir then + Simple_Nature := Get_Nature_Simple_Nature (El_Nat); + Set_Simple_Nature (Def, El_Nat); + elsif Get_Nature_Simple_Nature (El_Nat) /= Simple_Nature then + Error_Msg_Sem + (+El, "elements must have the same simple nature"); + end if; + -- LRM93 3.2.1.1 -- The same requirement [must define a constrained array -- subtype] exits for the subtype indication of an @@ -2739,4 +2754,28 @@ package body Vhdl.Sem_Types is end case; end Is_Nature_Type; + function Get_Nature_Simple_Nature (Nat : Iir) return Iir is + begin + case Iir_Kinds_Nature_Indication (Get_Kind (Nat)) is + when Iir_Kind_Scalar_Nature_Definition => + return Nat; + when Iir_Kind_Array_Nature_Definition + | Iir_Kind_Record_Nature_Definition => + return Get_Simple_Nature (Nat); + when Iir_Kind_Array_Subnature_Definition => + return Get_Simple_Nature (Get_Base_Nature (Nat)); + end case; + end Get_Nature_Simple_Nature; + + function Is_Composite_Nature (Nat : Iir) return Boolean is + begin + case Iir_Kinds_Nature_Indication (Get_Kind (Nat)) is + when Iir_Kind_Scalar_Nature_Definition => + return False; + when Iir_Kind_Array_Nature_Definition + | Iir_Kind_Record_Nature_Definition + | Iir_Kind_Array_Subnature_Definition => + return True; + end case; + end Is_Composite_Nature; end Vhdl.Sem_Types; diff --git a/src/vhdl/vhdl-sem_types.ads b/src/vhdl/vhdl-sem_types.ads index f104f2428..996dae14f 100644 --- a/src/vhdl/vhdl-sem_types.ads +++ b/src/vhdl/vhdl-sem_types.ads @@ -74,4 +74,17 @@ package Vhdl.Sem_Types is -- -- Return true iff DTYPE is a nature type. function Is_Nature_Type (Dtype : Iir) return Boolean; + + -- Return the simple nature of NAT. + -- + -- AMS-LRM17 5.8.2 Scalar natures + -- The simple nature of a scalar nature is the nature itself. + -- + -- AMS-LRM17 5.8.3 Composite natures + -- The scalar subelements of a composite nature shall have the same simple + -- nature, which is also the simple nature of the composite nature. + function Get_Nature_Simple_Nature (Nat : Iir) return Iir; + + -- Return TRUE iff nature NAT is a composite nature. + function Is_Composite_Nature (Nat : Iir) return Boolean; end Vhdl.Sem_Types; |