Line 471... |
Line 471... |
|
|
The available physical memory protection logic is configured via the _PMP_NUM_REGIONS_ and
|
The available physical memory protection logic is configured via the _PMP_NUM_REGIONS_ and
|
_PMP_MIN_GRANULARITY_ top entity generics. _PMP_NUM_REGIONS_ defines the number of implemented
|
_PMP_MIN_GRANULARITY_ top entity generics. _PMP_NUM_REGIONS_ defines the number of implemented
|
protection regions and thus, the availability of the according `pmpcfg*` and `pmpaddr*` CSRs.
|
protection regions and thus, the availability of the according `pmpcfg*` and `pmpaddr*` CSRs.
|
|
|
[TIP]
|
[NOTE]
|
If trying to access an PMP-related CSR beyond _PMP_NUM_REGIONS_ **no illegal instruction
|
If trying to access an PMP-related CSR beyond _PMP_NUM_REGIONS_ **no illegal instruction
|
exception** is triggered. The according CSRs are read-only (writes are ignored) and always return zero.
|
exception** is triggered. The according CSRs are read-only (writes are ignored) and always return zero.
|
|
|
[IMPORTANT]
|
[IMPORTANT]
|
The RISC-V-compatible NEORV32 physical memory protection only implements the _NAPOT_
|
The RISC-V-compatible NEORV32 physical memory protection only implements the **NAPOT**
|
(naturally aligned power-of-two region) mode with a minimal region granularity of 8 bytes.
|
(naturally aligned power-of-two region) mode yet with a minimal region granularity of 8 bytes.
|
|
|
|
|
:sectnums!:
|
:sectnums!:
|
===== **`pmpcfg`**
|
===== **`pmpcfg`**
|
|
|
Line 498... |
Line 498... |
.Physical memory protection configuration register entry
|
.Physical memory protection configuration register entry
|
[cols="^1,^3,^1,<11"]
|
[cols="^1,^3,^1,<11"]
|
[options="header",grid="rows"]
|
[options="header",grid="rows"]
|
|=======================
|
|=======================
|
| Bit | RISC-V name | R/W | Function
|
| Bit | RISC-V name | R/W | Function
|
| 7 | _L_ | r/w | lock bit, can be set - but not be cleared again (only via CPU reset)
|
| 7 | _L_ | r/w | lock bit, can only be cleared by CPU reset
|
| 6:5 | - | r/- | reserved, read as zero
|
| 6:5 | - | r/- | reserved, read as zero
|
| 4:3 | _A_ | r/w | mode configuration; only OFF (`00`) and NAPOT (`11`) are supported
|
| 4:3 | _A_ | r/w | mode configuration; only OFF (`00`) and NAPOT (`11`) are supported
|
| 2 | _X_ | r/w | execute permission
|
| 2 | _X_ | r/w | execute permission
|
| 1 | _W_ | r/w | write permission
|
| 1 | _W_ | r/w | write permission
|
| 0 | _R_ | r/w | read permission
|
| 0 | _R_ | r/w | read permission
|
Line 513... |
Line 513... |
===== **`pmpaddr`**
|
===== **`pmpaddr`**
|
|
|
[cols="4,27,>7"]
|
[cols="4,27,>7"]
|
[frame="topbot",grid="none"]
|
[frame="topbot",grid="none"]
|
|======
|
|======
|
| 0x3b0 - 0x3ef| **Physical memory protection configuration registers** | `pmpaddr0` - `pmpaddr63`
|
| 0x3b0 - 0x3ef| **Physical memory protection address registers** | `pmpaddr0` - `pmpaddr63`
|
3+| Reset value: _UNDEFINED_
|
3+| Reset value: _UNDEFINED_
|
3+| The `pmpaddr*` CSRs are compatible to the RISC-V specifications. They are used to configure the base
|
3+| The `pmpaddr*` CSRs are compatible to the RISC-V specifications. They are used to configure the PMP region's base
|
address and the region size.
|
address and the region size.
|
|======
|
|======
|
|
|
[NOTE]
|
[NOTE]
|
When configuring PMP make sure to set `pmpaddr*` before activating the according region via
|
When configuring PMP make sure to set `pmpaddr*` before activating the according region via
|
Line 609... |
Line 609... |
|======
|
|======
|
| 0xb00 | **Machine cycle counter - low word** | `mcycle`
|
| 0xb00 | **Machine cycle counter - low word** | `mcycle`
|
| 0xb80 | **Machine cycle counter - high word** | `mcycleh`
|
| 0xb80 | **Machine cycle counter - high word** | `mcycleh`
|
3+| Reset value: _UNDEFINED_
|
3+| Reset value: _UNDEFINED_
|
3+| The `mcycle[h]` CSR is compatible to the RISC-V specifications. It shows the lower/upper 32-bit of the 64-bit cycle
|
3+| The `mcycle[h]` CSR is compatible to the RISC-V specifications. It shows the lower/upper 32-bit of the 64-bit cycle
|
counter. The `mcycle[h]` CSR can also be written when in machine mode and is copied to the `cycle[h]` CSR.
|
counter. The `mcycle[h]` CSR can also be written when in machine mode and is mirrored to the `cycle[h]` CSR.
|
|======
|
|======
|
|
|
|
|
:sectnums!:
|
:sectnums!:
|
===== **`minstret[h]`**
|
===== **`minstret[h]`**
|
Line 623... |
Line 623... |
|======
|
|======
|
| 0xb02 | **Machine instructions-retired counter - low word** | `minstret`
|
| 0xb02 | **Machine instructions-retired counter - low word** | `minstret`
|
| 0xb82 | **Machine instructions-retired counter - high word** | `minstreth`
|
| 0xb82 | **Machine instructions-retired counter - high word** | `minstreth`
|
3+| Reset value: _UNDEFINED_
|
3+| Reset value: _UNDEFINED_
|
3+| The `minstret[h]` CSR is compatible to the RISC-V specifications. It shows the lower/upper 32-bit of the 64-bit retired
|
3+| The `minstret[h]` CSR is compatible to the RISC-V specifications. It shows the lower/upper 32-bit of the 64-bit retired
|
instructions counter. The `minstret[h]` CSR also be written when in machine mode and is copied to the `instret[h]` CSR.
|
instructions counter. The `minstret[h]` CSR also be written when in machine mode and is mirrored to the `instret[h]` CSR.
|
|======
|
|======
|
|
|
|
|
|
|
|
|