From 1d5221aa49ad6bf151407b097e32330391ebf564 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 3 Aug 2020 18:56:54 +0200 Subject: synth: fix handling of static index in indexed names. For #1421 --- src/synth/synth-expr.adb | 4 ++-- src/synth/synth-values.ads | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 683b86ddd..60c8cd3d3 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1189,9 +1189,9 @@ package body Synth.Expr is Bnd := Get_Array_Bound (Pfx_Type, Dim_Type (I + 1)); - if Is_Static (Idx_Val.Val) then + if Is_Static_Val (Idx_Val.Val) then Idx_Off := Index_To_Offset (Syn_Inst, Bnd, - Read_Discrete (Idx_Val), Name); + Get_Static_Discrete (Idx_Val), Name); Off.Net_Off := Off.Net_Off + Idx_Off.Net_Off * Stride * El_Typ.W; Off.Mem_Off := Off.Mem_Off + Idx_Off.Mem_Off * Size_Type (Stride) * El_Typ.Sz; diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads index 0cef26b2b..df80a9fe7 100644 --- a/src/synth/synth-values.ads +++ b/src/synth/synth-values.ads @@ -107,6 +107,7 @@ package Synth.Values is function Is_Static (Val : Value_Acc) return Boolean; -- Can also return true for nets and wires. + -- Use Get_Static_Discrete to get the value. function Is_Static_Val (Val : Value_Acc) return Boolean; function Is_Equal (L, R : Valtyp) return Boolean; -- cgit v1.2.3