Tag Archives: ram

Typical CAM usage

Typically, a network board consists of a network processor, associated memories and CAM’s (multiple cams used in cascade configuration when the table density is more) and the physical interface.

As shown below, the network processor has multiple interfaces:
1. Ingress/egress ports. Ports through which data exchange happens.

2. Host interfaces. This interface is used to access the network processor for configuration setting and the other updates to be carried out.

3. Associated SRAM interfaces. The associated SRAM holds the packet forwarding information such as the port numbers and QoS which is accessed by the network processor to process the packet received. The index or address for accessing the associated SRAM is typically driven by the search result received from the CAM.

4. CAM interface. This is used to access the cam, update the database, perform searches and access the results. The result of the searches performed is typically used by the network processor to link it to the associated SRAM address in order to access the forwarding related information.

Working of a CAM

Let us see how CAM works in hardware. As mentioned earlier CAM can be binary or ternary.

Binary CAM cell
CAM logic will simply have the storage circuitry and comparator logic to provide the match information for the searches performed. In this case a XOR gate is used to compare between the stored data and the searched data.

Ternary CAM cell
A Ternary cam as the name indicates has three states 0,1 and X. A “don’t care” condition exists in a ternary CAM to mask off certain bits for a partial match. The possibility of masking off of certain bits of the data opens up a wide range of applications where partial match is necessary; for instances at the edge of a router, where the router only worries about the destination network address and not the host ID.( An IP address consists of two fields: network ID and host ID).

Software and Hardware CAM

Hardware search engines are faster than algorithmic approaches for search intensive applications. Also, the turnaround time of a hardware CAM would be highly deterministic while that of software would depend on how efficiently the search-tree balancing algorithm is implemented. However, software would results in low costs. Hybrid CAMS integrate the robustness of a hardware CAM while providing the flexibility of high degree of software programming.

Types of CAMs

Fundamentally, CAM’s are of two types binary and ternary. As the name indicates a binary CAM has two bit states (’1′ and a ’0′), while a ternary CAM has ’1′, ’0′ and a third state called “don’t care”, so a search-hit on a ternary CAM would be an exact match or a partial match.

Currently, ternary CAMs are defacto in the industry. These bring the possibility of multiple match in a lookup table. All the access list tables for packet forwarding use a popular address resolution algorithm called the longest prefix match where the addresses are placed in the CAM based on certain priorities and the CAM by itself has priority encoder that helps in resolving the winning address.

CAM's : Memories Faster then RAM's

Content Addressable Memorys (CAM’s) in their most trivial form, work in a way opposite to conventional memories. While a random access memory (RAM) returns data upon providing the address, a CAM provides address when data is supplied. So effectively a CAM is a search tool that looks for the data in question within its data base.

CAM’s commonly work as hardware search engines in routers and switches to accelerate forwarding of packets on the destination route. We will talk about the various other applications that consider a CAM as an important processing engine as we proceed engine as we proceed in this article.

As indicated in its definition, CAM holds the address to be looked up for and returns the route associated information to the host processor to perform the successive tasks of forwarding the incoming packet. So we can also define a CAM as a network coprocessor to the central processor.

Note that TCP/IP and /or OSI models are taken here as reference to explain the concepts similar analogies may be drawn with other protocols like IPX/SPX, Apple Talk and UDP.