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

Fix RV32 Zcherilevels ACPERM #440

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tariqkurd-repo
Copy link
Collaborator

@tariqkurd-repo tariqkurd-repo commented Nov 5, 2024

This version has been verified by a python script which checks all possible combinations of removing permissions from maximum permissions

additional fix for #428

@tariqkurd-repo
Copy link
Collaborator Author

The modifications should have been for RV32 only, so this needs fixing

| 9 | <<sl_perm>> | <<c_perm>>
| 7 | <<el_perm>> | <<c_perm>> and <<r_perm>> and <<lm_perm>>
| 8 | <<lm_perm>> | <<c_perm>> and <<r_perm>> and (<<w_perm>> or <<el_perm>>)
| 9 | <<sl_perm>> | (<<c_perm>> and <<lm_perm>> and (<<x_perm>> or <<w_perm>>)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need to explicitly list LM here? I guess it's implied since SL depends on W, and W implies LM. Not opposed to keeping it since I imagine the checks will be optimized out but wondering if the text can be simplified.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
| 9 | <<sl_perm>> | (<<c_perm>> and <<lm_perm>> and (<<x_perm>> or <<w_perm>>)
| 9 (RV32 only) | <<sl_perm>> | (<<c_perm>> and <<lm_perm>> and (<<x_perm>> or <<w_perm>>)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes - RV32 only was missing - will push a new commit soon

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this relates to rule 12 for the latest commit
if rule 12 is omitted then the following case fails:

Start: Perms(R=True, W=False, C=True, LM=True, EL=True, SL=True, X=False)
Final: Perms(R=True, W=False, C=True, LM=True, EL=True, SL=True, X=False)

(ASR has no bearing so is omitted - so in reality there are two failing cases)

Choose a reason for hiding this comment

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

If you remove LM from the SL term in rule 9 there are 10 routes to get an invalid encoding, but they all end with the same permissions.

R W C LM SL X Rule
1 1 1 0 1 1 After &
1 0 1 0 1 1 Rule 5 - clear W
1 0 1 0 1 1 Rule 9 - but no LM inclusion (no change)
1 0 1 0 1 0 Rule 10 - clear X

This leaves us with R, C, SL which doesn't map to any table entry. If you have LM as part of the rule, then you remove SL end at R, C.

Choose a reason for hiding this comment

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

Rule 9 without LM does not clear SL because X is still HIGH, but SL needs to be aware of X because Quadrant 1, row 2/3 has W == 0 and C, LM, EL == 1 and SL == inf while Quadrant 3, row 3 has identical values for W, C, LM, EL however SL=0. So the only differentiator between these two cases is that in Quadrant 1 has X

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.

I think these constraints should be scoped to RV32 but it looks sensible to me. The logic should be folded to something simpler anyway so I don't think it's a huge problem that these clauses are getting somewhat complex.

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.

3 participants