Overview - Overview - 2.0 English - PG468

DRAM Semi-Ternary CAM 2.0 LogiCORE IP Product Guide (PG468)

Document_ID
PG468
Release_Date
2026-01-30
Version
2.0 English

The DRAM Semi-Ternary CAM (DSTCAM) Search AMD LogiCORE™ IP is related to the on-chip STCAMs provided by AMD, see Semi-Ternary CAM Search LogiCORE IP Product Guide (PG319). DSTCAM uses dynamic random access memory (DRAM) as storage for entries, whereas on-chip STCAM uses FPGA's internal SRAM. This enables DSTCAM to store much more entires. DSTCAM is a member of the family of CAMs provided by AMD. The CAM family consists of the following members:

Binary CAM (BCAM)
Used for exact matching, BCAM is available in two versions. A software-managed version and a hardware-managed version (CBCAM). CBCAM offers you the flexibility to insert or delete entries using a hardware interface with or without a software driver. For more information, see Binary CAM Search LogiCORE IP Product Guide (PG317).
Cached DRAM Binary CAM (CDBCAM)
Used for exact matching, CDBCAM is similar to BCAM except that it uses DRAM as the primary storage for entries, whereas BCAM uses UltraRAM (URAM) or block RAM (BRAM). CDBCAM can store more entries, and, in combination with its on-chip BCAM cache, it can achieve lookup rates comparable to the BCAM. Similar to the BCAM, the CDBCAM supports both a software managed and hardware managed interface. For further information, see Cached DRAM Binary CAM LogiCORE IP Product Guide (PG427).
DRAM Semi-Ternary CAM (DSTCAM)
Described in this document, DSTCAM is fully flexible in terms of number, size and position of wildcard (ignored) fields. Every key bit has a corresponding mask bit. The number of allowed unique masks is however limited. This allows for considerable memory and logic optimizations. For LPM applications, DSTCAM uses special hardware to compress keys, which improves storage efficiency. The LPM mode uses prefix masks instead of fully flexible masks, which reduces cost. DSTCAM is designed to operate with variable rate and latency optimizing the average rate.
Semi-Ternary CAM (STCAM)
STCAM is available in two versions, one with fixed rate and latency and the other with variable rate and latency for low-cost applications. The variable-rate STCAM is similar to the DSTCAM except that it uses Block RAM (BRAM) or UltraRAM (URAM) to store the entries, whereas DSTCAM uses DRAM. For more information, see Semi-Ternary CAM Search LogiCORE IP Product Guide (PG319).
Ternary CAM (TCAM)
The primary usage of TCAM is tables requiring full flexibility in terms of size and position of wildcard (ignored) fields. Every key bit has a corresponding mask bit stored together with the key. All entries can have different masks. TCAMs are used for Access Control List (ACL) type of lookups, requiring a large number of different masks. For more information, see Ternary CAM Search LogiCORE IP Product Guide (PG318).

One or multiple instances of each type can be used inside the same FPGA. Different types can also be mixed inside the same FPGA. Each CAM type is optimized for its specific task in terms of hardware resource usage.

The Lookup interface of the DSTCAM receives a lookup key and outputs a result that contains a match flag indicating whether the masked lookup key matches the masked key of any entry in the DSTCAM. The width of the mask is the same as the key width. A cleared mask bit invalidates the corresponding key bit and ignores it. Both the lookup key and the stored key are bit-wise ANDed with the mask prior to the bit-wise matching.

If multiple entries are matched, the response value of the matching entry with the lowest priority is output. If two entries have the same priority, one of them is arbitrarily picked as the winner. The API software ensures that two entries with the same masked key cannot be inserted.

The entries are read and written using a driver consisting of a set of high-level API functions. The API functions are written in C and delivered as part of the IP. The API encapsulates the details of memory management and register access and provides a simple and efficient software interface. The API software with detailed documentation is found on the CAM IP product page. You must add the basic hardware read and write functions to the API. This allows for flexible hardware mapping and consequently, the communications link between the API software and the hardware adapts to the your desired specifications. The communication link could be, for instance, AXI4-Lite or PCIe® .

Following are the main functions of the DSTCAM API:

  • stcam_create
  • stcam_destroy
  • stcam_insert
  • stcam_delete
  • stcam_update

