39
Young Won Lim 5/24/16 Cache Memory

Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Young Won Lim5/24/16

Cache Memory

Page 2: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Young Won Lim5/24/16

Copyright (c) 2010-2016 Young W. Lim.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Please send corrections (or suggestions) to [email protected].

This document was produced by using OpenOffice.

Page 3: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Memory 3 Young Won Lim5/24/16

Address is used as an index to a data array

Memory Unit2k words

n-bit per word

Input n-bit Data

Output n-bit Data

0000000100100011010001010110011110001001101010111100110111101111

k-bit Address n-bit data

24 words

k-bit Address

Read

Write

index

Page 4: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Memory 4 Young Won Lim5/24/16

MM Address Decoder

k-bit Address

n-bit data

en.wikipedia.org

AddressDecoder

Page 5: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Memory 5 Young Won Lim5/24/16

Cache : Storing a partial copy of MM

0000000100100011010001010110011110001001101010111100110111101111

(MM Address, Data) pair

dataMM Address

010001011000100110101011

Cache Memory

Main Memory

Page 6: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Memory 6 Young Won Lim5/24/16

Cache Memory : two components

Cache Memory

Tag Cache Directory

DataMM Address

Data

Cache Array

Page 7: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Memory 7 Young Won Lim5/24/16

Accessing Cache Memory : Address Matching

CacheMemory

Tag MemoryCache Directory

DataMM Address

DataCache Array

Address

Match

Hit

from CPU

to / from CPU

Page 8: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 8 Young Won Lim5/24/16

CAM (Content Addressable Memory) Interface

DIN[M:0]WR_ADDR[logN:0]DATA_MASK[M:0]CMP_DIN[M:0]CMP_DATA_MASK[M:0]

CLKENWE

MATCH_ADDR[J:0]MULTIPLE_MATCH

SINGLE_MATCH

BUSYREAD_WARNING

xapp1151_Param_CAM.pdf

Xilinx CAM

Page 9: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 9 Young Won Lim5/24/16

CAM Read Operation – Search a key

DIN[M:0]

CLKENWE

MATCH_ADDR[J:0]MULTIPLE_MATCH

SINGLE_MATCH

xapp1151_Param_CAM.pdf

CAM Address

0

Search Data

CA

M A

ddre

ss

Search DataSearch Data

match?

0

Page 10: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 10 Young Won Lim5/24/16

Write Operation

DIN[M:0]WR_ADDR[logN:0]

CLKENWE

xapp1151_Param_CAM.pdf

CAM AddressWrite Data

CA

M A

ddre

ss

Search Data

write

10

Page 11: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 11 Young Won Lim5/24/16

Simultaneous Read / Write

DIN[M:0]WR_ADDR[logN:0]DATA_MASK[M:0]CMP_DIN[M:0]CMP_DATA_MASK[M:0]

CLKENWE

BUSYREAD_WARNING

xapp1151_Param_CAM.pdf

1

EN=1 simultaneous write/read

Simultaneous Read/Write Simultaneous write and search operationsWith an output to warn the user of possible collisionRead warning flag:

The data applied to the CAM for a readMatches the data that is currently being written into the CAMBy unfinished write operation

Search Data

Write DataCAM Address

MATCH_ADDR[J:0]MULTIPLE_MATCH

SINGLE_MATCH

CAM Address

Page 12: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 12 Young Won Lim5/24/16

Ternary Mode

DIN[M:0]WR_ADDR[logN:0]DATA_MASK[M:0]CMP_DIN[M:0]CMP_DATA_MASK[M:0]

CLKENWE

MATCH_ADDR[J:0]MULTIPLE_MATCH

SINGLE_MATCH

BUSYREAD_WARNING

xapp1151_Param_CAM.pdf

1

Cache Address

EN=1 simultaneous write/read

DIN[M:0] Data in Bus The data to be written into The data read from the CAM

Simultaneous read/write modeCMP_DIN for the read operation

Standard Ternary modeDIN DATA_MASK0 0 01 0 10 1 X1 1 X

CMP_DIN[M:0] Compare Data In BusSimultaneous read/write

The data read from the CAMTernary mode

One of the two input busesTo determine the bit value During read operation

Page 13: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 13 Young Won Lim5/24/16

SRAM Cell

CMOS VLSI Design 4th ed, Weste

bit bit_b

word

Page 14: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 14

R

Sinput

select

output

Read / Write

Read / Write = 1→ READ op

Read / Write = 0→ WRITE op

BC

select

Read / Write

input output

SRAM Bit Cell RTL Model

Q

en.wikipedia.org

Page 15: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 15

R

Sinput

select

output

Read / Write = 1→ READ op

SRAM Bit Cell Read & Write Operations

Q

R

SInput x

select

output

Read / Write = 0→ WRITE op

Q0

0

0

x

xb

1

10

S=1

R=0

SET

S=0

R=1

RESET

S=0

R=0

HOLD Q=old Q

Q=old Q

Q=1

Q=0

Q=0

Q=1

Input x=1

Input x=0

en.wikipedia.org

Page 16: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 16 Young Won Lim5/24/16

10T CAM Cell

bit bit_b

match

word

CMOS VLSI Design 4th ed, Weste

Page 17: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 17

BC

select

Read / Write

input output

SRAM Bit Cell RTL Model

match

Page 18: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 18

R

Sinput

select

Read / Write

Read / Write = 1→ READ op

Read / Write = 0→ WRITE op

BC'

select

read / write

input

CAM Bit Cell RTL Model

Q

match

match

Page 19: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 19

