diff options
Diffstat (limited to 'src/vhdl/simulate')
-rw-r--r-- | src/vhdl/simulate/simul-environments.adb | 14 | ||||
-rw-r--r-- | src/vhdl/simulate/simul-execution.adb | 40 |
2 files changed, 29 insertions, 25 deletions
diff --git a/src/vhdl/simulate/simul-environments.adb b/src/vhdl/simulate/simul-environments.adb index 662fd1729..7a722a53a 100644 --- a/src/vhdl/simulate/simul-environments.adb +++ b/src/vhdl/simulate/simul-environments.adb @@ -557,7 +557,6 @@ package body Simul.Environments is return Create_Range_Value (Left, Right, Dir, Len); end Create_Range_Value; - -- Return an array of length LENGTH. function Create_Array_Value (Dim : Iir_Index32; Pool : Areapool_Acc := Current_Pool) return Iir_Value_Literal_Acc @@ -580,9 +579,9 @@ package body Simul.Environments is return Res; end Create_Array_Value; - procedure Create_Array_Data (Arr : Iir_Value_Literal_Acc; - Len : Iir_Index32; + function Create_Value_Array (Len : Iir_Index32; Pool : Areapool_Acc := Current_Pool) + return Value_Array_Acc is use System; subtype Data_Type is Value_Array (Len); @@ -605,7 +604,14 @@ package body Simul.Environments is null; end; - Arr.Val_Array := To_Value_Array_Acc (Res); + return To_Value_Array_Acc (Res); + end Create_Value_Array; + + procedure Create_Array_Data (Arr : Iir_Value_Literal_Acc; + Len : Iir_Index32; + Pool : Areapool_Acc := Current_Pool) is + begin + Arr.Val_Array := Create_Value_Array (Len, Pool); end Create_Array_Data; function Create_Array_Value (Length: Iir_Index32; diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb index 48dfc2480..b96e1f173 100644 --- a/src/vhdl/simulate/simul-execution.adb +++ b/src/vhdl/simulate/simul-execution.adb @@ -1720,22 +1720,20 @@ package body Simul.Execution is -- Create an iir_value_literal of kind iir_value_array and of life LIFE. -- Allocate the array of bounds, and fill it from A_TYPE. -- Allocate the array of values. - function Create_Array_Bounds_From_Type - (Block : Block_Instance_Acc; - A_Type : Iir; - Create_Val_Array : Boolean) - return Iir_Value_Literal_Acc + function Create_Array_Bounds_From_Type (Block : Block_Instance_Acc; + A_Type : Iir; + Create_Val_Array : Boolean) + return Iir_Value_Literal_Acc is -- Only for constrained subtypes. - pragma Assert (Get_Kind (A_Type) /= Iir_Kind_Array_Type_Definition); + pragma Assert (Get_Constraint_State (A_Type) = Fully_Constrained); Index_List : constant Iir_Flist := Get_Index_Subtype_List (A_Type); Res : Iir_Value_Literal_Acc; Len : Iir_Index32; Bound : Iir_Value_Literal_Acc; begin - Res := Create_Array_Value - (Iir_Index32 (Get_Nbr_Elements (Index_List))); + Res := Create_Array_Value (Iir_Index32 (Get_Nbr_Elements (Index_List))); Len := 1; for I in 1 .. Res.Bounds.Nbr_Dims loop Bound := Execute_Bounds @@ -1841,15 +1839,14 @@ package body Simul.Execution is -- Fill LENGTH elements of RES, starting at ORIG by steps of STEP. -- Use expressions from (BLOCK, AGGREGATE) to fill the elements. -- EL_TYPE is the type of the array element. - procedure Fill_Array_Aggregate_1 - (Block : Block_Instance_Acc; - Aggregate : Iir; - Res : Iir_Value_Literal_Acc; - Orig : Iir_Index32; - Step : Iir_Index32; - Dim : Iir_Index32; - Nbr_Dim : Iir_Index32; - El_Type : Iir) + procedure Fill_Array_Aggregate_1 (Block : Block_Instance_Acc; + Aggregate : Iir; + Res : Iir_Value_Literal_Acc; + Orig : Iir_Index32; + Step : Iir_Index32; + Dim : Iir_Index32; + Nbr_Dim : Iir_Index32; + El_Type : Iir) is Value : Iir; Bound : constant Iir_Value_Literal_Acc := Res.Bounds.D (Dim); @@ -2009,10 +2006,9 @@ package body Simul.Execution is end Fill_Array_Aggregate_1; -- Use expressions from (BLOCK, AGGREGATE) to fill RES. - procedure Fill_Array_Aggregate - (Block : Block_Instance_Acc; - Aggregate : Iir; - Res : Iir_Value_Literal_Acc) + procedure Fill_Array_Aggregate (Block : Block_Instance_Acc; + Aggregate : Iir; + Res : Iir_Value_Literal_Acc) is Aggr_Type : constant Iir := Get_Type (Aggregate); El_Type : constant Iir := Get_Element_Subtype (Aggr_Type); @@ -2260,6 +2256,8 @@ package body Simul.Execution is Res : Iir_Value_Literal_Acc; Step : Iir_Index32; begin + pragma Assert + (Get_Constraint_State (Aggregate_Type) = Fully_Constrained); Res := Create_Array_Bounds_From_Type (Block, Aggregate_Type, True); Step := Get_Step_For_Dim (Res, 1); |