10 Memory Organization

download 10 Memory Organization

of 16

Transcript of 10 Memory Organization

  • 8/2/2019 10 Memory Organization

    1/16

    Lecture 10: Memor Or anization

    Direct Map

    M. Safayani

    1

  • 8/2/2019 10 Memory Organization

    2/16

    Localit

    empora oca y: you use some a a recen y, you

    will likely use it again

    Spatial locality: if you used some data recently, you

    will likely access its neighbors

    M. Safayani

    2

  • 8/2/2019 10 Memory Organization

    3/16

    Memor Hierarch

    e as er memor es are more expens ve per an

    the slower memories and thus smaller.

    M. Safayani

    3

  • 8/2/2019 10 Memory Organization

    4/16

    Memor Hierarch

    s you go ur er, capac y an a ency ncrease

    Registers1KB

    1 cycle

    instructionCache32KB

    L2 cache2MB

    15 c cles

    Memory1GB

    300 cyclesDisk

    80 GB

    2 cycles 10M cycles

    M. Safayani

    4

  • 8/2/2019 10 Memory Organization

    5/16

    Cache

    y o cac es wor

    assume that there are two-level memory

    No hierarchy: average access time for data = 300 cycles

    32KB 1-cycle L1 cache that has a hit rate of 95%:average access time = 0.95 x 1 + 0.05 x (301)

    = cyc es

    Main MemoryCPU

    512 x 8Wordaccess

    Blocktransfer

    M. Safayani

    5

  • 8/2/2019 10 Memory Organization

    6/16

    Accessin the Cache direct-ma ed

    M. Safayani

    6

  • 8/2/2019 10 Memory Organization

    7/16

    Accessin the Cache direct-ma ed

    122000000

    234000 1220

    77700000

    3450

    456077701

    00002 5670

    671077727777

    Cache

    M. Safayani

    7Main memory

  • 8/2/2019 10 Memory Organization

    8/16

    Exam le direct-ma ed

    22(10110)

    22(10110)

    26(11010)

    3 (00011)16(10000)

    M. Safayani

    8

  • 8/2/2019 10 Memory Organization

    9/16

    Exam le direct-ma ed

    22(10110)

    22(10110)

    26(11010)

    3 (00011)16(10000)

    M. Safayani

    9

  • 8/2/2019 10 Memory Organization

    10/16

    Direct-ma ed

    M. Safayani

    10

  • 8/2/2019 10 Memory Organization

    11/16

    Direct-ma ed

    M. Safayani

    11

  • 8/2/2019 10 Memory Organization

    12/16

    Exam le Bits in a cache

    -data and 4-word blocks, assuming a 32-bit address?

    um er o oc s=Number of bits in each block:128 bitsTag=32-10-2-2

    Valid bit=1Total cache size:

    M. Safayani

    12

  • 8/2/2019 10 Memory Organization

    13/16

    Com utin Cache blocks

    =

    M. Safayani

    13

  • 8/2/2019 10 Memory Organization

    14/16

    Direct-ma ed

    M. Safayani

    14

  • 8/2/2019 10 Memory Organization

    15/16

    Handling Cache Misses

    1. Send the original PC value (current PC 4) to the memory.

    2. Instruct main memory to perform a read and wait for the memory tocom lete its access.

    3. Write the cache entry, putting the data from memory in the data,

    ALU) into the tag field, and turning the valid bit on.

    . ,the instruction, this time finding it in the cache.

    M. Safayani

    15

  • 8/2/2019 10 Memory Organization

    16/16

    Handling Write

    1. Write-through

    Example:10% of the instructions are storesthe CPI without cache misses was 1.0100 extra cycles on every write

    CPI becomes: 1.0 + 100 * 10% = 11

    2. Write-back

    M. Safayani

    16