Module 6a CacheMemory
Module 6a CacheMemory
Layout:
If in cache memory, each line address just contain 1 word, then line/slot = line address only.
Main Memory
1
Example 2: Hit/Miss Operation (Read)
Main = 32-word
Cache = 8-word
2
Hit/Miss: (Read Process)
3
Cache Memory Examples
(b). Given a cache memory of the size 16 K line = 16 * K line = 24 * 210 = 214 lines
Therefore the number of bits for the cache lines/slots/blocks = 14 bits
(d). Memory address format consists of tag, line/slot/block and word field.
Tag bits + lines/slots/blocks bits + words bits = 24 bits
Tag bits + 14 + 2 = 24 bits
Therefore tag bits = 24 – 16 = 8 bits
4
(e) For data at main memory address of 111111h, the cache address is:
0001 0001 0001 0001 0001 00 01
Word address = 01
Line address = 0001 0001 0001 00 = 00 0100 0100 0100 = 0444h
Tag value = 0001 0001 = 11h
(g) For data at cache line address 0CE7, the main memory address is:
line/slot tag word 11 word 10 word 01 word 00
0CE7h 3Dh Data
Word address= 11
Line address = 0CE7h = 00 1100 1110 0111
Tag value = 3Dh = 0011 1101
001111010011001110011111
3D339Fh
5
Example 7: Associative Mapping Example
(b) Given a cache memory of the size 16 K line = 16 * K line = 24 * 210 = 214 locations (line number) –
not important
Tag Word
22 bits 2 bits
6
(e) For data at main memory address of 666666h, the cache address is:
0110 0110 0110 0110 0110 01 10
Word address = 10
Tag = 0110 0110 0110 0110 0110 01
199999h
(g) For data in cache as follows, the main memory address is:
tag word 11 word 10 word 01 word 00
123456h Data
Word address = 00
Tag value = 123456h = 0001 0010 0011 0100 0101 0110
48D158h
7
Example 8: 2-way Set Associative Mapping Example
(e) Memory address format consists of tag, set and word field.
Tag bits + set bits + words bits = 24 bits
Tag bits + 13 + 2 = 24 bits
Therefore tag bits = 24 – 15 = 9 bits
8
(f) For data at main memory address of BBBBBBh, the cache address is:
Word address = 11
Set Number = 011 1011 1011 10 = 0 1110 1110 1110 = 0EEEh
Tag value = 1011 1011 1 = 1 0111 0111 = 177h
(h) For data in cache as follows, the main memory address is:
Set Tag word 11 word 10 word 01 word 00
1652h 0ACh Data
Word address = 01
Set no. = 1652h = 0001 0110 0101 0010
Tag value = 0ACh = 0000 1010 1100
56594Ah