aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-22 18:57:00 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-22 21:31:27 +0200
commitf1b30e039589a780c3cbf4ae24af18e8eb3f948d (patch)
tree5f18d1f9fd436366b968097bd8f65c36521c2174
parente4efd609757cc9c303e3a27f421f5b75f551e5d2 (diff)
downloadghdl-f1b30e039589a780c3cbf4ae24af18e8eb3f948d.tar.gz
ghdl-f1b30e039589a780c3cbf4ae24af18e8eb3f948d.tar.bz2
ghdl-f1b30e039589a780c3cbf4ae24af18e8eb3f948d.zip
synth-oper: handle dynamic slice in operands. Fix ghdl-yosys-plugin#108
-rw-r--r--src/synth/synth-oper.adb25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index 12fa0239b..0bd5769e0 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -128,14 +128,25 @@ package body Synth.Oper is
begin
Res := Prev.Typ;
- if Res.Vbound.Dir = Dir_Downto
- and then Res.Vbound.Right = 0
- then
- -- Normalized range
- return Res;
- end if;
+ case Res.Kind is
+ when Type_Vector =>
+ if Res.Vbound.Dir = Dir_Downto
+ and then Res.Vbound.Right = 0
+ then
+ -- Normalized range
+ return Res;
+ end if;
+ return Create_Vec_Type_By_Length (Res.W, Res.Vec_El);
+
+ when Type_Slice =>
+ return Create_Vec_Type_By_Length (Res.W, Res.Slice_El);
- return Create_Vec_Type_By_Length (Res.W, Res.Vec_El);
+ when Type_Unbounded_Vector =>
+ raise Internal_Error;
+
+ when others =>
+ raise Internal_Error;
+ end case;
end Create_Res_Bound;
function Create_Bounds_From_Length