From c794aaa2a7dbec514d188c28f75da181a5692992 Mon Sep 17 00:00:00 2001 From: marph91 <33229141+marph91@users.noreply.github.com> Date: Wed, 28 Aug 2019 18:51:02 +0200 Subject: synth: Integer operators (#902) * synth: added missing integer operators I. e. inequality and remainder. * testsuite/synth: added testcase for the missing integer operators --- src/synth/synth-expr.adb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/synth/synth-expr.adb') diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index a21309b47..063257008 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1196,6 +1196,15 @@ package body Synth.Expr is Error_Msg_Synth (+Expr, "non-constant mod not supported"); return null; end if; + when Iir_Predefined_Integer_Rem => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Left.Scal rem Right.Scal, + Get_Value_Type (Syn_Inst, Get_Type (Expr))); + else + Error_Msg_Synth (+Expr, "non-constant rem not supported"); + return null; + end if; when Iir_Predefined_Integer_Exp => if Is_Const (Left) and then Is_Const (Right) then return Create_Value_Discrete @@ -1241,6 +1250,13 @@ package body Synth.Expr is else return Synth_Compare (Id_Eq); end if; + when Iir_Predefined_Integer_Inequality => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Boolean'Pos (Left.Scal /= Right.Scal), Boolean_Type); + else + return Synth_Compare (Id_Ne); + end if; when others => Error_Msg_Synth (+Expr, "synth_dyadic_operation: unhandled " -- cgit v1.2.3