From 92616e09b4a050ee9ba4496a3f68b6db2cb2552a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 1 Oct 2019 07:41:39 +0200 Subject: synth: handle selected element of const record. --- src/synth/synth-expr.adb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 9e5ccff6a..12579b1eb 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1574,11 +1574,14 @@ package body Synth.Expr is begin Res := Synth_Expression (Syn_Inst, Pfx); Res_Typ := Res.Typ.Rec.E (Idx + 1).Typ; - -- FIXME: handle const. - N := Build_Extract - (Build_Context, Get_Net (Res), - Res.Typ.Rec.E (Idx + 1).Off, Get_Type_Width (Res_Typ)); - return Create_Value_Net (N, Res_Typ); + if Res.Kind = Value_Const_Record then + return Res.Rec.V (Idx + 1); + else + N := Build_Extract + (Build_Context, Get_Net (Res), + Res.Typ.Rec.E (Idx + 1).Off, Get_Type_Width (Res_Typ)); + return Create_Value_Net (N, Res_Typ); + end if; end; when Iir_Kind_Character_Literal => return Synth_Expression_With_Type -- cgit v1.2.3