forked from rems-project/sail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
trdthg
committed
Jul 28, 2024
1 parent
48e0ca1
commit 3019946
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
default Order dec | ||
$include <prelude.sail> | ||
|
||
union ast = { | ||
B : (bool), | ||
Z : unit | ||
} | ||
|
||
mapping bool_not_bits : bool <-> bits(1) = { | ||
true <-> 0b0, | ||
false <-> 0b1 | ||
} | ||
|
||
mapping encdec : bits(2) <-> ast = { | ||
0b1 @ bool_not_bits(s) if true <-> B(s), | ||
0b00 <-> Z() | ||
} | ||
|
||
val main : unit -> unit | ||
function main() = { | ||
let _ = encdec(0b00) | ||
} |