diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/riscv_mem.sail | 4 | ||||
-rw-r--r-- | model/rvfi_dii.sail | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/model/riscv_mem.sail b/model/riscv_mem.sail index c10df30..85891e7 100644 --- a/model/riscv_mem.sail +++ b/model/riscv_mem.sail @@ -44,7 +44,7 @@ function rvfi_read (addr, width, result) = { match result { MemValue(v) => if width <= 8 then { rvfi_exec->rvfi_mem_rdata() = sail_zero_extend(v,64); - rvfi_exec->rvfi_mem_rmask() = to_bits(8,width) } + rvfi_exec->rvfi_mem_rmask() = rvfi_encode_width_mask(width) } else (), MemException(_) => () }; @@ -97,7 +97,7 @@ function rvfi_write (addr, width, value) = { rvfi_exec->rvfi_mem_addr() = addr; if width <= 8 then { rvfi_exec->rvfi_mem_wdata() = sail_zero_extend(value,64); - rvfi_exec->rvfi_mem_wmask() = to_bits(8,width); + rvfi_exec->rvfi_mem_wmask() = rvfi_encode_width_mask(width); } } $else diff --git a/model/rvfi_dii.sail b/model/rvfi_dii.sail index b0e3a06..00de956 100644 --- a/model/rvfi_dii.sail +++ b/model/rvfi_dii.sail @@ -74,6 +74,11 @@ val rvfi_get_exec_packet : unit -> bits(704) effect {rreg} function rvfi_get_exec_packet() = rvfi_exec.bits() +val rvfi_encode_width_mask : forall 'n, 0 < 'n <= 8. atom('n) -> bits(8) + +function rvfi_encode_width_mask(width) = + (0xFF >> (8 - width)) + val print_rvfi_exec : unit -> unit effect {rreg} function print_rvfi_exec () = { |