Skip to content

rvfi: fix non-zero mem_rmask on non-memory instructions - #2489

Open
devtyagi3909 wants to merge 1 commit into
lowRISC:masterfrom
devtyagi3909:fix-rvfi-mem-rmask
Open

rvfi: fix non-zero mem_rmask on non-memory instructions#2489
devtyagi3909 wants to merge 1 commit into
lowRISC:masterfrom
devtyagi3909:fix-rvfi-mem-rmask

Conversation

@devtyagi3909

Copy link
Copy Markdown

Fixes #2476.

As outlined in the issue, non-memory instructions previously defaulted to an rvfi_mem_rmask of 4'b1111 because lsu_type defaulted to word encoding and the mask was only gated to zero for stores (data_we_o). This violates the RVFI spec by formally claiming 4 bytes were read from an arbitrary address.

This PR gates the application of rvfi_mem_mask_int to both the read and write masks with lsu_req, guaranteeing they evaluate to 4'b0000 when the instruction doesn't issue a memory request.

Note: CLA is already signed from my previous PR today.

When an instruction performs no memory access, its rvfi_mem_rmask
should be zero. Previously, it defaulted to 4'b1111 (via lsu_type
defaulting to 2'b00) and was only zeroed out for stores (data_we_o).
This meant every non-memory instruction reported a read mask of 4'b1111,
which formally violates the RVFI specification by claiming four bytes
were read from an arbitrary address.

This gates the assignment of both rvfi_stage_mem_rmask and
rvfi_stage_mem_wmask with lsu_req, ensuring they are strictly zeroed
when the instruction does not actually issue a memory request.

Fixes lowRISC#2476
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rvfi_mem_rmask is non-zero on instructions that make no memory access

1 participant