diff options
author | marph91 <33229141+marph91@users.noreply.github.com> | 2019-08-19 20:28:06 +0200 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2019-08-19 20:28:06 +0200 |
commit | 008d54327842b999f3ea442de5d9e312ab94b5f1 (patch) | |
tree | 9c9149ce1b094de6006c73afc6f6737290e3184d /src | |
parent | e51f0ae6ee0a6c94b1a92b36dab7980d46b99668 (diff) | |
download | ghdl-008d54327842b999f3ea442de5d9e312ab94b5f1.tar.gz ghdl-008d54327842b999f3ea442de5d9e312ab94b5f1.tar.bz2 ghdl-008d54327842b999f3ea442de5d9e312ab94b5f1.zip |
synth: handle array attribute "length" (#895)
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-expr.adb | 10 |
1 files changed, 10 insertions, 0 deletions
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; |