aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/libghdl/thin/vhdl/nodes.py4
-rw-r--r--python/libghdl/thin/vhdl/nodes_meta.py201
-rw-r--r--src/ghdldrv/ghdlxml.adb2
-rw-r--r--src/vhdl/translate/trans-chap2.adb1
-rw-r--r--src/vhdl/translate/trans-chap3.adb43
-rw-r--r--src/vhdl/translate/trans-chap9.adb1
-rw-r--r--src/vhdl/translate/translation.adb32
-rw-r--r--src/vhdl/translate/translation.ads3
-rw-r--r--src/vhdl/vhdl-disp_tree.adb16
-rw-r--r--src/vhdl/vhdl-disp_tree.ads1
-rw-r--r--src/vhdl/vhdl-nodes.adb35
-rw-r--r--src/vhdl/vhdl-nodes.ads25
-rw-r--r--src/vhdl/vhdl-nodes_meta.adb526
-rw-r--r--src/vhdl/vhdl-nodes_meta.ads8
-rw-r--r--src/vhdl/vhdl-sem_inst.adb2
-rw-r--r--src/vhdl/vhdl-sem_types.adb28
-rw-r--r--src/vhdl/vhdl-std_package.adb24
17 files changed, 559 insertions, 393 deletions
diff --git a/python/libghdl/thin/vhdl/nodes.py b/python/libghdl/thin/vhdl/nodes.py
index 9a2a05f60..17c70ddea 100644
--- a/python/libghdl/thin/vhdl/nodes.py
+++ b/python/libghdl/thin/vhdl/nodes.py
@@ -2545,6 +2545,10 @@ Get_Expr_Staticness = libghdl.vhdl__nodes__get_expr_staticness
Set_Expr_Staticness = libghdl.vhdl__nodes__set_expr_staticness
+Get_Scalar_Size = libghdl.vhdl__nodes__get_scalar_size
+
+Set_Scalar_Size = libghdl.vhdl__nodes__set_scalar_size
+
Get_Error_Origin = libghdl.vhdl__nodes__get_error_origin
Set_Error_Origin = libghdl.vhdl__nodes__set_error_origin
diff --git a/python/libghdl/thin/vhdl/nodes_meta.py b/python/libghdl/thin/vhdl/nodes_meta.py
index d6387d3ca..e8091798d 100644
--- a/python/libghdl/thin/vhdl/nodes_meta.py
+++ b/python/libghdl/thin/vhdl/nodes_meta.py
@@ -40,12 +40,13 @@ class types:
Number_Base_Type = 22
PSL_NFA = 23
PSL_Node = 24
- Source_File_Entry = 25
- Source_Ptr = 26
- String8_Id = 27
- Time_Stamp_Id = 28
- Token_Type = 29
- Tri_State_Type = 30
+ Scalar_Size = 25
+ Source_File_Entry = 26
+ Source_Ptr = 27
+ String8_Id = 28
+ Time_Stamp_Id = 29
+ Token_Type = 30
+ Tri_State_Type = 31
class Attr:
@@ -329,97 +330,98 @@ class fields:
Alias_Declaration = 265
Referenced_Name = 266
Expr_Staticness = 267
- Error_Origin = 268
- Operand = 269
- Left = 270
- Right = 271
- Unit_Name = 272
- Name = 273
- Group_Template_Name = 274
- Name_Staticness = 275
- Prefix = 276
- Signature_Prefix = 277
- External_Pathname = 278
- Pathname_Suffix = 279
- Pathname_Expression = 280
- In_Formal_Flag = 281
- Slice_Subtype = 282
- Suffix = 283
- Index_Subtype = 284
- Parameter = 285
- Parameter_2 = 286
- Parameter_3 = 287
- Parameter_4 = 288
- Attr_Chain = 289
- Signal_Attribute_Declaration = 290
- Actual_Type = 291
- Actual_Type_Definition = 292
- Association_Chain = 293
- Individual_Association_Chain = 294
- Subprogram_Association_Chain = 295
- Aggregate_Info = 296
- Sub_Aggregate_Info = 297
- Aggr_Dynamic_Flag = 298
- Aggr_Min_Length = 299
- Aggr_Low_Limit = 300
- Aggr_High_Limit = 301
- Aggr_Others_Flag = 302
- Aggr_Named_Flag = 303
- Aggregate_Expand_Flag = 304
- Association_Choices_Chain = 305
- Case_Statement_Alternative_Chain = 306
- Choice_Staticness = 307
- Procedure_Call = 308
- Implementation = 309
- Parameter_Association_Chain = 310
- Method_Object = 311
- Subtype_Type_Mark = 312
- Subnature_Nature_Mark = 313
- Type_Conversion_Subtype = 314
- Type_Mark = 315
- File_Type_Mark = 316
- Return_Type_Mark = 317
- Has_Disconnect_Flag = 318
- Has_Active_Flag = 319
- Is_Within_Flag = 320
- Type_Marks_List = 321
- Implicit_Alias_Flag = 322
- Alias_Signature = 323
- Attribute_Signature = 324
- Overload_List = 325
- Simple_Name_Identifier = 326
- Simple_Name_Subtype = 327
- Protected_Type_Body = 328
- Protected_Type_Declaration = 329
- Use_Flag = 330
- End_Has_Reserved_Id = 331
- End_Has_Identifier = 332
- End_Has_Postponed = 333
- Has_Label = 334
- Has_Begin = 335
- Has_End = 336
- Has_Is = 337
- Has_Pure = 338
- Has_Body = 339
- Has_Parameter = 340
- Has_Component = 341
- Has_Identifier_List = 342
- Has_Mode = 343
- Has_Class = 344
- Has_Delay_Mechanism = 345
- Suspend_Flag = 346
- Is_Ref = 347
- Is_Forward_Ref = 348
- Psl_Property = 349
- Psl_Sequence = 350
- Psl_Declaration = 351
- Psl_Expression = 352
- Psl_Boolean = 353
- PSL_Clock = 354
- PSL_NFA = 355
- PSL_Nbr_States = 356
- PSL_Clock_Sensitivity = 357
- PSL_EOS_Flag = 358
+ Scalar_Size = 268
+ Error_Origin = 269
+ Operand = 270
+ Left = 271
+ Right = 272
+ Unit_Name = 273
+ Name = 274
+ Group_Template_Name = 275
+ Name_Staticness = 276
+ Prefix = 277
+ Signature_Prefix = 278
+ External_Pathname = 279
+ Pathname_Suffix = 280
+ Pathname_Expression = 281
+ In_Formal_Flag = 282
+ Slice_Subtype = 283
+ Suffix = 284
+ Index_Subtype = 285
+ Parameter = 286
+ Parameter_2 = 287
+ Parameter_3 = 288
+ Parameter_4 = 289
+ Attr_Chain = 290
+ Signal_Attribute_Declaration = 291
+ Actual_Type = 292
+ Actual_Type_Definition = 293
+ Association_Chain = 294
+ Individual_Association_Chain = 295
+ Subprogram_Association_Chain = 296
+ Aggregate_Info = 297
+ Sub_Aggregate_Info = 298
+ Aggr_Dynamic_Flag = 299
+ Aggr_Min_Length = 300
+ Aggr_Low_Limit = 301
+ Aggr_High_Limit = 302
+ Aggr_Others_Flag = 303
+ Aggr_Named_Flag = 304
+ Aggregate_Expand_Flag = 305
+ Association_Choices_Chain = 306
+ Case_Statement_Alternative_Chain = 307
+ Choice_Staticness = 308
+ Procedure_Call = 309
+ Implementation = 310
+ Parameter_Association_Chain = 311
+ Method_Object = 312
+ Subtype_Type_Mark = 313
+ Subnature_Nature_Mark = 314
+ Type_Conversion_Subtype = 315
+ Type_Mark = 316
+ File_Type_Mark = 317
+ Return_Type_Mark = 318
+ Has_Disconnect_Flag = 319
+ Has_Active_Flag = 320
+ Is_Within_Flag = 321
+ Type_Marks_List = 322
+ Implicit_Alias_Flag = 323
+ Alias_Signature = 324
+ Attribute_Signature = 325
+ Overload_List = 326
+ Simple_Name_Identifier = 327
+ Simple_Name_Subtype = 328
+ Protected_Type_Body = 329
+ Protected_Type_Declaration = 330
+ Use_Flag = 331
+ End_Has_Reserved_Id = 332
+ End_Has_Identifier = 333
+ End_Has_Postponed = 334
+ Has_Label = 335
+ Has_Begin = 336
+ Has_End = 337
+ Has_Is = 338
+ Has_Pure = 339
+ Has_Body = 340
+ Has_Parameter = 341
+ Has_Component = 342
+ Has_Identifier_List = 343
+ Has_Mode = 344
+ Has_Class = 345
+ Has_Delay_Mechanism = 346
+ Suspend_Flag = 347
+ Is_Ref = 348
+ Is_Forward_Ref = 349
+ Psl_Property = 350
+ Psl_Sequence = 351
+ Psl_Declaration = 352
+ Psl_Expression = 353
+ Psl_Boolean = 354
+ PSL_Clock = 355
+ PSL_NFA = 356
+ PSL_Nbr_States = 357
+ PSL_Clock_Sensitivity = 358
+ PSL_EOS_Flag = 359
Get_Boolean = libghdl.vhdl__nodes_meta__get_boolean
@@ -472,6 +474,8 @@ Get_PSL_NFA = libghdl.vhdl__nodes_meta__get_psl_nfa
Get_PSL_Node = libghdl.vhdl__nodes_meta__get_psl_node
+Get_Scalar_Size = libghdl.vhdl__nodes_meta__get_scalar_size
+
Get_Source_File_Entry = libghdl.vhdl__nodes_meta__get_source_file_entry
Get_Source_Ptr = libghdl.vhdl__nodes_meta__get_source_ptr
@@ -1289,6 +1293,9 @@ Has_Referenced_Name =\
Has_Expr_Staticness =\
libghdl.vhdl__nodes_meta__has_expr_staticness
+Has_Scalar_Size =\
+ libghdl.vhdl__nodes_meta__has_scalar_size
+
Has_Error_Origin =\
libghdl.vhdl__nodes_meta__has_error_origin
diff --git a/src/ghdldrv/ghdlxml.adb b/src/ghdldrv/ghdlxml.adb
index 10e1644ef..5a201955d 100644
--- a/src/ghdldrv/ghdlxml.adb
+++ b/src/ghdldrv/ghdlxml.adb
@@ -371,6 +371,8 @@ package body Ghdlxml is
when Type_Iir_Staticness =>
Put_Field (F, Image_Iir_Staticness
(Get_Iir_Staticness (N, F)));
+ when Type_Scalar_Size =>
+ Put_Field (F, Image_Scalar_Size (Get_Scalar_Size (N, F)));
when Type_Date_State_Type =>
Put_Field (F, Image_Date_State_Type
(Get_Date_State_Type (N, F)));
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index ac58068af..7badaeafb 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -1471,6 +1471,7 @@ package body Trans.Chap2 is
| Type_Int32
| Type_Fp64
| Type_Token_Type
+ | Type_Scalar_Size
| Type_Name_Id =>
null;
end case;
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index 082a20810..b0f61fe7e 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -27,7 +27,6 @@ with Trans.Chap7;
with Trans.Chap14;
with Trans_Decls; use Trans_Decls;
with Trans.Helpers2; use Trans.Helpers2;
-with Translation;
package body Trans.Chap3 is
use Trans.Helpers;
@@ -332,45 +331,21 @@ package body Trans.Chap3 is
-- Integer --
---------------
- -- Return the number of bits (32 or 64) required to represent the
- -- (integer or physical) type definition DEF.
- type Type_Precision is (Precision_32, Precision_64);
- function Get_Type_Precision (Def : Iir) return Type_Precision
- is
- St : constant Iir :=
- Get_Subtype_Definition (Get_Type_Declarator (Def));
- L, H : Iir;
- Lv, Hv : Int64;
- subtype Int64_32 is Int64 range -(2 ** 31) .. 2 ** 31 - 1;
- begin
- Get_Low_High_Limit (Get_Range_Constraint (St), L, H);
- Lv := Get_Value (L);
- Hv := Get_Value (H);
- if Lv in Int64_32 and then Hv in Int64_32 then
- return Precision_32;
- else
- if Translation.Flag_Only_32b then
- Error_Msg_Sem
- (+St, "range of %n is too large", +Get_Type_Declarator (St));
- return Precision_32;
- end if;
- return Precision_64;
- end if;
- end Get_Type_Precision;
-
procedure Translate_Integer_Type (Def : Iir_Integer_Type_Definition)
is
Info : constant Type_Info_Acc := Get_Info (Def);
begin
- case Get_Type_Precision (Def) is
- when Precision_32 =>
+ case Get_Scalar_Size (Def) is
+ when Scalar_32 =>
Info.Ortho_Type (Mode_Value) := New_Signed_Type (32);
Info.Type_Mode := Type_Mode_I32;
Info.B.Align := Align_32;
- when Precision_64 =>
+ when Scalar_64 =>
Info.Ortho_Type (Mode_Value) := New_Signed_Type (64);
Info.Type_Mode := Type_Mode_I64;
Info.B.Align := Align_64;
+ when others =>
+ raise Internal_Error;
end case;
-- Integers are always in their ranges.
Info.S.Nocheck_Low := True;
@@ -406,15 +381,17 @@ package body Trans.Chap3 is
is
Info : constant Type_Info_Acc := Get_Info (Def);
begin
- case Get_Type_Precision (Def) is
- when Precision_32 =>
+ case Get_Scalar_Size (Def) is
+ when Scalar_32 =>
Info.Ortho_Type (Mode_Value) := New_Signed_Type (32);
Info.Type_Mode := Type_Mode_P32;
Info.B.Align := Align_32;
- when Precision_64 =>
+ when Scalar_64 =>
Info.Ortho_Type (Mode_Value) := New_Signed_Type (64);
Info.Type_Mode := Type_Mode_P64;
Info.B.Align := Align_64;
+ when others =>
+ raise Internal_Error;
end case;
-- Physical types are always in their ranges.
Info.S.Nocheck_Low := True;
diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb
index c10c0d24f..58533e37b 100644
--- a/src/vhdl/translate/trans-chap9.adb
+++ b/src/vhdl/translate/trans-chap9.adb
@@ -1388,6 +1388,7 @@ package body Trans.Chap9 is
| Type_Int32
| Type_Fp64
| Type_Token_Type
+ | Type_Scalar_Size
| Type_Name_Id =>
null;
end case;
diff --git a/src/vhdl/translate/translation.adb b/src/vhdl/translate/translation.adb
index 7bb16a17b..693212776 100644
--- a/src/vhdl/translate/translation.adb
+++ b/src/vhdl/translate/translation.adb
@@ -438,10 +438,8 @@ package body Translation is
Ghdl_Real_Type := New_Float_Type;
New_Type_Decl (Get_Identifier ("__ghdl_real"), Ghdl_Real_Type);
- if not Flag_Only_32b then
- Ghdl_I64_Type := New_Signed_Type (64);
- New_Type_Decl (Get_Identifier ("__ghdl_i64"), Ghdl_I64_Type);
- end if;
+ Ghdl_I64_Type := New_Signed_Type (64);
+ New_Type_Decl (Get_Identifier ("__ghdl_i64"), Ghdl_I64_Type);
-- File index for elaborated file object.
Ghdl_File_Index_Type := New_Unsigned_Type (32);
@@ -1226,10 +1224,8 @@ package body Translation is
-- procedure __ghdl_image_p64 (res : std_string_ptr_node;
-- val : ghdl_i64_type;
-- rti : ghdl_rti_access);
- if not Flag_Only_32b then
- Create_Image_Value_Subprograms
- ("p64", Ghdl_I64_Type, True, Ghdl_Image_P64, Ghdl_Value_P64);
- end if;
+ Create_Image_Value_Subprograms
+ ("p64", Ghdl_I64_Type, True, Ghdl_Image_P64, Ghdl_Value_P64);
-- procedure __ghdl_image_f64 (res : std_string_ptr_node;
-- val : ghdl_real_type);
@@ -1611,17 +1607,15 @@ package body Translation is
Ghdl_Signal_Add_Port_Driver_F64,
Ghdl_Signal_Driving_Value_F64);
- if not Flag_Only_32b then
- Create_Signal_Subprograms ("i64", Ghdl_I64_Type,
- Ghdl_Create_Signal_I64,
- Ghdl_Signal_Init_I64,
- Ghdl_Signal_Simple_Assign_I64,
- Ghdl_Signal_Start_Assign_I64,
- Ghdl_Signal_Next_Assign_I64,
- Ghdl_Signal_Associate_I64,
- Ghdl_Signal_Add_Port_Driver_I64,
- Ghdl_Signal_Driving_Value_I64);
- end if;
+ Create_Signal_Subprograms ("i64", Ghdl_I64_Type,
+ Ghdl_Create_Signal_I64,
+ Ghdl_Signal_Init_I64,
+ Ghdl_Signal_Simple_Assign_I64,
+ Ghdl_Signal_Start_Assign_I64,
+ Ghdl_Signal_Next_Assign_I64,
+ Ghdl_Signal_Associate_I64,
+ Ghdl_Signal_Add_Port_Driver_I64,
+ Ghdl_Signal_Driving_Value_I64);
-- procedure __ghdl_process_add_sensitivity (sig : __ghdl_signal_ptr);
Start_Procedure_Decl
diff --git a/src/vhdl/translate/translation.ads b/src/vhdl/translate/translation.ads
index 73c92c347..91e8785e3 100644
--- a/src/vhdl/translate/translation.ads
+++ b/src/vhdl/translate/translation.ads
@@ -47,9 +47,6 @@ package Translation is
-- If set, generate Run-Time Information nodes.
Flag_Rti : Boolean := True;
- -- If set, do not generate 64 bits integer types and operations.
- Flag_Only_32b : Boolean := False;
-
-- If set, do not generate code for unused subprograms.
-- Be careful: unless you are in whole compilation mode, this
-- flag shouldn't be set for packages and entities.
diff --git a/src/vhdl/vhdl-disp_tree.adb b/src/vhdl/vhdl-disp_tree.adb
index cbf9c324a..16aaab9f8 100644
--- a/src/vhdl/vhdl-disp_tree.adb
+++ b/src/vhdl/vhdl-disp_tree.adb
@@ -341,6 +341,20 @@ package body Vhdl.Disp_Tree is
function Image_Token_Type (Tok : Vhdl.Tokens.Token_Type) return String
renames Vhdl.Tokens.Image;
+ function Image_Scalar_Size (Sz : Scalar_Size) return String is
+ begin
+ case Sz is
+ when Scalar_8 =>
+ return "8";
+ when Scalar_16 =>
+ return "16";
+ when Scalar_32 =>
+ return "32";
+ when Scalar_64 =>
+ return "64";
+ end case;
+ end Image_Scalar_Size;
+
function Image_String8 (N : Iir) return String
is
use Str_Table;
@@ -577,6 +591,8 @@ package body Vhdl.Disp_Tree is
(Get_File_Checksum_Id (N, F)));
when Type_Token_Type =>
Log_Line (Image_Token_Type (Get_Token_Type (N, F)));
+ when Type_Scalar_Size =>
+ Log_Line (Image_Scalar_Size (Get_Scalar_Size (N, F)));
when Type_Name_Id =>
Log (Image_Name_Id (Get_Name_Id (N, F)));
Log (" ");
diff --git a/src/vhdl/vhdl-disp_tree.ads b/src/vhdl/vhdl-disp_tree.ads
index d2828b1bc..633844d38 100644
--- a/src/vhdl/vhdl-disp_tree.ads
+++ b/src/vhdl/vhdl-disp_tree.ads
@@ -50,4 +50,5 @@ package Vhdl.Disp_Tree is
function Image_Iir_Direction (Dir : Iir_Direction) return String;
function Image_Token_Type (Tok : Vhdl.Tokens.Token_Type) return String;
function Image_String8 (N : Iir) return String;
+ function Image_Scalar_Size (Sz : Scalar_Size) return String;
end Vhdl.Disp_Tree;
diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb
index fed51ba7e..21697e6b1 100644
--- a/src/vhdl/vhdl-nodes.adb
+++ b/src/vhdl/vhdl-nodes.adb
@@ -5676,6 +5676,41 @@ package body Vhdl.Nodes is
Set_State1 (Target, Iir_Staticness'Pos (Static));
end Set_Expr_Staticness;
+ type Scalar_Size_Conv is record
+ Flag6: Boolean;
+ Flag7: Boolean;
+ end record;
+ pragma Pack (Scalar_Size_Conv);
+ pragma Assert (Scalar_Size_Conv'Size = Scalar_Size'Size);
+
+ function Get_Scalar_Size (N : Iir) return Scalar_Size
+ is
+ function To_Scalar_Size is new Ada.Unchecked_Conversion
+ (Scalar_Size_Conv, Scalar_Size);
+ Conv : Scalar_Size_Conv;
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Scalar_Size (Get_Kind (N)),
+ "no field Scalar_Size");
+ Conv.Flag6 := Get_Flag6 (N);
+ Conv.Flag7 := Get_Flag7 (N);
+ return To_Scalar_Size (Conv);
+ end Get_Scalar_Size;
+
+ procedure Set_Scalar_Size (N : Iir; Sz : Scalar_Size)
+ is
+ function To_Scalar_Size_Conv is new Ada.Unchecked_Conversion
+ (Scalar_Size, Scalar_Size_Conv);
+ Conv : Scalar_Size_Conv;
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Scalar_Size (Get_Kind (N)),
+ "no field Scalar_Size");
+ Conv := To_Scalar_Size_Conv (Sz);
+ Set_Flag6 (N, Conv.Flag6);
+ Set_Flag7 (N, Conv.Flag7);
+ end Set_Scalar_Size;
+
function Get_Error_Origin (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 d8bcd14ec..628f1b2f8 100644
--- a/src/vhdl/vhdl-nodes.ads
+++ b/src/vhdl/vhdl-nodes.ads
@@ -2312,6 +2312,9 @@ package Vhdl.Nodes is
-- Get/Set_Is_Ref (Flag12)
--
-- Get/Set_Type_Staticness (State1)
+ --
+ -- Note: only 8 or 32.
+ -- Get/Set_Scalar_Size (Flag6,Flag7)
-- Iir_Kind_Enumeration_Literal (Short)
--
@@ -2372,6 +2375,8 @@ package Vhdl.Nodes is
-- Get/Set_End_Has_Identifier (Flag9)
--
-- Get/Set_Is_Ref (Flag12)
+ --
+ -- Get/Set_Scalar_Size (Flag6,Flag7)
-- Iir_Kind_Unit_Declaration (Short)
--
@@ -2439,6 +2444,9 @@ package Vhdl.Nodes is
-- Get/Set_Has_Signal_Flag (Flag3)
--
-- Get/Set_Is_Ref (Flag12)
+ --
+ -- Note: only 32 or 64.
+ -- Get/Set_Scalar_Size (Flag6,Flag7)
-- Iir_Kind_Array_Type_Definition (Medium)
--
@@ -5894,6 +5902,17 @@ package Vhdl.Nodes is
Iir_Predefined_Functions'Succ (Iir_Predefined_None) ..
Iir_Predefined_Functions'Last;
+ -- Size of scalar types.
+ -- Their size is determined during analysis (using the range), so that
+ -- all backends have the same view.
+ type Scalar_Size is
+ (
+ Scalar_8,
+ Scalar_16,
+ Scalar_32,
+ Scalar_64
+ );
+
-- Staticness as defined by LRM93 6.1 and 7.4
type Iir_Staticness is
(
@@ -5904,7 +5923,7 @@ package Vhdl.Nodes is
);
-- Staticness as defined by LRM93 6.1 and 7.4
- function Min (L,R: Iir_Staticness) return Iir_Staticness renames
+ function Min (L, R : Iir_Staticness) return Iir_Staticness renames
Iir_Staticness'Min;
-- Purity state of a procedure.
@@ -8370,6 +8389,10 @@ package Vhdl.Nodes is
function Get_Expr_Staticness (Target : Iir) return Iir_Staticness;
procedure Set_Expr_Staticness (Target : Iir; Static : Iir_Staticness);
+ -- Field: Flag6,Flag7 (grp)
+ function Get_Scalar_Size (N : Iir) return Scalar_Size;
+ procedure Set_Scalar_Size (N : Iir; Sz : Scalar_Size);
+
-- Node which couldn't be correctly analyzed.
-- Field: Field2
function Get_Error_Origin (Target : Iir) return Iir;
diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb
index 48a05f0aa..1046e8856 100644
--- a/src/vhdl/vhdl-nodes_meta.adb
+++ b/src/vhdl/vhdl-nodes_meta.adb
@@ -287,6 +287,7 @@ package body Vhdl.Nodes_Meta is
Field_Alias_Declaration => Type_Iir,
Field_Referenced_Name => Type_Iir,
Field_Expr_Staticness => Type_Iir_Staticness,
+ Field_Scalar_Size => Type_Scalar_Size,
Field_Error_Origin => Type_Iir,
Field_Operand => Type_Iir,
Field_Left => Type_Iir,
@@ -924,6 +925,8 @@ package body Vhdl.Nodes_Meta is
return "referenced_name";
when Field_Expr_Staticness =>
return "expr_staticness";
+ when Field_Scalar_Size =>
+ return "scalar_size";
when Field_Error_Origin =>
return "error_origin";
when Field_Operand =>
@@ -2268,6 +2271,8 @@ package body Vhdl.Nodes_Meta is
return Attr_Ref;
when Field_Expr_Staticness =>
return Attr_None;
+ when Field_Scalar_Size =>
+ return Attr_None;
when Field_Error_Origin =>
return Attr_None;
when Field_Operand =>
@@ -2947,6 +2952,7 @@ package body Vhdl.Nodes_Meta is
Field_Has_Signal_Flag,
Field_Only_Characters_Flag,
Field_Is_Character_Type,
+ Field_Scalar_Size,
Field_Type_Staticness,
Field_Enumeration_Literal_List,
Field_Range_Constraint,
@@ -2957,6 +2963,7 @@ package body Vhdl.Nodes_Meta is
Field_Is_Ref,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Scalar_Size,
Field_Type_Staticness,
Field_Range_Constraint,
Field_Type_Declarator,
@@ -2966,6 +2973,7 @@ package body Vhdl.Nodes_Meta is
Field_Is_Ref,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Scalar_Size,
Field_Type_Staticness,
Field_Range_Constraint,
Field_Type_Declarator,
@@ -2975,6 +2983,7 @@ package body Vhdl.Nodes_Meta is
Field_Is_Ref,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Scalar_Size,
Field_End_Has_Reserved_Id,
Field_End_Has_Identifier,
Field_Type_Staticness,
@@ -5127,246 +5136,246 @@ package body Vhdl.Nodes_Meta is
Iir_Kind_Floating_Subtype_Definition => 397,
Iir_Kind_Integer_Subtype_Definition => 407,
Iir_Kind_Enumeration_Subtype_Definition => 417,
- Iir_Kind_Enumeration_Type_Definition => 428,
- Iir_Kind_Integer_Type_Definition => 436,
- Iir_Kind_Floating_Type_Definition => 444,
- Iir_Kind_Physical_Type_Definition => 455,
- Iir_Kind_Range_Expression => 463,
- Iir_Kind_Protected_Type_Body => 470,
- Iir_Kind_Wildcard_Type_Definition => 475,
- Iir_Kind_Subtype_Definition => 482,
- Iir_Kind_Scalar_Nature_Definition => 490,
- 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 => 697,
- Iir_Kind_Component_Declaration => 707,
- Iir_Kind_Attribute_Declaration => 714,
- Iir_Kind_Group_Template_Declaration => 720,
- Iir_Kind_Group_Declaration => 727,
- Iir_Kind_Element_Declaration => 734,
- Iir_Kind_Nature_Element_Declaration => 741,
- Iir_Kind_Non_Object_Alias_Declaration => 749,
- Iir_Kind_Psl_Declaration => 757,
- Iir_Kind_Psl_Endpoint_Declaration => 771,
- Iir_Kind_Enumeration_Literal => 782,
- Iir_Kind_Function_Declaration => 807,
- Iir_Kind_Procedure_Declaration => 831,
- Iir_Kind_Function_Body => 841,
- Iir_Kind_Procedure_Body => 852,
- Iir_Kind_Terminal_Declaration => 861,
- Iir_Kind_Object_Alias_Declaration => 872,
- Iir_Kind_Free_Quantity_Declaration => 884,
- Iir_Kind_Spectrum_Quantity_Declaration => 897,
- Iir_Kind_Noise_Quantity_Declaration => 909,
- Iir_Kind_Across_Quantity_Declaration => 925,
- Iir_Kind_Through_Quantity_Declaration => 941,
- Iir_Kind_File_Declaration => 955,
- Iir_Kind_Guard_Signal_Declaration => 968,
- Iir_Kind_Signal_Declaration => 985,
- Iir_Kind_Variable_Declaration => 998,
- Iir_Kind_Constant_Declaration => 1012,
- Iir_Kind_Iterator_Declaration => 1023,
- Iir_Kind_Interface_Constant_Declaration => 1039,
- Iir_Kind_Interface_Variable_Declaration => 1055,
- Iir_Kind_Interface_Signal_Declaration => 1076,
- Iir_Kind_Interface_File_Declaration => 1092,
- Iir_Kind_Interface_Quantity_Declaration => 1108,
- Iir_Kind_Interface_Terminal_Declaration => 1120,
- Iir_Kind_Interface_Type_Declaration => 1130,
- Iir_Kind_Interface_Package_Declaration => 1142,
- Iir_Kind_Interface_Function_Declaration => 1159,
- Iir_Kind_Interface_Procedure_Declaration => 1172,
- Iir_Kind_Anonymous_Signal_Declaration => 1181,
- Iir_Kind_Signal_Attribute_Declaration => 1184,
- Iir_Kind_Identity_Operator => 1188,
- Iir_Kind_Negation_Operator => 1192,
- Iir_Kind_Absolute_Operator => 1196,
- Iir_Kind_Not_Operator => 1200,
- Iir_Kind_Implicit_Condition_Operator => 1204,
- Iir_Kind_Condition_Operator => 1208,
- Iir_Kind_Reduction_And_Operator => 1212,
- Iir_Kind_Reduction_Or_Operator => 1216,
- Iir_Kind_Reduction_Nand_Operator => 1220,
- Iir_Kind_Reduction_Nor_Operator => 1224,
- Iir_Kind_Reduction_Xor_Operator => 1228,
- Iir_Kind_Reduction_Xnor_Operator => 1232,
- Iir_Kind_And_Operator => 1237,
- Iir_Kind_Or_Operator => 1242,
- Iir_Kind_Nand_Operator => 1247,
- Iir_Kind_Nor_Operator => 1252,
- Iir_Kind_Xor_Operator => 1257,
- Iir_Kind_Xnor_Operator => 1262,
- Iir_Kind_Equality_Operator => 1267,
- Iir_Kind_Inequality_Operator => 1272,
- Iir_Kind_Less_Than_Operator => 1277,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1282,
- Iir_Kind_Greater_Than_Operator => 1287,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1292,
- Iir_Kind_Match_Equality_Operator => 1297,
- Iir_Kind_Match_Inequality_Operator => 1302,
- Iir_Kind_Match_Less_Than_Operator => 1307,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1312,
- Iir_Kind_Match_Greater_Than_Operator => 1317,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1322,
- Iir_Kind_Sll_Operator => 1327,
- Iir_Kind_Sla_Operator => 1332,
- Iir_Kind_Srl_Operator => 1337,
- Iir_Kind_Sra_Operator => 1342,
- Iir_Kind_Rol_Operator => 1347,
- Iir_Kind_Ror_Operator => 1352,
- Iir_Kind_Addition_Operator => 1357,
- Iir_Kind_Substraction_Operator => 1362,
- Iir_Kind_Concatenation_Operator => 1367,
- Iir_Kind_Multiplication_Operator => 1372,
- Iir_Kind_Division_Operator => 1377,
- Iir_Kind_Modulus_Operator => 1382,
- Iir_Kind_Remainder_Operator => 1387,
- Iir_Kind_Exponentiation_Operator => 1392,
- Iir_Kind_Function_Call => 1400,
- Iir_Kind_Aggregate => 1407,
- Iir_Kind_Parenthesis_Expression => 1410,
- Iir_Kind_Qualified_Expression => 1414,
- Iir_Kind_Type_Conversion => 1419,
- Iir_Kind_Allocator_By_Expression => 1423,
- Iir_Kind_Allocator_By_Subtype => 1428,
- Iir_Kind_Selected_Element => 1436,
- Iir_Kind_Dereference => 1441,
- Iir_Kind_Implicit_Dereference => 1446,
- Iir_Kind_Slice_Name => 1453,
- Iir_Kind_Indexed_Name => 1459,
- Iir_Kind_Psl_Expression => 1461,
- Iir_Kind_Sensitized_Process_Statement => 1482,
- Iir_Kind_Process_Statement => 1502,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1515,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1528,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1542,
- Iir_Kind_Concurrent_Assertion_Statement => 1550,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1557,
- Iir_Kind_Concurrent_Break_Statement => 1565,
- Iir_Kind_Psl_Assert_Directive => 1578,
- Iir_Kind_Psl_Assume_Directive => 1589,
- Iir_Kind_Psl_Cover_Directive => 1601,
- Iir_Kind_Psl_Restrict_Directive => 1612,
- Iir_Kind_Block_Statement => 1626,
- Iir_Kind_If_Generate_Statement => 1637,
- Iir_Kind_Case_Generate_Statement => 1646,
- Iir_Kind_For_Generate_Statement => 1655,
- Iir_Kind_Component_Instantiation_Statement => 1666,
- Iir_Kind_Psl_Default_Clock => 1670,
- Iir_Kind_Generate_Statement_Body => 1681,
- Iir_Kind_If_Generate_Else_Clause => 1687,
- Iir_Kind_Simple_Simultaneous_Statement => 1694,
- Iir_Kind_Simultaneous_Null_Statement => 1698,
- Iir_Kind_Simultaneous_Procedural_Statement => 1709,
- Iir_Kind_Simultaneous_Case_Statement => 1718,
- Iir_Kind_Simultaneous_If_Statement => 1727,
- Iir_Kind_Simultaneous_Elsif => 1733,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1744,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1755,
- Iir_Kind_Selected_Waveform_Assignment_Statement => 1767,
- Iir_Kind_Null_Statement => 1771,
- Iir_Kind_Assertion_Statement => 1778,
- Iir_Kind_Report_Statement => 1784,
- Iir_Kind_Wait_Statement => 1792,
- Iir_Kind_Variable_Assignment_Statement => 1799,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1806,
- Iir_Kind_Return_Statement => 1812,
- Iir_Kind_For_Loop_Statement => 1823,
- Iir_Kind_While_Loop_Statement => 1834,
- Iir_Kind_Next_Statement => 1841,
- Iir_Kind_Exit_Statement => 1848,
- Iir_Kind_Case_Statement => 1856,
- Iir_Kind_Procedure_Call_Statement => 1862,
- Iir_Kind_Break_Statement => 1869,
- Iir_Kind_If_Statement => 1879,
- Iir_Kind_Elsif => 1885,
- Iir_Kind_Character_Literal => 1893,
- Iir_Kind_Simple_Name => 1901,
- Iir_Kind_Selected_Name => 1910,
- Iir_Kind_Operator_Symbol => 1916,
- Iir_Kind_Reference_Name => 1921,
- Iir_Kind_External_Constant_Name => 1929,
- Iir_Kind_External_Signal_Name => 1937,
- Iir_Kind_External_Variable_Name => 1946,
- Iir_Kind_Selected_By_All_Name => 1952,
- Iir_Kind_Parenthesis_Name => 1957,
- Iir_Kind_Package_Pathname => 1961,
- Iir_Kind_Absolute_Pathname => 1962,
- Iir_Kind_Relative_Pathname => 1963,
- Iir_Kind_Pathname_Element => 1968,
- Iir_Kind_Base_Attribute => 1970,
- Iir_Kind_Subtype_Attribute => 1975,
- Iir_Kind_Element_Attribute => 1980,
- Iir_Kind_Across_Attribute => 1985,
- Iir_Kind_Through_Attribute => 1990,
- Iir_Kind_Nature_Reference_Attribute => 1994,
- Iir_Kind_Left_Type_Attribute => 1999,
- Iir_Kind_Right_Type_Attribute => 2004,
- Iir_Kind_High_Type_Attribute => 2009,
- Iir_Kind_Low_Type_Attribute => 2014,
- Iir_Kind_Ascending_Type_Attribute => 2019,
- Iir_Kind_Image_Attribute => 2025,
- Iir_Kind_Value_Attribute => 2031,
- Iir_Kind_Pos_Attribute => 2037,
- Iir_Kind_Val_Attribute => 2043,
- Iir_Kind_Succ_Attribute => 2049,
- Iir_Kind_Pred_Attribute => 2055,
- Iir_Kind_Leftof_Attribute => 2061,
- Iir_Kind_Rightof_Attribute => 2067,
- Iir_Kind_Signal_Slew_Attribute => 2075,
- Iir_Kind_Quantity_Slew_Attribute => 2083,
- Iir_Kind_Ramp_Attribute => 2091,
- Iir_Kind_Zoh_Attribute => 2099,
- Iir_Kind_Ltf_Attribute => 2107,
- Iir_Kind_Ztf_Attribute => 2117,
- Iir_Kind_Dot_Attribute => 2124,
- Iir_Kind_Integ_Attribute => 2131,
- Iir_Kind_Above_Attribute => 2139,
- Iir_Kind_Quantity_Delayed_Attribute => 2147,
- Iir_Kind_Delayed_Attribute => 2156,
- Iir_Kind_Stable_Attribute => 2165,
- Iir_Kind_Quiet_Attribute => 2174,
- Iir_Kind_Transaction_Attribute => 2183,
- Iir_Kind_Event_Attribute => 2187,
- Iir_Kind_Active_Attribute => 2191,
- Iir_Kind_Last_Event_Attribute => 2195,
- Iir_Kind_Last_Active_Attribute => 2199,
- Iir_Kind_Last_Value_Attribute => 2203,
- Iir_Kind_Driving_Attribute => 2207,
- Iir_Kind_Driving_Value_Attribute => 2211,
- Iir_Kind_Behavior_Attribute => 2211,
- Iir_Kind_Structure_Attribute => 2211,
- Iir_Kind_Simple_Name_Attribute => 2218,
- Iir_Kind_Instance_Name_Attribute => 2223,
- Iir_Kind_Path_Name_Attribute => 2228,
- Iir_Kind_Left_Array_Attribute => 2235,
- Iir_Kind_Right_Array_Attribute => 2242,
- Iir_Kind_High_Array_Attribute => 2249,
- Iir_Kind_Low_Array_Attribute => 2256,
- Iir_Kind_Length_Array_Attribute => 2263,
- Iir_Kind_Ascending_Array_Attribute => 2270,
- Iir_Kind_Range_Array_Attribute => 2277,
- Iir_Kind_Reverse_Range_Array_Attribute => 2284,
- Iir_Kind_Attribute_Name => 2293
+ Iir_Kind_Enumeration_Type_Definition => 429,
+ Iir_Kind_Integer_Type_Definition => 438,
+ Iir_Kind_Floating_Type_Definition => 447,
+ Iir_Kind_Physical_Type_Definition => 459,
+ Iir_Kind_Range_Expression => 467,
+ Iir_Kind_Protected_Type_Body => 474,
+ Iir_Kind_Wildcard_Type_Definition => 479,
+ Iir_Kind_Subtype_Definition => 486,
+ Iir_Kind_Scalar_Nature_Definition => 494,
+ Iir_Kind_Record_Nature_Definition => 507,
+ Iir_Kind_Array_Nature_Definition => 521,
+ Iir_Kind_Array_Subnature_Definition => 536,
+ Iir_Kind_Overload_List => 537,
+ Iir_Kind_Entity_Declaration => 550,
+ Iir_Kind_Configuration_Declaration => 559,
+ Iir_Kind_Context_Declaration => 565,
+ Iir_Kind_Package_Declaration => 580,
+ Iir_Kind_Package_Instantiation_Declaration => 594,
+ Iir_Kind_Vmode_Declaration => 605,
+ Iir_Kind_Vprop_Declaration => 616,
+ Iir_Kind_Vunit_Declaration => 628,
+ Iir_Kind_Package_Body => 636,
+ Iir_Kind_Architecture_Body => 649,
+ Iir_Kind_Type_Declaration => 656,
+ Iir_Kind_Anonymous_Type_Declaration => 662,
+ Iir_Kind_Subtype_Declaration => 669,
+ Iir_Kind_Nature_Declaration => 675,
+ Iir_Kind_Subnature_Declaration => 682,
+ Iir_Kind_Package_Header => 684,
+ Iir_Kind_Unit_Declaration => 693,
+ Iir_Kind_Library_Declaration => 701,
+ Iir_Kind_Component_Declaration => 711,
+ Iir_Kind_Attribute_Declaration => 718,
+ Iir_Kind_Group_Template_Declaration => 724,
+ Iir_Kind_Group_Declaration => 731,
+ Iir_Kind_Element_Declaration => 738,
+ Iir_Kind_Nature_Element_Declaration => 745,
+ Iir_Kind_Non_Object_Alias_Declaration => 753,
+ Iir_Kind_Psl_Declaration => 761,
+ Iir_Kind_Psl_Endpoint_Declaration => 775,
+ Iir_Kind_Enumeration_Literal => 786,
+ Iir_Kind_Function_Declaration => 811,
+ Iir_Kind_Procedure_Declaration => 835,
+ Iir_Kind_Function_Body => 845,
+ Iir_Kind_Procedure_Body => 856,
+ Iir_Kind_Terminal_Declaration => 865,
+ Iir_Kind_Object_Alias_Declaration => 876,
+ Iir_Kind_Free_Quantity_Declaration => 888,
+ Iir_Kind_Spectrum_Quantity_Declaration => 901,
+ Iir_Kind_Noise_Quantity_Declaration => 913,
+ Iir_Kind_Across_Quantity_Declaration => 929,
+ Iir_Kind_Through_Quantity_Declaration => 945,
+ Iir_Kind_File_Declaration => 959,
+ Iir_Kind_Guard_Signal_Declaration => 972,
+ Iir_Kind_Signal_Declaration => 989,
+ Iir_Kind_Variable_Declaration => 1002,
+ Iir_Kind_Constant_Declaration => 1016,
+ Iir_Kind_Iterator_Declaration => 1027,
+ Iir_Kind_Interface_Constant_Declaration => 1043,
+ Iir_Kind_Interface_Variable_Declaration => 1059,
+ Iir_Kind_Interface_Signal_Declaration => 1080,
+ Iir_Kind_Interface_File_Declaration => 1096,
+ Iir_Kind_Interface_Quantity_Declaration => 1112,
+ Iir_Kind_Interface_Terminal_Declaration => 1124,
+ Iir_Kind_Interface_Type_Declaration => 1134,
+ Iir_Kind_Interface_Package_Declaration => 1146,
+ Iir_Kind_Interface_Function_Declaration => 1163,
+ Iir_Kind_Interface_Procedure_Declaration => 1176,
+ Iir_Kind_Anonymous_Signal_Declaration => 1185,
+ Iir_Kind_Signal_Attribute_Declaration => 1188,
+ Iir_Kind_Identity_Operator => 1192,
+ Iir_Kind_Negation_Operator => 1196,
+ Iir_Kind_Absolute_Operator => 1200,
+ Iir_Kind_Not_Operator => 1204,
+ Iir_Kind_Implicit_Condition_Operator => 1208,
+ Iir_Kind_Condition_Operator => 1212,
+ Iir_Kind_Reduction_And_Operator => 1216,
+ Iir_Kind_Reduction_Or_Operator => 1220,
+ Iir_Kind_Reduction_Nand_Operator => 1224,
+ Iir_Kind_Reduction_Nor_Operator => 1228,
+ Iir_Kind_Reduction_Xor_Operator => 1232,
+ Iir_Kind_Reduction_Xnor_Operator => 1236,
+ Iir_Kind_And_Operator => 1241,
+ Iir_Kind_Or_Operator => 1246,
+ Iir_Kind_Nand_Operator => 1251,
+ Iir_Kind_Nor_Operator => 1256,
+ Iir_Kind_Xor_Operator => 1261,
+ Iir_Kind_Xnor_Operator => 1266,
+ Iir_Kind_Equality_Operator => 1271,
+ Iir_Kind_Inequality_Operator => 1276,
+ Iir_Kind_Less_Than_Operator => 1281,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1286,
+ Iir_Kind_Greater_Than_Operator => 1291,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1296,
+ Iir_Kind_Match_Equality_Operator => 1301,
+ Iir_Kind_Match_Inequality_Operator => 1306,
+ Iir_Kind_Match_Less_Than_Operator => 1311,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1316,
+ Iir_Kind_Match_Greater_Than_Operator => 1321,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1326,
+ Iir_Kind_Sll_Operator => 1331,
+ Iir_Kind_Sla_Operator => 1336,
+ Iir_Kind_Srl_Operator => 1341,
+ Iir_Kind_Sra_Operator => 1346,
+ Iir_Kind_Rol_Operator => 1351,
+ Iir_Kind_Ror_Operator => 1356,
+ Iir_Kind_Addition_Operator => 1361,
+ Iir_Kind_Substraction_Operator => 1366,
+ Iir_Kind_Concatenation_Operator => 1371,
+ Iir_Kind_Multiplication_Operator => 1376,
+ Iir_Kind_Division_Operator => 1381,
+ Iir_Kind_Modulus_Operator => 1386,
+ Iir_Kind_Remainder_Operator => 1391,
+ Iir_Kind_Exponentiation_Operator => 1396,
+ Iir_Kind_Function_Call => 1404,
+ Iir_Kind_Aggregate => 1411,
+ Iir_Kind_Parenthesis_Expression => 1414,
+ Iir_Kind_Qualified_Expression => 1418,
+ Iir_Kind_Type_Conversion => 1423,
+ Iir_Kind_Allocator_By_Expression => 1427,
+ Iir_Kind_Allocator_By_Subtype => 1432,
+ Iir_Kind_Selected_Element => 1440,
+ Iir_Kind_Dereference => 1445,
+ Iir_Kind_Implicit_Dereference => 1450,
+ Iir_Kind_Slice_Name => 1457,
+ Iir_Kind_Indexed_Name => 1463,
+ Iir_Kind_Psl_Expression => 1465,
+ Iir_Kind_Sensitized_Process_Statement => 1486,
+ Iir_Kind_Process_Statement => 1506,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1519,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1532,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1546,
+ Iir_Kind_Concurrent_Assertion_Statement => 1554,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1561,
+ Iir_Kind_Concurrent_Break_Statement => 1569,
+ Iir_Kind_Psl_Assert_Directive => 1582,
+ Iir_Kind_Psl_Assume_Directive => 1593,
+ Iir_Kind_Psl_Cover_Directive => 1605,
+ Iir_Kind_Psl_Restrict_Directive => 1616,
+ Iir_Kind_Block_Statement => 1630,
+ Iir_Kind_If_Generate_Statement => 1641,
+ Iir_Kind_Case_Generate_Statement => 1650,
+ Iir_Kind_For_Generate_Statement => 1659,
+ Iir_Kind_Component_Instantiation_Statement => 1670,
+ Iir_Kind_Psl_Default_Clock => 1674,
+ Iir_Kind_Generate_Statement_Body => 1685,
+ Iir_Kind_If_Generate_Else_Clause => 1691,
+ Iir_Kind_Simple_Simultaneous_Statement => 1698,
+ Iir_Kind_Simultaneous_Null_Statement => 1702,
+ Iir_Kind_Simultaneous_Procedural_Statement => 1713,
+ Iir_Kind_Simultaneous_Case_Statement => 1722,
+ Iir_Kind_Simultaneous_If_Statement => 1731,
+ Iir_Kind_Simultaneous_Elsif => 1737,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1748,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1759,
+ Iir_Kind_Selected_Waveform_Assignment_Statement => 1771,
+ Iir_Kind_Null_Statement => 1775,
+ Iir_Kind_Assertion_Statement => 1782,
+ Iir_Kind_Report_Statement => 1788,
+ Iir_Kind_Wait_Statement => 1796,
+ Iir_Kind_Variable_Assignment_Statement => 1803,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1810,
+ Iir_Kind_Return_Statement => 1816,
+ Iir_Kind_For_Loop_Statement => 1827,
+ Iir_Kind_While_Loop_Statement => 1838,
+ Iir_Kind_Next_Statement => 1845,
+ Iir_Kind_Exit_Statement => 1852,
+ Iir_Kind_Case_Statement => 1860,
+ Iir_Kind_Procedure_Call_Statement => 1866,
+ Iir_Kind_Break_Statement => 1873,
+ Iir_Kind_If_Statement => 1883,
+ Iir_Kind_Elsif => 1889,
+ Iir_Kind_Character_Literal => 1897,
+ Iir_Kind_Simple_Name => 1905,
+ Iir_Kind_Selected_Name => 1914,
+ Iir_Kind_Operator_Symbol => 1920,
+ Iir_Kind_Reference_Name => 1925,
+ Iir_Kind_External_Constant_Name => 1933,
+ Iir_Kind_External_Signal_Name => 1941,
+ Iir_Kind_External_Variable_Name => 1950,
+ Iir_Kind_Selected_By_All_Name => 1956,
+ Iir_Kind_Parenthesis_Name => 1961,
+ Iir_Kind_Package_Pathname => 1965,
+ Iir_Kind_Absolute_Pathname => 1966,
+ Iir_Kind_Relative_Pathname => 1967,
+ Iir_Kind_Pathname_Element => 1972,
+ Iir_Kind_Base_Attribute => 1974,
+ Iir_Kind_Subtype_Attribute => 1979,
+ Iir_Kind_Element_Attribute => 1984,
+ Iir_Kind_Across_Attribute => 1989,
+ Iir_Kind_Through_Attribute => 1994,
+ Iir_Kind_Nature_Reference_Attribute => 1998,
+ Iir_Kind_Left_Type_Attribute => 2003,
+ Iir_Kind_Right_Type_Attribute => 2008,
+ Iir_Kind_High_Type_Attribute => 2013,
+ Iir_Kind_Low_Type_Attribute => 2018,
+ Iir_Kind_Ascending_Type_Attribute => 2023,
+ Iir_Kind_Image_Attribute => 2029,
+ Iir_Kind_Value_Attribute => 2035,
+ Iir_Kind_Pos_Attribute => 2041,
+ Iir_Kind_Val_Attribute => 2047,
+ Iir_Kind_Succ_Attribute => 2053,
+ Iir_Kind_Pred_Attribute => 2059,
+ Iir_Kind_Leftof_Attribute => 2065,
+ Iir_Kind_Rightof_Attribute => 2071,
+ Iir_Kind_Signal_Slew_Attribute => 2079,
+ Iir_Kind_Quantity_Slew_Attribute => 2087,
+ Iir_Kind_Ramp_Attribute => 2095,
+ Iir_Kind_Zoh_Attribute => 2103,
+ Iir_Kind_Ltf_Attribute => 2111,
+ Iir_Kind_Ztf_Attribute => 2121,
+ Iir_Kind_Dot_Attribute => 2128,
+ Iir_Kind_Integ_Attribute => 2135,
+ Iir_Kind_Above_Attribute => 2143,
+ Iir_Kind_Quantity_Delayed_Attribute => 2151,
+ Iir_Kind_Delayed_Attribute => 2160,
+ Iir_Kind_Stable_Attribute => 2169,
+ Iir_Kind_Quiet_Attribute => 2178,
+ Iir_Kind_Transaction_Attribute => 2187,
+ Iir_Kind_Event_Attribute => 2191,
+ Iir_Kind_Active_Attribute => 2195,
+ Iir_Kind_Last_Event_Attribute => 2199,
+ Iir_Kind_Last_Active_Attribute => 2203,
+ Iir_Kind_Last_Value_Attribute => 2207,
+ Iir_Kind_Driving_Attribute => 2211,
+ Iir_Kind_Driving_Value_Attribute => 2215,
+ Iir_Kind_Behavior_Attribute => 2215,
+ Iir_Kind_Structure_Attribute => 2215,
+ Iir_Kind_Simple_Name_Attribute => 2222,
+ Iir_Kind_Instance_Name_Attribute => 2227,
+ Iir_Kind_Path_Name_Attribute => 2232,
+ Iir_Kind_Left_Array_Attribute => 2239,
+ Iir_Kind_Right_Array_Attribute => 2246,
+ Iir_Kind_High_Array_Attribute => 2253,
+ Iir_Kind_Low_Array_Attribute => 2260,
+ Iir_Kind_Length_Array_Attribute => 2267,
+ Iir_Kind_Ascending_Array_Attribute => 2274,
+ Iir_Kind_Range_Array_Attribute => 2281,
+ Iir_Kind_Reverse_Range_Array_Attribute => 2288,
+ Iir_Kind_Attribute_Name => 2297
);
function Get_Fields_First (K : Iir_Kind) return Fields_Index is
@@ -7300,6 +7309,30 @@ package body Vhdl.Nodes_Meta is
end case;
end Set_PSL_Node;
+ function Get_Scalar_Size
+ (N : Iir; F : Fields_Enum) return Scalar_Size is
+ begin
+ pragma Assert (Fields_Type (F) = Type_Scalar_Size);
+ case F is
+ when Field_Scalar_Size =>
+ return Get_Scalar_Size (N);
+ when others =>
+ raise Internal_Error;
+ end case;
+ end Get_Scalar_Size;
+
+ procedure Set_Scalar_Size
+ (N : Iir; F : Fields_Enum; V: Scalar_Size) is
+ begin
+ pragma Assert (Fields_Type (F) = Type_Scalar_Size);
+ case F is
+ when Field_Scalar_Size =>
+ Set_Scalar_Size (N, V);
+ when others =>
+ raise Internal_Error;
+ end case;
+ end Set_Scalar_Size;
+
function Get_Source_File_Entry
(N : Iir; F : Fields_Enum) return Source_File_Entry is
begin
@@ -10878,6 +10911,19 @@ package body Vhdl.Nodes_Meta is
end case;
end Has_Expr_Staticness;
+ function Has_Scalar_Size (K : Iir_Kind) return Boolean is
+ begin
+ case K is
+ when Iir_Kind_Enumeration_Type_Definition
+ | Iir_Kind_Integer_Type_Definition
+ | Iir_Kind_Floating_Type_Definition
+ | Iir_Kind_Physical_Type_Definition =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Has_Scalar_Size;
+
function Has_Error_Origin (K : Iir_Kind) return Boolean is
begin
return K = Iir_Kind_Error;
diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads
index 82bf5dbdb..dd48460d8 100644
--- a/src/vhdl/vhdl-nodes_meta.ads
+++ b/src/vhdl/vhdl-nodes_meta.ads
@@ -50,6 +50,7 @@ package Vhdl.Nodes_Meta is
Type_Number_Base_Type,
Type_PSL_NFA,
Type_PSL_Node,
+ Type_Scalar_Size,
Type_Source_File_Entry,
Type_Source_Ptr,
Type_String8_Id,
@@ -329,6 +330,7 @@ package Vhdl.Nodes_Meta is
Field_Alias_Declaration,
Field_Referenced_Name,
Field_Expr_Staticness,
+ Field_Scalar_Size,
Field_Error_Origin,
Field_Operand,
Field_Left,
@@ -591,6 +593,11 @@ package Vhdl.Nodes_Meta is
procedure Set_PSL_Node
(N : Iir; F : Fields_Enum; V: PSL_Node);
+ function Get_Scalar_Size
+ (N : Iir; F : Fields_Enum) return Scalar_Size;
+ procedure Set_Scalar_Size
+ (N : Iir; F : Fields_Enum; V: Scalar_Size);
+
function Get_Source_File_Entry
(N : Iir; F : Fields_Enum) return Source_File_Entry;
procedure Set_Source_File_Entry
@@ -894,6 +901,7 @@ package Vhdl.Nodes_Meta is
function Has_Alias_Declaration (K : Iir_Kind) return Boolean;
function Has_Referenced_Name (K : Iir_Kind) return Boolean;
function Has_Expr_Staticness (K : Iir_Kind) return Boolean;
+ function Has_Scalar_Size (K : Iir_Kind) return Boolean;
function Has_Error_Origin (K : Iir_Kind) return Boolean;
function Has_Operand (K : Iir_Kind) return Boolean;
function Has_Left (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb
index 526c4224f..f4fe1f5f6 100644
--- a/src/vhdl/vhdl-sem_inst.adb
+++ b/src/vhdl/vhdl-sem_inst.adb
@@ -381,6 +381,8 @@ package body Vhdl.Sem_Inst is
Set_Fp64 (Res, F, Get_Fp64 (N, F));
when Type_Token_Type =>
Set_Token_Type (Res, F, Get_Token_Type (N, F));
+ when Type_Scalar_Size =>
+ Set_Scalar_Size (Res, F, Get_Scalar_Size (N, F));
when Type_Name_Id =>
Set_Name_Id (Res, F, Get_Name_Id (N, F));
end case;
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index 3a0705d50..94538eb58 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -221,6 +221,22 @@ package body Vhdl.Sem_Types is
return Expr;
end Sem_Type_Range_Expression;
+ function Compute_Scalar_Size (Rng : Iir) return Scalar_Size
+ is
+ L, H : Iir;
+ Lv, Hv : Int64;
+ subtype Int64_32 is Int64 range -(2 ** 31) .. 2 ** 31 - 1;
+ begin
+ Get_Low_High_Limit (Rng, L, H);
+ Lv := Get_Value (L);
+ Hv := Get_Value (H);
+ if Lv in Int64_32 and then Hv in Int64_32 then
+ return Scalar_32;
+ else
+ return Scalar_64;
+ end if;
+ end Compute_Scalar_Size;
+
function Create_Integer_Type (Loc : Iir; Constraint : Iir; Decl : Iir)
return Iir
is
@@ -244,6 +260,9 @@ package body Vhdl.Sem_Types is
if Get_Type_Staticness (Ntype) /= Locally then
Error_Msg_Sem
(+Decl, "range constraint of type must be locally static");
+ Set_Scalar_Size (Ndef, Scalar_32);
+ else
+ Set_Scalar_Size (Ndef, Compute_Scalar_Size (Constraint));
end if;
return Ntype;
end Create_Integer_Type;
@@ -286,6 +305,7 @@ package body Vhdl.Sem_Types is
Set_Base_Type (Ndef, Ndef);
Set_Type_Declarator (Ndef, Decl);
Set_Type_Staticness (Ndef, Get_Expr_Staticness (Expr));
+ Set_Scalar_Size (Ndef, Scalar_64);
Set_Signal_Type_Flag (Ndef, True);
Set_Base_Type (Ntype, Ndef);
Set_Type_Declarator (Ntype, Decl);
@@ -389,6 +409,7 @@ package body Vhdl.Sem_Types is
"physical type %i has a null range", (1 => +Decl));
end if;
end if;
+ Set_Scalar_Size (Def, Compute_Scalar_Size (Range_Expr1));
-- Create the subtype.
Sub_Type := Create_Iir (Iir_Kind_Physical_Subtype_Definition);
@@ -831,6 +852,13 @@ package body Vhdl.Sem_Types is
Create_Range_Constraint_For_Enumeration_Type (Def);
+ -- Set the size.
+ if Get_Nbr_Elements (Literal_List) <= 256 then
+ Set_Scalar_Size (Def, Scalar_8);
+ else
+ Set_Scalar_Size (Def, Scalar_32);
+ end if;
+
-- Identifier IEEE.Std_Logic_1164.Std_Ulogic.
if Get_Identifier (Decl) = Std_Names.Name_Std_Ulogic
and then
diff --git a/src/vhdl/vhdl-std_package.adb b/src/vhdl/vhdl-std_package.adb
index 7f6273dfe..1495de4cf 100644
--- a/src/vhdl/vhdl-std_package.adb
+++ b/src/vhdl/vhdl-std_package.adb
@@ -404,6 +404,14 @@ package body Vhdl.Std_Package is
Wildcard_Type_Declaration_Chain := Decl;
end Create_Wildcard_Type;
+ function Is64 (B : Boolean) return Scalar_Size is
+ begin
+ if B then
+ return Scalar_64;
+ else
+ return Scalar_32;
+ end if;
+ end Is64;
begin
-- Create design file.
Std_Standard_File := Create_Std_Iir (Iir_Kind_Design_File);
@@ -457,6 +465,7 @@ package body Vhdl.Std_Package is
Set_Signal_Type_Flag (Boolean_Type_Definition, True);
Set_Has_Signal_Flag (Boolean_Type_Definition,
not Flags.Flag_Whole_Analyze);
+ Set_Scalar_Size (Boolean_Type_Definition, Scalar_8);
-- type boolean is
Create_Std_Type (Boolean_Type_Declaration, Boolean_Type_Definition,
@@ -495,6 +504,7 @@ package body Vhdl.Std_Package is
Set_Has_Signal_Flag (Bit_Type_Definition,
not Flags.Flag_Whole_Analyze);
Set_Only_Characters_Flag (Bit_Type_Definition, True);
+ Set_Scalar_Size (Bit_Type_Definition, Scalar_8);
-- type bit is
Create_Std_Type (Bit_Type_Declaration, Bit_Type_Definition, Name_Bit);
@@ -531,6 +541,7 @@ package body Vhdl.Std_Package is
end if;
Set_Enumeration_Literal_List
(Character_Type_Definition, Create_Iir_Flist (Len));
+ Set_Scalar_Size (Character_Type_Definition, Scalar_8);
for I in Name_Nul .. Name_Usp loop
El := Create_Std_Literal
@@ -577,6 +588,7 @@ package body Vhdl.Std_Package is
Severity_Level_Type_Definition);
Set_Enumeration_Literal_List
(Severity_Level_Type_Definition, Create_Iir_Flist (4));
+ Set_Scalar_Size (Severity_Level_Type_Definition, Scalar_8);
Severity_Level_Note := Create_Std_Literal
(Name_Note, 0, Severity_Level_Type_Definition);
@@ -607,6 +619,8 @@ package body Vhdl.Std_Package is
Universal_Integer_Type_Declaration,
Name_Universal_Integer);
Add_Decl (Universal_Integer_Type_Declaration);
+ Set_Scalar_Size (Universal_Integer_Type_Definition,
+ Is64 (Flags.Flag_Time_64 or Flags.Flag_Integer_64));
Create_Integer_Subtype (Universal_Integer_Type_Definition,
Universal_Integer_Type_Declaration,
@@ -684,6 +698,8 @@ package body Vhdl.Std_Package is
Create_Integer_Type (Convertible_Integer_Type_Definition,
Convertible_Integer_Type_Declaration,
Name_Convertible_Integer);
+ Set_Scalar_Size (Convertible_Integer_Type_Definition,
+ Is64 (Flags.Flag_Time_64 or Flags.Flag_Integer_64));
Create_Integer_Subtype (Convertible_Integer_Type_Definition,
Convertible_Integer_Type_Declaration,
Convertible_Integer_Subtype_Definition,
@@ -717,6 +733,8 @@ package body Vhdl.Std_Package is
Create_Integer_Type (Integer_Type_Definition,
Integer_Type_Declaration,
Name_Integer);
+ Set_Scalar_Size (Integer_Type_Definition,
+ Is64 (Flags.Flag_Integer_64));
Add_Decl (Integer_Type_Declaration);
-- Now that Integer is declared, create operations for universal
@@ -751,6 +769,7 @@ package body Vhdl.Std_Package is
Set_Signal_Type_Flag (Real_Type_Definition, True);
Set_Has_Signal_Flag (Real_Type_Definition,
not Flags.Flag_Whole_Analyze);
+ Set_Scalar_Size (Real_Type_Definition, Scalar_64);
Real_Type_Declaration :=
Create_Std_Decl (Iir_Kind_Anonymous_Type_Declaration);
@@ -857,6 +876,8 @@ package body Vhdl.Std_Package is
Set_Has_Signal_Flag (Time_Type_Definition,
not Flags.Flag_Whole_Analyze);
Set_End_Has_Reserved_Id (Time_Type_Definition, True);
+ Set_Scalar_Size (Time_Type_Definition,
+ Is64 (Flags.Flag_Time_64));
Chain_Init (First_Unit, Last_Unit);
@@ -974,6 +995,7 @@ package body Vhdl.Std_Package is
Domain_Type_Type_Definition);
Set_Enumeration_Literal_List
(Domain_Type_Type_Definition, Create_Iir_Flist (3));
+ Set_Scalar_Size (Domain_Type_Type_Definition, Scalar_8);
Domain_Type_Quiescent_Domain := Create_Std_Literal
(Name_Quiescent_Domain, 0, Domain_Type_Type_Definition);
@@ -1237,6 +1259,7 @@ package body Vhdl.Std_Package is
File_Open_Kind_Type_Definition);
Set_Enumeration_Literal_List
(File_Open_Kind_Type_Definition, Create_Iir_Flist (3));
+ Set_Scalar_Size (File_Open_Kind_Type_Definition, Scalar_8);
File_Open_Kind_Read_Mode := Create_Std_Literal
(Name_Read_Mode, 0, File_Open_Kind_Type_Definition);
@@ -1275,6 +1298,7 @@ package body Vhdl.Std_Package is
File_Open_Status_Type_Definition);
Set_Enumeration_Literal_List
(File_Open_Status_Type_Definition, Create_Iir_Flist (4));
+ Set_Scalar_Size (File_Open_Status_Type_Definition, Scalar_8);
File_Open_Status_Open_Ok := Create_Std_Literal
(Name_Open_Ok, 0, File_Open_Status_Type_Definition);