Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RVFI INSTR IF - Heed clicptr in is_instr_bus_valid #2565

Draft
wants to merge 1 commit into
base: cv32e40x/dev
Choose a base branch
from

Conversation

silabs-robin
Copy link
Contributor

@silabs-robin silabs-robin commented Dec 11, 2024

This PR amends uvma_rvfi_instr_if, making sure is_instr_bus_valid considers rvfi_trap.clicptr.

Relevant clicptr spec:
https://docs.openhwgroup.org/projects/cv32e40x-user-manual/en/latest/rvfi.html#compatibility
"rvfi_trap.clicptr is set for CLIC pointers. CLIC pointers are only reported on RVFI when they get an exception during fetch."

Test status:

  • Formal - Compiles and runs ✅
  • ci_check - Passed ✅

Background:
Here is the assert that failed before: a_mintstatus_mil_decrease_intended.
It required an mret in a certain situation, but the RVFI instr if claimed that there was no mret because of an "instruction access fault". (The fault was on the pointer fetch, but the mret itself was fine.)

@@ -275,6 +276,10 @@ interface uvma_rvfi_instr_if_t

asm_t instr_asm;

wire is_exception_cause_instr_acc_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_ACC_FAULT);
wire is_exception_cause_integrity_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_INTEGRITY_FAULT);
wire is_exception_cause_bus_fault = (rvfi_trap.exception_cause == EXC_CAUSE_INSTR_BUS_FAULT);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Having one single token (instead of 8) makes it easier to reason about the boolean expression (for is_instr_bus_valid) that combines all of these 3 boolean expressions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Maybe put in a comment to that effect.

!is_exception_cause_integrity_fault &&
!is_exception_cause_instr_acc_fault
) ||
rvfi_trap.clicptr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is the primary change. rvfi_trap.clicptr can now "make the instr valid after all".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment.

@silabs-robin silabs-robin deleted the rvfi_instr_if_clicptr branch December 11, 2024 14:07
@silabs-robin silabs-robin restored the rvfi_instr_if_clicptr branch December 11, 2024 14:10
@silabs-robin silabs-robin reopened this Dec 11, 2024
@MikeOpenHWGroup MikeOpenHWGroup added enhancement New feature or request Common Infrastructure Library components or scriptware common to all environments in CORE-V-VERIF labels Dec 11, 2024
@MikeOpenHWGroup
Copy link
Member

Nice @silabs-robin. I'll hold off on the Approval until you've removed the "draft" lablel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Common Infrastructure Library components or scriptware common to all environments in CORE-V-VERIF enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants