Split six virtual addresses into page and offset, and take each through a small page table.
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
A tiny system has virtual and physical addresses of 8 bits, written as two hex digits. A page has 16 bytes, so there are 16 pages and 16 frames. The page table of the running program has five valid entries: page 0 is in frame 5, page 2 in frame c, page 4 in frame 9, page 7 in frame 2 and page f in frame 0. Every other entry is not valid. An entry stores a valid bit and a frame number.
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. A physical address such as 9c in hex is entered as 156.
| Entry | Your decision |
|---|---|
| OFFSET_BITS | How many bits has the offset in a page? |
| PAGE_OF_4C | Which page number has virtual address 4c? |
| OFFSET_OF_4C | Which offset has virtual address 4c? Enter it in decimal. |
| PHYS_OF_4C | Which physical address does 4c become? |
| PHYS_OF_27 | Which physical address does 27 become? |
| PHYS_OF_0F | Which physical address does 0f become? |
| PHYS_OF_F3 | Which physical address does f3 become? |
| FAULT_AT_1A | Does a load from virtual address 1a fault? Enter 1 for yes, 0 for no. |
| PHYS_OF_7F | Which physical address does 7f, the last byte of page 7, become? |
| TABLE_BITS | How many bits does the whole page table store? |
| PHYS_IN_PAGE_4 | A load uses the byte with offset OFFSET in page 4. Give its physical address in decimal. |
Examples
Example 1
OFFSET BITS- Input
How many bits has the offset in a page?
- Output
matches = 1
A page has 16 bytes, and 16 is 2 to the power 4.
Example 2
PAGE OF 4C- Input
Which page number has virtual address 4c?
- Output
matches = 1
The first hex digit is the page number.
Example 3
OFFSET OF 4C- Input
Which offset has virtual address 4c? Enter it in decimal.
- Output
matches = 1
The second hex digit is the offset: c, which is 12.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For PHYS_IN_PAGE_4, enter a constant expression using OFFSET. Only this entry changes with the parameter. The supported integer range is 0 through 15, inclusive.
Hints
Hint 1
Write each address as a page digit and an offset digit.
Hint 2
Find the entry of the page. If it is not valid, stop: that is a fault.
Hint 3
Put the frame digit in front of the offset digit, and convert to decimal.
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