If you are a teacher/TA in a course in which any of these solutions clash with your curriculum, please contact me at mrtn [at] brkmnd [dot] com or write a comment, and I will most likely remove the solution. "Give me learning, sir, and you may keep your black bread" [Homer Simpson].

We are given the address 0x027c

We translate the address into binary of 14 bits: 0x027c = 00.0010.0111.1100

From page 851 we know that the VPO has size $p = 6$. And VPN has size $n - p = 14 - 6 = 8$. Thus we get

- VPN = 00.0010.01 = 0x9.
- VPO = 11.1100.

The TLB has $4$ sets. TLBI has size of $lg_2 sets = 2$. TLBI is the lower order bits of the VPN. TLBT (TLB tag) is the rest of the VPN. Thus

- TLBI = 01 = 0x1.
- TLBT = 00.0010 = 0x2.

We are given the address 0x03a9

We translate the address into binary of 14 bits: 0x03a9 = 00.0011.1100.1001

From page 851 we know that the VPO has size $p = 6$. And VPN has size $n - p = 14 - 6 = 8$. Thus we get

- VPN = 00.0011.11 = 0x0f.
- VPO = 00.1001.

The TLB has $4$ sets. TLBI has size of $lg_2 sets = 2$. TLBI is the lower order bits of the VPN. TLBT (TLB tag) is the rest of the VPN. Thus

- TLBI = 11 = 0x3.
- TLBT = 00.0011 = 0x03.

We obtain from the TLB table the valid PPN = 0x0d = 0000.1101.

We check for validity using second table from top. We get a valid hit in the last entry of the table.

We know VPO = PPO = 00.1001. We concatenate to obtain the 12 bit physical address PA = 00.1101 . 00.1001.

Now a cache block is 4 bytes. That is the 2 low order bits of the physical address serves as CO (block offset). We have 16 sets, so the next 4 bits serves as CI (cache index). The remaining 6 bits is CT (cache tag). We get

- CO = 01 = 0x1.
- CI = 0010 = 0x02.
- CT = 00.1101 = 0x0d

And by a lookup in the bottom table we get the column for idx = 0x02 does not have the tag we are looking for. Hence cache miss.

We look in the upper most table on page 858. The table index (set) is the TLBI, and we look for the tag $0x2$ which is found in the second box from left. This entry's valid bit is not set, that is we obtain PPN = -. We do not have TLB-hit, we have page fault. And we cannot obtain the PPN or finish part D. In this situation the MMU needs to fetch the PTE from main memory, but this is not given.

We are given the address 0x0040.

Translation : 0x0040 = 00.0000.0100.0000. Separated into VPN and VPO:

- VPN = 00.0000.01 = 0x01.
- VPO = 00.0000 = 0x0

From the VPN we obtain

- TLBI = 01 = 0x01
- TLBT = 00.0000 = 0x00

By a lookup in table 1 we conclude that no tag column "set 1" has the value 0x00. Thus we have a TLB lookup miss, and we do not proceed any further.

We are given the address 0x03d7.

Translate into binary: 0x03d7 = 00.0011.1101.0111. Now

- VPN = 00.0011.11 = 0x0f.
- VPO = 01.0111 = 0x17

Furthermore

- TLBI = 11 = 0x3.
- TLBT = 00.0011 = 0x03.

We have a hit in table 1, we obtain PPN = 0x0d. This is valid in table 2 as well. By concatenating we get PA = 0x0d . 0x17 = 00.1101 . 01.0111.

We obtain

- CO = 11 = 0x3.
- CI = 0101 = 0x5.
- CT = 00.1101 = 0x0d.

By a lookup in the last table we see that row 0x5 has tag 0x0d and is valid. We have a hit, and we offset 0x3 into the row to obtain 0x1d

CommentsGuest Name:Comment: