For basic STCAM operation, a certain number of RAM accesses are required based on the number of masks and the number of entries. The number of RAM accesses required due to the number of masks is fixed and does not depend on the number of entries. For this reason, the hardware cost is relatively high for small tables with few entries. Due to this, the storage efficiency for small STCAMs is lower. For larger STCAMs, the cost related to the number of masks gets amortized by a larger number of entries and the storage efficiency increases. For large STCAMs, the storage efficiency approaches 95%.
For STCAMs used for Longest Prefix Match (LPM) IP forwarding, it is often beneficial to use a narrow width response for indirection since there are many more forwarding entries than next hops. For example, if there are 1M IPv4 routes, but only 32K next hops, a 15-bit wide response would be sufficient to point out the next hops. Indirection is also useful for other purposes; if a next hop changes, then only the next hop entry needs to be modified instead of thousands of forwarding entries. For LPM, the number of priorities is also limited to the number of prefix lengths. This should be considered when the priority width is configured.
For IPv6 forwarding tables, it is beneficial to separate routes and host routes. Routes require a 64-bit wide LPM lookup and host routes a 128-bit wide exact match lookup. By separating the routes and host routes, the cost related to the number of masks is reduced and 64 bits of key data is saved for every route. One way of doing this is to lookup the 64-bit wide network part of the IPv6 packets in a 64-bit wide STCAM. If the lookup matches a host route, the response from the routing table could be a compressed IPv6 network part. For example, the 64 bits of the network part is compressed to 16 bits and returned as response data. These 16 bits together with the 64 remaining bits of the host part can be looked up in an 80-bit wide BCAM. If there are routes with a prefix length between 64 and 128, the second BCAM can be replaced with an STCAM using 16 bits of exact match and 64 bits of LPM.