diff options
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 10 |
1 files 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 |