What Does Ternary Content-Addressable Memory (TCAM) Mean?
Ternary content-addressable memory (TCAM) is a type of content-addressable memory (CAM) that allows a third state of “don’t care” or "X" in one or more of the bits of stored data, adding flexibility to the search. The word “ternary” refers to the number of inputs that the memory can store and query: 0, 1 and X or wild card. On the other hand, binary CAMs can only query using 1s and 0s.
Techopedia Explains Ternary Content-Addressable Memory (TCAM)
Ternary content-addressable memory is a type of CAM, which is considered an opposite of RAM because it does not access data in the same way, by providing a specific memory address to where the data is stored. But CAM-stored data can only be accessed by querying the specific data that is required and the CAM then retrieves the addresses where the queried data is stored. CAM is used for storing and searching on fixed-length data, which makes it perfect for storing MAC addresses because these have a fixed length. It is also faster than RAM because it allows parallel searching.
Regular CAM or binary CAM can only search with 1s and 0s, but ternary CAM adds an "X" to the mix so that data does not need to match exactly, adding to its flexibility. This makes it ideal for storing access control (ACL) lists in enterprise-grade switches and routers since it can be searched by a wider field, making the search more flexible. For example, an entire range of IP addresses can be searched at once instead of comparing all the content one by one. This is useful for increasing the speed of route lookup, packet forwarding, packet classification and ACL-based commands.
Even with its benefits, TCAM is rarely used in the electronics industry because it is expensive to build and consumes a lot of power, which is then transformed into heat, resulting in additional power requirements for cooling.