A method and apparatus for improving the efficiency of multi-level TCAM verification
By generating randomized TCAM configurations and multi-dimensional stimuli, combined with a multi-level comparison mechanism, the low hit rate and complex coordination problems in multi-level TCAM verification are solved, improving verification efficiency and coverage, and making it suitable for high-complexity chip designs.
Patent Information
- Application Number
- CN202510230793.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-02-27
AI Technical Summary
In existing technologies, multi-level TCAM verification has low efficiency, low hit rate, and difficulty in fully covering the collaborative working scenarios of multi-level TCAM. Traditional verification methods are unable to meet verification requirements.
Randomized TCAM configurations are generated based on user-defined byte matching number constraints and valid entry number constraints. These configurations are then synchronized to the DUT and reference model via atomic operations to generate multi-dimensional stimuli and perform multi-level comparisons, thereby achieving dynamic configuration and multi-level conflict detection.
It significantly improves the verification efficiency and coverage of multi-level TCAM, increases the hit rate, shortens the verification cycle, reduces debugging and error correction time, and supports verification of complex interactive scenarios.
Smart Images

Figure CN120086139B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication design technology, and specifically relates to methods and apparatus for improving the efficiency of multi-level TCAM verification. Background Technology
[0002] TCAM (Ternary Content Addressable Memory) is a tri-state content-addressable memory primarily used for fast lookup of entries in access control lists (ACLs), routing tables, and other similar databases. TCAM's lookup mechanism differs from traditional memories (such as SRAM and DRAM). It derives its address based on the stored content. After inputting data (called a key, used to match the key value for finding a TCAM entry), the TCAM internally compares the key with stored entries in parallel and outputs the matching address. If multiple entries match, the address with the smallest match is output. A single TCAM typically has 512 entries × 40 bits. Multiple TCAMs can be cascaded or stacked through control bit settings, thereby expanding the entry width or number of entries. However, configuring TCAM entries and sending stimulus constraints is a complex issue. Current TCAM verification faces the challenge of extremely low hit probability (e.g., 512 / 10) for single-level TCAMs under random stimuli. 40 The traditional verification methods are insufficient to fully cover the collaborative working scenarios of multi-level TCAMs and suffer from low verification efficiency. Furthermore, the data interaction and dependencies between multi-level TCAMs make it difficult to meet verification requirements. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for improving the efficiency of multi-level TCAM verification. It aims to solve the problems of low hit rate and complex multi-level coordination in traditional random verification in related technologies.
[0004] According to a first aspect of this application, a method for improving the efficiency of multi-level TCAM verification is provided, comprising:
[0005] Based on the user-defined byte matching number constraints N1 to N5 and the valid entry number constraint M, a randomized TCAM configuration is generated.
[0006] The configuration is synchronized to the DUT (Design Under Test) and the reference model through atomic operations;
[0007] Generate multi-dimensional stimuli and inject them into the DUT and the reference model RefM;
[0008] Perform multi-level comparisons between the DUT output and the results of the reference model.
[0009] This application effectively solves the problems of low hit rate and complex coordination in multi-level TCAM verification by dynamically configuring TCAM entries, generating constrained incentives, and using a multi-level conflict detection mechanism. It significantly improves verification efficiency and coverage and is suitable for high-reliability verification of TCAM modules in high-complexity chip designs.
[0010] In an optional implementation, generating a randomized TCAM configuration based on user-defined byte match number constraints N1 to N5 and valid entry number constraints M includes:
[0011] The user initializes and defines constraints N1 to N5, M, and randbyte, where randbyte is 0;
[0012] Generate a random keybyte[0:4] and a randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0013] Based on constraints N1 to N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes;
[0014] According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte;
[0015] Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, specifically including Key_X, Key_Y, and valid flags.
[0016] This implementation method covers TCAM masking rules and entry validity requirements through the joint constraints of N1 to N5 and M, covering more than 99% of TCAM functional scenarios.
[0017] In an optional implementation, synchronizing the configuration to the DUT and reference model via atomic operations includes:
[0018] The TCAM configuration generated based on the user-defined byte matching number is atomically written to the DUT and the reference model RefM, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states;
[0019] After the reference model RefM loads its configuration, it performs a self-check to verify the legality of the constraints.
[0020] This implementation ensures the consistency of the DUT with the reference model RetM through atomic operations, avoiding asynchronous errors caused by manual operations.
[0021] In an optional implementation, the generation of multi-dimensional stimuli and their injection into the DUT and reference model RefM includes:
[0022] Generate three types of incentives: hit incentives, miss incentives, and boundary incentives;
[0023] The stimuli are sent to the DUT and the reference model RefM via the Driver, and the input and context information are recorded.
[0024] The hit incentive is generated based on keybyte and covers single hits with unique matching entries and multiple hits with multiple matching entries.
[0025] The miss incentive is to generate a random key that is independent of all key bytes;
[0026] The boundary excitation is an extreme value containing all 0s or 1s in the keybyte and a scenario where the Key_Y = 0xFF mask is fully open.
[0027] This implementation method improves the completeness of verification by using a multi-dimensional excitation engine that integrates hit, miss, and boundary scenarios.
[0028] In an optional implementation, the multi-level comparison of the DUT output with the reference model results includes:
[0029] Verify the consistency of the hit index between the DUT and the reference model RefM;
[0030] Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent;
[0031] Verify whether the default behavior is consistent when there is no match.
[0032] This implementation method uses multi-level result verification, comparing the entire chain from index to action, to pinpoint the root cause of hardware and model deviations, thereby improving verification efficiency and coverage.
[0033] According to a second aspect of this application, an apparatus for improving the efficiency of multi-level TCAM verification is provided, comprising:
[0034] The configuration module is configured to generate randomized TCAM configurations based on user-defined byte matching number constraints N1 to N5 and valid entry number constraints M.
[0035] The synchronization module is configured to synchronize the configuration to the DUT and the reference model via atomic operations;
[0036] The generation module is configured to generate multi-dimensional stimuli and inject them into the DUT and reference model;
[0037] The test module is configured to perform multi-level comparisons between the DUT output and the results of the reference model.
[0038] In an optional implementation, the configuration module is configured as follows:
[0039] The user initializes and defines constraints N1 to N5, M, and randbyte, where randbyte is 0;
[0040] Generate a random keybyte[0:4] and a randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0041] Based on constraints N1 to N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes;
[0042] According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte;
[0043] Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, specifically including Key_X, Key_Y, and valid flags.
[0044] In an optional implementation, the synchronization module is configured as follows:
[0045] The configuration generated in the configuration module is atomically written to the DUT and the reference model RefM, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states;
[0046] After the reference model RefM loads its configuration, it performs a self-check to verify the legality of the constraints.
[0047] In an optional implementation, the generation module is configured as follows:
[0048] Generate three types of incentives: hit incentives, miss incentives, and boundary incentives;
[0049] The stimuli are sent to the DUT and the reference model RefM via the Driver, and the input and context information are recorded.
[0050] The hit incentive is generated based on keybyte and covers single hits with unique matching entries and multiple hits with multiple matching entries.
[0051] The miss incentive is to generate a random key that is independent of all key bytes;
[0052] The boundary excitation is an extreme value containing all 0s or 1s in the keybyte and a scenario where the Key_Y = 0xFF mask is fully open.
[0053] In an optional implementation, the test module is configured as follows:
[0054] Verify the consistency of the hit index between the DUT and the reference model RefM;
[0055] Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent;
[0056] Verify whether the default behavior is consistent when there is no match.
[0057] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures and processes shown in the description and the accompanying drawings. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a schematic diagram illustrating the data format definition for TCAM configuration in related technologies.
[0060] Figure 2 This is a flowchart illustrating a method for improving the efficiency of multi-level TCAM verification according to an exemplary embodiment of this application.
[0061] Figure 3 This is a schematic diagram illustrating the data format definition of a TCAM configuration according to an exemplary embodiment of this application.
[0062] Figure 4 This is a schematic diagram illustrating the data format definition of a single-level TCAM configuration according to an exemplary embodiment of this application.
[0063] Figure 5 This is a schematic diagram illustrating the data format definition of a two-level TCAM configuration according to an exemplary embodiment of this application.
[0064] Figure 6 This is a structural block diagram of an apparatus for improving the efficiency of multi-level TCAM verification according to an exemplary embodiment of this application.
[0065] Figure 7 This is a structural block diagram of a verification environment for improving the efficiency of multi-level TCAM verification according to an exemplary embodiment of this application. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0067] like Figure 1 In the related technologies shown, when verifying a TCAM, the common verification method is to search for the TCAM using random stimuli and compare the results with the design. However, due to the complexity of the TCAM matching conditions, a single TCAM requires all 40 bits to match a certain entry to be considered a hit. If a random method is used, the probability of hitting a TCAM is 512 / 10 when all entries are valid. 40 This data is almost zero, and this completely random method cannot meet the verification purpose. For multi-level TCAMs, the required probability of a hit increases exponentially. The result of a hit in the previous level provides the scenario configuration for the next level to look up the key, and the probability of a hit in the next level with a new key is also low. If random incentives are used to look up TCAMs, it may result in only a very small number of hits after running a large number of verification test cases, which cannot meet the verification completeness requirements. Moreover, random incentives are uncontrollable, making it difficult to construct specific verification test cases and meet the verification needs of some special scenarios.
[0068] Related technologies have proposed verifying a single TCAM by ensuring that constraint stimuli and TCAM entry configuration values are identical. While this method can address the probability of hitting a TCAM, it is directional and cannot randomly traverse and hit all entries. For multi-level TCAM verification, this method cannot solve the problem of all TCAMs hitting random entries. Data interactions and dependencies exist between different levels of TCAMs, and the configuration and state changes of each level affect each other. This makes traditional verification methods ineffective for comprehensive and accurate verification of multi-level TCAMs. During verification, the collaborative work between multi-level TCAMs and the transmission and matching of data between levels need to be considered, further increasing the difficulty and complexity of verification. When errors occur in the verification results, related verification methods often struggle to quickly and accurately locate the error and its cause. Due to the complexity of multi-level TCAMs and the large amount of data and operations involved in the verification process, determining whether the error occurs in the configuration, data storage, lookup logic of a specific level of TCAM, or in the interaction between levels is difficult. This leads to a significant increase in debugging and error correction time costs, severely impacting the efficiency of the entire verification process.
[0069] Based on the above analysis, see Figure 2 The flowchart illustrates a method for improving the efficiency of multi-level TCAM verification, comprising:
[0070] Based on the user-defined byte matching number constraints N1 to N5 and the valid entry number constraint M, a randomized TCAM configuration is generated.
[0071] The generated randomized TCAM configuration is synchronized to the DUT and reference model through atomic operations;
[0072] Generate multi-dimensional stimuli and inject them into the DUT and reference model;
[0073] Perform multi-level comparisons between the DUT output and the results of the reference model.
[0074] This application effectively solves the problems of low hit rate and complex coordination in multi-level TCAM verification by dynamically configuring TCAM entries, generating constrained incentives, and using a multi-level conflict detection mechanism. It significantly improves verification efficiency and coverage and is suitable for high-reliability verification of TCAM modules in high-complexity chip designs.
[0075] In some optional implementations, a randomized TCAM configuration is generated based on user-defined byte match number constraints N1 to N5 and valid entry number constraints M, including:
[0076] The user initializes and defines constraints N1 to N5, M, and randbyte, where randbyte is 0;
[0077] Generate a random keybyte[0:4] and a randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0078] Based on constraints N1 to N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes;
[0079] According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte;
[0080] Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, specifically including Key_X, Key_Y, and valid flags.
[0081] The pseudocode example of its specific implementation is as follows:
[0082]
[0083]
[0084] This implementation method covers TCAM masking rules and entry validity requirements through the joint constraints of N1 to N5 and M, covering more than 99% of TCAM functional scenarios.
[0085] For example, such as Figure 3 As shown, this embodiment provides a specific method to improve the matching probability of TCAM through reasonable configuration and constraints. In this embodiment, each TCAM entry consists of 5 bytes (keybyte0, keybyte1, keybyte2, keybyte3, keybyte4), for a total of 40 bits. The matching result of TCAM is jointly determined by Key_X and Key_Y. If a bit of Key_X is 0 and the corresponding bit of Key_Y is 0, then that bit must match; if a bit of Key_X is 1 and the corresponding bit of Key_Y is 0, then that bit must match; if a bit of Key_Y is 1, then that bit does not participate in the matching, i.e., "don't care"; when a keybyte does not need to participate in the matching, it can be filled with randbyte to indicate that the byte does not care about the matching result. The following provides two exemplary methods to improve the matching probability of TCAM.
[0086] Method 1: Fix the keybyte value. The specific configuration method is as follows: the keybyte value of all 512 entries uses a combination of keybyte0, keybyte1, keybyte2, keybyte3, keybyte4 and randbyte.
[0087] The hit probability analysis is as follows: There are a total of 5 keybytes, and each keybyte has 5 possible values (keybyte0 to keybyte4), therefore there are a total of 5... 5 = 3125 combinations. If all entries are valid, the hit probability is: 512 / 3125 ≈ 16.38%. If a certain keybyte is configured as "always match" (i.e., both Key_X and Key_Y are set to 0x00), then that byte will not participate in the matching, and the hit probability will increase significantly: 512 / 5 4 =512 / 625≈81.92%.
[0088] Method 2: Using randbyte with no repetition. The specific configuration is as follows: In the 512 entries, add randbyte to the keybyte value of each entry, ensuring no repetition. Hit probability analysis: There are a total of 6 bytes (keybyte0 to keybyte4 plus randbyte), each byte is unique, therefore there are a total of 6! = 720 combinations. If all entries are valid, the hit probability is: 512 / 720 ≈ 71.11%.
[0089] Therefore, in a single-level TCAM, if all entries are valid, the hit probability is 16.38%. By configuring certain keybytes to "always match", the hit probability can be increased to 81.92%.
[0090] If multiple TCAMs are cascaded, the overall hit probability is the product of the hit probabilities of each level. For example, if the second-level TCAM also uses a similar configuration, the overall hit probability is 16.38% × 16.38% ≈ 2.68%; if the second-level TCAM configures a certain column of keybyte as "always match", the overall hit probability is 16.38% × 81.92% ≈ 13.36%; if both levels of TCAM configure a certain column of keybyte as "always match", the overall hit probability is 81.92% × 81.92% ≈ 67.1%. Based on actual business needs, the configuration methods of keybyte and randbyte should be reasonably selected to maximize the hit probability. In multi-level TCAMs, this principle applies, prioritizing the configuration of certain bytes as "always match" to reduce matching complexity and improve the hit rate.
[0091] For example, such as Figure 4 As shown, this embodiment further illustrates a scenario where a specific network routing function is implemented by configuring a single-level TCAM. This embodiment imposes constraints on each byte (keybyte0 to keybyte4) such that the number of entries with equal values for each byte is greater than or equal to N1 to N5 (ranging from 0 to 512). As mentioned earlier, the configuration constraints are: the number of valid TCAM entries is greater than or equal to M (ranging from 0 to 512), and the number of invalid entries is 512-M.
[0092] If you need to filter source or destination MAC addresses within the range of {keybyte0, keybyte1, keybyte2, keybyte3, 0x00} to {keybyte0, keybyte1, keybyte2, keybyte3, 0xFF}, configure Key_X to {keybyte0, keybyte1, keybyte2, keybyte3, 0x00} and Key_Y to {~keybyte0, ~keybyte1, ~keybyte2, ~keybyte3, 0x00}. With this configuration, keybyte4 is fixed at 0x00, indicating that this byte is in "alwaysmatch" mode. The first four bytes (keybyte0 to keybyte3) must match exactly. The last byte (keybyte4) can match any value (0x00 to 0xFF), achieving a full range match for keybyte4. Similarly, setting the highest randbyte to 0 allows for selection filtering of {0x00, keybyte1, keybyte2, keybyte3, keybyte4} to {0xFF, keybyte1, keybyte2, keybyte3, keybyte4}, and so on, to achieve matching of keybyte0 to keybyte4.
[0093] For example, such as Figure 5 As shown, this embodiment further illustrates multi-level filtering of network packets using a two-level TCAM, particularly filtering based on source MAC address range and packet type and direction. The objective of this embodiment is to intercept LAN packets sent from the network side to the local host, with a source MAC address range of {keybyte5, keybyte6, keybyte2, keybyte3, 0x00} to {keybyte5, keybyte6, keybyte2, keybyte3, 0xFF}. Specifically, a first-level TCAM is used to filter packet type and sending direction; a second-level TCAM is used to filter the source MAC address range.
[0094] The first-level TCAM configuration primarily implements packet type and direction filtering, determining whether a packet is a LAN packet and whether it is sent from the network side to the local host. Specifically, the Key_X value is composed of keybyte0, keybyte1, keybyte2, keybyte3, keybyte4, and randbyte; the Key_Y value is the inverse of Key_X; key byte configuration: assuming keybyte0 is used to determine the packet type (LAN packet). Assuming keybyte1 is used to determine the packet direction (network side to local host). The remaining bytes (keybyte2, keybyte3, keybyte4) are configured as 0x00, indicating "alwaysmatch" mode. Example configuration: Key_X value: {keybyte0, keybyte1, 0x00, 0x00, 0x00, randbyte}, Key_Y value: {~keybyte0, ~keybyte1, 0xFF, 0xFF, 0xFF, ~randbyte}. In the above method, only keybyte0 and keybyte1 need to be matched to determine the message type and direction. The remaining bytes are configured as always match to reduce matching complexity and improve efficiency.
[0095] The second-level TCAM configuration primarily implements source MAC address range filtering, filtering packets with source MAC addresses ranging from {keybyte5, keybyte6, keybyte2, keybyte3, 0x00} to {keybyte5, keybyte6, keybyte2, keybyte3, 0xFF}. Specifically, the Key_X value is composed of keybyte5, keybyte6, keybyte2, keybyte3, keybyte7, and randbyte, while the Key_Y value is the inverse of Key_X. Key byte configuration: keybyte5, keybyte6, keybyte2, and keybyte3 are used for precise matching of the first four bytes of the source MAC address; keybyte7 is configured as 0x00, indicating that the last byte always matches; and randbyte is used for padding, also configured as 0x00. Example configuration: Key_X value: {keybyte5, keybyte6, keybyte2, keybyte3, 0x00, randbyte}, Key_Y value: {~keybyte5, ~keybyte6, ~keybyte2, ~keybyte3, 0x00, ~randbyte}. keybyte5, keybyte6, keybyte2, and keybyte3 must match exactly. keybyte7 is configured as 0x00, indicating that the last byte can match any value (0x00 to 0xFF). In this way, by precisely matching the first four bytes and matching the last byte across the entire range, MAC address range filtering is achieved.
[0096] This implementation achieves efficient filtering of network packets through a two-level TCAM configuration. In a multi-level TCAM configuration, each level of TCAM can be configured and its stimulus source set in a similar manner. The key lies in the proper allocation of keybyte and randbyte, and in simplifying the matching logic using an XOR relationship through the mask Key_Y, thus achieving efficient and flexible multi-level TCAM filtering. This configuration method is not only applicable to MAC address filtering but can also be extended to other network packet processing scenarios, such as filtering based on IP address, protocol type, etc.
[0097] In some alternative implementations, the generated randomized TCAM configuration is synchronized to the DUT and reference model via atomic operations, including:
[0098] The TCAM configuration generated based on the user-defined byte matching number is atomically written to the DUT and the reference model RefM, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states;
[0099] After the reference model RefM loads its configuration, it performs a self-check to verify the legality of the constraints.
[0100] The pseudocode example of its specific implementation is as follows:
[0101]
[0102]
[0103] This implementation ensures consistency between the DUT and the reference model RefM state through atomic operations, avoiding asynchronous errors caused by manual operations.
[0104] In some alternative implementations, multi-dimensional stimuli are generated and injected into the DUT and reference model, including:
[0105] Generate three types of incentives: hit incentives, miss incentives, and boundary incentives;
[0106] The stimuli are sent to the DUT and the reference model RefM via the Driver, and the input and context information are recorded.
[0107] Among them, the hit incentive is generated based on the keybyte, covering single hits for unique matching entries and multiple hits for multiple matching entries;
[0108] The penalty for a miss is to generate a random key that is independent of all key bytes;
[0109] The boundary excitation is an extreme value containing all 0s or 1s in the keybyte, and the Key_Y = 0xFF mask is fully open.
[0110] This implementation method improves the completeness of verification by using a multi-dimensional excitation engine that integrates hit, miss, and boundary scenarios.
[0111] In some optional implementations, the DUT output is compared with the reference model results at multiple levels, including:
[0112] Verify the consistency of the hit index between the DUT and the reference model RefM;
[0113] Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent;
[0114] Verify whether the default behavior is consistent when there is no match.
[0115] The pseudocode example of its specific implementation is as follows:
[0116]
[0117]
[0118] This implementation method uses multi-level result verification, comparing the entire chain from index to action, to pinpoint the root cause of hardware and model deviations, thereby improving verification efficiency and coverage.
[0119] Accordingly, such as Figure 6 As shown, this application exemplarily provides an apparatus for improving the efficiency of multi-level TCAM verification, comprising:
[0120] Configuration module 601 is configured to generate randomized TCAM configuration based on user-defined byte matching number constraints N1 to N5 and valid entry number constraints M.
[0121] Synchronization module 602 is configured to synchronize the generated randomized TCAM to the DUT and reference model via atomic operations;
[0122] The generation module 603 is configured to generate multi-dimensional stimuli and inject them into the DUT and reference model;
[0123] Test module 604 is configured to perform multi-level comparisons between the DUT output and the results of the reference model.
[0124] In some alternative implementations, the configuration module is implemented as follows:
[0125] The user initializes and defines constraints N1 to N5, M, and randbyte, where randbyte is 0;
[0126] Generate a random keybyte[0:4] and a randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0127] Based on constraints N1 to N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes;
[0128] According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte;
[0129] Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, specifically including Key_X, Key_Y, and valid flags.
[0130] In some alternative implementations, the synchronization module is implemented as follows:
[0131] The configuration generated in the configuration module is atomically written to the DUT and the reference model RefM, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states;
[0132] After the reference model RefM loads its configuration, it performs a self-check to verify the legality of the constraints.
[0133] In an optional implementation, the generation module is implemented as follows:
[0134] Generate three types of incentives: hit incentives, miss incentives, and boundary incentives;
[0135] The stimuli are sent to the DUT and the reference model RefM via the Driver, and the input and context information are recorded.
[0136] Among them, the hit incentive is generated based on the keybyte, covering single hits for unique matching entries and multiple hits for multiple matching entries;
[0137] The penalty for a miss is to generate a random key that is independent of all key bytes;
[0138] The boundary excitation is an extreme value containing all 0s or 1s in the keybyte, and the Key_Y = 0xFF mask is fully open.
[0139] In some alternative implementations, the test module is implemented as follows:
[0140] Verify the consistency of the hit index between the DUT and the reference model RefM;
[0141] Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent;
[0142] Verify whether the default behavior is consistent when there is no match.
[0143] The above-described device corresponds to the method for improving the efficiency of multi-level TCAM verification provided in the above embodiments. For specific details, please refer to the description of the method for improving the efficiency of multi-level TCAM verification in the above embodiments, which will not be repeated here.
[0144] Accordingly, such as Figure 7 The diagram shows the verification environment for this application, which is based on UVM (Universal Verification Methodology). The specific verification process is as follows:
[0145] 1. Configure a random set of keybyte values as the configuration values for TCAM entries;
[0146] 2. Initialization operation: Configure the random constraint values to the corresponding DUT TCAM table entries;
[0147] 3. Load the configuration values into the reference model RefM;
[0148] 4. The stimulus source for the item in the Sequence comes from the keybyte value of Configure, generating test stimuli (items) to verify the behavior of the DUT;
[0149] 5. Start the Sequence, send the item to the DUT, and then the DUT receives the TCAM matching index and the corresponding action and sends it out to verify the DUT's TCAM matching behavior and action output;
[0150] 6. RefM receives the same item, performs reference model processing, and generates the expected result;
[0151] 7. Compare the items sent out by the reference model with the items sent out by the DUT to verify whether the behavior of the DUT is consistent with that of the reference model.
[0152] The verification environment described above is used to provide the above-described apparatus with the method for improving the efficiency of multi-level TCAM verification provided in the above embodiments. For specific implementation details, please refer to the description of the method for improving the efficiency of multi-level TCAM verification in the above embodiments, which will not be repeated here.
[0153] This application implements a method and apparatus for improving the efficiency of multi-level TCAM verification by dynamically configuring TCAM entries, generating constrained incentives, and employing a multi-level conflict detection mechanism. The specific advantages are at least as follows:
[0154] 1. Significantly improved hit rate. The hit rate of single-level TCAM has increased from nearly 0% in traditional random scenarios to over 80%, and it still maintains efficient matching in multi-level cascaded scenarios.
[0155] 2. Optimize verification efficiency. By reducing invalid test cases through constraints and incentives, the verification cycle is shortened by more than 50%, reducing verification time and resource consumption.
[0156] 3. Multi-level collaborative verification. Supports vertical, horizontal, and hybrid cascading, covering complex interaction scenarios.
[0157] Rapid error localization. A multi-level conflict detection mechanism improves the ability to detect and locate multi-level TCAM design errors, enhancing the reliability and stability of the system-on-a-chip. It is understood that the circuit structures, names, and elements described in the above embodiments are merely examples. Those skilled in the art can make readily conceived combinations and adjustments to the structural features of the above embodiments according to their needs, and the concept of this application should not be limited to the specific details of the above examples.
[0158] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for improving the efficiency of multi-level TCAM verification, characterized in that, include: Based on the user-defined byte matching number constraints N1~N5 and the valid entry number constraint M, a randomized TCAM configuration is generated. The configuration is synchronized to the DUT and reference model through atomic operations; Generate multi-dimensional stimuli and inject them into the DUT and reference model; Perform multi-level comparisons between the DUT output and the results of the reference model; The randomized TCAM configuration is generated based on user-defined byte matching number constraints N1~N5 and valid entry number constraints M, including: The user initializes and defines constraints N1~N5, M, and randbyte, where randbyte is 0; Generate random keybyte[0:4] and randbyte as data Key_X, and calculate their inverse values ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching; Based on constraints N1~N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes; According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte; Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, which specifically includes Key_X, Key_Y and valid flags; The multi-dimensional incentives include three types: hit incentives, miss incentives, and boundary incentives.
2. The method for improving the efficiency of multi-level TCAM verification according to claim 1, characterized in that, The process of synchronizing the configuration to the DUT and reference model via atomic operations includes: The TCAM configuration generated based on the user-defined byte matching number is atomically written to the DUT and reference model, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states; After the reference model loads the configuration, it performs a self-check to verify the legality of the constraints.
3. The method for improving the efficiency of multi-level TCAM verification according to claim 1, characterized in that, The generation of multi-dimensional stimuli and their injection into the DUT and reference model includes: Generate three types of incentives: hit incentives, miss incentives, and boundary incentives; The stimuli are sent to the DUT and reference model via the Driver, and the input and context information are recorded. The hit incentive is generated based on keybyte and covers single hits with unique matching entries and multiple hits with multiple matching entries. The miss incentive is to generate a random key that is independent of all key bytes; The boundary excitation is an extreme value containing all 0s or 1s in the keybyte and a scenario where the Key_Y=0xFF mask is fully open.
4. The method for improving the efficiency of multi-level TCAM verification according to claim 1, characterized in that, The multi-level comparison between the DUT output and the reference model results includes: Verify the consistency between the hit index of the DUT and the reference model; Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent; Verify whether the default behavior is consistent when there is no match.
5. An apparatus for improving the efficiency of multi-level TCAM verification, characterized in that, include: The configuration module is configured to generate randomized TCAM configurations based on user-defined byte matching number constraints N1~N5 and valid entry number constraints M. The synchronization module is configured to synchronize the configuration to the DUT and the reference model via atomic operations; The generation module is configured to generate multi-dimensional stimuli and inject them into the DUT and reference model; The test module is configured to perform multi-level comparisons between the DUT output and the results of the reference model; The configuration module is implemented as follows: The user initializes and defines constraints N1~N5, M, and randbyte, where randbyte is 0; Generate a random keybyte[0:4] and a randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching; Based on constraints N1~N5, ensure that the number of matching entries for each byte i is greater than or equal to Ni, and entries can share constraints across bytes; According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid, represented by randbyte; Based on the above constraint randomization configuration, a TCAM entry configuration set is generated, which specifically includes Key_X, Key_Y and valid flags; The multi-dimensional incentives include three types: hit incentives, miss incentives, and boundary incentives.
6. The apparatus for improving the efficiency of multi-level TCAM verification according to claim 5, characterized in that, The synchronization module is implemented as follows: The configuration generated in the configuration module is atomically written to the DUT and the reference model, and the configuration data is synchronized through a single transaction operation to avoid inconsistencies in intermediate states. After the reference model loads the configuration, it performs a self-check to verify the legality of the constraints.
7. The apparatus for improving the efficiency of multi-level TCAM verification according to claim 5, characterized in that, The generation module is implemented as follows: Generate three types of incentives: hit incentives, miss incentives, and boundary incentives; The stimuli are sent to the DUT and reference model via the Driver, and the input and context information are recorded. The hit incentive is generated based on keybyte and covers single hits with unique matching entries and multiple hits with multiple matching entries. The miss incentive is to generate a random key that is independent of all key bytes; The boundary excitation is an extreme value containing all 0s or 1s in the keybyte and a scenario where the Key_Y=0xFF mask is fully open.
8. The apparatus for improving the efficiency of multi-level TCAM verification according to claim 5, characterized in that, The test module is implemented as follows: Verify the consistency between the DUT and the hit index of the reference model; Based on the configured scenario values mapped by the Index, verify whether the output actions are consistent; Verify whether the default behavior is consistent when there is no match.
Citation Information
Patent Citations
Method and device for improving TCAM verification efficiency based on UVM
CN111027278A
False hit detection in ternary content-addressable memory
US11386008B1