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

Simplify getPendingSet() interrupt handling #616

Open
Timmmm opened this issue Nov 13, 2024 · 0 comments
Open

Simplify getPendingSet() interrupt handling #616

Timmmm opened this issue Nov 13, 2024 · 0 comments
Labels
refactor Code clean up

Comments

@Timmmm
Copy link
Collaborator

Timmmm commented Nov 13, 2024

As noted by @KotorinMinami the getPendingSet() function can be simplified quite a lot now that N is gone:

function getPendingSet(priv : Privilege) -> option((xlenbits, Privilege)) = {
  assert(extensionEnabled(Ext_S) | mideleg == zeros());

  let pending_m = mip.bits & mie.bits & ~(mideleg);
  let pending_s = mip.bits & mie.bits & mideleg;

  let mIE = (priv == Machine & mstatus[MIE] == 0b1) | priv == User | priv == Supervisor;
  let sIE = (priv == Supervisor & mstatus[SIE] == 0b1)) | priv == User;

  if     mIE & (pending_m != zeros()) then Some((pending_m, Machine))
  else if sIE & (pending_s != zeros()) then Some((pending_s, Supervisor))
  else None()
}

(not tested!)

@Timmmm Timmmm added the refactor Code clean up label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code clean up
Projects
None yet
Development

No branches or pull requests

1 participant