diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-06 10:22:29 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-06 10:22:29 +0200 |
commit | 874ee1a5fb4c40bfc5a0b64669dfa495a8c44736 (patch) | |
tree | a163ed009d852482adc143b7c6333f17cf15a23d /src/synth/synth-oper.adb | |
parent | 00f8dd9107cef97100a409731e1d09903c98d24d (diff) | |
download | ghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.tar.gz ghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.tar.bz2 ghdl-874ee1a5fb4c40bfc5a0b64669dfa495a8c44736.zip |
synth: handle neg for integers.
Diffstat (limited to 'src/synth/synth-oper.adb')
-rw-r--r-- | src/synth/synth-oper.adb | 13 |
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, |