Lecture 3 - Cache 2B
Lecture 3 - Cache 2B
Microprocessor Architecture
Basic Cache Operation (Examples)
V TAG DATA
122544
Top 6 nibbles (24 bits) of address form the tag and lower 2
nibbles (8 bits) of address form the index and block offset fields
ECE 463/563, Microprocessor Architecture, 10
Prof. Rotenberg
address (hex) tag (hex) index || block offset
(binary) index comment
(decimal)
FF0040E0 FF0040 11100000 7 Miss
BEEF005C BEEF00 01011100 2 Miss
FF0040E2 FF0040 11100010 7 Hit
FF0040E8 FF0040 11101000 7 Hit
101078 1010 01111000 3 Miss
2183E0 2183 11100000 7 Miss/Repl
101064 1010 01100100 3 Hit
12255C 1225 01011100 2 Miss/Repl
122544 1225 01000100 2 Hit
V TAG DATA
0 0
1 0
2 0
3 0
4 0
5 0
24 6 0
7 0
1 FF0040
Match?
Valid? ECE 463/563, Microprocessor Architecture, Get block from
12
Prof. Rotenberg
memory (slow)
31 8 7 5 4 0
tag index block
BEEF00 2 offset
3
V TAG DATA
0 0
1 0
2 0
1 BEEF00
3 0
4 0
5 0 Get block from
24 6 0 memory (slow)
7 1 FF0040
Match?
Valid? ECE 463/563, Microprocessor Architecture, 13
Prof. Rotenberg
31 8 7 5 4 0
tag index block
FF0040 7 offset
3
V TAG DATA
0 0
1 0
2 1 BEEF00
3 0
4 0
5 0
24 6 0
7 1 FF0040
Match?
Valid? ECE 463/563, Microprocessor Architecture, 14
Prof. Rotenberg
31 8 7 5 4 0
tag index block
FF0040 7 offset
3
V TAG DATA
0 0
1 0
2 1 BEEF00
3 0
4 0
5 0
24 6 0
7 1 FF0040
Match?
Valid? ECE 463/563, Microprocessor Architecture, 15
Prof. Rotenberg
31 8 7 5 4 0
tag index block
1010 3 offset
3
V TAG DATA
0 0
1 0
2 1 BEEF00
3 0
1 1010
4 0
5 0
24 6 0 Get block from
7 1 FF0040 memory (slow)
Match?
Valid? ECE 463/563, Microprocessor Architecture, 16
Prof. Rotenberg
31 8 7 5 4 0
tag index block
2183 7 offset
3
V TAG DATA
0 0
1 0
2 1 BEEF00
3 1 1010
4 0
5 0
24 6 0
7 1 2183
FF0040
Match?
Get block from
Valid? ECE 463/563, Microprocessor Architecture, 17
Prof. Rotenberg memory (slow)
31 8 7 5 4 0
tag index block
1010 3 offset
3
V TAG DATA
0 0
1 0
2 1 BEEF00
3 1 1010
4 0
5 0
24 6 0
7 1 2183
Match?
Valid? ECE 463/563, Microprocessor Architecture, 18
Prof. Rotenberg
31 8 7 5 4 0
tag index block
1225 2 offset
3
V TAG DATA
0 0
1 0
1 1225
2 BEEF00
3 1 1010
4 0
Get block from
5 0
24 memory (slow)
6 0
7 1 2183
Match?
Valid? ECE 463/563, Microprocessor Architecture, 19
Prof. Rotenberg
31 8 7 5 4 0
tag index block
1225 2 offset
3
V TAG DATA
0 0
1 0
2 1 1225
3 1 1010
4 0
5 0
24 6 0
7 1 2183
Match?
Valid? ECE 463/563, Microprocessor Architecture, 20
Prof. Rotenberg
Revised Example
• Example: Processor accesses a 256 byte 2-way
set-associative cache, which has block size of 32
bytes, with following sequence of addresses.
Show contents of cache after each access,
count # of hits, count # of replacements.
== == select a block
Hex: F F 0 0 4 0 E 0
Binary: 1111 1111 0000 0000 0100 0000 1110 0000
Hex Tag:1 F E 0 0 8 1
tag index block
offset
V TAG V TAG
0 0 0
1 0 0
2 0 0
25 3 1 1FE0081
0 0 DATA
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00
0 0
25 3 1 1FE0081 0 DATA
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00 0
25 3 1 1FE0081 1 2020
0 DATA
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00 0
25 3 1 1FE0081 1 2020 DATA
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00 0
25 3 1 1FE0081 1 2020 DATA
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00 0
4307 DATA
25 3 1 1FE0081 1 2020
not shown
Match? Match? for convenience
Valid? Valid?
V TAG V TAG
0 0 0
1 0 0
2 1 17DDE00 0
25 3 1 4307 1 2020 DATA
not shown
Match? Match? for convenience
Valid? Valid?