Memory search result control method, system, device and readable storage medium
By dynamically configuring table entries within the time window of the lookup memory, the problem of limited simulation resources in lookup memory verification is solved, achieving efficient verification coverage and shortening the cycle.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU CENTEC COMM CO LTD
- Filing Date
- 2026-03-24
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies for memory lookup verification suffer from limited simulation resources, making it difficult to cover sufficient lookup scenarios within a limited timeframe. This is especially true for complex functionalities such as multi-entry hits, mask matching, and priority output, where verification completeness is difficult to guarantee.
Within the time window before the search operation, the search keywords are sampled, and the search results are controlled based on preset control flags. The entries in the search memory are dynamically configured, and the bitmap management and random selection mechanism are used to precisely control whether each search hits and the number of entries hit.
It overcomes hardware resource limitations, enabling any number of key hits in a single simulation, improving verification coverage and efficiency, and shortening the verification cycle.
Smart Images

Figure CN122242403A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of integrated circuit verification technology, and specifically relates to a method, system, device and readable storage medium for controlling the results of a lookup memory. Background Technology
[0002] Due to its characteristics, lookup memory is widely used in network devices for routing lookups, packet classification, and other scenarios to meet the performance requirements of line-speed forwarding. Lookup memory can complete the comparison of an input keyword with all stored entries and output the matching result within a single clock cycle, making its lookup efficiency significantly better than traditional random access memory.
[0003] However, the lookup memory requires that the key matches every bit of the stored entry, resulting in a very low hit rate for completely random incentives. As a result, a large number of test cases cannot effectively trigger the lookup logic, and the coverage and efficiency of the verification are severely limited.
[0004] To address these issues, existing technologies have proposed verification methods based on pre-generated keyword pools or pre-configured entry pools. These schemes reduce the randomness of the stimulus to some extent and improve the controllability of the hit. However, due to the limited entry depth of the lookup memory, the number of keywords that can be hit in a single simulation is still limited by hardware resources, making it difficult to cover sufficient search scenarios within a limited time. This is especially true when dealing with complex functionalities such as multi-entry hits, mask matching, and priority output, where verification completeness remains difficult to guarantee.
[0005] Therefore, given the limited simulation resources, it is necessary to provide a method, system, device, and readable storage medium for controlling the results of memory lookup in order to address the aforementioned technical problems.
[0006] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0007] The purpose of this invention is to provide a method, system, device, and readable storage medium for controlling the results of a lookup memory, which can improve the verification efficiency of the lookup memory for the design under test.
[0008] To achieve the above objectives, a specific embodiment of the present invention provides the following technical solution:
[0009] In a first aspect, the present invention provides a method for controlling the result of a search memory, comprising:
[0010] Within a time window after the keyword to be searched is generated and before the search memory performs a search operation based on the keyword to be searched, the keyword to be searched is sampled;
[0011] Based on preset control flags, determine whether to control the search results for this time;
[0012] If so, then based on the expected number of entries to be hit in this search and the expected search result, determine the table entry corresponding to the search result and the configuration value that satisfies the expected search result;
[0013] Within the time window, the configuration value is written into the lookup memory for the entry corresponding to the current lookup result.
[0014] In one or more embodiments of the present invention, determining the table entry corresponding to the current search result includes:
[0015] Create a bitmap with the same depth as the lookup memory entry, and configure each bit of the bitmap as a first identifier, wherein each bit of the bitmap corresponds one-to-one with the lookup memory entry;
[0016] At least one bit of a first identifier is obtained from the bitmap, and the number of first identifier bits obtained is less than or equal to the number of entries that the search keyword is expected to match.
[0017] After writing the configuration value that satisfies the expected search result into the lookup memory table entry corresponding to the acquired bit, the acquired bit is set as the second identifier.
[0018] In one or more embodiments of the present invention, obtaining at least one bit of the first identifier in the bitmap includes:
[0019] If the number of entries expected to be hit in this search is greater than or equal to the number of first identifier bits in the bitmap, then all first identifier bits in the bitmap are obtained;
[0020] If the number of entries expected to be hit in this search is less than the number of first identifier bits in the bitmap, then the number of first identifier bits obtained is equal to the number of entries expected to be hit in this search.
[0021] In one or more embodiments of the present invention, the method further includes: if all bits in the bitmap are second identifiers, then resetting each bit in the bitmap to a first identifier.
[0022] In one or more embodiments of the present invention, determining the configuration value that satisfies the expected search result includes:
[0023] Determine whether to perform a masking operation on the table entries corresponding to the search results;
[0024] If so, the random bit will be set to the Mask state in the table entry corresponding to the search result.
[0025] If not, the corresponding configuration value is calculated based on the expected search result of this search.
[0026] In one or more embodiments of the present invention, the method further includes:
[0027] Obtain the search result output by the search memory;
[0028] The search results are compared with the expected search results to determine whether the behavior of the tested design is correct.
[0029] In one or more embodiments of the present invention, the method further includes:
[0030] Based on preset control flags, determine whether to control the search results for this time;
[0031] If not, then a search operation is performed on the keyword to be searched based on the current search memory configuration.
[0032] In a second aspect, the present invention provides a search memory result control system, comprising:
[0033] The sampling module is used to sample the keyword to be searched within a time window after the keyword to be searched is generated and before the search memory performs a search operation based on the keyword to be searched.
[0034] The judgment module is used to determine whether to control the search results based on a preset control flag;
[0035] The determination module is used to determine the table entries corresponding to the search results and the configuration values that satisfy the expected search results based on the expected number of hit entries and the expected search results for this search.
[0036] The writing module is used to write the configuration value into the lookup memory corresponding to the current lookup result within the time window.
[0037] Thirdly, the present invention provides an electronic device comprising:
[0038] At least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the lookup memory result control method.
[0039] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the aforementioned lookup memory result control method.
[0040] Compared with the prior art, the lookup memory result control method provided by the present invention dynamically rewrites the table entry configuration in a specific time window before the lookup action, so that the same table entry can be repeatedly hit multiple times in a single simulation, thereby breaking through the limitations of hardware resources and increasing the number of effective stimuli in a single simulation.
[0041] At the same time, since the table entry configuration is derived from the expected search results corresponding to the keywords to be searched, it can precisely control whether each search hits and precisely control the number of table entry entries hit, among other complex functions.
[0042] Furthermore, this invention combines bitmap management with a random selection mechanism to ensure controllable hits each time while automatically traversing all table entries, avoiding repeated hits on the same entry, and achieving uniform coverage of all table entries within a single simulation; automatic rotation between multiple simulations continuously covers different combinations. This significantly reduces the number of simulations required to achieve the same coverage rate and substantially shortens the verification cycle. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a schematic diagram illustrating an implementation scenario of the memory lookup result control method according to an embodiment of the present invention;
[0045] Figure 2 This is a flowchart of a memory lookup result control method in one embodiment of the present invention;
[0046] Figure 3 This is a structural block diagram of the memory result search control system in another embodiment of the present invention;
[0047] Figure 4 This is a structural block diagram of an electronic device according to one embodiment of the present invention;
[0048] Figure 5 This is a timing diagram of TCAM / CAM lookup in a specific embodiment of the present invention. Detailed Implementation
[0049] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0050] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.
[0051] In existing technical solutions, there are various verification methods aimed at improving the lookup hit rate. For example, one approach is to pre-calculate all possible keys generated by the logic using a reference model, construct a Lookup Key Pool, and initialize the TCAM accordingly. While this approach can reduce the key repetition rate in a single simulation and increase the proportion of effective simulation time, the inherent and limited physical entry depth of the TCAM / CAM means that even if the Key Pool contains keys far exceeding the number of entries, the actual number of entries that can be initialized is still constrained by hardware resources, resulting in a strict limitation on the number of keys that can be hit in a single simulation.
[0052] Another improved approach involves first generating an stimulus pool with a data depth equal to that of the TCAM, and then using this data and its mask to generate a configuration pool. During initialization, the data and mask from the configuration pool are randomly assigned to the DUT's TCAM and reference model, followed by enabling lookup. During simulation, data is randomly selected from the self-random stimulus or the stimulus pool as test cases, and compared with the lookup results from the reference model. This approach, while inheriting the advantages of the previous approach, further controls the lookup hit probability during simulation. However, it does not overcome the limitation on the number of keys that can be hit in a single simulation.
[0053] The inventors of this invention have thoroughly analyzed the aforementioned shortcomings of existing technologies and creatively proposed a novel technical approach: utilizing the inherent timing window between the logic-generated lookup key and the actual execution of the lookup operation in the lookup memory, the table configuration of the lookup memory is dynamically modified before the lookup action occurs. Through this concept, this invention breaks free from the traditional framework of fixed pre-configuration, achieving precise and proactive control over the results of each lookup. Thus, regardless of the physical table depth of the lookup memory, a single simulation can theoretically achieve any number of key hits, and complex behaviors such as the specific hit entries, whether a mask is triggered, and the priority of multiple hits can be precisely set as needed. This fundamentally overcomes the constraint of table depth on verification efficiency, significantly improving verification coverage and efficiency with extremely low simulation costs, demonstrating remarkable ingenuity.
[0054] Please refer to Figure 1 The diagram shows an application scenario of the lookup memory result control method provided by the present invention under one embodiment. The scenario specifically includes: a verification server 101, a storage device 102, and a user terminal 103.
[0055] It should be noted that communication connections are established between the verification server 101, the storage device 102, and the user terminal 103. The communication network derived from these connections can include various connection types, including but not limited to wired connections, wireless connections, or fiber optic cable connections. Furthermore, this communication network can be a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), or any combination of these three.
[0056] The verification server 101 is used to run the simulation verification platform and is the core computing device for executing the lookup memory result control method described in this invention. The verification server 101 internally deploys verification components such as a simulation kernel, reference model, stimulus generator, and result comparator for simulating and verifying the design under test. During the simulation, the verification server 101 monitors the search keywords generated by the logic module and samples the search keywords within a time window after their generation but before the lookup memory performs a search operation based on them. It then determines whether to control the search result based on a preset control flag. If so, it determines the table entry corresponding to the search keyword and the configuration value that satisfies the expected search result based on the expected number of hit entries and the expected search result. Within the time window, it writes the configuration value into the table entry corresponding to the search keyword in the lookup memory, ensuring that the search result matches the expected search result.
[0057] Storage device 102 is used to store various types of data required and generated during the execution of the method of the present invention. Specifically, storage device 102 stores bitmap information and table entry configuration information for multiple test cases. The table entry configuration information includes preset control identifiers, expected number of hit entries, expected search results, mask configuration parameters, and the type of function point to be verified. In embodiments of the present invention, storage device 102 can be an independent database server, a network-attached storage device, a distributed file system, or a high-performance hard disk or solid-state storage array local to verification server 101.
[0058] User terminal 103 is equipped with computer software programs that match the lookup memory result control method provided in this method. It serves as the interface device for interaction between the user and the verification system. It can include, but is not limited to, portable electronic devices or wearable electronic devices such as desktop computers (PCs), smartphones, handheld computers, tablet computers, and personal digital assistants (PDAs). This embodiment of the invention does not impose any limitations on the above. By logging into the verification server 101 through user terminal 103, test case parameters can be configured, including setting the expected number of hits for this verification, the expected search results, whether to enable a mask, and the specific location of the mask.
[0059] Please refer to Figure 2 The diagram shown illustrates a process for controlling the lookup memory result according to an embodiment of the present invention. This lookup memory result control method specifically includes the following steps:
[0060] S201: Within a time window after the keyword to be searched is generated and before the search memory performs a search operation based on the keyword to be searched;
[0061] It should be noted that during the simulation process, the logic module continuously generates search keywords according to the design function. These search keywords will be sent to the lookup memory to trigger the search operation. This invention does not impose specific restrictions on the selection of the lookup memory, which may include, but is not limited to, TCAM, CAM, etc.
[0062] Figure 5 A timing diagram of TCAM / CAM lookup in a specific embodiment of the present invention is shown. For example... Figure 5 As shown, the logic generates the search key on the rising edge of F3, and the lookup memory captures the search enable signal and the key on the clock edge of F4, and outputs the search result on F6.
[0063] Based on the aforementioned timing relationships, it is evident that an inherent time window exists between the generation of the keyword to be searched and the execution of a search operation by the lookup memory based on that keyword. The inherent and deterministic nature of this time window allows the method of this invention to be applied to most simulation scenarios, and its existence is independent of the specific implementation. Limiting the sampling operation to this time window—from "after Key generation" to "before the search action"—ensures that the sampled keyword is the same Key that will be actually processed by the lookup memory, thereby achieving precise timing-level matching and providing a reliable input basis for subsequent dynamic rewriting of table entries.
[0064] Furthermore, the sampled keywords to be searched form the data basis for dynamically configuring TCAM / CAM entries in this invention. In this embodiment, only the sampling time window is limited, without restricting the specific implementation method of sampling. For example, sampling can be implemented by the simulation environment through a backdoor, which does not affect the normal timing logic of the design under test (DUT), ensuring the authenticity of the simulation process and the reproducibility of the results. Therefore, step S201 plays a crucial role in timing alignment throughout the verification process and provides the necessary prerequisites for the controllability of subsequent search results.
[0065] S202: Based on the preset control flag, determine whether to control the search results for this search;
[0066] It should be noted that during the verification process of memory lookup, the verification objectives can include two categories: targeted verification and random verification. Targeted verification aims to precisely control the lookup results for specific functionalities such as multi-entry hits, mask matching, and priority output, in order to verify whether the behavior of the DUT meets expectations. Random verification, on the other hand, uses random stimuli to cover potential scenarios not touched by targeted use cases.
[0067] If all search results are controlled, the random verification characteristic will be eliminated, making it difficult for the simulation process to detect unforeseen problems. Therefore, it is preferable to leave some search operations in an "uncontrolled" state, allowing the DUT to run under real random conditions to expose potential defects.
[0068] Furthermore, in certain specific test scenarios, whether the search results are hit or not is not the focus of verification. For example, when test cases focus on functions such as the TCAM / CAM read / write interface, initialization process, or low-power mode, controlling the search results may introduce irrelevant variables and interfere with the test objective. In other words, when it is necessary to verify the default output or exception handling behavior of the DUT when the search keyword does not hit any table entries, the table entries can be kept unchanged and no control can be applied to the search results.
[0069] The aforementioned control identifiers can be dynamically configured by verification personnel in test cases, supporting flexible setting of control conditions based on dimensions such as function points, time periods, and keyword characteristics. This embodiment of the invention only limits the existence of control identifiers and their judgment logic, without exhaustively restricting their specific implementation methods or configuration strategies. Any scheme that implements selective control based on the ideas in this step falls within the protection scope of this invention.
[0070] In an exemplary embodiment, if it is determined that no control over the current search result is required, a search operation can be performed on the keyword to be searched based directly on the current search memory configuration.
[0071] S203: If so, then based on the expected number of entries to be hit in this search and the expected search result, determine the table entry corresponding to the search result and the configuration value that satisfies the expected search result;
[0072] It should be noted that the expected number of hits and the expected search results can be derived from preset test cases. Specifically, the expected number of hits can be set by the user according to the verification objective; the expected search results can be either a hit or a miss.
[0073] In an exemplary embodiment, determining the configuration value that satisfies the expected search result includes: determining whether to perform a masking operation on the table entry corresponding to the current search result; if yes, then configuring the random bit in the table entry corresponding to the current search result to the Mask state; if no, then calculating the corresponding configuration value based on the expected search result of the current search.
[0074] For example, within a time window, the sampled keyword to be searched is 8'h5A, and the expected search result is "hit". According to the preset, specific bits need to be randomly selected and configured as mask bits. In this example, bits 2 and 5 are randomly selected as mask bits. To ensure a hit, the non-mask bits must be the same as the corresponding bits of the keyword to be searched; the data value of the mask bits can be arbitrarily set. In this example, the data value is set to be consistent with the keyword to be searched, i.e., 8'h5A. At this time, the data 8'h5A is written into the corresponding table entry, with a mask of 8'h24. When the keyword 8'h5A is input into TCAM to perform a search, for the non-mask bits, the data is exactly equal to the keyword to be searched, satisfying the matching condition; for the mask bits, regardless of the data value, it is considered a match. Therefore, all bits match, and the search result is a hit, as expected.
[0075] It should also be noted that during random verification, if the selection of table entries is not controlled each time, some entries may be repeatedly selected while others are never selected. This will cause verification to focus on a few entries, leaving a large number of entries untested and failing to fully cover all storage locations in the lookup memory, thus affecting the completeness of the verification.
[0076] In an exemplary embodiment, determining the table entry corresponding to the search keyword includes: creating a bitmap with the same depth as the lookup memory table entry, and configuring each bit of the bitmap as a first identifier, wherein each bit of the bitmap corresponds one-to-one with the table entry of the lookup memory; obtaining at least one bit of the first identifier from the bitmap, wherein the number of first identifier bits obtained is less than or equal to the number of entries expected to be matched by the search keyword; and after writing a configuration value that satisfies the expected search result into the lookup memory table entry corresponding to the obtained bit, setting the obtained bit as a second identifier.
[0077] For example, following the above embodiment, the lookup memory has an entry depth of 8 and a desired number of hits of 3. To obtain the entries to be dynamically rewritten, an 8-bit bitmap can be created and initialized to all zeros, i.e., the first identifier is configured to 0. Three bits that are 0 are obtained from the bitmap, and data 8'h5A and a mask 8'h24 are written into the entry corresponding to these bits. Then, these three bits are set to 1 (the second identifier).
[0078] Specifically, in one embodiment, if the number of entries expected to be hit by the search keyword is greater than or equal to the number of first identifier bits in the bitmap, then the available entries are insufficient to meet the expected number of hits for this test. However, the verification process cannot be interrupted or an error should not occur as a result. In order to make full use of the remaining available entries and simultaneously advance the verification process to the next round of traversal, it is preferable to use all remaining entries for this search, that is, to obtain all the first identifier bits in the bitmap.
[0079] On the other hand, if the number of entries expected to be matched by the search keyword is less than the number of first identifier bits in the bitmap, it indicates that there are sufficient available entries. Only the expected number of entries needs to be used, i.e., preferably, the number of first identifier bits equals the number of entries expected to be matched by the search keyword. This preserves the remaining available entries for subsequent searches, avoiding the consumption of too many entries at once that would leave no entries available for subsequent searches, thus maintaining the continuity and uniformity of the verification process.
[0080] It is understandable that when all bits in the bitmap are detected to be the second identifier, all entries have been verified. At this time, each bit in the bitmap can be reset to the first identifier to reset the entry to a usable entry for the next round of verification.
[0081] S204: Within the time window, the configuration value is written into the table entry in the lookup memory corresponding to the current lookup result.
[0082] As described in the above embodiments, after confirming the entry to be written and the configuration value to be written, the write operation can be performed on the corresponding entry within the time window. It should be noted that after the lookup memory performs the lookup operation, the method further includes: obtaining the lookup result output by the lookup memory; comparing the lookup result with the expected lookup result of the keyword to be searched, to determine whether the behavior of the design under test is correct. It is understood that if the lookup result matches the expected lookup result of the keyword to be searched, the behavior of the design under test is correct; if the lookup result does not match the expected lookup result of the keyword to be searched, the behavior of the design under test is incorrect.
[0083] Please refer to Figure 3 As shown, based on the same inventive concept as the aforementioned lookup memory result control method, one embodiment of the present invention provides a lookup memory result control system 300, including: a sampling module 301, a judgment module 302, a determination module 303, and a writing module 304.
[0084] It should be noted that the lookup memory result control method of this embodiment can be applied to the lookup memory result control system of this embodiment. This lookup memory result control system can be configured on a terminal. The terminal may include, but is not limited to, a PC (Personal Computer), a PDA (Tablet PC), a smartphone, a smart wearable device, etc.
[0085] Specifically, the sampling module 301 is used to sample the keyword to be searched within a time window after the keyword is generated and before the search memory performs a search operation based on the keyword; the judgment module 302 is used to determine whether to control the current search result based on a preset control flag; the determination module 303 is used to determine the table entry corresponding to the current search result and the configuration value that satisfies the expected search result based on the expected number of hit entries and the expected search result; and the writing module 304 is used to write the configuration value into the table entry corresponding to the current search result in the search memory within the time window.
[0086] Please refer to Figure 4 As shown, embodiments of the present invention also provide an electronic device 400, which includes at least one processor 401, a memory 402 (e.g., non-volatile memory), a memory 403, and a communication interface 404, wherein the at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via an internal bus 405. The at least one processor 401 is configured to invoke at least one program instruction stored or encoded in the memory 402, causing the at least one processor 401 to perform various operations and functions of the memory lookup result control method described in the various embodiments of this specification.
[0087] In the embodiments of this specification, electronic device 400 may include, but is not limited to: personal computer, server computer, workstation, desktop computer, laptop computer, notebook computer, mobile electronic device, smartphone, tablet computer, cellular phone, personal digital assistant (PDA), handheld device, messaging device, wearable electronic device, consumer electronic device, etc.
[0088] This invention also provides a computer-readable medium carrying computer-executable instructions. When executed by a processor, these instructions can be used to implement various operations and functions of the lookup memory result control method described in the various embodiments of this specification.
[0089] The computer-readable medium in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0090] In this invention, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.
[0091] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0092] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, systems, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0093] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.
[0094] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0095] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for controlling the result of a search memory, characterized in that, include: Within a time window after the keyword to be searched is generated and before the search memory performs a search operation based on the keyword to be searched, the keyword to be searched is sampled; Based on preset control flags, determine whether to control the search results for this time; If so, then based on the expected number of entries to be hit in this search and the expected search result, determine the table entry corresponding to the search result and the configuration value that satisfies the expected search result; Within the time window, the configuration value is written into the lookup memory for the entry corresponding to the current lookup result.
2. The method for controlling the lookup memory result according to claim 1, characterized in that, Determining the table entry corresponding to the search result includes: Create a bitmap with the same depth as the lookup memory entry, and configure each bit of the bitmap as a first identifier, wherein each bit of the bitmap corresponds one-to-one with the lookup memory entry; At least one bit of a first identifier is obtained from the bitmap, and the number of first identifier bits obtained is less than or equal to the number of entries that the search keyword is expected to match. After writing the configuration value that satisfies the expected search result into the lookup memory table entry corresponding to the acquired bit, the acquired bit is set as the second identifier.
3. The method for controlling the search memory result according to claim 2, characterized in that, The step of obtaining at least one bit of the first identifier in the bitmap includes: If the number of entries expected to be hit in this search is greater than or equal to the number of first identifier bits in the bitmap, then all first identifier bits in the bitmap are obtained; If the number of entries expected to be hit in this search is less than the number of first identifier bits in the bitmap, then the number of first identifier bits obtained is equal to the number of entries expected to be hit in this search.
4. The method for controlling the lookup memory result according to claim 2, characterized in that, The method further includes: if all bits in the bitmap are second identifiers, then resetting each bit in the bitmap to a first identifier.
5. The method for controlling the lookup memory result according to claim 1, characterized in that, Determining the configuration values that satisfy the expected search results includes: Determine whether to perform a masking operation on the table entries corresponding to the search results; If so, the random bit will be set to the Mask state in the table entry corresponding to the search result. If not, the corresponding configuration value is calculated based on the expected search result of this search.
6. The method for controlling the lookup memory result according to claim 1, characterized in that, The method further includes: Obtain the search result output by the search memory; The search results are compared with the expected search results to determine whether the behavior of the tested design is correct.
7. The method for controlling the lookup memory result according to claim 1, characterized in that, The method further includes: Based on preset control flags, determine whether to control the search results for this time; If not, then a search operation is performed on the keyword to be searched based on the current search memory configuration.
8. A search memory result control system, characterized in that, include: The sampling module is used to sample the keyword to be searched within a time window after the keyword to be searched is generated and before the search memory performs a search operation based on the keyword to be searched. The judgment module is used to determine whether to control the search results based on a preset control flag; The determination module is used to determine the table entries corresponding to the search results and the configuration values that satisfy the expected search results based on the expected number of hit entries and the expected search results for this search. The writing module is used to write the configuration value into the table entry in the lookup memory corresponding to the current lookup result within the time window, so that the current lookup result matches the expected lookup result.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory that stores instructions, which, when executed by the at least one processor, cause the at least one processor to perform the memory lookup result control method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the lookup memory result control method according to any one of claims 1-7.