diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-09-23 07:48:56 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-09-23 07:48:56 +0200 |
commit | ee9f2600d1272470abc4ebbf09f7469e1656c39c (patch) | |
tree | 730dda318d968339dd27219a6fe9798d7c057a5d /src/vhdl/translate/trans-chap7.adb | |
parent | 87da3b4fe3478295241bff8f6f400ab3aa097a7a (diff) | |
download | ghdl-ee9f2600d1272470abc4ebbf09f7469e1656c39c.tar.gz ghdl-ee9f2600d1272470abc4ebbf09f7469e1656c39c.tar.bz2 ghdl-ee9f2600d1272470abc4ebbf09f7469e1656c39c.zip |
aggregates (2008): support array expression
Fix #643
Diffstat (limited to 'src/vhdl/translate/trans-chap7.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index e83cbfe04..1d385ab95 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -2934,12 +2934,27 @@ package body Trans.Chap7 is procedure Do_Assign (Assoc : Iir) is Expr : constant Iir := Get_Associated_Expr (Assoc); + Dest : Mnode; + Len : Iir_Int64; begin if Final then - Translate_Assign (Chap3.Index_Base (Base_Ptr, Aggr_Type, - New_Obj_Value (Var_Index)), - Expr, Expr_Type); - Inc_Var (Var_Index); + if Get_Element_Type_Flag (Assoc) then + Dest := Chap3.Index_Base (Base_Ptr, Aggr_Type, + New_Obj_Value (Var_Index)); + Translate_Assign (Dest, Expr, Expr_Type); + Inc_Var (Var_Index); + else + Dest := Chap3.Slice_Base (Base_Ptr, Aggr_Type, + New_Obj_Value (Var_Index)); + Translate_Assign (Dest, Expr, Get_Type (Expr)); + Len := Eval_Discrete_Type_Length + (Get_Index_Type (Get_Type (Expr), 0)); + New_Assign_Stmt + (New_Obj (Var_Index), + New_Dyadic_Op (ON_Add_Ov, + New_Obj_Value (Var_Index), + New_Lit (New_Index_Lit (Unsigned_64 (Len))))); + end if; else Translate_Array_Aggregate_Gen (Base_Ptr, Bounds_Ptr, Expr, Aggr_Type, Dim + 1, Var_Index); |