diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-05-21 21:21:22 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-05-22 07:09:22 +0200 |
commit | 9ee5974eb73b553de30a64e635c328f92b2296a3 (patch) | |
tree | da5aa0fffffe925908ecbb06053e78e073dbac24 /src/synth/elab-vhdl_values.adb | |
parent | 8538537c96f380c7822c6101435b1ebfea58f9a9 (diff) | |
download | ghdl-9ee5974eb73b553de30a64e635c328f92b2296a3.tar.gz ghdl-9ee5974eb73b553de30a64e635c328f92b2296a3.tar.bz2 ghdl-9ee5974eb73b553de30a64e635c328f92b2296a3.zip |
synth: use unidimentional arrays in type_acc. Factorize code.
Diffstat (limited to 'src/synth/elab-vhdl_values.adb')
-rw-r--r-- | src/synth/elab-vhdl_values.adb | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/synth/elab-vhdl_values.adb b/src/synth/elab-vhdl_values.adb index 59bc63293..8d14048cb 100644 --- a/src/synth/elab-vhdl_values.adb +++ b/src/synth/elab-vhdl_values.adb @@ -167,26 +167,6 @@ package body Elab.Vhdl_Values is return Iir_Index32 (Typ.Vbound.Len); end Vec_Length; - function Get_Array_Flat_Length (Typ : Type_Acc) return Iir_Index32 is - begin - case Typ.Kind is - when Type_Vector => - return Iir_Index32 (Typ.Vbound.Len); - when Type_Array => - declare - Len : Uns32; - begin - Len := 1; - for I in Typ.Abounds.D'Range loop - Len := Len * Typ.Abounds.D (I).Len; - end loop; - return Iir_Index32 (Len); - end; - when others => - raise Internal_Error; - end case; - end Get_Array_Flat_Length; - function Create_Value_Alias (Obj : Valtyp; Off : Value_Offsets; Typ : Type_Acc) return Valtyp is @@ -413,10 +393,10 @@ package body Elab.Vhdl_Values is raise Internal_Error; when Type_Array => declare - Len : constant Iir_Index32 := Get_Array_Flat_Length (Typ); + Len : constant Uns32 := Get_Bound_Length (Typ); El_Typ : constant Type_Acc := Typ.Arr_El; begin - for I in 1 .. Len loop + for I in 1 .. Iir_Index32 (Len) loop Write_Value_Default (Arr_Index (M, I - 1, El_Typ), El_Typ); end loop; end; @@ -453,7 +433,7 @@ package body Elab.Vhdl_Values is function Value_To_String (Val : Valtyp) return String is - Str : String (1 .. Natural (Val.Typ.Abounds.D (1).Len)); + Str : String (1 .. Natural (Val.Typ.Abound.Len)); begin for I in Str'Range loop Str (Natural (I)) := Character'Val |