Skip to content

Commit

Permalink
sailcov test: add test for nested mapping with guard
Browse files Browse the repository at this point in the history
This test is reduced from a problem encountered in the RISCV model
(see #639).  Currently fails due sailcov producing an assertion
failure warning.
  • Loading branch information
ronorton committed Jul 23, 2024
1 parent 13d9458 commit 764d1fb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/sailcov/nested_mapping.sail
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)
}

0 comments on commit 764d1fb

Please sign in to comment.