From 68978a5a6bc78b9d71985648ae4976119d3c640c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 5 Jun 2022 09:08:27 +0200 Subject: synth-vhdl_expr: adjust max computation for memidx. Fix #2073 --- src/synth/synth-vhdl_expr.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/synth/synth-vhdl_expr.adb') diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index d58399021..75d7d7e78 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -1258,7 +1258,7 @@ package body Synth.Vhdl_Expr is -- max so that max*step+wd <= len - off -- max <= (len - off - wd) / step Max := (Pfx_Bnd.Len - Off.Net_Off - Res_Bnd.Len) / Step; - if Clog2 (Uns64 (Max)) > Natural (Inp_W) then + if Max > 2**Natural (Inp_W) - 1 then -- The width of Inp limits the max. Max := 2**Natural (Inp_W) - 1; end if; -- cgit v1.2.3