Lecture 3 - Cache 2A
Lecture 3 - Cache 2A
Fall `20
Basic Cache Operation
32-bit address
byte #0 00…00000000 1 byte of data
byte #1 00…00000001
byte #2 00…00000010
… 00…00000011
00…00000100
00…00000101
00…00000110
00…00000111
232 bytes 00…00001000
00…00001001
00…00001010
00…00001011
00…00001100
…
…
byte #(232-1) 11…11111111
01 1
01 0
10 1
10 0
11 1
11 0
1
000
00
mem. block #0 00…00000xxx Block offset
mem. block #1 00…00001xxx Low-order bits of
address that specify a
mem. block #2 00…00010xxx byte within the block
… 00…00011xxx Since cache is
managed at
00…00100xxx granularity of blocks,
the block offset bits
00…00101xxx are irrelevant for
determining hit or
00…00110xxx miss
00…00111xxx
232 bytes 00…01000xxx
…
(229 memory blocks)
…
…
…
…
…
11…11111xxx
01 1
01 0
10 1
10 0
11 1
11 0
1
000
• BLOCKSIZE = 8 bytes
00
mem. block #0 00…00000xxx • 1 block per cache set
mem. block #1 00…00001xxx
mem. block #2 00…00010xxx
… 00…00011xxx
00…00100xxx cache set #0
index
01 1
01 0
10 1
10 0
11 1
11 0
1
000
00
mem. block #0 00…00000xxx
mem. block #1 00…00001xxx
mem. block #2 00…00010xxx
… 00…00011xxx
00…00100xxx cache set #0
index
tag
01 1
01 0
10 1
10 0
11 1
11 0
1
000
00
mem. block #0 00…00000xxx
mem. block #1 00…00001xxx
mem. block #2 00…00010xxx
… 00…00011xxx
00…00100xxx cache set #0
row
dec
hit/miss MDR
row
dec
? ? ?
X
Associatively search for the block among N ways of the set.
Direct-mapped cache is one extreme where there is only 1 way. Once a set is indexed
using the index bits from the block address, there is no need to search among multiple
blocks within the set because there is only 1 block in the set.
Generic picture of
N-way set-associative cache
X
index bits of the
block address.
set 2 block
…
block block
...
block