Method and device for improving verification efficiency of multi-stage TCAM (Ternary Content Addressable Memory)
By dynamically configuring TCAM table entries, constrained incentive generation and multi-level conflict detection mechanisms in multi-level TCAM verification, the problems of low hit rate and complex coordination in multi-level TCAM verification are solved, and the verification efficiency and coverage are significantly improved.
Patent Information
- Application Number
- CN202510230793.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2045-02-27
AI Technical Summary
The existing technology has low hit rate and complex coordination problems in multi-level TCAM verification, and traditional random verification methods are difficult to fully cover the collaborative working scenarios of multi-level TCAM, and the verification efficiency is low.
By generating a randomized TCAM configuration based on user-defined byte match number constraints and valid number of entries constraints, atomized operations are used to synchronize the configuration to the DUT and reference models, multi-dimensional excitation is generated and DUT and reference models are injected, and multi-level comparisons are performed to improve verification efficiency.
It significantly improves the hit rate and coverage of multi-level TCAM verification, optimizes verification efficiency, and is suitable for high-reliability verification of TCAM modules in high-complexity chip designs.
Smart Images

Figure CN120086139A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of communication design, and particularly relates to a method and device for improving the verification efficiency of multi-level TCAM. Background Art
[0002] TCAM (Ternary Content Addressable Memory) is a ternary content addressable memory, mainly used for quickly searching access control lists ACL, routing tables and other entries. The search mechanism of TCAM is different from that of traditional memories (such as SRAM, DRAM). It obtains the corresponding address according to the stored content. After inputting a data (referred to as key, the key matching value for searching TCAM entries), TCAM will compare the key with the stored entries in parallel internally and output the matching address. If multiple entries match, the smallest address will be output. The specification of a single TCAM is usually 512 entries × 40-bit width. Through control bit settings, cascading or stacking of multiple TCAMs can be achieved, thereby expanding the entry width or the number of entries. However, how to configure the entries of TCAM and the excitation constraints sent is a relatively complex problem. Currently, the verification of TCAM faces the problem that under random excitation, the hit probability of a single-level TCAM is extremely low (such as 512 / 10 40 ), which is difficult to meet the verification requirements; there are data interactions and dependencies between multi-level TCAMs, and traditional verification methods are difficult to comprehensively cover the collaborative working scenarios of multi-level TCAMs and have low verification efficiency. Summary of the Invention
[0003] The purpose of this application is to provide a method and device for improving the verification efficiency of multi-level TCAM. It aims to solve the problems of low hit rate and complex multi-level collaboration in traditional random verification in related technologies.
[0004] According to the first aspect of this application, a method for improving the verification efficiency of multi-level TCAM is provided, including:
[0005] Generating a randomized TCAM configuration based on the byte match number constraints N1 to N5 and the valid entry number constraint M defined by the user;
[0006] Synchronizing the configuration to the DUT (Design Under Test) and the reference model through atomic operations;
[0007] Generating multi-dimensional excitations and injecting them into the DUT and the reference model RefM (Reference Model);
[0008] Performing multi-level comparison on the DUT output and the reference model results.
[0009] This application effectively solves the problems of low hit rate and complex coordination in multi-level TCAM verification through dynamic configuration of TCAM entries, constraint-based incentive generation, and multi-level conflict detection mechanisms, significantly improving verification efficiency and coverage, and is applicable to highly reliable verification of TCAM modules in high-complexity chip designs.
[0010] In an alternative embodiment, generating a randomized TCAM configuration based on user-defined byte match count constraints N1 to N5 and valid entry count constraint M includes:
[0011] The user initializes and defines the constraint conditions N1 to N5, M, and randbyte, where randbyte is 0;
[0012] Generate a random keybyte[0:4] and 1 randbyte as data Key_X, and calculate its inverted values ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0013] According to the N1 to N5 constraints, ensure that the number of matching entries for each byte i ≥ Ni, and the entries can be shared across bytes;
[0014] According to the M constraint, allocate at least M valid entries, and the remaining entries are invalid, represented by randbyte;
[0015] Generate a set of TCAM entry configurations based on the above constraints for randomization, specifically including Key_X, Key_Y, and valid flags.
[0016] This embodiment covers the TCAM mask rules and entry validity requirements through the combined constraints of N1 to N5 and M, covering more than 99% of the TCAM functional scenarios.
[0017] In an alternative embodiment, synchronizing the configuration to the DUT and the reference model through atomic operations includes:
[0018] Atomically write the TCAM configuration generated based on the user-defined byte match count to the DUT and the reference model RefM, and synchronize the configuration data through a single transaction operation to avoid inconsistent intermediate states;
[0019] After loading the configuration, the reference model RefM performs self-checking to verify the legality of the constraints.
[0020] This embodiment ensures the state consistency between the DUT and the reference model RetM through atomic operations, avoiding incorrect asynchronous caused by manual operations.
[0021] In an alternative embodiment, generating multi-dimensional incentives and injecting them into the DUT and the reference model RefM includes:
[0022] Generate three types of incentives: hit incentive, miss incentive, and boundary incentive;
[0023] Send the incentives to the DUT and the reference model RefM through the Driver, and record the input and context information.
[0024] Among them, the hit incentive is generated based on the keybyte, covering single hits that match a unique entry and multiple hits that match multiple entries;
[0025] The miss incentive is to generate a random Key that has nothing to do with all keybytes;
[0026] The boundary incentive is a scenario that includes extreme values where the keybyte is all 0 or 1, and the Key_Y = 0xFF mask is fully open.
[0027] This implementation method uses a multi-dimensional incentive engine to integrate hit, miss, and boundary scenarios, improving the verification completeness.
[0028] In an alternative implementation, the multi-level comparison of the DUT output and the reference model results includes:
[0029] Verify the consistency of the hit index Index between the DUT and the reference model RefM;
[0030] According to the configured scenario values mapped by the Index, verify whether the output actions are consistent;
[0031] Verify whether the default behaviors when there is no match are consistent.
[0032] This implementation method locates the root cause of the deviation between the hardware and the model through multi-level result verification and full-link comparison from index to action, improving the verification efficiency and coverage rate.
[0033] According to the second aspect of the present application, there is provided a device for improving the verification efficiency of multi-level TCAM, including:
[0034] A configuration module, configured to generate a randomized TCAM configuration based on the byte matching number constraints N1 to N5 and the valid entry number constraint M defined by the user;
[0035] A synchronization module, configured to synchronize the configuration to the DUT and the reference model through an atomic operation;
[0036] A generation module, configured to generate multi-dimensional incentives and inject them into the DUT and the reference model;
[0037] A test module, configured to perform multi-level comparison of the DUT output and the reference model results.
[0038] In an alternative implementation, the configuration module is implemented as:
[0039] The user initializes and defines constraint conditions N1 to N5, M, and randbyte, where randbyte is 0;
[0040] Generate a random keybyte[0:4] and 1 randbyte as the data Key_X, and calculate its inverted values ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0041] According to the constraints of N1 to N5, ensure that the number of matching entries for each byte i ≥ Ni, and the entries can be shared across bytes;
[0042] According to the M constraint, allocate at least M valid entries, and the remaining entries are invalid, represented by randbyte;
[0043] Generate a set of TCAM table entry configurations according to the above constraint randomization configuration, specifically including Key_X, Key_Y, and valid flags.
[0044] In an optional implementation manner, the synchronization module is implemented as:
[0045] Atomically write the configurations generated in the configuration module to the DUT and the reference model RefM, and synchronize the configuration data through a single transaction operation to avoid inconsistent intermediate states;
[0046] After the reference model RefM loads the configuration, it performs self-checking to verify the legality of the constraints.
[0047] In an optional implementation manner, the generation module is implemented as:
[0048] Generate three types of stimuli: hit stimulus, miss stimulus, and boundary stimulus;
[0049] Send the stimuli to the DUT and the reference model RefM through the Driver, and record the input and context information,
[0050] Among them, the hit stimulus is generated based on keybyte, covering single hits for unique matching entries and multiple hits for multiple entry matches;
[0051] The miss stimulus is to generate a random Key that has nothing to do with all keybytes;
[0052] The boundary stimulus is a scenario that includes extreme values where keybyte is all 0 or 1, and Key_Y = 0xFF with all masks open.
[0053] In an optional implementation manner, the test module is implemented as:
[0054] Verify the consistency of the hit index Index between the DUT and the reference model RefM;
[0055] Verify whether the output actions are consistent according to the configured scenario values mapped by Index;
[0056] Verify whether the default behaviors when there is no match are consistent.
[0057] Other features and advantages of the present application will be described in the subsequent specification, and will be partially obvious from the specification, or will be understood by implementing the present application. The objectives and other advantages of the present application can be achieved and obtained through the structures and processes pointed out in the specification and the drawings. Description of the Drawings
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0059] Figure 1 It is a schematic diagram of the data format definition of the TCAM configuration in related technologies.
[0060] Figure 2 It is a schematic flowchart of a method for improving the verification efficiency of multi-level TCAM according to an exemplary embodiment of the present application.
[0061] Figure 3 It is a schematic diagram of the data format definition of the TCAM configuration according to an exemplary embodiment of the present application.
[0062] Figure 4 It is a schematic diagram of the data format definition of the single-level TCAM configuration according to an exemplary embodiment of the present application.
[0063] Figure 5 It is a schematic diagram of the data format definition of the two-level TCAM configuration according to an exemplary embodiment of the present application.
[0064] Figure 6 It is a structural block diagram of a device for improving the verification efficiency of multi-level TCAM according to an exemplary embodiment of the present application.
[0065] Figure 7 It is a structural block diagram of a verification environment for improving the verification efficiency of multi-level TCAM according to an exemplary embodiment of the present application. Detailed Embodiments
[0066] In order to make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this application without creative efforts shall fall within the protection scope of this application.
[0067] As Figure 1 shown in the related art, when verifying a TCAM, the common verification method is to search for the TCAM through random stimuli and compare the results with the design. However, due to the complex conditions for a TCAM search hit, for a single TCAM, all 40 bits need to match a certain entry to be considered a hit. If a random method is used, when all entries are valid, the probability of hitting a TCAM is 512 / 10 40 , this data is almost zero, and this completely random method cannot meet the verification purpose. For a multi-level TCAM, the probability of a hit increases multiplicatively. The result after a hit in the previous level provides a scenario configuration for the key search in the next level, and the probability of hitting with a new key in the next level is also relatively low. If random stimuli are used to search for the TCAM, it may result in only a very small number of hits after running a large number of verification cases, failing to meet the completeness requirements of the verification. Moreover, random stimuli are uncontrollable, making it difficult to construct specific verification cases and unable to meet the verification requirements in some special scenarios.
[0068] In the related art, a method has been proposed to verify a single TCAM by making the constraint stimuli the same as the configured values of the TCAM entries. Although this verification method can solve the problem of the probability of hitting the TCAM, it has directivity and cannot randomly traverse and hit all entries. This method cannot solve the problem of randomly hitting all entries for the verification of a multi-level TCAM. There are data interactions and dependencies between different levels of TCAMs, and the configuration and state changes of each level of TCAM will affect each other, making it difficult for traditional verification methods to effectively and comprehensively verify a multi-level TCAM accurately. During the verification process, it is necessary to consider the collaborative work between different levels of TCAMs and the transfer and matching of data between levels, further increasing the difficulty and complexity of the verification. When an error occurs in the verification result, the related verification methods often have difficulty quickly and accurately locating the position and cause of the error. Due to the complexity of the multi-level TCAM and the large amount of data and operations involved in the verification process, it is difficult to determine whether the error occurs in the configuration, data storage, search logic of a certain level of TCAM or the interaction process between levels, which leads to a significant increase in the time cost of debugging and error correction and seriously affects the efficiency of the entire verification process.
[0069] Based on the above analysis, refer toFigure 2 Schematic diagram of the process. In this application, an exemplary method for improving the verification efficiency of multi-level TCAM is proposed, including:
[0070] Generating a randomized TCAM configuration based on the byte match number constraints N1 to N5 and the valid entry number constraint M defined by the user;
[0071] Synchronizing the generated randomized TCAM configuration to the DUT and the reference model through atomic operations;
[0072] Generating multi-dimensional stimuli and injecting them into the DUT and the reference model;
[0073] Performing multi-level comparison between the DUT output and the reference model result.
[0074] Through dynamic configuration of TCAM entries, constraint-based stimulus generation, and multi-level conflict detection mechanisms, this application effectively solves the problems of low hit rate and complex coordination in multi-level TCAM verification, significantly improves verification efficiency and coverage, and is applicable to high-reliability verification of TCAM modules in high-complexity chip designs.
[0075] In some alternative embodiments, generating a randomized TCAM configuration based on the byte match number constraints N1 to N5 and the valid entry number constraint M defined by the user includes:
[0076] The user initializes and defines the constraint conditions N1 to N5, M, and randbyte, where randbyte is 0;
[0077] Generating random keybyte[0:4] and 1 randbyte as the data Key_X, and calculating its inverted values ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0078] According to the N1 to N5 constraints, ensuring that the number of matching entries for each byte i ≥ Ni, and the entries can be shared across bytes;
[0079] According to the M constraint, allocating at least M valid entries, and the remaining entries are invalid, represented by randbyte;
[0080] Generating a set of TCAM entry configurations according to the above constraint randomization, specifically including Key_X, Key_Y, and valid flags.
[0081] The pseudo-code example of its specific implementation is as follows:
[0082]
[0083]
[0084] This implementation mode covers the TCAM mask rules and entry validity requirements through the combined constraints of N1 to N5 and M, covering more than 99% of the TCAM functional scenarios.
[0085] Exemplarily, as Figure 3 shown, this implementation mode provides a specific way 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), a total of 40 bits. The matching result of TCAM is jointly determined by Key_X and Key_Y. If a certain bit of Key_X is 0 and the corresponding bit of Key_Y is 0, then this bit must match; if a certain bit of Key_X is 1 and the corresponding bit of Key_Y is 0, then this bit must match; if a certain bit of Key_Y is 1, then this bit does not participate in the matching, that is, "don't care"; when a certain keybyte does not need to participate in the matching, it can be filled with randbyte, indicating that this byte does not care about the matching result. The following provides two exemplary methods to improve the TCAM matching probability.
[0086] Method 1: Fix the keybyte value, and the specific configuration method is as follows: The keybyte values of all 512 entries use the combination of keybyte0, keybyte1, keybyte2, keybyte3, keybyte4 and randbyte.
[0087] The analysis of its hit probability is as follows: There are a total of 5 keybytes, and each keybyte has 5 possible values (keybyte0 to keybyte4), so 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" (that is, both Key_X and Key_Y are set to 0x00), then this byte does not participate in the matching, and the hit probability will increase significantly: 512 / 5 4 = 512 / 625 ≈ 81.92%.
[0088] Method 2: Use randbyte and do not repeat, and the specific configuration method is as follows: Among the 512 entries, the keybyte value of each entry is added with randbyte, and all entries are not repeated. The analysis of its hit probability: There are a total of 6 bytes (keybyte0 to keybyte4 plus randbyte), and each byte is not repeated, so there are a total of 6! = 720 combinations. If all entries are valid, the hit probability is: 512 / 720 ≈ 71.11%.
[0089] It can be seen that in a single - level TCAM, if all entries are valid, the hit probability is 16.38%. By configuring some keybytes as "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. Exemplarily, if the second - level TCAM also adopts a similar configuration, the overall hit probability is: 16.38%×16.38%≈2.68%; if a certain column of keybytes in the second - level TCAM is configured as "always match", the overall hit probability is: 16.38%×81.92%≈13.36%; if a certain column of keybytes in both levels of TCAMs is configured as "always match", the overall hit probability is: 81.92%×81.92%≈67.1%. According to the actual service requirements, reasonably select the configuration methods of keybytes and randbytes to maximize the hit probability; in multi - level TCAMs, by analogy, preferentially configure some bytes as "always match" to reduce the matching complexity and improve the hit rate.
[0091] Exemplarily, as Figure 4 shown, this embodiment further gives a scenario of implementing a specific network routing function by configuring a single - level TCAM. This embodiment respectively constrains each byte (from keybyte0 to keybyte4) so that the number of entries with each byte equal is greater than or equal to N1 to N5 (ranging from 0 to 512). As mentioned above, the configuration constraint is: the number of valid entries in the TCAM is constrained to be greater than or equal to M (ranging from 0 to 512), and the number of invalid entries is 512 - M.
[0092] If it is necessary to filter the source or destination MAC address range from: {keybyte0, keybyte1, keybyte2, keybyte3, 0x00} to {keybyte0, keybyte1, keybyte2, keybyte3, 0xFF}. Configure the Key_X value as {keybyte0, keybyte1, keybyte2, keybyte3, 0x00}, and the Key_Y value: {~keybyte0, ~keybyte1, ~keybyte2, ~keybyte3, 0x00}; after such configuration: keybyte4 is fixed at 0x00, indicating that this byte is in the "always match" mode. The first four bytes (keybyte0 to keybyte3) must match exactly. The last byte (keybyte4) can match any value (from 0x00 to 0xFF), achieving a full range match for keybyte4. Similarly, by configuring the highest randbyte to 0, the selection filtering for {0x00, keybyte1, keybyte2, keybyte3, keybyte4} to {0xFF, keybyte1, keybyte2, keybyte3, keybyte4} can be achieved, and so on, the matching of the key keybyte0 to keybyte4 can be realized.
[0093] Exemplarily, as Figure 5 shown, this embodiment further presents the use of two-level TCAM to achieve multi-level filtering of network packets, especially for filtering the source MAC address range and screening the packet type and direction. The goal of this embodiment is to intercept LAN packets sent from the network side to the local Host, and the source MAC address range is: {keybyte5, keybyte6, keybyte2, keybyte3, 0x00} to {keybyte5, keybyte6, keybyte2, keybyte3, 0xFF}. The specific implementation method is: use the first-level TCAM to filter the packet type and sending direction; use the second-level TCAM to filter the source MAC address range.
[0094] Among them, the first-level TCAM configuration mainly realizes packet type and direction filtering, determines whether the packet is a LAN packet, and whether it is sent from the network side to the local Host. The specific configuration method is as follows: The Key_X value is composed of keybyte0, keybyte1, keybyte2, keybyte3, keybyte4, and randbyte; the Key_Y value is the inverse value of Key_X; Key byte configuration: Assume that keybyte0 is used to determine the packet type (LAN packet). Assume that keybyte1 is used to determine the packet direction (from the network side to the local Host). The remaining bytes (keybyte2, keybyte3, keybyte4) are configured as 0x00, indicating the "always match" mode. Exemplary configuration: Key_X value: {keybyte0, keybyte1, 0x00, 0x00, 0x00, randbyte}, Key_Y value: {~keybyte0, ~keybyte1, 0xFF, 0xFF, 0xFF, ~randbyte}. The above method only needs to match keybyte0 and keybyte1 to determine the packet type and direction, and the remaining bytes are configured as always match to reduce the matching complexity and improve the efficiency.
[0095] The second - level TCAM configuration mainly realizes the filtering of the source MAC address range, filtering packets with the source MAC address range from {keybyte5, keybyte6, keybyte2, keybyte3, 0x00} to {keybyte5, keybyte6, keybyte2, keybyte3, 0xFF}. The specific configuration method is as follows: The Key_X value is composed of keybyte5, keybyte6, keybyte2, keybyte3, keybyte7 and randbyte, and the Key_Y value is the inverse value of Key_X. Key byte configuration: keybyte5, keybyte6, keybyte2, keybyte3 are used to accurately match 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 and is also configured as 0x00. Exemplary configuration: Key_X value: {keybyte5, keybyte6, keybyte2, keybyte3, 0x00, randbyte}, Key_Y value: {~keybyte5, ~keybyte6, ~keybyte2, ~keybyte3, 0x00, ~randbyte}. keybyte5, keybyte6, keybyte2, keybyte3 must match exactly. keybyte7 is configured as 0x00, indicating that the last byte can match any value (from 0x00 to 0xFF). In this way, by accurately matching the first four bytes and fully - range matching the last byte, the filtering of the MAC address range is achieved.
[0096] Through the configuration of two - level TCAM in this embodiment, efficient filtering of network packets can be achieved. In the multi - level TCAM configuration, each level of TCAM can be configured and the excitation source can be set in a similar way. The key lies in reasonably allocating keybyte and randbyte, and simplifying the matching logic by using the exclusive - OR relationship with the mask Key_Y, so as to achieve efficient and flexible multi - level TCAM filtering. This configuration method is not only applicable to MAC address filtering, but also can be extended to other network packet processing scenarios, such as filtering based on IP addresses, protocol types, etc.
[0097] In some optional embodiments, the generated randomized TCAM configuration is synchronized to the DUT and the reference model through atomic operations, including:
[0098] Atomically write the TCAM configuration generated based on the user - defined number of byte matches into the DUT and the reference model RefM, and synchronize the configuration data through a single transaction operation to avoid inconsistent intermediate states;
[0099] After the reference model RefM loads the configuration, it performs self-checking to verify the legality of the constraints.
[0100] The pseudo-code example of its specific implementation is as follows:
[0101]
[0102]
[0103] This implementation ensures the state consistency between the DUT and the reference model RefM 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 the reference model, including:
[0105] Generating three types of stimuli: hit stimuli, miss stimuli, and boundary stimuli;
[0106] Sending the stimuli to the DUT and the reference model RefM through the Driver, and recording the input and context information,
[0107] Among them, the hit stimuli are generated based on the keybyte, covering single hits that match a unique entry and multiple hits that match multiple entries;
[0108] The miss stimuli are random Keys generated independently of all keybytes;
[0109] The boundary stimuli are scenarios that include extreme values where the keybyte is all 0 or 1, and the Key_Y = 0xFF mask is fully open.
[0110] This implementation enhances the verification completeness by integrating hit, miss, and boundary scenarios through a multi-dimensional stimulus engine.
[0111] In some alternative implementations, multi-level comparisons are made between the DUT output and the reference model results, including:
[0112] Verifying the consistency of the hit index Index between the DUT and the reference model RefM;
[0113] According to the configured scenario values mapped by the Index, verifying whether the output actions are consistent;
[0114] Verifying whether the default behaviors when there is no match are consistent.
[0115] The pseudo-code example of its specific implementation is as follows:
[0116]
[0117]
[0118] Through multi-level result verification and full-link comparison from index to action, the root cause of the deviation between the hardware and the model is located, improving the verification efficiency and coverage rate.
[0119] Correspondingly, as Figure 6 shown, the present application exemplarily provides a device for improving the verification efficiency of multi-level TCAM, including:
[0120] A configuration module 601, configured to generate a randomized TCAM configuration based on user-defined byte match number constraints N1 to N5 and valid entry number constraints M;
[0121] A synchronization module 602, configured to synchronize the generated randomized TCAM configuration to the DUT and the reference model through an atomic operation;
[0122] A generation module 603, configured to generate multi-dimensional stimuli and inject them into the DUT and the reference model;
[0123] A test module 604, configured to perform multi-level comparison on the DUT output and the reference model results.
[0124] In some alternative implementation manners, the configuration module is implemented as:
[0125] The user initializes and defines constraint conditions N1 to N5, M, and randbyte, where randbyte is 0;
[0126] Generate random keybyte[0:4] and 1 randbyte as data Key_X, and calculate its inverted values ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching;
[0127] According to the N1 to N5 constraints, ensure that the number of matching entries for each byte i ≥ Ni, and the entries can be shared across bytes;
[0128] According to the M constraint, allocate at least M valid entries, and the remaining entries are invalid, represented by randbyte;
[0129] Generate a set of TCAM table entry configurations according to the above constraints for randomization, specifically including Key_X, Key_Y, and valid flags.
[0130] In some alternative implementation manners, the synchronization module is implemented as:
[0131] Atomically write the configuration generated in the configuration module to the DUT and the reference model RefM, and synchronize the configuration data through a single transaction operation to avoid inconsistent intermediate states;
[0132] After the reference model RefM loads the configuration, it performs self-checking to verify the legality of the constraints.
[0133] In an alternative embodiment, the generation module is implemented as:
[0134] Generate three types of incentives: hit incentive, miss incentive, and boundary incentive;
[0135] Send the incentives to the DUT and the reference model RefM through the Driver, and record the input and context information,
[0136] wherein, the hit incentive is generated based on the keybyte, covering single hits for unique matching entries and multiple hits for multiple entry matches;
[0137] The miss incentive is to generate a random Key independent of all keybytes;
[0138] The boundary incentive is a scenario that includes extreme values where the keybyte is all 0 or 1, and the Key_Y = 0xFF mask is fully open.
[0139] In some alternative embodiments, the test module is implemented as:
[0140] Verify the consistency of the hit index Index between the DUT and the reference model RefM;
[0141] Verify whether the output actions are consistent according to the configured scenario values mapped by the Index;
[0142] Verify whether the default behaviors when there is no match are consistent.
[0143] The above device corresponds to the method for improving the verification efficiency of multi-level TCAM provided in the above embodiment. For specific details, reference can be made to the description of the method for improving the verification efficiency of multi-level TCAM in the above embodiment, which will not be elaborated here.
[0144] Correspondingly, as Figure 7 shown, a verification environment of the present application, a verification environment based on UVM (Universal Verification Methodology), the specific verification process is as follows:
[0145] 1. Configure a set of keybyte values with random constraints as the configuration values of the TCAM entries;
[0146] 2. Perform initialization operations, and configure the randomly constrained configuration values into the corresponding DUT TCAM entries;
[0147] 3. Load the configuration values into the reference model RefM;
[0148] 4. The excitation source of the item in the Sequence comes from the keybyte value of the Configure, generating a test excitation (item) for verifying the behavior of the DUT.
[0149] 5. Start the Sequence, send the item to the DUT, and then the DUT obtains the hit index of the TCAM and the corresponding action to send out, verifying the TCAM matching behavior and action output of the DUT.
[0150] 6. The RefM receives the same item and performs the reference model processing action to generate the expected result.
[0151] 7. Compare the item sent out by the reference model with the item sent out by the DUT to verify whether the behavior of the DUT is consistent with the reference model.
[0152] The above verification environment is used to provide the above device to execute the method for improving the verification efficiency of the multi-level TCAM provided by the above embodiments. The specific implementation details can refer to the description of the method for improving the verification efficiency of the multi-level TCAM in the above embodiments, which will not be elaborated here.
[0153] This application realizes a method and device for improving the verification efficiency of the multi-level TCAM through dynamic configuration of TCAM entries, constrained excitation generation, and multi-level conflict detection mechanism. The specific advantages are at least as follows:
[0154] 1. The hit rate is significantly improved. The hit rate of the single-level TCAM is increased from the traditional random approach close to 0 to more than 80%, and still maintains efficient matching in the multi-level cascaded scenario.
[0155] 2. The verification efficiency is optimized. By constraining the excitation, the invalid test cases are reduced, and the verification cycle is shortened by more than 50%, reducing the consumption of verification time and resources.
[0156] 3. Multi-level collaborative verification. It supports vertical, horizontal, and hybrid cascades, covering complex interaction scenarios.
[0157] Fast error location. Through the multi-level conflict detection mechanism, the ability to discover and locate design errors in the multi-level TCAM is improved, enhancing the reliability and stability of the system-level chip. It can be understood that the circuit structures, names, and elements described in the above embodiments are only for examples. Those skilled in the art can also easily combine and adjust the structural features of the above multiple embodiments according to the usage needs, and should not limit the concept of this application to the specific details of the above examples.
[0158] Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements 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 the present application.
Claims
1. A method for improving multi-level TCAM verification efficiency, characterized in that: include: Generate a randomized TCAM configuration based on the user-defined byte matching number constraints N1-N5 and the valid entry number constraint M; Synchronizing the configuration to the DUT and the reference model through atomic operations; Generate multi-dimensional stimulus and inject it into DUT and reference model; Perform multi-level comparison of DUT outputs with reference model results.
2. The method for improving multi-level TCAM verification efficiency according to claim 1, characterized in that: The generating of the randomized TCAM configuration based on the byte matching number constraints N1-N5 and the valid entry number constraint M defined by the user includes: The user initializes and defines the constraints N1 to N5, M, and randbyte, where randbyte is 0; Generate random keybyte[0:4] and randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching; According to the constraints N1 to N5, ensure that the number of matching entries for each byte i is ≥ Ni, and the entries can share constraints across bytes; According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid and represented by randbyte; A TCAM table entry configuration set is generated according to the above constraint randomization configuration, specifically including Key_X, Key_Y and a valid flag.
3. The method for improving multi-level TCAM verification efficiency according to claim 1, characterized in that: The step of synchronizing the configuration to the DUT and the reference model through atomic operations includes: Atomically write the TCAM configuration generated based on the user-defined byte match number into the DUT and reference model, synchronizing the configuration data through a single transaction operation to avoid intermediate state inconsistencies; After the reference model is loaded and configured, a self-check is performed to verify the legality of the constraints.
4. The method for improving multi-level TCAM verification efficiency according to claim 1, characterized in that: The generating of multi-dimensional stimulus and injecting it into DUT and reference model includes: Generate three types of incentives: hit incentives, miss incentives, and boundary incentives; Send stimulus to DUT and reference model through Driver, record input and context information, The hit incentive is generated based on keybyte, covering single hits of unique matching entries and multiple hits of multiple entry matches; The miss incentive is to generate a random key that is independent of all keybytes; The boundary stimulus is a scenario including an extreme value of keybyte all 0 or 1, and Key_Y=0xFF mask fully open.
5. The method for improving multi-level TCAM verification efficiency according to claim 1, characterized in that: The multi-level comparison of the DUT output and the reference model results includes: Verify the consistency of hit index between DUT and reference model; Verify that the output actions are consistent based on the configuration scenario value mapped by Index; Verify that the default behavior when no match is true is consistent.
6. A device for improving multi-level TCAM verification efficiency, characterized in that: include: A configuration module configured to generate a randomized TCAM configuration based on a user-defined byte match number constraint N1-N5 and a valid entry number constraint M; A synchronization module configured to synchronize the configuration to the DUT and the reference model through an atomic operation; A generation module, configured to generate multi-dimensional stimulus and inject it into the DUT and the reference model; The test module is configured to perform multi-level comparison between the DUT output and the reference model results.
7. The device for improving multi-level TCAM verification efficiency according to claim 6, characterized in that: The configuration module is implemented as follows: The user initializes and defines the constraints N1 to N5, M, and randbyte, where randbyte is 0; Generate a random keybyte[0:4] and 1 randbyte as data Key_X, and calculate its inverse value ~keybyte[0:4] and ~randbyte as the mask Key_Y for data matching; According to the constraints N1 to N5, ensure that the number of matching entries for each byte i is ≥ Ni, and the entries can share constraints across bytes; According to the M constraint, at least M valid entries are allocated, and the remaining entries are invalid and represented by randbyte; A TCAM table entry configuration set is generated according to the above constraint randomization configuration, specifically including Key_X, Key_Y and a valid flag.
8. The device for improving multi-level TCAM verification efficiency according to claim 6, characterized in that: The synchronization module is implemented as follows: Write the configuration generated in the configuration module into the DUT and reference model atomically, and synchronize the configuration data through a single transaction operation to avoid inconsistency in the intermediate state; After the reference model is loaded and configured, a self-check is performed to verify the legality of the constraints.
9. The device for improving multi-level TCAM verification efficiency according to claim 6, characterized in that: The generation module is implemented as follows: Generate three types of incentives: hit incentives, miss incentives, and boundary incentives; Send stimulus to DUT and reference model through Driver, record input and context information, The hit incentive is generated based on keybyte, covering single hits of unique matching entries and multiple hits of multiple entry matches; The miss incentive is to generate a random key that is independent of all keybytes; The boundary stimulus is a scenario including an extreme value of keybyte all 0 or 1, and Key_Y=0xFF mask fully open.
10. The device for improving multi-level TCAM verification efficiency according to claim 6, characterized in that: The test module is implemented as follows: Verify the consistency of hit index between DUT and reference model; Verify that the output actions are consistent based on the configuration scenario value mapped by Index; Verify that the default behavior when no match is true is consistent.
Citation Information
Patent Citations
Verification platform and method and electronic equipment
CN108763743A
Template library construction method of excitation generation device and chip verification method and system
CN109992461A
Method and device for improving TCAM verification efficiency based on UVM
CN111027278A
Chip simulation verification method and device, electronic equipment and medium
CN118036549A
False hit detection in ternary content-addressable memory
US11386008B1