sail-riscv icon indicating copy to clipboard operation
sail-riscv copied to clipboard

is_CSR_defined has redundant privilege mode checks

Open Timmmm opened this issue 1 year ago • 1 comments

is_CSR_defined has a ton of p == Machine etc. checks that should be replaced by true, since the permission check is already handled in a generic way by this:

function check_CSR(csr : csreg, p : Privilege, isWrite : bool) -> bool =
    is_CSR_defined(csr, p)
  & check_CSR_access(csrAccess(csr), csrPriv(csr), p, isWrite)    <------------- this checks the privilege mode already
  & check_TVM_SATP(csr, p)
  & check_Counteren(csr, p)
  & check_seed_CSR(csr, p, isWrite)

Timmmm avatar Feb 06 '24 16:02 Timmmm