Arguments for stcam_insert, stcam_delete, stcam_update are:

  • key
  • mask
  • priority
  • response

LPM mode uses a simplified API using prefix length instead of the mask and priority arguments. For LPM mode, the main functions are:

  • lpm_create
  • lpm_destroy
  • lpm_insert
  • lpm_delete
  • lpm_update

The driver maintains a CPU shadow of the CAM Database. This way high latency read operations to the CAM Database from the CPU is eliminated. It also allows for testing the interaction between control plane and driver without any hardware.

A DSTCAM design is highly configurable at compile time, which makes it suitable for a large variety of applications. For LPM mode most configuration parameters can be omitted. The reduced set of parameters can be found in the subsequent table. The following table lists the configuration parameters.

Table 1. Configuration Parameters
Parameter Name Valid Range Description
LPM_MODE False This is a regular STCAM.
KEY_WIDTH 10–992 bits

The width of the lookup key.

KEY_WIDTH + RESPONSE_WIDTH + PRIORITY_WIDTH + CTRL cannot exceed 2048

CTRL = 1 (VARIABLE_RATE = FALSE)

CTRL = up to 11 + total width of ranges (VARIABLE_RATE = TRUE)

RESPONSE_WIDTH 1–1024 bits

The width of the lookup response.

KEY_WIDTH + RESPONSE_WIDTH + PRIORITY_WIDTH + CTRL cannot exceed 2048

CTRL = 1 (VARIABLE_RATE = FALSE)

CTRL = up to 11 + total width of ranges (VARIABLE_RATE = TRUE)

FORMAT_STRING N/A Range matching requires a format string. The key width is derived from the format string and does not need to be specified. For more information, see Format String.
PRIORITY_WIDTH 0–32 bits The width of the priority assigned to each entry. Usually, each entry would use its own priority value. To simplify inserts of new entries between two existing entries (without changing priority of existing entries), more priority values than number of entries can be used. Entries using the same mask cannot match at the same time and can thus use the same priority value. This would reduce the number of priority values. The PRIORITY_WIDTH needs to be set wide enough to accommodate all priority values.
NUM_MASKS

1–256 (VARIABLE_RATE = FALSE)

1–1024 (VARIABLE_RATE = TRUE)

The number of unique masks. NUM_MASKS can be omitted if a format string is used. If omitted, NUM_MASKS is set to a default value based on conservative ACLs using NUM_ENTRIES rules.
NUM_ENTRIES 1–1M The supported number of entries (depth).
DRAM_TYPE HBM, DDR4, or LPDDR5 The type of DRAM used.
LOOKUP_RATE 1–150 Mlps This is the supported lookup rate of the instance (expressed in million lookups per second). To save resources, it is important not to set the lookup rate higher than required.
LOOKUP_INTERFACE_FREQ 1–600 MHz This is the clock frequency of the Lookup Request and Lookup Response interfaces.

LOOKUP_INTERFACE_FREQ >= LOOKUP_RATE

RAM_FREQ 1–600 MHz This is the clock frequency of the CAM database. Significant resource savings can be achieved by setting the RAM_FREQ parameter higher than the LOOKUP_RATE. This enables time division of the hardware resources, see the TDM_FACTOR parameter.
TDM_FACTOR 1–256

TDM_FACTOR must be set as high as possible while still achieve timing closure.

For more information, see Throughput.

Example:

At 400K updates per second and LOOKUP_RATE = 100 Mlps, TDM_FACTOR = 4 can be used if RAM_FREQ = 401 MHz

The Block RAM or Ultra RAM can be accessed four times per lookup, saving logic resources and up to four times the Block RAM or Ultra RAM.

CLOCKING_MODE SINGLE_CLOCK or DUAL_CLOCK The use of a separate RAM clock is optional. If RAM_FREQ = LOOKUP_INTERFACE_FREQ, then the single clock mode is enabled. In single clock mode, only the lookup interface clock is used for lookup interfaces, RAM and match logic.
NUM_PCS 1, 2, or 4

