aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-06 10:22:29 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-06 10:22:29 +0200
commit874ee1a5fb4c40bfc5a0b64669dfa495a8c44736 (patch)
treea163ed009d852482adc143b7c6333f17cf15a23d /src/synth
parent00f8dd9107cef97100a409731e1d09903c98d24d (diff)
downloadghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.tar.gz
ghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.tar.bz2
ghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.zip
synth: handle neg for integers.
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-oper.adb13
1 files changed, 13 insertions, 0 deletions
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,