Cache Memory-Associative Mapping
Cache Memory-Associative Mapping
A main memory block can load into any line of cache Memory address is interpreted as tag and word Tag uniquely identifies block of memory Every lines tag is examined for a match Cache searching gets expensive
22 bit tag stored with each 32 bit block of data Compare tag field with tag entry in cache to check for hit Least significant 2 bits of address identify which 16 bit word is required from 32 bit data block e.g.
Word 2 bit
Use set field to determine cache set to look in Compare tag field to see if we have a hit e.g
Address number 1FF 7FFC 001 7FFC Tag Data Set
1FF 001
12345678 11223344
1FFF 1FFF
Random
Write Policy
Must not overwrite a cache block unless main memory is up to date Multiple CPUs may have individual caches I/O may address main memory directly
Write through
All writes go to main memory as well as cache Multiple CPUs can monitor main memory traffic to keep local (to CPU) cache up to date Lots of traffic Slows down writes
Write back
Updates initially made in cache only Update bit for cache slot is set when update occurs If block is to be replaced, write to main memory only if update bit is set Other caches get out of sync I/O must access main memory through cache N.B. 15% of memory references are writes
Pentium 4 Cache
80386 no on chip cache 80486 8k using 16 byte lines and four way set associative organization Pentium (all versions) two on chip L1 caches
Data & instructions
Pentium 4 L1 caches
8k bytes 64 byte lines four way set associative
L2 cache
Feeding both L1 caches 256k 128 byte lines
Execution units
Execute micro-ops Data from L1 cache Results in registers
Memory subsystem
Pentium instructions long & complex Performance improved by separating decoding from scheduling & pipelining
(More later ch14)
PowerPC G4