CMSC 311 Fall, 2006 Virtual Memory Worksheet

RTfP

Problem 1. (16 points):

The following problem concerns the way virtual addresses are translated into physical addresses.

• The memory is byte addressable.

• Memory accesses are to 4-byte words.

• Virtual addresses are 20 bits wide.

• Physical addresses are 16 bits wide.

• The page size is 4096 bytes.

• The TLB is 4-way set associative with 16 total entries.

In the following tables, all numbers are given in hexadecimal. The contents of the TLB and the page table for the first 32 pages are as follows:

TLB

Index Tag PPN Valid
0  03  B  1
07  6  0
28  3  1
01  F  0
1  31  0  1
12  3  0
07  E  1
0B  1  1
2  2A  A  0
11  1  0
1F  8  1
07  5  1
3  07  3  1
3F  F  0
10  D  0
32  0  0

Page Table

VPN PPN Valid VPN PPN Valid
00 7  1 10 6  0
01 8  1 11 7  0
02 9  1 12 8  0
03 A  1 13 3  0
04 6  0 14 D  0
05 3  0 15 B  0
06 1  0 16 9  0
07 8  0 17 6  0
08 2  0 18 C  1
09 3  0 19 4  1
0A 1  1 1A F  0
0B 6  1 1B 2  1
0C A  1 1C 0  0
0D D  0 1D E  1
0E E  0 1E 5  1
0F D  1 1F 3  1

Part 1 The Basics (8pts)

1. The box below shows the format of a virtual address. Indicate (by labeling the diagram) the fields (if they exist) that would be used to determine the following: (If a field doesn’t exist, don’t draw it on the diagram.)

VPO The virtual page offset
VPN The virtual page number
TLBI The TLB index
TLBT The TLB tag
19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

2. The box below shows the format of a physical address. Indicate (by labeling the diagram) the fields that would be used to determine the following:

PPO The physical page offset
PPN The physical page number
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Part 2 Translation For the given virtual addresses, indicate the TLB entry accessed and the physical address. Indicate whether the TLB misses and whether a page fault occurs. If there is a page fault, enter “-” for “PPN” and leave part C blank. Virtual address: 2DA49

1. Virtual address format (one bit per box)

19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

2. Address translation

Parameter  Value
VPN 0x
TLB Index  0x
TLB Tag  0x

TLB Hit? (Y/N) Page Fault? (Y/N)

PPN  0x

3. Physical address format (one bit per box)

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Virtual address: 1F1F8

1. Virtual address format (one bit per box)

19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

2. Address translation

Parameter  Value
VPN 0x
TLB Index  0x
TLB Tag  0x

TLB Hit? (Y/N) Page Fault? (Y/N)

PPN  0x

3. Physical address format (one bit per box)

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0