In: Electrical Engineering
Suppose we have a direct-mapped cache that can hold a total of 1024
blocks with 4 words per block.
Compute the block index, block offset, and the tag for the
following addresses:
(a) 0x11001001
(b) 0x00010014
(c) 0x01000004
(d) 0x01001018
(e) 0x7bdcca10
Answer :- Since 1024 blocks, hence number of index bits = 10. Two bits for offset since 4 words per block.
Thus fro LSB, 2-bit gives the value of block offset, next 10 bits gives the value of block index and rest bits are the value of tag.
a) 0x11001001 =>
0001_0001_0000_0000_0001_0000_0000_0001,
block offset = 01, block index = 0000_0000_00, and tag =
0001_0001_0000_0000_0001.
b) 0x00010014 =>
0000_0000_0000_0001_0000_0000_0001_0100,
block offset = 00, block index = 0000_0001_01, and tag =
0000_0000_0000_0001_0000.
c) 0x01000004 =>
0000_0001_0000_0000_0000_0000_0000_0100,
block offset = 00, block index = 0000_0000_01, tag =
0000_0001_0000_0000_0000.
d) 0x01001018 =>
0000_0001_0000_0000_0001_0000_0001_1000,
block offset = 00, block index = 0000_0001_10, tag =
0000_0001_0000_0000_0001.
e) 0x7bdcca10 =>
0111_1011_1101_1100_1100_1010_0001_0000,
block offset = 00, block index = 1010_0001_00, tag =
0111_1011_1101_1100_1100.