aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-27 21:45:26 +0100
committerTristan Gingold <tgingold@free.fr>2019-10-27 21:45:26 +0100
commit428277de6335c4f926c3d5cde8f2b76e82c0633f (patch)
treea179205977446c482274d75d0bd6a61fc48089e1 /src
parent152541125dedcc10d1e82cbba4f6e8492a2c4d0d (diff)
downloadghdl-428277de6335c4f926c3d5cde8f2b76e82c0633f.tar.gz
ghdl-428277de6335c4f926c3d5cde8f2b76e82c0633f.tar.bz2
ghdl-428277de6335c4f926c3d5cde8f2b76e82c0633f.zip
synth-expr (synth_slice_suffix): compute max value for slices.
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-expr.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index b5e54c12c..d16dedffe 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1207,6 +1207,7 @@ package body Synth.Expr is
Left, Right : Value_Acc;
Dir : Iir_Direction;
Step : Uns32;
+ Max : Uns32;
begin
Off := 0;
@@ -1258,9 +1259,11 @@ package body Synth.Expr is
Synth_Extract_Dyn_Suffix
(Name, Pfx_Bnd, Get_Net (Left), Get_Net (Right),
Inp, Step, Off, Wd);
+ -- FIXME: convert range to offset.
+ Max := (Pfx_Bnd.Len - Off) / Step;
Inp := Build_Memidx
(Get_Build (Syn_Inst),
- Inp, Step * El_Wd, 0,
+ Inp, Step * El_Wd, Max,
Get_Width (Inp) + Width (Clog2 (Uns64 (Step * El_Wd))));
Wd := Wd * El_Wd;
end if;