diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-05-17 08:35:04 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-05-17 08:38:16 +0200 |
commit | 612e79e4aafa00e2908bf857023c779aebf64d15 (patch) | |
tree | dd2d3d016be1c96f15cff09f63ef0a2c8845f5c8 | |
parent | e2bcb854e0a3b26122576232db71690a5c395dfc (diff) | |
download | ghdl-612e79e4aafa00e2908bf857023c779aebf64d15.tar.gz ghdl-612e79e4aafa00e2908bf857023c779aebf64d15.tar.bz2 ghdl-612e79e4aafa00e2908bf857023c779aebf64d15.zip |
synth-expr: handle array attribute on functions.
-rw-r--r-- | src/synth/synth-expr.adb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index c960b8867..953c6e0e9 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -532,17 +532,20 @@ package body Synth.Expr is function Synth_Array_Attribute (Syn_Inst : Synth_Instance_Acc; Attr : Node) return Bound_Type is - Prefix : constant Iir := Strip_Denoting_Name (Get_Prefix (Attr)); - Dim : constant Natural := + Prefix_Name : constant Iir := Get_Prefix (Attr); + Prefix : constant Iir := Strip_Denoting_Name (Prefix_Name); + Dim : constant Natural := Vhdl.Evaluation.Eval_Attribute_Parameter_Or_1 (Attr); - Typ : Type_Acc; + Typ : Type_Acc; + Val : Valtyp; begin -- Prefix is an array object or an array subtype. if Get_Kind (Prefix) = Iir_Kind_Subtype_Declaration then -- TODO: does this cover all the cases ? Typ := Get_Subtype_Object (Syn_Inst, Get_Subtype_Indication (Prefix)); else - Typ := Synth_Type_Of_Object (Syn_Inst, Prefix); + Val := Synth_Expression_With_Basetype (Syn_Inst, Prefix_Name); + Typ := Val.Typ; end if; return Get_Array_Bound (Typ, Dim_Type (Dim)); |