Computer Organization and Design: The Hardware/Software Interface

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS152 Computer Architecture and Engineering Lecture 20 Caches April 14, 2003 John Kubiatowicz ( ) lecture slides: 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.2 ° The Five Classic Components of a Computer ° Today’s Topics: Recap last lecture Simple caching techniques Many ways to improve cache performance Virtual memory? Recap: The Big Picture: Where are We Now? Control Datapath Memory Processor Input Output 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.3 Processor $ MEM Memory reference stream <op,addr>, <op,addr>,<op,addr>,<op,addr>, . . . op: i-fetch, read, write Optimize the memory system organization to minimize the average memory access time for typical workloads Workload or Benchmark programs The Art of Memory System Design 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.4 Execution_Time = Instruction_Count x Cycle_Time x (ideal CPI + Memory_Stalls/Inst + Other_Stalls/Inst) Memory_Stalls/Inst = Instruction Miss Rate x Instruction Miss Penalty + Loads/Inst x Load Miss Rate x Load Miss Penalty + Stores/Inst x Store Miss Rate x Store Miss Penalty Average Memory Access time (AMAT) = Hit Time L1 + (Miss Rate L1 x Miss Penalty L1 ) = (Hit Rate L1 x Hit Time L1 ) + (Miss Rate L1 x Miss Time L1 ) Recap: Cache Performance
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.5 Example: 1 KB Direct Mapped Cache with 32 B Blocks ° For a 2 ** N byte cache: The uppermost (32 - N) bits are always the Cache Tag The lowest M bits are the Byte Select (Block Size = 2 M ) One cache miss, pull in complete “Cache Block” (or “Cache Line”) Cache Index 0 1 2 3 : Cache Data Byte 0 0 4 31 : Cache Tag Example: 0x50 Ex: 0x01 0x50 Stored as part of the cache “state” Valid Bit : 31 Byte 1 Byte 31 : Byte 32 Byte 33 Byte 63 : Byte 992 Byte 1023 : Cache Tag Byte Select Ex: 0x00 9 Block address 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.6 Set Associative Cache ° N-way set associative : N entries for each Cache Index N direct mapped caches operates in parallel ° Example: Two-way set associative cache Cache Index selects a “set” from the cache The two tags in the set are compared to the input in parallel Data is selected based on the tag result Cache Data Cache Block 0 Cache Tag Valid : : : Cache Data Cache Block 0 Cache Tag Valid : : : Cache Index Mux 0 1 Sel1 Sel0 Cache Block Compare Adr Tag Compare OR Hit 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.7 Disadvantage of Set Associative Cache ° N-way Set Associative Cache versus Direct Mapped Cache: N comparators vs. 1 Extra MUX delay for the data Data comes AFTER Hit/Miss decision and set selection ° In a direct mapped cache, Cache Block is available BEFORE Hit/Miss: Possible to assume a hit and continue. Recover later if miss. Cache Data Cache Block 0 Cache Tag Valid : : : Cache Data Cache Block 0 Cache Tag Valid : : : Cache Index Mux 0 1 Sel1 Sel0 Cache Block Compare Adr Tag Compare OR Hit 4/14/04 ©UCB Spring 2004 CS152 / Kubiatowicz Lec20.8 Example: Fully Associative ° Fully Associative Cache Forget about the Cache Index Compare the Cache Tags of all cache entries in parallel
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern