aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-05-04 06:27:10 +0200
committerTristan Gingold <tgingold@free.fr>2020-05-04 19:04:11 +0200
commit6844b2e0b2bd14f9d359e13b08e1d916538b6289 (patch)
treef497dd63028004e110ced4c0e56745fc69f05d0d /src/synth/synth-expr.adb
parent210c497e86d6dff0337114b013e0c3a8066dee72 (diff)
downloadghdl-6844b2e0b2bd14f9d359e13b08e1d916538b6289.tar.gz
ghdl-6844b2e0b2bd14f9d359e13b08e1d916538b6289.tar.bz2
ghdl-6844b2e0b2bd14f9d359e13b08e1d916538b6289.zip
synth-expr: handle subtype name in synth_slice_suffix. Fix #1280
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r--src/synth/synth-expr.adb18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index bccb022fd..dfe2f47d2 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -603,6 +603,11 @@ package body Synth.Expr is
Left => Int64 (B.Left),
Right => Int64 (B.Right));
end;
+ when Iir_Kinds_Denoting_Name =>
+ -- A discrete subtype name.
+ Synth_Discrete_Range
+ (Syn_Inst, Get_Subtype_Indication (Get_Named_Entity (Bound)),
+ Rng);
when others =>
Error_Kind ("synth_discrete_range", Bound);
end case;
@@ -1419,20 +1424,24 @@ package body Synth.Expr is
Inp_W : Width;
begin
Off := (0, 0);
+ Inp := No_Net;
case Get_Kind (Expr) is
when Iir_Kind_Range_Expression =>
+ -- As the range may be dynamic, cannot use synth_discrete_range.
Left := Synth_Expression_With_Basetype
(Syn_Inst, Get_Left_Limit (Expr), En);
Right := Synth_Expression_With_Basetype
(Syn_Inst, Get_Right_Limit (Expr), En);
Dir := Get_Direction (Expr);
- when Iir_Kind_Range_Array_Attribute =>
+
+ when Iir_Kind_Range_Array_Attribute
+ | Iir_Kind_Reverse_Range_Array_Attribute
+ | Iir_Kinds_Denoting_Name =>
declare
Rng : Discrete_Range_Type;
begin
Synth_Discrete_Range (Syn_Inst, Expr, Rng);
- Inp := No_Net;
Synth_Slice_Const_Suffix (Syn_Inst, Expr,
Name, Pfx_Bnd,
Rng.Left, Rng.Right, Rng.Dir,
@@ -1442,10 +1451,11 @@ package body Synth.Expr is
when others =>
Error_Msg_Synth
(+Expr, "only range expression supported for slices");
+ Res_Bnd := (Dir => Dir_To, Left => 1, Right => 0, Len => 0);
+ return;
end case;
if Is_Static_Val (Left.Val) and then Is_Static_Val (Right.Val) then
- Inp := No_Net;
Synth_Slice_Const_Suffix (Syn_Inst, Expr,
Name, Pfx_Bnd,
Get_Static_Discrete (Left),
@@ -1455,8 +1465,6 @@ package body Synth.Expr is
else
if Pfx_Bnd.Dir /= Dir then
Error_Msg_Synth (+Name, "direction mismatch in slice");
- Inp := No_Net;
- Off := (0, 0);
if Dir = Dir_To then
Res_Bnd := (Dir => Dir_To, Left => 1, Right => 0, Len => 0);
else