From 7da5c8b0aeca0f824ac7af99dbcdb205d6e1f155 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 12 Jan 2020 09:14:33 +0100 Subject: synth-expr: handle pos attribute. For #1080 --- src/synth/synth-expr.adb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 763e6379c..56f32a0ba 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1923,6 +1923,18 @@ package body Synth.Expr is B := Synth_Array_Attribute (Syn_Inst, Expr); return Create_Value_Discrete (Int64 (B.Len), Expr_Type); end; + when Iir_Kind_Pos_Attribute => + declare + Param : constant Node := Get_Parameter (Expr); + V : Value_Acc; + Dtype : Type_Acc; + begin + V := Synth_Expression (Syn_Inst, Param); + Dtype := Get_Value_Type (Syn_Inst, Get_Type (Expr)); + -- FIXME: to be generalized. Not always as simple as a + -- subtype conversion. + return Synth_Subtype_Conversion (V, Dtype, False, Expr); + end; when Iir_Kind_Null_Literal => return Create_Value_Access (Expr_Type, Null_Heap_Index); when Iir_Kind_Allocator_By_Subtype => -- cgit v1.2.3