aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-expr.adb
diff options
context:
space:
mode:
authorPepijn de Vos <pepijndevos@gmail.com>2019-08-01 19:07:53 +0200
committertgingold <tgingold@users.noreply.github.com>2019-08-01 19:07:53 +0200
commit9b64728925b49051e6ae489ae005c0f22df0110e (patch)
tree41bcb027ac5757e8c501fb8ce8892972d24bf463 /src/synth/synth-expr.adb
parentae6d2b79e508684f189b6d8cc093dbb6f586f767 (diff)
downloadghdl-9b64728925b49051e6ae489ae005c0f22df0110e.tar.gz
ghdl-9b64728925b49051e6ae489ae005c0f22df0110e.tar.bz2
ghdl-9b64728925b49051e6ae489ae005c0f22df0110e.zip
synth: handle signed integer comparisons (#878)
* comparisons with integer literals * display signed comparison nicely * revert literal size changes * properly display signed values
Diffstat (limited to 'src/synth/synth-expr.adb')
-rw-r--r--src/synth/synth-expr.adb21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 67121652f..f7cbe074b 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -1048,6 +1048,27 @@ package body Synth.Expr is
else
return Synth_Compare (Id_Sle);
end if;
+ when Iir_Predefined_Integer_Less =>
+ 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_Slt);
+ end if;
+ when Iir_Predefined_Integer_Greater_Equal =>
+ 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_Sge);
+ end if;
+ when Iir_Predefined_Integer_Greater =>
+ 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_Sgt);
+ end if;
when Iir_Predefined_Integer_Equality =>
if Is_Const (Left) and then Is_Const (Right) then
return Create_Value_Discrete