S3.7.2 Why Did It Fault

MediumImplement22 minIcarus Verilog · serverReview the topic

Decode the low byte of ten page-table entries, and name the bit that refuses each access.

Hardware context: Two programs with a flat page table of 16 entries each over a physical memory of 16 frames, as test code. Keeping programs apart with address translation

The low byte of a page-table entry holds its bits: D in bit 7, A in bit 6, U in bit 4, X in bit 3, W in bit 2, R in bit 1 and V in bit 0. Bit 5 is not used here. A load needs R, a store needs W and a fetch needs X. A user program needs U at 1, and the operating system needs U at 0. An access to a page with A at 0 faults, and so does a store to a page with D at 0. With V at 0 every access faults, whatever the other bits say.

This worksheet uses named constants. The first three entries show how to record your decisions.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification

Enter one code for each access: 0 if it is allowed, 1 if V refuses it, 2 for R, 3 for W, 4 for X, 5 for U, 6 for A, 7 for D. In every case at most one bit refuses.

EntryYour decision
STORE_5B_USERLow byte 5b, a store by a user program: which code?
FETCH_5B_USERLow byte 5b, a fetch by a user program?
FETCH_D7_USERLow byte d7, a fetch by a user program?
LOAD_C7_USERLow byte c7, a load by a user program?
LOAD_D6_USERLow byte d6, a load by a user program?
LOAD_17_USERLow byte 17, a load by a user program?
STORE_57_USERLow byte 57, a store by a user program?
STORE_D7_USERLow byte d7, a store by a user program?
STORE_D7_SYSTEMLow byte d7, a store by the operating system?
LOAD_59_USERLow byte 59, a load by a user program?
USER_LOAD_ALLOWEDThe low byte of an entry is LOW. Enter an expression that is 1 when a load by a user program is allowed, and 0 when it is not.

Examples

Example 1

STORE 5B USER
Input
Low byte 5b, a store by a user program: which code?
Output
matches = 1

In binary 5b is 0101 1011. W, bit 2, is 0: code 3.

Example 2

FETCH 5B USER
Input
Low byte 5b, a fetch by a user program?
Output
matches = 1

V, X, U and A are all 1: allowed.

Example 3

FETCH D7 USER
Input
Low byte d7, a fetch by a user program?
Output
matches = 1

In binary d7 is 1101 0111. X, bit 3, is 0: code 4.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For USER_LOAD_ALLOWED, enter a constant expression using LOW. Only this entry changes with the parameter. The supported integer range is 83 through 91, inclusive.

Hints

Hint 1

Write the low byte as eight bits, and put the letters D A - U X W R V over them.

Hint 2

List the bits that this access needs: V, the bit of its kind, the right U, A, and D for a store.

Hint 3

Find the needed bit that has the wrong value. Its code is the answer.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

11 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

STORE 5B USER

Input
Low byte 5b, a store by a user program: which code?
Expected output
matches = 1

In binary 5b is 0101 1011. W, bit 2, is 0: code 3.

Run samples executes all 3 public checks. Check all tests runs 11 checks on the server.

Icarus Verilog · server