STCAM - 2022.2 English

Vitis Networking P4 User Guide (UG1308)

Document ID
2022.2 English

Semi-ternary CAMs (STCAM) use a form of a ranged match comparing the most significant bits of the key to a table of prefixes in a table. The longest matching prefix has priority over any other matches. The associated value for the longest prefix is returned within the response as well as an indication of whether the key produced a prefix match. The STCAM is a restricted version of TCAM for the purpose of more efficient implementation in hardware. It is limited in the number of unique masks as specified by num_masks. This CAM uses internal URAM or BRAM to store data. There are limits for the number of URAMs and BRAMs that can be used at higher frequencies. See Semi-Ternary CAM Search LogiCORE IP Product Guide (PG319), Tables 1 and 6 for parameter limits, and NUM_ENTRIES in Chapter 5, Design Flow Steps, for more information on these limits.

  • Key width: up to 1024 bits
  • Response width: up to 1024 bits
  • Hit/miss flag: Yes
  • Number of masks: 2 to 64

Here is an example of how to instantiate an STCAM in a P4 file:

    table forwardIPv6 {
        key             = { hdr.ipv6.dst : lpm; }
        actions         = { forwardPacket; 
                            dropPacket; }
        size            = 1024;
        default_action  = dropPacket;

For more details on how the compiler selects an STCAM, see the Compile Table Selection section of this chapter. See the Semi-Ternary CAM Search LogiCORE IP Product Guide (PG319) for more information on STCAMs.