aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-08-03 18:56:54 +0200
committerTristan Gingold <tgingold@free.fr>2020-08-03 19:06:00 +0200
commit1d5221aa49ad6bf151407b097e32330391ebf564 (patch)
tree783baf3dde4c9beea2f83b1a3ae9a84b7d535f05 /src
parent60c3d12395c6fb6892f30bf326f223d3bedf38bb (diff)
downloadghdl-1d5221aa49ad6bf151407b097e32330391ebf564.tar.gz
ghdl-1d5221aa49ad6bf151407b097e32330391ebf564.tar.bz2
ghdl-1d5221aa49ad6bf151407b097e32330391ebf564.zip
synth: fix handling of static index in indexed names. For #1421
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-expr.adb4
-rw-r--r--src/synth/synth-values.ads1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 683b86ddd..60c8cd3d3 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1189,9 +1189,9 @@ package body Synth.Expr is
Bnd := Get_Array_Bound (Pfx_Type, Dim_Type (I + 1));
- if Is_Static (Idx_Val.Val) then
+ if Is_Static_Val (Idx_Val.Val) then
Idx_Off := Index_To_Offset (Syn_Inst, Bnd,
- Read_Discrete (Idx_Val), Name);
+ Get_Static_Discrete (Idx_Val), Name);
Off.Net_Off := Off.Net_Off + Idx_Off.Net_Off * Stride * El_Typ.W;
Off.Mem_Off := Off.Mem_Off
+ Idx_Off.Mem_Off * Size_Type (Stride) * El_Typ.Sz;
diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads
index 0cef26b2b..df80a9fe7 100644
--- a/src/synth/synth-values.ads
+++ b/src/synth/synth-values.ads
@@ -107,6 +107,7 @@ package Synth.Values is
function Is_Static (Val : Value_Acc) return Boolean;
-- Can also return true for nets and wires.
+ -- Use Get_Static_Discrete to get the value.
function Is_Static_Val (Val : Value_Acc) return Boolean;
function Is_Equal (L, R : Valtyp) return Boolean;