On part 2 program opmizaons that consider caches cache

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n binary is 00...0110000 011 0011. (m-k-4) bits k bits Tag Index m-bit Address k=3 4-bit Block Offset k=2 k=1 1-way associativity 8 sets, 1 block each 2-way associativity 4 sets, 2 blocks each 4-way associativity 2 sets, 4 blocks each Set 0 1 2 3 4 5 6 7 Set Set 0 0 1 2 1 3 Cache Organiza?on University of Washington Block replacement       Any empty block in the correct set may be used for storing data. If there are no empty blocks, which one should we replace? Replace something, of course, but what?   Caches typically use something close to least-recently-used 1-way associativity 8 sets, 1 block each 2-way associativity 4 sets, 2 blocks each 4-way associativity 2 sets, 4 blocks each Set 0 1 2 3 4 5 6 7 Set Set 0 0 1 2 1 3 Cache Organiza?on University of Washington Another puzzle.         What can you infer from this: Cache starts empty Access (addr, hit/miss) stream (10, miss); (12, miss); (10, miss) Cache Organiza?on University of Washington Memory and Caches           Cache basics Principle of locality Memory hierarchies Cache organiza?on (part 2) Program op?miza?ons that consider caches Cache Organiza?on University of Washington General Cache Organiza?on (S, E, B) E = 2e lines per set set line S = 2s sets v valid bit tag 012 B ­1 cache size: S x E x B data bytes B = 2b bytes of data per cache line (the data block) Cache Organiza?on University of Washington Cache Read E = 2e lines per set • Locate set • Check if any line in set has matching tag • Yes + line valid: hit • Locate data star4ng at offset Address of byte in memory: t bits tag S = 2s sets s bits b bits set block index offset data begins at this offset v valid bit tag 012 B ­1 B = 2b bytes of data per cache line (the data block) Cache Organiza?on University of Washington Example: Direct ­Mapped Cache (E = 1) Direct ­mapped: One line per set Assume: cache block si...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online