Cut five addresses into two indexes and an offset, and walk a toy page table of two levels.
Hardware context: A two-level page table stored in a memory of 32 frames and walked by test code. Building and checking the page tables of a 32-bit system
A toy system has virtual addresses of 8 bits: the upper index is bits 7 and 6, the lower index is bits 5 and 4, and the offset is bits 3 to 0. A frame has 16 bytes. A table has 4 entries of one byte each. In an entry, bit 7 is the valid bit and bits 3 to 0 are a frame number. The root table is in frame 4, so it starts at address 40 (hex). Memory holds these bytes, all in hex: at 40: 85, at 41: 00, at 42: 86, at 43: 00. At 50: 8a, at 51: 8b, at 52: 00, at 53: 81. At 60: 00, at 61: 8c, at 62: 00, at 63: 00. An entry lies at the start of its table plus its index.
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
Enter every answer as a whole number in decimal. An address such as 42 in hex is entered as 66.
| Entry | Your decision |
|---|---|
| UPPER_INDEX_OF_9E | Which upper index has virtual address 9e? |
| LOWER_INDEX_OF_9E | Which lower index has virtual address 9e? |
| ROOT_ENTRY_ADDR_9E | At which address is the root entry for 9e read? |
| SECOND_ENTRY_ADDR_9E | At which address is the second entry for 9e read? |
| PHYS_OF_9E | Which physical address does 9e become? |
| PHYS_OF_13 | Which physical address does 13 become? |
| PHYS_OF_3F | Which physical address does 3f become? |
| FAULT_LEVEL_OF_55 | A load from 55 faults. At which read does the walk stop? Enter 1 for the root entry, 2 for the second entry. |
| FAULT_LEVEL_OF_2A | A load from 2a faults. At which read does the walk stop? |
| TABLE_BYTES | How many bytes do the three tables take together? |
| SECOND_ENTRY_ADDR | A virtual address has an upper index of 2 and a lower index of LOWER. Give the address at which its second entry is read, in decimal. |
Examples
Example 1
UPPER INDEX OF 9E- Input
Which upper index has virtual address 9e?
- Output
matches = 1
In binary 9e is 10 01 1110. The first two bits are 10, which is 2.
Example 2
LOWER INDEX OF 9E- Input
Which lower index has virtual address 9e?
- Output
matches = 1
The next two bits are 01.
Example 3
ROOT ENTRY ADDR 9E- Input
At which address is the root entry for 9e read?
- Output
matches = 1
The root table starts at 40. Entry 2 is at 42 in hex, which is 66.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For SECOND_ENTRY_ADDR, enter a constant expression using LOWER. Only this entry changes with the parameter. The supported integer range is 0 through 3, inclusive.
Hints
Hint 1
Write each address as eight bits, and cut it 2, 2 and 4.
Hint 2
Read the root entry. If bit 7 is set, its low digit is the frame of the next table.
Hint 3
The low digit of the second entry is the frame of the page. Put the offset behind it.
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 1 problem on this path