From 008d54327842b999f3ea442de5d9e312ab94b5f1 Mon Sep 17 00:00:00 2001 From: marph91 <33229141+marph91@users.noreply.github.com> Date: Mon, 19 Aug 2019 20:28:06 +0200 Subject: synth: handle array attribute "length" (#895) --- src/synth/synth-expr.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index fae3b80fb..f5767b3f0 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -2241,6 +2241,16 @@ package body Synth.Expr is end case; return Create_Value_Discrete (Int64 (V), Typ); end; + when Iir_Kind_Length_Array_Attribute => + declare + -- Use base type as the expression type is the index subtype. + Typ : constant Type_Acc := + Get_Value_Type (Syn_Inst, Get_Base_Type (Expr_Type)); + B : Bound_Type; + begin + B := Synth_Array_Attribute (Syn_Inst, Expr); + return Create_Value_Discrete (Int64 (B.Len), Typ); + end; when others => Error_Kind ("synth_expression_with_type", Expr); end case; -- cgit v1.2.3