/
CAM Content Addressable Memory CAM Content Addressable Memory

CAM Content Addressable Memory - PowerPoint Presentation

giovanna-bartolotta
giovanna-bartolotta . @giovanna-bartolotta
Follow
408 views
Uploaded On 2018-03-21

CAM Content Addressable Memory - PPT Presentation

For TAG lookup in a FullyAssociative Cache Fully Associative Cache Tag0 Tag1 Tag15 Tagin V V V 1 Data0 Data1 Data15 Tag0 Tag1 Tag15 Tagin V V V 1 Data0 ID: 659614

address data tag cam data address cam tag block cache set empty ram write addr bit location valid associative

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "CAM Content Addressable Memory" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

CAMContent Addressable Memory

For TAG look-up

in a

Fully-Associative CacheSlide2

Fully Associative Cache

Tag0

Tag1

Tag15

==

==

==

Tagin

V

V

V

1

Data0

Data1

Data15Slide3

Tag0

Tag1

Tag15

==

==

==

Tagin

V

V

V

1

Data0

Data1

Data15

CAM

Data RAMSlide4

Tag search Using CAM

CAM: Content Addressable Memory

Input: Data

Output: Address

It searches for the content (input data) and provides the address of the location with that contentTag search using CAMInput: Tag portion of the block address requestedOutput: One hot coded or encoded binary address of where the tag is found => i.e. the address of the data in the data RAMSlide5

Tag search using CAM

Tag0

Tag1

Tag15

==

Tag in

V

V

V

==

==

Match 0

Match 1

Match 15

At most one match signal is high

Match signal determines the correct line in DATA RAM

One hot encoded address for Data RAM

==

Tag in

RE

WESlide6

Interfacing with Data RAM

Use binary encoding to generate address from Tag RAM

Use that address to fetch data from Data RAM

(Hit == 1) => Address is valid

(Hit == 0) => Address is invalid

CAM

16 X 8

Tag In

Addr

8

Hit

4

1

Data RAM

16 X 32

4

32

Addr

Data

RE

Data RAM

64 X 32

4

32

Addr

Data

2

Word Field

Data RAM with

one word/block

Data RAM with

four words/blockSlide7

Updating CAM

CAM should be updated on a cache miss

Use Write Enable Signal

Input: Location to write

Input: Tag to be written

CAM

16 X 8

Addr

7

Hit

4

1

Tag In

WE

4

Write

Addr

RE

Note: Address to write can be one of the empty locations address if the cache is not full.

If the cache is full, the “Victim” address is chosen using either RANDOM replacement algorithm or LRU (Least Recently Used) replacement algorithm. In a Write-back cache, if the victim block is dirty, it should first be copied to the MM. Then Data is written into the Data RAM while Tag (along with Valid-bit == 1) is written into the CAM.

1Slide8

Empty address

CAM constantly generates Empty information and also an empty address for use by CCU if it is going to bring a new (missing) block into cache and store the corresponding Tag into the CAM.

If multiple locations of the CAM are empty, the address of the lowest addressed empty location can be produced. This is to be deterministic instead of being random in choosing an empty address as logic to make it random is more expensive.Slide9

Showing Empty Address also

When you bring a new block you not only deposit the TAG in the CAM but you validate it by setting the Valid bit to 1. If we are always writing a “1” into the valid bit can we avoid stating it explicitly through a pin and save a pin? Well we write a zero in the valid bit if we are flushing out a block for various reasons (1. replacing the dirty block in preparation to bring a new block into cache, 2. in a multicore system to be covered later, if the cache in another core requests the block as he wants to write to it, we need to give away the block and invalidate it in this core’s cache). So we need the input pin for Valid bit.

CAM

16 X 8

Hit Addr

7

Hit

4

1

Tag In

WE

4

Write

Addr

RE

1

Empty Addr

Empty

4

1

Empty Addr

LRU Addr

EmptySlide10

A CAM for Fully-Associative Mapping only?

A CAM is certainly used in fully associative mapping (in TLBs, in routers, etc. but not in cache as cache are too big for fully-associative mapping).

But a CAM can also be used whenever the degree of set associativity is quite high (say 16 or more) where so many shallow TAG RAMs do not make sense. See Q#4.3 from the

ee457_MT_Spring2017

.Slide11

Q#4.3 of

ee457_MT_Spring2017

Processor: 80486 (32-bit address, 32-bit data, byte-addressable processor)

Cache size: 1KB (256 32-bit words in 4 byte-wide banks each 256x8)

Block size = 4 words => Block frames = 64

DoSA ( Degree of Set Associativity ) = 32Number of sets = 2This is almost fully associative. 32 segregations (with 32 2-location TAG RAMs and 32 8-location DATA RAMs) does not make sense.So we choose to handle with 2 CAMs and 2 DATA RAMs as shown on next page. Each CAM searches the block frames in one set.Slide12

Q#4.3 of

ee457_MT_Spring2017

Incomplete diagram in the QuestionSlide13

Q#4.3 of

ee457_MT_Spring2017

Solution diagramSlide14

Explanation of the “i” and the “j” in the figure

If the processor wants to read or write to the cache, the CCU would first ascertain that the block is present in the specific set (I = 0 or 1 based on the set bit in the address from the CPU) and then allow the processor to read from or write to the data ram of that set.

The “i” (either a “0” or a “1” based on the set #)

When there is a cache miss, the cache control unit (CCU) will bring the block from MM and will deposit in either set 0 or set 1 based on the set index bit of the address of the block. Within the set, it will choose an empty location if available, or a victim location chosen by LRU or Random replacement algorithm, if it is full.

The “j” (either a “0” or a “1” based on the set #)Slide15

Q#4.3 of

ee457_MT_Spring2017

Solution diagram replicated for the two sets (set

0

and set

1)

Set 1