FinalQuestion2 Soln
FinalQuestion2 Soln
a. Show how the physical memory address is partitioned into fields for the cache access. Give the name and
bit length of each field.
Answer: 2^29 bytes memory, 4-byte words, 2^5 bytes blocks (256 bits= 256/8= 32 bytes). Therefore
byte offset-2, block offset-3. 4KB / (2 x 2^5 bytes) = 2^6 sets. Index/set – 6 bits. So,
Tag- 18
Index/set- 6
Block offset- 3
Byte offset- 2
b. Draw one line (set) of the cache memory in terms of its components. What is the total storage
required to implement one set in number of bits?
Answer: 2 ways - each with 1 bit V, 18 bits Tag, 256 bits actual data, in total 2 x 275 = 550 bits for
one set.
For the implementation of the cache memory do we need the following hardware components: equality
comparator, and gate, and or gates? If your answer is no: explain why. If your answer is yes: how many
of each component is needed. No need to draw a figure.
Answer: There will be 2 AND gates, 2 Comparators and 1 Or gate.
=======================================================================
2. Cache Memory (12 pts.) Consider a computer with physical (main) memory of size 4GB. The word size
is given as 32 bits. A direct mapped cache memory organization has a block size 1 word and has 4 sets.
All sets are initially empty. The memory accesses are done for the following memory locations:
0x23, 0x38, 0xA9.
a. Show the final contents of the cache memory. Clearly state the set numbers and their contents with field
names and values. Draw a table for illustration.
Answer: 0
=======================================================================
1
3. Virtual Memory (15 pts.) Consider a VM environment with VM size: 1 GB, page size: 4 KB, and
physical memory size: 128 MB.
a. What is the size of one row of the page table in number of bits?
Answer: Page offset- 12 bits, VPN – 18 bits, PPN – 15 bits.
Valid bit + PPN for each row, therefore 16 bits.
b. What is the total page table size in terms of number of bits? Please do the calculation as it is illustrated in
the textbook.
Answer: There are 2^18 virtual pages (rows) x 2^4 bits (for each row) = 2^22 bits.
c. This system has a TLB for address translation, the physical memory access time is 50 ns TLB access time
is 10 ns, the hit rate for TLB is 80%. What is the minimum memory access time?
Answer: Minimum access requires one TLB access and 1 memory access. That is 60ns.
=======================================================================
4. Virtual Memory (11 pts.) In a VM environment 4096 different virtual memory pages are mapped to one
physical memory page (in a textbook illustration, with complete detail, there would be 4096 different
virtual memory pages pointing to one single physical memory page). For this architecture consider the
following two VM accesses and the corresponding physical memory addresses obtained for them. (All
numbers are in hex.) As shown in the table the memory accesses are done for the VM locations first 0 40
A0 A0 and then 0 00 BA C0.
Virtual Physical
Memory Memory
Address Address
0 40 A0 A0 28 A0 A0
0 00 BA C0 00 BA C0
c. This system has a two-entry TLB (Entry-0 and Entry-1). Give the contents of the TLB after performing
the above memory accesses. Answer:
Entry 1 Entry 0
V VPN PPN V VPN PPN
1 0x000 0x00 1 0x040 0x28
=======================================================================