From c287c34df944647fcfd1923e37f4d97466f264bd Mon Sep 17 00:00:00 2001 From: Tim Hutt Date: Mon, 12 Feb 2024 10:39:23 +0000 Subject: [PATCH] Add missing comparison operators Some less-than/greater-than operators were missing. This adds the full set. --- model/prelude.sail | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/model/prelude.sail b/model/prelude.sail index 792c2e628..b1814b1d8 100644 --- a/model/prelude.sail +++ b/model/prelude.sail @@ -116,22 +116,31 @@ val to_bits : forall 'l, 'l >= 0.(atom('l), int) -> bits('l) function to_bits (l, n) = get_slice_int(l, n, 0) infix 4 <_s +infix 4 >_s +infix 4 <=_s infix 4 >=_s infix 4 <_u -infix 4 >=_u +infix 4 >_u infix 4 <=_u +infix 4 >=_u val operator <_s : forall 'n, 'n > 0. (bits('n), bits('n)) -> bool +val operator >_s : forall 'n, 'n > 0. (bits('n), bits('n)) -> bool +val operator <=_s : forall 'n, 'n > 0. (bits('n), bits('n)) -> bool val operator >=_s : forall 'n, 'n > 0. (bits('n), bits('n)) -> bool val operator <_u : forall 'n. (bits('n), bits('n)) -> bool -val operator >=_u : forall 'n. (bits('n), bits('n)) -> bool +val operator >_u : forall 'n. (bits('n), bits('n)) -> bool val operator <=_u : forall 'n. (bits('n), bits('n)) -> bool +val operator >=_u : forall 'n. (bits('n), bits('n)) -> bool function operator <_s (x, y) = signed(x) < signed(y) +function operator >_s (x, y) = signed(x) > signed(y) +function operator <=_s (x, y) = signed(x) <= signed(y) function operator >=_s (x, y) = signed(x) >= signed(y) function operator <_u (x, y) = unsigned(x) < unsigned(y) -function operator >=_u (x, y) = unsigned(x) >= unsigned(y) +function operator >_u (x, y) = unsigned(x) > unsigned(y) function operator <=_u (x, y) = unsigned(x) <= unsigned(y) +function operator >=_u (x, y) = unsigned(x) >= unsigned(y) infix 7 >> infix 7 <<