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

detect pma load/store fault, use in assert #2332

Merged

Conversation

silabs-robin
Copy link
Contributor

@silabs-robin silabs-robin commented Dec 14, 2023

This PR fixes an erronous assert, and two TODOs within it.

Test status:

  • ci_check - All good.
  • Formal - These new asserts ran for about 10-20 minutes without CEXes. (Bound of 18.)

Signed-off-by: Robin Pedersen <Robin.Pedersen@silabs.com>
Copy link
Contributor Author

@silabs-robin silabs-robin left a comment

Choose a reason for hiding this comment

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

Adding some comments in an attempt to ease the review.

cv32e40s/tb/uvmt/uvmt_cv32e40s_pma_assert.sv Show resolved Hide resolved
cv32e40s/tb/uvmt/uvmt_cv32e40s_pma_assert.sv Show resolved Hide resolved
@@ -174,6 +182,16 @@ module uvmt_cv32e40s_pma_assert
);


// PMA-deny on instr, no mem op (vplan: Not a vplan item. Inspo from a_failure_denies_subsequents.)

a_failure_denies_memops: assert property (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the old assert, with a new name, because it was somewhat useful still.

Choose a reason for hiding this comment

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

If this assertion is necessary shouldnt we add it to the vplan? Or is it somehow a support assert for another assert (listed in a vplan)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In principle it could be added to the vplan.
But since this is a very minor extra check, I don't think it is worth the effort.

|->
(rvfi_instr_if.rvfi_mem_wmask != rvfi_instr_if.rvfi_mem_wmask_intended)
||
(rvfi_instr_if.rvfi_mem_wmask == 'd 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Luckily, we had the rvfi_mem_wmask_intended signal from before. 🙇

Choose a reason for hiding this comment

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

is || (rvfi_instr_if.rvfi_mem_wmask == 'd 0) necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

This might be unnecessary, but not breaking, so we let it lie.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is || (rvfi_instr_if.rvfi_mem_wmask == 'd 0) necessary?

It would look more sensible if it said:
|| (rvfi_instr_if.rvfi_mem_wmask_intended == 'd 0)

The point is:
Either "actual" is short of "intended", or nothing was intended at all.

Or, it might have been a better fit to have it as a constraint in the antecedent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not unnecessary. It was found by a CEX.

@@ -146,12 +146,20 @@ module uvmt_cv32e40s_pma_assert

// After PMA-deny, subsequent accesses are also suppressed (vplan:"Multi-memory operation instructions")

a_failure_denies_subsequents: assert property (
rvfi_instr_if.is_pma_instr_fault
a_failure_denies_subsequents_loads: assert property (

Choose a reason for hiding this comment

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

I see you have changed the assertion name. Is this something that should be updated in link to coverage in a vplan?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That kind of work is better suited for a machine than a human.
And we are in the process of revising the vplan system to facilitate more automation.

Can this be the first challenge for a new automated system to sort out?
Or is the benefit of doing it manually today so big that it is warranted?

(Note that the name's prefix is the same, so the linkage is not 100% broken.)
(Note also that no testing has been removed, so the vplan is not more lacking after this PR.)

Copy link
Contributor

@silabs-mateilga silabs-mateilga left a comment

Choose a reason for hiding this comment

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

A few reasonable comments here, but as they are non-functional objections and we want to merge now, we defer these until Robin has time to revisit, and approve as is.

|->
(rvfi_instr_if.rvfi_mem_wmask != rvfi_instr_if.rvfi_mem_wmask_intended)
||
(rvfi_instr_if.rvfi_mem_wmask == 'd 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be unnecessary, but not breaking, so we let it lie.

Copy link
Contributor

@silabs-hfegran silabs-hfegran left a comment

Choose a reason for hiding this comment

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

Approving, @silabs-robin please update vplan accordingly

@silabs-hfegran silabs-hfegran merged commit 955f1b5 into openhwgroup:cv32e40s/dev Dec 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants