120 likes | 137 Views
This review covers the key principles of memory hierarchies, cache design, and control signals in computer architecture. It includes topics such as block placement, block replacement, write strategies, cache performance, and control signal subsets.
E N D
Lab#13- Cache Memory Review - HW#11 - Quiz#4 Apr.20, 2005
Review: Memory Hierarchies • Key Principles: • Locality: spatial and temporal • Smaller hardware is faster • Goal: • Keeping more likely used data as “close” to the CPU as possible - Thanks to Prof. Narahari for his class notes on review of memory.
Cache Design • Where can a block be placed in a cache? • How do we know which elements are in cache? • Which block should be replaced on a miss? • What happens on a write?
Block Placement • Direct mapped is not flexible enough: • Fully associative allows any mapping, i.e. all locations must be searched to find the right one – expensive hardware
set 0 set 1 Block Replacement • Direct-Mapped Cache: determined by index • Set/Fully Associative • Random • LRU (Least Recently Used) • Example: For a 2-way set associative cache with a four word total capacity and one word blocks. Compute the hits and misses for LRU replacement with the following word accesses (ignore bytes for this problem): 0, 2, 0, 1, 4, 0, 2, 3, 5, 4 loc 0 loc 1 0
Write Strategy • Write through • The information is written to both the block in the cache and to the block in the lower-level memory. • Write back: • The information is written only to the block in the cache. The modified cache block is written to main memory only when it is replaced. • A dirty bit is kept in the block description area. • Pros and Cons of each? • WT: read misses cannot result in writes • WB: no writes of repeated writes
Cache Performance • Hit rate: • #requests that are hits / #total requests • Cost of memory access • r*C_hit+(1-r)*C_miss • CPI = ideal CPI + average stalls per instruction • Example: • Ideal CPI=1.1, 50% arith/logic, 30% ld/st, 20% control • 10% of memory operations get 50 cycle miss penalty • 1% of instructions get same miss penalty
Control Signals • Control lines can be divided into 5 groups: • IF – NONE • ID – NONE • ALU – RegDst, ALUOp, ALUSrc • MEM – Branch, MemRead, MemWrite • WB – MemtoReg, RegWrite • Group these nine control lines into 3 subsets: • ALUControl, MEMControl, WBControl • Control signals: • generated at ID stage • grouped into three sets • passed to other stages through pipeline registers.
Extend the pipeline registers to include control information