Skip to content

Commit

Permalink
Add missing comparison operators
Browse files Browse the repository at this point in the history
Some less-than/greater-than operators were missing. This adds the full set.
  • Loading branch information
Timmmm committed Feb 12, 2024
1 parent 9602e3a commit cb6bda4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions model/prelude.sail
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<
Expand Down

0 comments on commit cb6bda4

Please sign in to comment.