diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-07-24 06:22:16 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-07-24 06:22:16 +0200 |
commit | 921398c1dac0979723374afc01b9feb6e01fa98e (patch) | |
tree | 2d4fa3122f13edba041eae0529f30951d3c1ef85 /src/synth/synth-expr.adb | |
parent | 01c82f09be0baaa84cc189255b47fb1326da7424 (diff) | |
download | ghdl-921398c1dac0979723374afc01b9feb6e01fa98e.tar.gz ghdl-921398c1dac0979723374afc01b9feb6e01fa98e.tar.bz2 ghdl-921398c1dac0979723374afc01b9feb6e01fa98e.zip |
synth: fix handling of multi-dim ROM. Fix #1390
Document index order for memidx.
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r-- | src/synth/synth-expr.adb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 85404d7e3..654d25eb8 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1167,16 +1167,10 @@ package body Synth.Expr is Voff := No_Net; Off := (0, 0); - for I in Flist_First .. Flist_Last (Indexes) loop + Stride := 1; + for I in reverse Flist_First .. Flist_Last (Indexes) loop Idx_Expr := Get_Nth_Element (Indexes, I); - -- Compute stride. This is O(n**2), but for small n. - Stride := 1; - for J in I + 1 .. Flist_Last (Indexes) loop - Bnd := Get_Array_Bound (Pfx_Type, Dim_Type (J + 1)); - Stride := Stride * Bnd.Len; - end loop; - -- Use the base type as the subtype of the index is not synth-ed. Idx_Val := Synth_Expression_With_Basetype (Syn_Inst, Idx_Expr); Strip_Const (Idx_Val); @@ -1204,6 +1198,8 @@ package body Synth.Expr is Set_Location (Voff, Idx_Expr); end if; end if; + + Stride := Stride * Bnd.Len; end loop; end Synth_Indexed_Name; |