From f1b30e039589a780c3cbf4ae24af18e8eb3f948d Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 22 Apr 2020 18:57:00 +0200 Subject: synth-oper: handle dynamic slice in operands. Fix ghdl-yosys-plugin#108 --- src/synth/synth-oper.adb | 25 ++++++++++++++++++------- 1 file 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 -- cgit v1.2.3