diff options
author | Tim Hutt <timothy.hutt@codasip.com> | 2024-02-02 11:56:55 +0000 |
---|---|---|
committer | Bill McSpadden <bill@riscv.org> | 2024-02-05 11:22:09 -0600 |
commit | 4de2bff12d967d91dd064e4a49e25ca4785f25e3 (patch) | |
tree | b106b03932811b9f35c4ac025a89c6f47862dc8f /model/riscv_mem.sail | |
parent | d5e89a71e3a84495c1b88a7749c25fd6b9da684b (diff) | |
download | sail-riscv-4de2bff12d967d91dd064e4a49e25ca4785f25e3.zip sail-riscv-4de2bff12d967d91dd064e4a49e25ca4785f25e3.tar.gz sail-riscv-4de2bff12d967d91dd064e4a49e25ca4785f25e3.tar.bz2 |
Improve PMP support
This implements a lot of missing functionality for PMPs.
* Support 64 PMPs as well as 0 and 16.
* Support setting PMP grain
* Return correct address bits on read (some read as 0 or 1 depending on the grain and match type)
* Unlock PMPs on reset
* Implement pmpcfg WARL legalisation
Co-authored-by: Ben Fletcher <benjamin.fletcher@codasip.com>
Diffstat (limited to 'model/riscv_mem.sail')
-rw-r--r-- | model/riscv_mem.sail | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/model/riscv_mem.sail b/model/riscv_mem.sail index 2df6192..5224938 100644 --- a/model/riscv_mem.sail +++ b/model/riscv_mem.sail @@ -144,7 +144,7 @@ function checked_mem_read forall 'n, 0 < 'n <= max_mem_access . (t : AccessType( /* PMP checks if enabled */ function pmp_mem_read forall 'n, 0 < 'n <= max_mem_access . (t : AccessType(ext_access_type), p : Privilege, paddr : xlenbits, width : atom('n), aq : bool, rl : bool, res: bool, meta : bool) -> MemoryOpResult((bits(8 * 'n), mem_meta)) = - if not(plat_enable_pmp()) + if sys_pmp_count() == 0 then checked_mem_read(t, paddr, width, aq, rl, res, meta) else { match pmpCheck(paddr, width, t, p) { @@ -272,7 +272,7 @@ function checked_mem_write forall 'n, 0 < 'n <= max_mem_access . (wk : write_kin /* PMP checks if enabled */ function pmp_mem_write forall 'n, 0 < 'n <= max_mem_access . (wk: write_kind, paddr : xlenbits, width : atom('n), data: bits(8 * 'n), typ: AccessType(ext_access_type), priv: Privilege, meta: mem_meta) -> MemoryOpResult(bool) = - if not(plat_enable_pmp()) + if sys_pmp_count() == 0 then checked_mem_write(wk, paddr, width, data, meta) else { match pmpCheck(paddr, width, typ, priv) { |