Lecture 7 Cache Memory
Lecture 7 Cache Memory
Lecture 7 Cache Memory
Computer Organization
and Architecture
8th Edition
Chapter 4
Cache Memory
• 24 bit address
• 2 bit word identifier (4 byte block)
• 22 bit block identifier
– 8 bit tag (=22-14)
– 14 bit slot or line
• No two blocks in the same line have the same Tag field
• Check contents of cache by finding line and checking Tag
Direct Mapping Cache Organization
Direct Mapping
Example
Direct Mapping Summary
• Address length = (s + w) bits
• Number of addressable units = 2s+w words or bytes
• Block size = line size = 2w words or bytes
• Number of blocks in main memory = 2s+ w/2w = 2s
• Number of lines in cache = m = 2r
• Size of tag = (s – r) bits
Direct Mapping pros & cons
• Simple
• Inexpensive
• Fixed location for given block
– If a program accesses 2 blocks that map to the same
line repeatedly, cache misses are very high
Associative
Associative Mapping
Mapping
Example Example
Associative Mapping Address Structure
Word
Tag 9 bit Set 13 bit 2 bit
❑What are the differences among direct mapping, associative mapping, and
set- associative mapping?
❑ For a direct-mapped cache, a main memory address is viewed as consisting
of three fields. List and define the three fields.
❑For an associative cache , a main memory address is viewed as consisting of two
fields. List and define the two fields.
❑For a set-associative cache, a main memory address is viewed as consisting of
three fields. List and define the three fields.
Thank you