CAM Bit Cell RTL Model – Read / Write Operations

R

Sinput

select

Q

R

Sinput

select

Q

S=1

R=0

SET

S=0

R=1

RESET

S=0

R=0

HOLD Q=old Q

Q=old Q

Q=1

Q=0

Q=0

Q=1

Input x=1

Input x=0

Read / Write = 1→ READ op

Read / Write = 0→ WRITE op

match_out

0

0

0 1

x

xb

0

match_out

0

Page 20: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 20

BC

select

Read / Write

input output

2x2 CAM Bit Cell RTL Model

match

BC

select

Read / Write

Ain1

output

match

BC

select

Read / Write

input output

match

BC

select

Read / Write

input output

match

select

select

r/w

Ain0

CAM Address

Page 21: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 21

Diagram for a Cache Memory with 2 lines

4-bit word

D3 D2 D1 D0

O3 O2 O1 O0R/W

BCBC

BCBC

BCBC

BCBC

BCBC

BCBC

BCBC

BCBC

BC

select

Read / Write

input output

match

BC

select

Read / Write

output

match

BC

select

Read / Write

input output

match

BC

select

Read / Write

input output

match

select

select

r/w

A1 A0

000801

10AB11

dataMM Address

0801AB11

Cache Memory

Main Memory

Page 22: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 22 Young Won Lim5/24/16

Cache Organization

8 sets 1-way 1 line / set

4 sets 2-way 2 lines / set

2 sets 4-way 4 lines / set

1 set 8-way 8 lines / set

Page 23: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 23 Young Won Lim5/24/16

Direct Mapping

8 sets 1-way 1 line / set

CacheMemory

MainMemory

Page 24: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 24 Young Won Lim5/24/16

2-Way Set Associative Mapping

4 sets 2-way 2 lines / set

CacheMemory

MainMemory

Page 25: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 25 Young Won Lim5/24/16

4-way Set Associative Mapping

2 sets 4-way 4 line / set

CacheMemory

MainMemory

Page 26: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 26 Young Won Lim5/24/16

Fully Associative Mapping

1 sets 8-way 8 line / set

CacheMemory

MainMemory

Page 27: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 27 Young Won Lim5/24/16

Tag Field

8 sets 1-way 1 line / set

4 sets 2-way 2 lines / set

2 sets 4-way 4 lines / set

1 set 8-way 8 lines / set

tag set block

Page 28: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 28 Young Won Lim5/24/16

Cache Mapping Method (set-view)

8 sets 1-way 1 line / set

4 sets 2-way 2 lines / set

2 sets 4-way 4 lines / set

1 set 8-way 8 lines / set

Page 29: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 29 Young Won Lim5/24/16

Cache Mapping Method (set-view)

8 sets 1-way 1 line / set

4 sets 2-way 2 lines / set

2 sets 4-way 4 lines / set

1 set 8-way 8 lines / set

Page 30: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 30 Young Won Lim5/24/16

Cache Mapping Method (way-view)

8 sets 1-way 1 line / set

4 sets 2-way 2 lines / set

2 sets 4-way 4 lines / set

1 set 8-way 8 lines / set

Page 31: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 31 Young Won Lim5/24/16

CAM (Content Addressable Memory)

Page 32: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 32 Young Won Lim5/24/16

CAM (Content Addressable Memory)

Page 33: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 33 Young Won Lim5/24/16

CAM (Content Addressable Memory)

Page 34: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 34 Young Won Lim5/24/16

CAM (Content Addressable Memory)

Page 35: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 35

BC

select

Read / Write

input output

SRAM Bit Cell RTL Model

match_out

match_in

out

Page 36: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 36

R

Sinput

select

output

Read / Write

Read / Write = 1→ READ op

Read / Write = 0→ WRITE op

BC'

select

read / write

input output

CAM Bit Cell RTL Model

Q

match_out

match_out

match_in

match_in

Page 37: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 37

CAM Bit Cell RTL Model – Read / Write Operations

R

Sinput

select

output

Q

R

Sinput

select

output

Q

S=1

R=0

SET

S=0

R=1

RESET

S=0

R=0

HOLD Q=old Q

Q=old Q

Q=1

Q=0

Q=0

Q=1

Input x=1

Input x=0

Read / Write = 1→ READ op

Read / Write = 0→ WRITE op

match_out

0

0

0 1

x

xb

0

0

match_out

0

match_in match_in

Page 38: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Cache Memory 38

BC

select

Read / Write

input output

2x2 CAM Bit Cell RTL Model

match_out

match_inout

BC

select

Read / Write

Ain1

output

match_out

match_inout

BC

select

Read / Write

input output

match_out

match_inout

BC

select

Read / Write

input output

match_out

match_inout

select

select

r/w

Ain0

Aout1 Aout0

Page 39: Cache Memory - upload.wikimedia.orgMemory 5 Young Won Lim 5/24/16 Cache : Storing a partial copy of MM 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

Young Won Lim5/24/16

References

[1] http://en.wikipedia.org/[2] https://en.wikiversity.org/wiki/The_necessities_in_SOC_Design[3] https://en.wikiversity.org/wiki/The_necessities_in_Digital_Design[4] https://en.wikiversity.org/wiki/The_necessities_in_Computer_Design[5] https://en.wikiversity.org/wiki/The_necessities_in_Computer_Architecture[6] https://en.wikiversity.org/wiki/The_necessities_in_Computer_Organization[7] https://en.wikiversity.org/wiki/Understanding_Embedded_Software[8] Digital Systems, Hill, Peterson, 1987