You are on page 1of 2

Content-addressable memories (CAMs) are hardware search engines that are much

faster than algorithmic approaches for search-intensive applications.


CAM Application: Router Address Lookup
Internet routers forward data packets from an incoming port using an address lookup
function [RSBD01]. The address lookup function examines the packet's destination
address and chooses an output port associated with that address. The router's list of
destination addresses and their corresponding output ports is called the routing table.
An example of a simplified routing table is displayed in Table 1. All four entries in the
table are 5-bit words, with the don't care bit, X, matching both a 0 and a 1 in that
position. Because of the X bits, the first three entries in Table 1 represent a range of
input addresses, i.e. the entry on Line 1 indicates that all addresses in the range of
10100 10111 are forwarded to port A. The router searches for the destination
address of each incoming packet in the address lookup table to find the appropriate
output port. For example, if the router receives a packet with the incoming address
01101, the address lookup matches both Line 2 and Line 3 in the table. Line 2 is
selected since it has the most defined bits, indicating it is the most direct route to the
destination.
2

Line No.

Address (Binary)

Output Port

1
2
3
4

101XX
0110X
011XX
10011

A
B
C
D

Table 1: Simplified routing table.


Content-Addressable Memory
There are two basic forms of CAM: binary and ternary.
Binary CAMs support storage and searching of binary bits, zero or one (0,1). Ternary
CAMs support storing of zero, one, or don't care bit (0,1,X). Ternary CAMs are
presently the dominant CAM since longest-prefix routing is the Internet standard.
Figure 1 shows a block diagram of a simplified 4 x 5 bit ternary CAM with a NORbased architecture. The CAM contains the routing table from Table 1 to illustrate how

a CAM implements address lookup. The CAM core cells are arranged into four
horizontal words, each five bits long. Core cells contain both storage and comparison
circuitry. The search lines run vertically in the figure and broadcast the search data to
the CAM cells. The matchlines run horizontally across the array and indicate whether
the search data matches the row's word. An activated matchline indicates a match and
a deactivated matchline indicates a non-match, called a mismatch in the CAM
literature. The matchlines are inputs to an encoder that generates the address
corresponding to the match location.

Figure 1: NOR-based CAM architecture (adapted from [Sch96])


In the example, the encoder selects numerically the smallest numbered matchline of
the two activated matchlines, generating the match address 01. This match address is
used as the input address to a RAM that contains a list of output ports as depicted in
Figure . The match address output of the CAM is in fact a pointer used to retrieve
associated data from the RAM. In this case the associated data is the output port.

Figure 2: Address lookup with CAM/RAM.

You might also like