diff options
-rw-r--r-- | src/synth/synth-ieee-numeric_std.adb | 206 | ||||
-rw-r--r-- | src/synth/synth-ieee-numeric_std.ads | 122 | ||||
-rw-r--r-- | src/synth/synth-vhdl_eval.adb | 145 |
3 files changed, 295 insertions, 178 deletions
diff --git a/src/synth/synth-ieee-numeric_std.adb b/src/synth/synth-ieee-numeric_std.adb index 10f19fb3e..ad41757fc 100644 --- a/src/synth/synth-ieee-numeric_std.adb +++ b/src/synth/synth-ieee-numeric_std.adb @@ -65,18 +65,19 @@ package body Synth.Ieee.Numeric_Std is end loop; end Fill; - procedure Warn_Compare_Null (Loc : Syn_Src) is + procedure Warn_Compare_Null (Loc : Location_Type) is begin - Warning_Msg_Synth (+Loc, "null argument detected, returning false"); + Warning_Msg_Synth (Loc, "null argument detected, returning false"); end Warn_Compare_Null; - procedure Warn_Compare_Meta (Loc : Syn_Src) is + procedure Warn_Compare_Meta (Loc : Location_Type) is begin - Warning_Msg_Synth (+Loc, "metavalue detected, returning false"); + Warning_Msg_Synth (Loc, "metavalue detected, returning false"); end Warn_Compare_Meta; - function Compare_Uns_Uns - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type + function Compare_Uns_Uns (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type is Lw : constant Uns32 := Left.Typ.W; Rw : constant Uns32 := Right.Typ.W; @@ -129,8 +130,9 @@ package body Synth.Ieee.Numeric_Std is return Equal; end Compare_Uns_Uns; - function Compare_Uns_Nat - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type + function Compare_Uns_Nat (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type is Lw : constant Uns32 := Left.Typ.W; Rval : constant Uns64 := To_Uns64 (Read_Discrete (Right)); @@ -183,8 +185,9 @@ package body Synth.Ieee.Numeric_Std is return Equal; end Compare_Uns_Nat; - function Compare_Nat_Uns - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type + function Compare_Nat_Uns (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type is Rw : constant Uns32 := Right.Typ.W; Lval : constant Uns64 := To_Uns64 (Read_Discrete (Left)); @@ -237,8 +240,9 @@ package body Synth.Ieee.Numeric_Std is return Equal; end Compare_Nat_Uns; - function Compare_Sgn_Sgn - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type + function Compare_Sgn_Sgn (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type is Lw : constant Uns32 := Left.Typ.W; Rw : constant Uns32 := Right.Typ.W; @@ -293,8 +297,9 @@ package body Synth.Ieee.Numeric_Std is return Res; end Compare_Sgn_Sgn; - function Compare_Sgn_Int - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type + function Compare_Sgn_Int (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type is Lw : constant Uns32 := Left.Typ.W; Rval : constant Int64 := Read_Discrete (Right); @@ -341,7 +346,7 @@ package body Synth.Ieee.Numeric_Std is return Res; end Compare_Sgn_Int; - function Add_Vec_Vec (L, R : Memtyp; Signed : Boolean; Loc : Syn_Src) + function Add_Vec_Vec (L, R : Memtyp; Signed : Boolean; Loc : Location_Type) return Memtyp is Llen : constant Uns32 := L.Typ.Abound.Len; @@ -394,18 +399,20 @@ package body Synth.Ieee.Numeric_Std is return Res; end Add_Vec_Vec; - function Add_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp is + function Add_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp is begin return Add_Vec_Vec (L, R, False, Loc); end Add_Uns_Uns; - function Add_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp is + function Add_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is begin return Add_Vec_Vec (L, R, True, Loc); end Add_Sgn_Sgn; - function Add_Vec_Int - (L : Memtyp; R : Uns64; Signed : Boolean; Loc : Syn_Src) return Memtyp + function Add_Vec_Int (L : Memtyp; + R : Uns64; + Signed : Boolean; + Loc : Location_Type) return Memtyp is Len : constant Uns32 := L.Typ.Abound.Len; Res : Memtyp; @@ -439,17 +446,19 @@ package body Synth.Ieee.Numeric_Std is return Res; end Add_Vec_Int; - function Add_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp is + function Add_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp is begin return Add_Vec_Int (L, To_Uns64 (R), True, Loc); end Add_Sgn_Int; - function Add_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp is + function Add_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp is begin return Add_Vec_Int (L, R, True, Loc); end Add_Uns_Nat; - function Sub_Vec_Vec (L, R : Memtyp; Signed : Boolean; Loc : Syn_Src) + function Sub_Vec_Vec (L, R : Memtyp; Signed : Boolean; Loc : Location_Type) return Memtyp is Llen : constant Uns32 := L.Typ.Abound.Len; @@ -503,18 +512,20 @@ package body Synth.Ieee.Numeric_Std is return Res; end Sub_Vec_Vec; - function Sub_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp is + function Sub_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp is begin return Sub_Vec_Vec (L, R, False, Loc); end Sub_Uns_Uns; - function Sub_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp is + function Sub_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is begin return Sub_Vec_Vec (L, R, True, Loc); end Sub_Sgn_Sgn; - function Sub_Vec_Int - (L : Memtyp; R : Uns64; Signed : Boolean; Loc : Syn_Src) return Memtyp + function Sub_Vec_Int (L : Memtyp; + R : Uns64; + Signed : Boolean; + Loc : Location_Type) return Memtyp is Len : constant Uns32 := L.Typ.Abound.Len; Res : Memtyp; @@ -549,18 +560,23 @@ package body Synth.Ieee.Numeric_Std is return Res; end Sub_Vec_Int; - function Sub_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp is + function Sub_Sgn_Int (L : Memtyp; + R : Int64; + Loc : Location_Type) return Memtyp is begin return Sub_Vec_Int (L, To_Uns64 (R), True, Loc); end Sub_Sgn_Int; - function Sub_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp is + function Sub_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp is begin return Sub_Vec_Int (L, R, True, Loc); end Sub_Uns_Nat; - function Sub_Int_Vec - (L : Uns64; R : Memtyp; Signed : Boolean; Loc : Syn_Src) return Memtyp + function Sub_Int_Vec (L : Uns64; + R : Memtyp; + Signed : Boolean; + Loc : Location_Type) return Memtyp is Len : constant Uns32 := R.Typ.Abound.Len; Res : Memtyp; @@ -595,17 +611,19 @@ package body Synth.Ieee.Numeric_Std is return Res; end Sub_Int_Vec; - function Sub_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp is + function Sub_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp is begin return Sub_Int_Vec (L, R, False, Loc); end Sub_Nat_Uns; - function Sub_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp is + function Sub_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp is begin return Sub_Int_Vec (To_Uns64 (L), R, True, Loc); end Sub_Int_Sgn; - function Mul_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Mul_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp is Llen : constant Uns32 := L.Typ.Abound.Len; Rlen : constant Uns32 := R.Typ.Abound.Len; @@ -667,7 +685,8 @@ package body Synth.Ieee.Numeric_Std is return Res; end To_Unsigned; - function Mul_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Mul_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -678,7 +697,8 @@ package body Synth.Ieee.Numeric_Std is return Mul_Uns_Uns (Lv, R, Loc); end Mul_Nat_Uns; - function Mul_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp + function Mul_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -689,7 +709,7 @@ package body Synth.Ieee.Numeric_Std is return Mul_Uns_Uns (L, Rv, Loc); end Mul_Uns_Nat; - function Mul_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Mul_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is Llen : constant Uns32 := L.Typ.Abound.Len; Rlen : constant Uns32 := R.Typ.Abound.Len; @@ -770,7 +790,8 @@ package body Synth.Ieee.Numeric_Std is return Res; end To_Signed; - function Mul_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Mul_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -781,7 +802,8 @@ package body Synth.Ieee.Numeric_Std is return Mul_Sgn_Sgn (Lv, R, Loc); end Mul_Int_Sgn; - function Mul_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp + function Mul_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -822,7 +844,7 @@ package body Synth.Ieee.Numeric_Std is Neg_Vec (V.Mem, V.Mem, V.Typ); end Neg_Vec; - function Neg_Vec (V : Memtyp; Loc : Syn_Src) return Memtyp + function Neg_Vec (V : Memtyp; Loc : Location_Type) return Memtyp is Len : constant Uns32 := V.Typ.Abound.Len; Res : Memtyp; @@ -858,7 +880,7 @@ package body Synth.Ieee.Numeric_Std is end loop; end To_01X; - function Abs_Vec (V : Memtyp; Loc : Syn_Src) return Memtyp + function Abs_Vec (V : Memtyp; Loc : Location_Type) return Memtyp is pragma Unreferenced (Loc); Len : constant Uns32 := V.Typ.Abound.Len; @@ -973,25 +995,20 @@ package body Synth.Ieee.Numeric_Std is return Res; end Rotate_Vec; - function Resize_Vec (Val : Memtyp; - Size : Uns32; - Signed : Boolean) return Memtyp + procedure Resize_Vec (Dest : Memtyp; Val : Memtyp; Signed : Boolean) is - Old_Size : constant Uns32 := Uns32 (Vec_Length (Val.Typ)); + Size : constant Uns32 := Dest.Typ.Abound.Len; + Old_Size : constant Uns32 := Val.Typ.Abound.Len; L : Uns32; - Res : Memtyp; Pad, B : Std_Ulogic; begin - Res.Typ := Create_Res_Type (Val.Typ, Size); - Res := Create_Memory (Res.Typ); - if Size = 0 then - return Res; + return; end if; if Signed and then Old_Size > 0 then Pad := Read_Std_Logic (Val.Mem, 0); - Write_Std_Logic (Res.Mem, 0, Pad); + Write_Std_Logic (Dest.Mem, 0, Pad); L := Size - 1; else Pad := '0'; @@ -1004,8 +1021,20 @@ package body Synth.Ieee.Numeric_Std is else B := Pad; end if; - Write_Std_Logic (Res.Mem, Size - I, B); + Write_Std_Logic (Dest.Mem, Size - I, B); end loop; + end Resize_Vec; + + function Resize_Vec (Val : Memtyp; + Size : Uns32; + Signed : Boolean) return Memtyp + is + Res : Memtyp; + begin + Res.Typ := Create_Res_Type (Val.Typ, Size); + Res := Create_Memory (Res.Typ); + + Resize_Vec (Res, Val, Signed); return Res; end Resize_Vec; @@ -1074,7 +1103,7 @@ package body Synth.Ieee.Numeric_Std is return Res; end Has_0x; - function Div_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Div_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp is Nlen : constant Uns32 := L.Typ.Abound.Len; Dlen : constant Uns32 := R.Typ.Abound.Len; @@ -1103,7 +1132,8 @@ package body Synth.Ieee.Numeric_Std is return Quot; end Div_Uns_Uns; - function Div_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp + function Div_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -1114,7 +1144,8 @@ package body Synth.Ieee.Numeric_Std is return Div_Uns_Uns (L, Rv, Loc); end Div_Uns_Nat; - function Div_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Div_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -1125,7 +1156,7 @@ package body Synth.Ieee.Numeric_Std is return Div_Uns_Uns (Lv, R, Loc); end Div_Nat_Uns; - function Div_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Div_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is Nlen : constant Uns32 := L.Typ.Abound.Len; Dlen : constant Uns32 := R.Typ.Abound.Len; @@ -1179,7 +1210,8 @@ package body Synth.Ieee.Numeric_Std is return Quot; end Div_Sgn_Sgn; - function Div_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp + function Div_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -1190,7 +1222,8 @@ package body Synth.Ieee.Numeric_Std is return Div_Sgn_Sgn (L, Rv, Loc); end Div_Sgn_Int; - function Div_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Div_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -1201,7 +1234,7 @@ package body Synth.Ieee.Numeric_Std is return Div_Sgn_Sgn (Lv, R, Loc); end Div_Int_Sgn; - function Rem_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Rem_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp is Nlen : constant Uns32 := L.Typ.Abound.Len; Dlen : constant Uns32 := R.Typ.Abound.Len; @@ -1230,7 +1263,8 @@ package body Synth.Ieee.Numeric_Std is return Rema; end Rem_Uns_Uns; - function Rem_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp + function Rem_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -1241,7 +1275,8 @@ package body Synth.Ieee.Numeric_Std is return Rem_Uns_Uns (L, Rv, Loc); end Rem_Uns_Nat; - function Rem_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Rem_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -1252,7 +1287,7 @@ package body Synth.Ieee.Numeric_Std is return Rem_Uns_Uns (Lv, R, Loc); end Rem_Nat_Uns; - function Rem_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Rem_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is Nlen : constant Uns32 := L.Typ.Abound.Len; Dlen : constant Uns32 := R.Typ.Abound.Len; @@ -1306,7 +1341,8 @@ package body Synth.Ieee.Numeric_Std is return Rema; end Rem_Sgn_Sgn; - function Rem_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp + function Rem_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -1317,7 +1353,8 @@ package body Synth.Ieee.Numeric_Std is return Rem_Sgn_Sgn (L, Rv, Loc); end Rem_Sgn_Int; - function Rem_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Rem_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -1328,7 +1365,7 @@ package body Synth.Ieee.Numeric_Std is return Rem_Sgn_Sgn (Lv, R, Loc); end Rem_Int_Sgn; - function Mod_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp + function Mod_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp is Nlen : constant Uns32 := L.Typ.Abound.Len; Dlen : constant Uns32 := R.Typ.Abound.Len; @@ -1399,7 +1436,8 @@ package body Synth.Ieee.Numeric_Std is end if; end Mod_Sgn_Sgn; - function Mod_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp + function Mod_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp is Rv : Memtyp; begin @@ -1410,7 +1448,8 @@ package body Synth.Ieee.Numeric_Std is return Mod_Sgn_Sgn (L, Rv, Loc); end Mod_Sgn_Int; - function Mod_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp + function Mod_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp is Lv : Memtyp; begin @@ -1421,4 +1460,39 @@ package body Synth.Ieee.Numeric_Std is return Mod_Sgn_Sgn (Lv, R, Loc); end Mod_Int_Sgn; + function Minmax (L, R : Memtyp; Is_Signed : Boolean; Is_Max : Boolean) + return Memtyp + is + Len : constant Uns32 := Uns32'Max (L.Typ.Abound.Len, R.Typ.Abound.Len); + Res : Memtyp; + Lt : Boolean; + begin + if L.Typ.Abound.Len = 0 or R.Typ.Abound.Len = 0 then + Res.Typ := Create_Res_Type (L.Typ, 0); + Res := Create_Memory (Res.Typ); + return Res; + end if; + + Res.Typ := Create_Res_Type (L.Typ, Len); + Res := Create_Memory (Res.Typ); + + if Has_0x (L) = 'X' or else Has_0x (R) = 'X' then + Fill (Res, 'X'); + return Res; + end if; + + if Is_Signed then + Lt := Compare_Sgn_Sgn (L, R, Less, No_Location) = Less; + else + Lt := Compare_Uns_Uns (L, R, Less, No_Location) = Less; + end if; + + if Lt xor Is_Max then + Resize_Vec (Res, L, False); + else + Resize_Vec (Res, R, False); + end if; + return Res; + end Minmax; + end Synth.Ieee.Numeric_Std; diff --git a/src/synth/synth-ieee-numeric_std.ads b/src/synth/synth-ieee-numeric_std.ads index 69ebaae1a..22616986e 100644 --- a/src/synth/synth-ieee-numeric_std.ads +++ b/src/synth/synth-ieee-numeric_std.ads @@ -19,72 +19,97 @@ with Types; use Types; with Elab.Vhdl_Objtypes; use Elab.Vhdl_Objtypes; -with Synth.Source; use Synth.Source; package Synth.Ieee.Numeric_Std is -- Reminder: vectors elements are from left to right. - function Compare_Uns_Uns - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type; - function Compare_Uns_Nat - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type; - function Compare_Nat_Uns - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type; - function Compare_Sgn_Sgn - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type; - function Compare_Sgn_Int - (Left, Right : Memtyp; Err : Order_Type; Loc : Syn_Src) return Order_Type; + function Compare_Uns_Uns (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type; + function Compare_Uns_Nat (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type; + function Compare_Nat_Uns (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type; + function Compare_Sgn_Sgn (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type; + function Compare_Sgn_Int (Left, Right : Memtyp; + Err : Order_Type; + Loc : Location_Type) return Order_Type; -- Unary "-" - function Neg_Vec (V : Memtyp; Loc : Syn_Src) return Memtyp; + function Neg_Vec (V : Memtyp; Loc : Location_Type) return Memtyp; -- "abs" - function Abs_Vec (V : Memtyp; Loc : Syn_Src) return Memtyp; + function Abs_Vec (V : Memtyp; Loc : Location_Type) return Memtyp; -- "+" - function Add_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Add_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Add_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; - function Add_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp; + function Add_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Add_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Add_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; + function Add_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp; -- "-" - function Sub_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Sub_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp; - function Sub_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp; - - function Sub_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Sub_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; - function Sub_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp; + function Sub_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Sub_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp; + function Sub_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp; + + function Sub_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Sub_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; + function Sub_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp; -- "*" - function Mul_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Mul_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp; - function Mul_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp; - - function Mul_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Mul_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp; - function Mul_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; + function Mul_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Mul_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp; + function Mul_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp; + + function Mul_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Mul_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp; + function Mul_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; -- "/" - function Div_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Div_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp; - function Div_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp; - function Div_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Div_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; - function Div_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp; + function Div_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Div_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp; + function Div_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp; + function Div_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Div_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; + function Div_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp; -- "rem" - function Rem_Uns_Uns (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Rem_Uns_Nat (L : Memtyp; R : Uns64; Loc : Syn_Src) return Memtyp; - function Rem_Nat_Uns (L : Uns64; R : Memtyp; Loc : Syn_Src) return Memtyp; - function Rem_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Rem_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; - function Rem_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp; + function Rem_Uns_Uns (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Rem_Uns_Nat (L : Memtyp; R : Uns64; Loc : Location_Type) + return Memtyp; + function Rem_Nat_Uns (L : Uns64; R : Memtyp; Loc : Location_Type) + return Memtyp; + function Rem_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) return Memtyp; + function Rem_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; + function Rem_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp; -- "mod" - function Mod_Sgn_Sgn (L, R : Memtyp; Loc : Syn_Src) return Memtyp; - function Mod_Sgn_Int (L : Memtyp; R : Int64; Loc : Syn_Src) return Memtyp; - function Mod_Int_Sgn (L : Int64; R : Memtyp; Loc : Syn_Src) return Memtyp; + function Mod_Sgn_Sgn (L, R : Memtyp; Loc : Location_Type) + return Memtyp; + function Mod_Sgn_Int (L : Memtyp; R : Int64; Loc : Location_Type) + return Memtyp; + function Mod_Int_Sgn (L : Int64; R : Memtyp; Loc : Location_Type) + return Memtyp; -- Shift function Shift_Vec (Val : Memtyp; @@ -100,4 +125,9 @@ package Synth.Ieee.Numeric_Std is function Resize_Vec (Val : Memtyp; Size : Uns32; Signed : Boolean) return Memtyp; + + -- Minimum/Maximum. + function Minmax (L, R : Memtyp; Is_Signed : Boolean; Is_Max : Boolean) + return Memtyp; + end Synth.Ieee.Numeric_Std; diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb index d7a0c5694..6b4788556 100644 --- a/src/synth/synth-vhdl_eval.adb +++ b/src/synth/synth-vhdl_eval.adb @@ -860,35 +860,35 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Greater, Expr) = Equal; + Res := Compare_Uns_Uns (Left, Right, Greater, +Expr) = Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Sgn (Left, Right, Greater, Expr) = Equal; + Res := Compare_Sgn_Sgn (Left, Right, Greater, +Expr) = Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Eq_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Greater, Expr) = Equal; + Res := Compare_Uns_Nat (Left, Right, Greater, +Expr) = Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Eq_Sgn_Int => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Left, Right, Greater, Expr) = Equal; + Res := Compare_Sgn_Int (Left, Right, Greater, +Expr) = Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Eq_Int_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Right, Left, Greater, Expr) = Equal; + Res := Compare_Sgn_Int (Right, Left, Greater, +Expr) = Equal; return Create_Memory_Boolean (Res); end; @@ -896,14 +896,14 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Greater, Expr) /= Equal; + Res := Compare_Uns_Uns (Left, Right, Greater, +Expr) /= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ne_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Greater, Expr) /= Equal; + Res := Compare_Uns_Nat (Left, Right, Greater, +Expr) /= Equal; return Create_Memory_Boolean (Res); end; @@ -911,42 +911,42 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Less, Expr) = Greater; + Res := Compare_Uns_Uns (Left, Right, Less, +Expr) = Greater; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Sgn (Left, Right, Less, Expr) = Greater; + Res := Compare_Sgn_Sgn (Left, Right, Less, +Expr) = Greater; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Gt_Nat_Uns => declare Res : Boolean; begin - Res := Compare_Nat_Uns (Left, Right, Less, Expr) = Greater; + Res := Compare_Nat_Uns (Left, Right, Less, +Expr) = Greater; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Gt_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Less, Expr) = Greater; + Res := Compare_Uns_Nat (Left, Right, Less, +Expr) = Greater; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Gt_Sgn_Int => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Left, Right, Less, Expr) = Greater; + Res := Compare_Sgn_Int (Left, Right, Less, +Expr) = Greater; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Gt_Int_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Right, Left, Greater, Expr) < Equal; + Res := Compare_Sgn_Int (Right, Left, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; @@ -954,42 +954,42 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Less, Expr) >= Equal; + Res := Compare_Uns_Uns (Left, Right, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ge_Nat_Uns => declare Res : Boolean; begin - Res := Compare_Nat_Uns (Left, Right, Less, Expr) >= Equal; + Res := Compare_Nat_Uns (Left, Right, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ge_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Less, Expr) >= Equal; + Res := Compare_Uns_Nat (Left, Right, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Sgn (Left, Right, Less, Expr) >= Equal; + Res := Compare_Sgn_Sgn (Left, Right, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ge_Sgn_Int => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Left, Right, Less, Expr) >= Equal; + Res := Compare_Sgn_Int (Left, Right, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Ge_Int_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Right, Left, Greater, Expr) <= Equal; + Res := Compare_Sgn_Int (Right, Left, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; @@ -997,42 +997,42 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Greater, Expr) <= Equal; + Res := Compare_Uns_Uns (Left, Right, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Le_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Greater, Expr) <= Equal; + Res := Compare_Uns_Nat (Left, Right, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Le_Nat_Uns => declare Res : Boolean; begin - Res := Compare_Nat_Uns (Left, Right, Greater, Expr) <= Equal; + Res := Compare_Nat_Uns (Left, Right, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Sgn (Left, Right, Greater, Expr) <= Equal; + Res := Compare_Sgn_Sgn (Left, Right, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Le_Int_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Right, Left, Less, Expr) >= Equal; + Res := Compare_Sgn_Int (Right, Left, Less, +Expr) >= Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Le_Sgn_Int => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Left, Right, Greater, Expr) <= Equal; + Res := Compare_Sgn_Int (Left, Right, Greater, +Expr) <= Equal; return Create_Memory_Boolean (Res); end; @@ -1040,42 +1040,42 @@ package body Synth.Vhdl_Eval is declare Res : Boolean; begin - Res := Compare_Uns_Uns (Left, Right, Greater, Expr) < Equal; + Res := Compare_Uns_Uns (Left, Right, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Lt_Uns_Nat => declare Res : Boolean; begin - Res := Compare_Uns_Nat (Left, Right, Greater, Expr) < Equal; + Res := Compare_Uns_Nat (Left, Right, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Lt_Nat_Uns => declare Res : Boolean; begin - Res := Compare_Nat_Uns (Left, Right, Greater, Expr) < Equal; + Res := Compare_Nat_Uns (Left, Right, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Sgn (Left, Right, Greater, Expr) < Equal; + Res := Compare_Sgn_Sgn (Left, Right, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Lt_Int_Sgn => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Right, Left, Less, Expr) > Equal; + Res := Compare_Sgn_Int (Right, Left, Less, +Expr) > Equal; return Create_Memory_Boolean (Res); end; when Iir_Predefined_Ieee_Numeric_Std_Lt_Sgn_Int => declare Res : Boolean; begin - Res := Compare_Sgn_Int (Left, Right, Greater, Expr) < Equal; + Res := Compare_Sgn_Int (Left, Right, Greater, +Expr) < Equal; return Create_Memory_Boolean (Res); end; @@ -1084,86 +1084,86 @@ package body Synth.Vhdl_Eval is | Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Log | Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Slv | Iir_Predefined_Ieee_Std_Logic_Arith_Add_Uns_Uns_Slv => - return Add_Uns_Uns (Left, Right, Expr); + return Add_Uns_Uns (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Add_Uns_Nat | Iir_Predefined_Ieee_Std_Logic_Unsigned_Add_Slv_Int => - return Add_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), Expr); + return Add_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Add_Nat_Uns => - return Add_Uns_Nat (Right, To_Uns64 (Read_Discrete (Left)), Expr); + return Add_Uns_Nat (Right, To_Uns64 (Read_Discrete (Left)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Add_Sgn_Sgn => - return Add_Sgn_Sgn (Left, Right, Expr); + return Add_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Add_Sgn_Int => - return Add_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Add_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Add_Int_Sgn => - return Add_Sgn_Int (Right, Read_Discrete (Left), Expr); + return Add_Sgn_Int (Right, Read_Discrete (Left), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Uns => - return Sub_Uns_Uns (Left, Right, Expr); + return Sub_Uns_Uns (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Uns_Nat => - return Sub_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), Expr); + return Sub_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Nat_Uns => - return Sub_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, Expr); + return Sub_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Sgn_Sgn => - return Sub_Sgn_Sgn (Left, Right, Expr); + return Sub_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Sgn_Int => - return Sub_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Sub_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Sub_Int_Sgn => - return Sub_Int_Sgn (Read_Discrete (Left), Right, Expr); + return Sub_Int_Sgn (Read_Discrete (Left), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Uns_Uns => - return Mul_Uns_Uns (Left, Right, Expr); + return Mul_Uns_Uns (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Nat_Uns => - return Mul_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, Expr); + return Mul_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Uns_Nat => - return Mul_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), Expr); + return Mul_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Sgn_Sgn => - return Mul_Sgn_Sgn (Left, Right, Expr); + return Mul_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Sgn_Int => - return Mul_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Mul_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mul_Int_Sgn => - return Mul_Int_Sgn (Read_Discrete (Left), Right, Expr); + return Mul_Int_Sgn (Read_Discrete (Left), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Uns => - return Div_Uns_Uns (Left, Right, Expr); + return Div_Uns_Uns (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Uns_Nat => - return Div_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), Expr); + return Div_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Nat_Uns => - return Div_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, Expr); + return Div_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Sgn_Sgn => - return Div_Sgn_Sgn (Left, Right, Expr); + return Div_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Int_Sgn => - return Div_Int_Sgn (Read_Discrete (Left), Right, Expr); + return Div_Int_Sgn (Read_Discrete (Left), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Div_Sgn_Int => - return Div_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Div_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Uns_Uns | Iir_Predefined_Ieee_Numeric_Std_Mod_Uns_Uns => - return Rem_Uns_Uns (Left, Right, Expr); + return Rem_Uns_Uns (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Uns_Nat | Iir_Predefined_Ieee_Numeric_Std_Mod_Uns_Nat => - return Rem_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), Expr); + return Rem_Uns_Nat (Left, To_Uns64 (Read_Discrete (Right)), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Nat_Uns | Iir_Predefined_Ieee_Numeric_Std_Mod_Nat_Uns => - return Rem_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, Expr); + return Rem_Nat_Uns (To_Uns64 (Read_Discrete (Left)), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Sgn_Sgn => - return Rem_Sgn_Sgn (Left, Right, Expr); + return Rem_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Int_Sgn => - return Rem_Int_Sgn (Read_Discrete (Left), Right, Expr); + return Rem_Int_Sgn (Read_Discrete (Left), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Rem_Sgn_Int => - return Rem_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Rem_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mod_Sgn_Sgn => - return Mod_Sgn_Sgn (Left, Right, Expr); + return Mod_Sgn_Sgn (Left, Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mod_Int_Sgn => - return Mod_Int_Sgn (Read_Discrete (Left), Right, Expr); + return Mod_Int_Sgn (Read_Discrete (Left), Right, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Mod_Sgn_Int => - return Mod_Sgn_Int (Left, Read_Discrete (Right), Expr); + return Mod_Sgn_Int (Left, Read_Discrete (Right), +Expr); when Iir_Predefined_Ieee_Numeric_Std_Srl_Uns_Int | Iir_Predefined_Ieee_Numeric_Std_Srl_Sgn_Int => @@ -1461,9 +1461,9 @@ package body Synth.Vhdl_Eval is end; when Iir_Predefined_Ieee_Numeric_Std_Neg_Sgn => - return Neg_Vec (Operand, Expr); + return Neg_Vec (Operand, +Expr); when Iir_Predefined_Ieee_Numeric_Std_Abs_Sgn => - return Abs_Vec (Operand, Expr); + return Abs_Vec (Operand, +Expr); when Iir_Predefined_Ieee_1164_Vector_Not | Iir_Predefined_Ieee_Numeric_Std_Not_Uns @@ -2069,6 +2069,19 @@ package body Synth.Vhdl_Eval is return Eval_Logic_Vector_To_String (Get_Memtyp (Param1), Res_Typ, 3); + when Iir_Predefined_Ieee_Numeric_Std_Max_Uns_Uns => + return Minmax (Get_Memtyp (Param1), Get_Memtyp (Param2), + False, True); + when Iir_Predefined_Ieee_Numeric_Std_Min_Uns_Uns => + return Minmax (Get_Memtyp (Param1), Get_Memtyp (Param2), + False, False); + when Iir_Predefined_Ieee_Numeric_Std_Max_Sgn_Sgn => + return Minmax (Get_Memtyp (Param1), Get_Memtyp (Param2), + True, True); + when Iir_Predefined_Ieee_Numeric_Std_Min_Sgn_Sgn => + return Minmax (Get_Memtyp (Param1), Get_Memtyp (Param2), + True, False); + when Iir_Predefined_Ieee_Math_Real_Log2 => declare function Log2 (Arg : Fp64) return Fp64; |