diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-23 05:30:08 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-23 05:30:08 +0200 |
commit | ed01a04ef4d9c0627ec1412f09a6a38ec82a419f (patch) | |
tree | 739a5710c78aceeb677fb2cd2fee7f3d3787b041 /src | |
parent | 5ab518311214dec42f0ae4ce8287008f964624e1 (diff) | |
download | ghdl-ed01a04ef4d9c0627ec1412f09a6a38ec82a419f.tar.gz ghdl-ed01a04ef4d9c0627ec1412f09a6a38ec82a419f.tar.bz2 ghdl-ed01a04ef4d9c0627ec1412f09a6a38ec82a419f.zip |
synth: add more operators.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-expr.adb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index d8614f543..9658bbd25 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -742,7 +742,19 @@ package body Synth.Expr is when Iir_Predefined_Array_Equality => -- TODO: check size, handle non-vector. - return Synth_Compare (Id_Eq); + if Is_Vector_Type (Ltype) then + return Synth_Compare (Id_Eq); + else + raise Internal_Error; + end if; + when Iir_Predefined_Array_Greater => + -- TODO: check size, non-vector. + -- TODO: that's certainly not the correct operator. + if Is_Vector_Type (Ltype) then + return Synth_Compare (Id_Ugt); + else + raise Internal_Error; + end if; when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Nat => -- "+" (Unsigned, Natural) @@ -860,6 +872,27 @@ package body Synth.Expr is Error_Msg_Synth (+Expr, "non-constant division not supported"); return null; end if; + when Iir_Predefined_Integer_Mod => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete (Left.Scal mod Right.Scal); + else + Error_Msg_Synth (+Expr, "non-constant mod not supported"); + return null; + end if; + when Iir_Predefined_Integer_Less_Equal => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Boolean'Pos (Left.Scal <= Right.Scal)); + else + return Synth_Compare (Id_Sle); + end if; + when Iir_Predefined_Integer_Equality => + if Is_Const (Left) and then Is_Const (Right) then + return Create_Value_Discrete + (Boolean'Pos (Left.Scal = Right.Scal)); + else + return Synth_Compare (Id_Eq); + end if; when others => Error_Msg_Synth (+Expr, "synth_dyadic_operation: unhandled " |