What’s TCAM?
TCAM stands for Ternary Content-addressable Memory. It is a kind of CAM. Then, What the CAM is? CAM is Content-addressable Memory. The principle of CAM is giving CAM a keyword. Then, the user gets an address to go. Like going to the 8 floors library, asking the librarian where the book named “Lord of the ring : the fellowship of the ring” is. Then, the librarian gives a location such as 8th floor, shelf A, row C and column B. CAM’s principle is retrieving fixed-length keywords and searching in the rule table. Giving an address to the user as the answer. In addition, the keyword must only be “0” or “1”.
CAM works opposite to RAM. RAM is working by giving it a location. After That, the user retrieves the data. For easy to understand, from the last example in the library, the user knows the location which is 8th floor , shelf A, row C and column B. but user does not know what the book is until the user gets to the location.
Now, The question is: How does TCAM work? TCAM works similarly to CAM but there are slightly different. Users must give CAM a full keyword in order to get the result. TCAM, on the other hand, requires only a part of the keywords but the length needs to be equal to the full keyword. Let’s go back to the library example again but this time it is different. When the user requests the location of “Lord of the ring : xxx xxxxxxxxxx xx xxx xxxx”. The Librarian of CAM version would not give an answer due to “Lord of the ring : xxx xxxxxxxxxx xx xxx xxxx” is not recognized. Users have to input the “xxx xxxxxxxxxx xx xxx xxxx” part to get the answer. To contrast, the librarian of the TCAM version would give the answer even though it gets the “Lord of the ring : xxx xxxxxxxxxx xx xxx xxxx” keyword. But the answers might not be an “8th floor , shelf A, row C and column B”. The answer depends on the rules table of TCAM. The reason TCAM is able to give an answer with unreadable inputs. Because TCAM accepts “X” or “don’t care” inputs not only “0” or “1” in CAM’s principle.
Application
Most applications on TCAM are found in high-end Network devices for example routers and switches with fancy options. CAM is a perfect solution to increase speed of route lookup, package forwarding and package classification. To be easy to understand, MAC is fixed-length information in a package. When the package reaches the switch or router, they need to tell the package where to go. If the switch is composed of TCAM. Just match the MAC in the rule table and the package knows where to go. Without TCAM, Router or Switch goes to RAM address by address to search for the matched MAC they are looking for. Then, tell the packet where to go. RAM takes more time than using TCAM to get the same result. However, there are some cons by using TCAM which is price. Due TCAM might be a dedicated chip opposite to the RAM. RAM might be embedded in the CPU which is cheaper than using the other chip to do the same action.
Conclusion
CAM is like a search engine in circuit with a fixed-length of keyword to search and accept only “0” or “1” input. TCAM is a developed version of CAM that accepts “don’t care” input but the keyword is still fixed-length. CAM is working opposite to RAM. CAM is using a keyword to find the location. RAM is going to the location and gets the data. Therefore, CAM is mostly used in network devices due its ability to find the way which is the job of router or switch.
More info about TCAM on FPGA, please visit