Content-addressable memory (CAM) is a special type ofcomputer memory used in certain very-high-speed searching applications. It is also known asassociative memory orassociative storage and compares input search data against a table of stored data, and returns the address of matching data.[1]
CAM is frequently used innetworking devices where it speeds upforwarding information base androuting table operations. This kind of associative memory is also used in cache memory. In associative cache memory, both address and content is stored side by side. When the address matches, the corresponding content is fetched from cache memory.
Dudley Allen Buck invented the concept of content-addressable memory in 1955. Buck is credited with the idea ofrecognition unit.[2]
Unlike standard computer memory,random-access memory (RAM), in which the user supplies a memory address and the RAM returns the data word stored at that address, a CAM is designed such that the user supplies a data word and the CAM searches its entire memory to see if that data word is stored anywhere in it. If the data word is found, the CAM returns a list of one or more storage addresses where the word was found. Thus, a CAM is the hardware embodiment of what in software terms would be called anassociative array.
A similar concept can be found in thedata word recognition unit, as proposed byDudley Allen Buck in 1955.[3]
A major interface definition for CAMs and othernetwork search engines was specified in an interoperability agreement called theLook-Aside Interface (LA-1 and LA-1B) developed by theNetwork Processing Forum.[4] Numerous devices conforming to the interoperability agreement have been produced byIntegrated Device Technology,Cypress Semiconductor,IBM,Broadcom and others. On December 11, 2007, the OIF published the serial look-aside (SLA) interface agreement.[citation needed]
CAM is much faster than RAM in data search applications. There are cost disadvantages to CAM, however. Unlike a RAMchip, which has simple storage cells, each individual memorybit in a fully parallel CAM must have its own associated comparison circuit to detect a match between the stored bit and the input bit. Additionally, match outputs from each cell in the data word must be combined to yield a complete data word match signal. The additional circuitry increases the physical size and manufacturing cost of the CAM chip. The extra circuitry also increases power dissipation since every comparison circuit is active on every clock cycle. Consequently, CAM is used only in specialized applications where searching speed cannot be accomplished using a less costly method. One successful early implementation was a General Purpose Associative Processor IC and System.[5]
In the early 2000s several semiconductor companies includingCypress,IDT,Netlogic, Sibercore,[6] andMOSAID introduced CAM products targeting networking applications. These products were labelled Network Search Engines (NSE), Network Search Accelerators (NSA), and Knowledge-based Processors (KBP) but were essentially CAM with specialized interfaces and features optimized for networking. CurrentlyBroadcom offers several families of KBPs.[7]
To achieve a different balance between speed, memory size and cost, some implementations emulate the function of CAM by using standard tree search or hashing designs in hardware, using hardware tricks like replication or pipelining to speed up effective performance. These designs are often used inrouters.[citation needed] TheLuleå algorithm is an efficient implementation for longest prefix match searches as required in internet routing tables.
Binary CAM is the simplest type of CAM and uses data search words consisting entirely of1s and 0s.Ternary CAM (TCAM)[8] allows athird matching state ofX ordon't care for one or more bits in the stored word, thus adding flexibility to the search. For example, a stored word of10XX0 in a ternary CAM will match any of the four search words10000,10010,10100, or10110. The added search flexibility comes at an additional cost over binary CAM as the internal memory cell must now encode three possible states instead of the two for the binary CAM. This additional state is typically implemented by adding a mask bit (care ordon't care bit) to every memory cell.In 2013,IBM fabricated a nonvolatile TCAM using 2-transistor/2-resistive-storage (2T-2R) cells.[9] A design of TCAM using hybrid FerroelectricFeFET was recently published by a group of International scientists.[10]
Content-addressable memory is often used incomputer networking devices. For example, when anetwork switch receives adata frame from one of its ports, it updates an internal table with the frame's sourceMAC address and the port it was received on. It then looks up the destination MAC address in the table to determine what port the frame needs to be forwarded to, and sends it out on that port. The MAC address table is usually implemented with a binary CAM so the destination port can be found very quickly, reducing the switch's latency.
Ternary CAMs are often used in networkrouters, where each address has two parts: thenetwork prefix, which can vary in size depending on thesubnet configuration, and the host address, which occupies the remaining bits. Each subnet has a network mask that specifies which bits of the address are the network prefix and which bits are the host address.Routing is done by consulting a routing table maintained by the router which contains each known destination network prefix, the associated network mask, and the information needed to route packets to that destination. In a simple software implementation, the router compares the destination address of the packet to be routed with each entry in the routing table, performing abitwise AND with the network mask and comparing it with the network prefix. If they are equal, the corresponding routing information is used to forward the packet. Using a ternary CAM for the routing table makes the lookup process very efficient. The addresses are stored usingdon't care for the host part of the address, so looking up the destination address in the CAM immediately retrieves the correct routing entry; both the masking and comparison are done by the CAM hardware. This works if (a) the entries are stored in order of decreasing network mask length, and (b) the hardware returns only the first matching entry; thus, the match with the longest network mask (longest prefix match) is used.[11]
Other CAM applications include:
The TLB is a small associative memory which maps virtual to real addresses.