Skip to content

Simplify PMP control code by removing pmpMatchEntry #976

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

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented May 23, 2025

I think this extra function was unnecessary and just made the code harder to follow.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

Since there is only one call the extra indirection and new type don't add any value. easier to understand now.

Copy link
Collaborator

@pmundkur pmundkur left a comment

Choose a reason for hiding this comment

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

One advantage of the current code is pmpMatchEntry is a pure function for which it is easier to write SMT property tests.

@arichardson
Copy link
Collaborator

CI is not happy with this:

Type error:
riscv_pmp_control.sail:108.11-74:
108 |        if pmpCheckRWX(cfg, acc) | (priv == Machine & not(pmpLocked(cfg)))
    |           ^-------------------------------------------------------------^ checking function argument has type Pmpcfg_ent
    | Identifier cfg is unbound

I think this extra function was unnecessary and just made the code harder to follow.
@Timmmm Timmmm force-pushed the user/timh/pmp_simplification_2 branch from c1742eb to 20e63d9 Compare June 2, 2025 13:54
@Timmmm
Copy link
Collaborator Author

Timmmm commented Jun 2, 2025

CI is not happy with this:

Oops, fixed.

One advantage of the current code is pmpMatchEntry is a pure function for which it is easier to write SMT property tests.

That is true. Not sure I have a strong opinion on that.

Copy link

github-actions bot commented Jun 2, 2025

Test Results

400 tests  ±0   400 ✅ ±0   1m 25s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 20e63d9. ± Comparison against base commit fd99207.

Copy link
Collaborator

@pmundkur pmundkur left a comment

Choose a reason for hiding this comment

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

As discussed in today's meeting, property tests don't have to be pure. We can prioritize for readability here.

@jordancarlin jordancarlin added the will be merged Scheduled to be merged in a few days if nobody objects label Jun 2, 2025
@pmundkur pmundkur added this pull request to the merge queue Jun 3, 2025
Merged via the queue into riscv:master with commit 4c1fd79 Jun 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
will be merged Scheduled to be merged in a few days if nobody objects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants