Three PMP entries overlap, and two of them are locked. Decide which entry answers each access, and what it says.
Hardware context: Four PMP entries (a configuration byte and an address word each) and a region check, as test code, over the SRAM and UART0 of ap_soc. Confining an untrusted task on a microcontroller that has no page tables
A processor has four PMP entries. Entry 0 is NA4: the one word at 2000_0040, with R only, and it is locked. Entry 1 is NAPOT: the 256 bytes from 2000_0000 to 2000_00ff, with R and W, and it is not locked. Entry 2 is NAPOT: the 4 KiB from 2000_0000 to 2000_0fff, with R and X, and it is locked. Entry 3 is OFF. Every access is one aligned word of four bytes.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
For "which entry", enter its number, or 4 when no entry covers the address. For a yes or no question, enter 1 for yes and 0 for no.
| Entry | Your decision |
|---|---|
| ENTRY_FOR_40 | Which entry decides an access to 2000_0040? |
| USER_STORE_40 | May user code store to 2000_0040? |
| ENTRY_FOR_44 | Which entry decides an access to 2000_0044? |
| USER_STORE_44 | May user code store to 2000_0044? |
| USER_FETCH_44 | May user code fetch an instruction from 2000_0044? |
| ENTRY_FOR_100 | Which entry decides an access to 2000_0100? |
| USER_FETCH_100 | May user code fetch an instruction from 2000_0100? |
| MACHINE_STORE_100 | May machine mode store to 2000_0100? |
| MACHINE_STORE_44 | May machine mode store to 2000_0044? |
| MACHINE_STORE_40 | May machine mode store to 2000_0040? |
| ENTRY_FOR_1000 | Which entry decides an access to 2000_1000? |
| USER_LOAD_1000 | May user code load from 2000_1000? |
| MACHINE_LOAD_1000 | May machine mode load from 2000_1000? |
| DECIDING_ENTRY | User code stores one word at 2000_0000 plus OFFSET (OFFSET is in decimal). Give the number of the entry that decides. |
Examples
Example 1
ENTRY FOR 40- Input
Which entry decides an access to 2000_0040?
- Output
matches = 1
Entries 0, 1 and 2 all cover it. The lowest number decides.
Example 2
USER STORE 40- Input
May user code store to 2000_0040?
- Output
matches = 1
Entry 0 decides, and it has R only.
Example 3
ENTRY FOR 44- Input
Which entry decides an access to 2000_0044?
- Output
matches = 1
Entry 0 covers one word only. Entries 1 and 2 cover this address, and 1 is the lower.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For DECIDING_ENTRY, enter a constant expression using OFFSET. Only this entry changes with the parameter. The supported integer range is 0 through 4092, inclusive.
Hints
Hint 1
For each address, write every entry whose region holds all four bytes.
Hint 2
The entry with the lowest number decides. The others are not asked.
Hint 3
For machine mode, the entry counts only if it is locked. User code is always bound.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
14 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path