diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-09-22 20:40:39 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-09-22 20:40:39 +0200 |
commit | 5819a01f0b175002ed79b6ed5b42ed296b39f239 (patch) | |
tree | d2fd98a9b2e91ed7503b9884d8b336c36d751deb /src/synth/synth-decls.adb | |
parent | b67d934541336238f66556d8f861f972c288c131 (diff) | |
download | ghdl-5819a01f0b175002ed79b6ed5b42ed296b39f239.tar.gz ghdl-5819a01f0b175002ed79b6ed5b42ed296b39f239.tar.bz2 ghdl-5819a01f0b175002ed79b6ed5b42ed296b39f239.zip |
synth: introduce type_unbounded_vector.
Diffstat (limited to 'src/synth/synth-decls.adb')
-rw-r--r-- | src/synth/synth-decls.adb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index 122e8ca99..f41d0e9ca 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -77,11 +77,19 @@ package body Synth.Decls is (Syn_Inst : Synth_Instance_Acc; Def : Node) return Type_Acc is El_Type : constant Node := Get_Element_Subtype (Def); + El_Typ : Type_Acc; Typ : Type_Acc; begin Synth_Subtype_Indication_If_Anonymous (Syn_Inst, El_Type); - Typ := Create_Unbounded_Array - (Get_Value_Type (Syn_Inst, El_Type)); + El_Typ := Get_Value_Type (Syn_Inst, El_Type); + + if El_Typ.Kind = Type_Bit + and then Is_One_Dimensional_Array_Type (Def) + then + Typ := Create_Unbounded_Vector (El_Typ); + else + Typ := Create_Unbounded_Array (El_Typ); + end if; return Typ; end Synth_Array_Type_Definition; @@ -230,6 +238,7 @@ package body Synth.Decls is El_Type : constant Node := Get_Element_Subtype (Atype); St_Indexes : constant Iir_Flist := Get_Index_Subtype_List (Atype); St_El : Iir; + Btyp : Type_Acc; Etyp : Type_Acc; Bnds : Bound_Array_Acc; begin @@ -246,16 +255,15 @@ package body Synth.Decls is Synth_Subtype_Indication (Syn_Inst, El_Type); end if; - Etyp := Get_Value_Type (Syn_Inst, El_Type); + Btyp := Get_Value_Type (Syn_Inst, Get_Base_Type (Atype)); - if Etyp.Kind = Type_Bit - and then Is_One_Dimensional_Array_Type (Atype) - then + if Btyp.Kind = Type_Unbounded_Vector then St_El := Get_Index_Type (St_Indexes, 0); return Create_Vector_Type - (Synth_Bounds_From_Range (Syn_Inst, St_El), Etyp); + (Synth_Bounds_From_Range (Syn_Inst, St_El), Btyp.Uvec_El); else -- FIXME: partially constrained arrays, subtype in indexes... + Etyp := Get_Value_Type (Syn_Inst, El_Type); Bnds := Create_Bound_Array (Iir_Index32 (Get_Nbr_Elements (St_Indexes))); for I in Flist_First .. Flist_Last (St_Indexes) loop |