Professional Documents
Culture Documents
edu/~cs61c
UCB CS61C : Machine Structures Direct-Mapped Cache Terminology
Lecture 31 – Caches II All fields are read as unsigned integers.
2008-04-14 Index
specifies the cache index (or “row”/block)
Lecturer SOE Tag
Hi to Yi Luo from Seattle, WA !
Dan Garcia distinguishes betw the addresses that map to the same location
Offset
specifies which byte within the block we want
In this week’s Science, IBM researchers describe a new
class of data storage, called racetrack memory,
combining the data storage density of disk with the ttttttttttttttttt iiiiiiiiii oooo
ruggedness and speed of flash memory (no moving
parts). They store bits as magnetic fields on nanowires. tag index byte
They don’t have a prototype, and say commercialization to check to offset
is about 7 years away. But, this could be something big! if have select within
www.technologyreview.com/Infotech/20553/ correct block block block
CS61C L31 Caches II (2) Garcia, Spring 2008 © UCB
CS61C L31 Caches II (3) Garcia, Spring 2008 © UCB CS61C L31 Caches II (4) Garcia, Spring 2008 © UCB
Accessing data in a direct mapped cache Accessing data in a direct mapped cache
Ex.: 16KB of data, Memory 4 Addresses:
Address...
(hex) Value...
of Word
direct-mapped, 0x00000014, 0x0000001C,
00000010
a
0x00000034, 0x00008014
4 word blocks 00000014 b
Can you work out 00000018 c
4 Addresses divided (for convenience) into
height, width, area? 0000001C d
...
...
Tag, Index, Byte Offset fields
Read 4 addresses 00000030
e
000000000000000000 0000000001 0100
1. 0x00000014 00000034 f
2. 0x0000001C 00000038 g
000000000000000000 0000000001 1100
3. 0x00000034 0000003C h
...
...
000000000000000000 0000000011 0100
4. 0x00008014 00008010
i
00008014 j
000000000000000010 0000000001 0100
Memory vals here: 00008018 k
0000801C l
Tag Index Offset
CS61C L31 Caches II (5)
...
...
Garcia, Spring 2008 © UCB CS61C L31 Caches II (6) Garcia, Spring 2008 © UCB
16 KB Direct Mapped Cache, 16B blocks 1. Read 0x00000014
Valid bit: determines whether anything is stored in that 000000000000000000 0000000001 0100
row (when computer initially turned on, all entries invalid) Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1 0
1
0
2
0
2
0
3
0
3
0
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (7) Garcia, Spring 2008 © UCB CS61C L31 Caches II (8) Garcia, Spring 2008 © UCB
CS61C L31 Caches II (9) Garcia, Spring 2008 © UCB CS61C L31 Caches II (10) Garcia, Spring 2008 © UCB
So load that data into cache, setting tag, valid Read from cache at offset, return word b
000000000000000000 0000000001 0100 000000000000000000 0000000001 0100
Tag field
Index field
Offset
Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1
1
0
d
c
b
a
1
1
0
d
c
b
a
2
0
2
0
3
0
3
0
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (11) Garcia, Spring 2008 © UCB CS61C L31 Caches II (12) Garcia, Spring 2008 © UCB
2. Read 0x0000001C = 0…00 0..001 1100 Index is Valid
000000000000000000 0000000001 1100 000000000000000000 0000000001 1100
Tag field
Index field
Offset
Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1
1
0
d
c
b
a
1 1
0
d
c
b
a
2
0
2
0
3
0
3
0
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (13) Garcia, Spring 2008 © UCB CS61C L31 Caches II (14) Garcia, Spring 2008 © UCB
CS61C L31 Caches II (15) Garcia, Spring 2008 © UCB CS61C L31 Caches II (16) Garcia, Spring 2008 © UCB
CS61C L31 Caches II (17) Garcia, Spring 2008 © UCB CS61C L31 Caches II (18) Garcia, Spring 2008 © UCB
No valid data Load that cache block, return word f
000000000000000000 0000000011 0100 000000000000000000 0000000011 0100
Tag field
Index field
Offset
Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1
1
0
d
c
b
a
1
1
0
d
c
b
a
2
0
2
0
3
0
3
1
0
h
g
f
e
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (19) Garcia, Spring 2008 © UCB CS61C L31 Caches II (20) Garcia, Spring 2008 © UCB
4. Read 0x00008014 = 0…10 0..001 0100 So read Cache Block 1, Data is Valid
000000000000000010 0000000001 0100 000000000000000010 0000000001 0100
Tag field
Index field
Offset
Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1
1
0
d
c
b
a
1
1
0
d
c
b
a
2
0
2
0
3
1
0
h
g
f
e
3
1
0
h
g
f
e
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (21) Garcia, Spring 2008 © UCB CS61C L31 Caches II (22) Garcia, Spring 2008 © UCB
Cache Block 1 Tag does not match (0 != 2) Miss, so replace block 1 with new data & tag
000000000000000010 0000000001 0100 000000000000000010 0000000001 0100
Tag field
Index field
Offset
Tag field
Index field
Offset
Valid
Valid
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
0
0
0
0
1
1
0
d
c
b
a
1
1
2
l
k
j
i
2
0
2
0
3
1
0
h
g
f
e
3
1
0
h
g
f
e
4
0
4
0
5
0
5
0
6
0
6
0
7
0
7
0
...
...
...
...
1022
0
1022
0
1023
0
1023
0
CS61C L31 Caches II (23) Garcia, Spring 2008 © UCB CS61C L31 Caches II (24) Garcia, Spring 2008 © UCB
And return word J Do an example yourself. What happens?
Chose from: Cache: Hit, Miss, Miss w. replace
000000000000000010 0000000001 0100 Values returned: a ,b, c, d, e, ..., k, l
Valid
Tag field
Index field
Offset
Read address 0x00000030 ?
Index
Tag
0xc-f
0x8-b
0x4-7
0x0-3
000000000000000000 0000000011 0000
0
0
Read address 0x0000001c ?
1
1
2
l
k
j
i
000000000000000000 0000000001 1100
2
0
Cache
3
1
0
h
g
f
e
Valid
4
0
Index
Tag
0x0-3
0x4-7
0x8-b
0xc-f
5
0
0
0
6
0
1
1
2
l
k
j
i
7
0
2
0
...
...
3
1
0
h
g
f
e
4
0
1022
0
5
0
1023
0
6
0
7
0
...
...
CS61C L31 Caches II (25) Garcia, Spring 2008 © UCB CS61C L31 Caches II (26) Garcia, Spring 2008 © UCB