From f43889ac073acb67c1ddd5d53906943dd24068e5 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 30 Jul 2019 20:57:48 +0200 Subject: synth: slightly improve output for indexes. --- src/synth/synth-expr.adb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 8f7665ace..b1e88ea3c 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1162,13 +1162,17 @@ package body Synth.Expr is Off : Net; Right : Net; begin - -- TODO: handle width. + Idx2 := Synth_Resize (Idx_Val, Bnd.Wbounds, Loc); + + if Bnd.Right = 0 and then Bnd.Dir = Iir_Downto then + -- Simple case without adjustments. + return Idx2; + end if; + Right := Build_Const_UB32 (Build_Context, To_Uns32 (Bnd.Right), Bnd.Wbounds); Set_Location (Right, Loc); - Idx2 := Synth_Resize (Idx_Val, Bnd.Wbounds, Loc); - case Bnd.Dir is when Iir_To => -- L <= I <= R --> off = R - I -- cgit v1.2.3