From 874ee1a5fb4c40bfc5a0b64669dfa495a8c44736 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 6 Oct 2019 10:22:29 +0200 Subject: synth: handle neg for integers. --- src/synth/synth-oper.adb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb index 35906eee5..caa5b3742 100644 --- a/src/synth/synth-oper.adb +++ b/src/synth/synth-oper.adb @@ -820,6 +820,19 @@ package body Synth.Oper is return Synth_Vec_Reduce_Monadic(Id_Red_Or); when Iir_Predefined_Ieee_1164_Condition_Operator => return Operand; + when Iir_Predefined_Integer_Negation => + if Is_Const (Operand) then + return Create_Value_Discrete (-Operand.Scal, Operand.Typ); + else + declare + N : Net; + begin + N := Build_Monadic + (Build_Context, Id_Neg, Get_Net (Operand)); + Set_Location (N, Loc); + return Create_Value_Net (N, Operand.Typ); + end; + end if; when others => Error_Msg_Synth (+Loc, -- cgit v1.2.3