The default value is set in the GUI and calculated based on NUM_ENTRIES and entry width. The entry width is either 32 B, 64 B, or 128 B. The default value calculation tries to minimize the number of PCs. The default value can be changed to use more but not fewer PCs. If the number of PCs is increased, the memory BW increases allowing for a higher lookup rate. If more PCs are used, the memory usage per PC is automatically reduced.

Note:
  • NUM_PCS = 1 for DDR4
  • NUM_PCS = NUM_NOC_NMU_IF for LPDDR5
DEDICATED_PC Boolean (True or False) Set a PC to not used, a dedicated PC is always free.
NUM_NOC_NMU_IF 1, 2, or 4

The total number of NoC Master Units used for NoC connection.

HBM
Generally, values equal to the number of PCs, twice the number of PCs, and half the number of PCs are allowed.

A recommended value is suggested when the number of PCs is selected; this gives best performance while minimizing resource usage.

DDR4
Fixed to 1.
LPDDR5
1 or 2 (implicitly affects NUM_PCS).
Table 2. LPM Mode Configuration Parameters
Parameter Name Valid Range Description
LPM_Mode True DSTCAM operates in LPM mode.
KEY_WIDTH 10–256 bits

The width of the lookup key.

KEY_WIDTH + 8*RESPONSE_WIDTH + CTRL cannot exceed 512

CTRL= 32 to 63

RESPONSE_WIDTH 2–32 bits

The width of the lookup response.

KEY_WIDTH + 8*RESPONSE_WIDTH + CTRL cannot exceed 512

CTRL= 32 to 63

FORMAT_STRING N/A For more information, see section Format String in Designing with the Core.
NUM_ENTRIES 512–8M The supported number of guaranteed keys/prefixes (depth). In LPM mode, keys are compressed. This means that actual number of keys that fit in the CAM is between NUM_ENTRIES and 8 x NUM_ENTRIES. For large IPv4 BGP routing tables (RouteViews), 2.5 x NUM_ENTRIES keys fit.
DRAM_TYPE HBM, DDR4, or LPDDR5 The type of DRAM used.
LOOKUP_RATE 1–150 Mlps

This is the supported lookup rate of the instance (expressed in million lookups per second). To save resources it is important not to set the lookup rate higher than required.

LOOKUP_INTERFACE_FREQ 1–600 MHz

This is the clock frequency of the Lookup request and response interfaces.

LOOKUP_INTERFACE_FREQ >= LOOKUP_RATE

RAM_FREQ 1–600 MHz This is the clock frequency of the memories and the internal datapath. An optional, high frequency RAM clock enables time division of the hardware resources, leading to significant savings. See the TDM_FACTOR parameter.
TDM_FACTOR 1–256

TDM_FACTOR must be set as high as possible while still achieve timing closure.

For more information, see Throughput.

Example:

At 300K updates per second and LOOKUP_RATE = 150 Mlps, TDM_FACTOR = 2 can be used if RAM_FREQ = 301 MHz.

The RAM can be accessed two times per lookup, saving up to two times the RAM and logic resources for small table configurations.

CLOCKING_MODE SINGLE_CLOCK or DUAL_CLOCK The use of a separate RAM clock is optional. If RAM_FREQ = LOOKUP_INTERFACE_FREQ, then the single clock mode is enabled. In single clock mode, only the lookup interface clock is used for lookup interfaces, RAM, and match logic.
DEDICATED_PC Boolean (True or False) Set a PC to not used, a dedicated PC is always free.
NUM_NOC_NMU_IF 1, 2, or 4

The total number of NoC Master Units used for NoC connection.

HBM
Generally, values equal to the number of PCs, twice the number of PCs, and half the number of PCs are allowed.

A recommended value is suggested when the number of PCs is selected; this gives best performance while minimizing resource usage.

DDR4
Fixed to 1.
LPDDR5
1 or 2 (implicitly affects NUM_PCS).
OVERRIDE_NMU Boolean (True or False) Based on the number of PCs you select, the optimal number of NoC NMUs are automatically populated in Vivado IDE.

To increase the number of NMUs for a potentially higher lookup rate, you must enable the OVERRIDE_NMU parameter.

You must manually set these configuration parameters prior to generating the DSTCAM hardware or calling the software DSTCAM API. Ensure that the parameters used to generate the hardware DSTCAM and the parameters used to call the software DSTCAM are identical.