From 111007296f1553540a78f59d20197faba29d43c9 Mon Sep 17 00:00:00 2001 From: Brian Padalino Date: Wed, 22 Sep 2021 11:38:59 -0400 Subject: Add explicit ?>= and ?> functions for translation. Instead of swapping L/R arguments to try to create ?>= and ?>, create a function for each which performs the not operation of ?< and ?<= as defined by the LRM. --- src/grt/grt-std_logic_1164.adb | 14 ++++++++++++++ src/grt/grt-std_logic_1164.ads | 4 ++++ 2 files changed, 18 insertions(+) (limited to 'src/grt') diff --git a/src/grt/grt-std_logic_1164.adb b/src/grt/grt-std_logic_1164.adb index 675039b3d..bb6f49207 100644 --- a/src/grt/grt-std_logic_1164.adb +++ b/src/grt/grt-std_logic_1164.adb @@ -91,6 +91,20 @@ package body Grt.Std_Logic_1164 is Match_Eq_Table (Left, Right))); end Ghdl_Std_Ulogic_Match_Le; + function Ghdl_Std_Ulogic_Match_Ge (L, R : Ghdl_E8) return Ghdl_E8 + is + Lt : constant Ghdl_E8 := Ghdl_Std_Ulogic_Match_Lt(L, R); + begin + return Std_Ulogic'Pos (Not_Table (Std_Ulogic'Val(Lt))) ; + end Ghdl_Std_Ulogic_Match_Ge; + + function Ghdl_Std_Ulogic_Match_Gt (L, R : Ghdl_E8) return Ghdl_E8 + is + Le : constant Ghdl_E8 := Ghdl_Std_Ulogic_Match_Le(L, R); + begin + return Std_Ulogic'Pos (Not_Table (Std_Ulogic'Val(Le))) ; + end Ghdl_Std_Ulogic_Match_Gt; + Assert_Arr_Msg : constant String := "parameters of '?=' array operator are not of the same length"; diff --git a/src/grt/grt-std_logic_1164.ads b/src/grt/grt-std_logic_1164.ads index 38b78c7cf..8d2b09457 100644 --- a/src/grt/grt-std_logic_1164.ads +++ b/src/grt/grt-std_logic_1164.ads @@ -96,6 +96,8 @@ package Grt.Std_Logic_1164 is function Ghdl_Std_Ulogic_Match_Ne (L, R : Ghdl_E8) return Ghdl_E8; function Ghdl_Std_Ulogic_Match_Lt (L, R : Ghdl_E8) return Ghdl_E8; function Ghdl_Std_Ulogic_Match_Le (L, R : Ghdl_E8) return Ghdl_E8; + function Ghdl_Std_Ulogic_Match_Ge (L, R : Ghdl_E8) return Ghdl_E8; + function Ghdl_Std_Ulogic_Match_Gt (L, R : Ghdl_E8) return Ghdl_E8; -- For Gt and Ge, use Lt and Le with swapped parameters. function Ghdl_Std_Ulogic_Array_Match_Eq (L : Ghdl_Ptr; @@ -114,6 +116,8 @@ private pragma Export (C, Ghdl_Std_Ulogic_Match_Ne, "__ghdl_std_ulogic_match_ne"); pragma Export (C, Ghdl_Std_Ulogic_Match_Lt, "__ghdl_std_ulogic_match_lt"); pragma Export (C, Ghdl_Std_Ulogic_Match_Le, "__ghdl_std_ulogic_match_le"); + pragma Export (C, Ghdl_Std_Ulogic_Match_Ge, "__ghdl_std_ulogic_match_ge"); + pragma Export (C, Ghdl_Std_Ulogic_Match_Gt, "__ghdl_std_ulogic_match_gt"); pragma Export (C, Ghdl_Std_Ulogic_Array_Match_Eq, "__ghdl_std_ulogic_array_match_eq"); -- cgit v1.2.3