Test program batch variant method
By testing the batch variant method of the program, and analyzing and generating test programs with different Cache behaviors, the problem of insufficient coverage of the existing cache consistency test program collection is solved, and more comprehensive test coverage and higher testing efficiency are achieved.
Patent Information
- Application Number
- CN202110425772.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-20
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2041-04-20
AI Technical Summary
The existing cache consistency test program collection is not comprehensive enough to fully verify cache consistency in multi-core processors.
The batch variant method of test program is used to analyze the test program source code, determine the core code segment and establish a function stack, generate test programs with different cache behaviors, and increase the test coverage.
Based on the original test program collection, multiple times are expanded to enhance test coverage, and can conduct full verification and testing in the silicon pre- and post-silicon verification of domestic multi-core processors, reducing chip design costs and shortening R&D cycle.
Smart Images

Figure CN114218062B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a test program batch variation method, belonging to the field of high-speed cache consistency verification. Background Art
[0002] The adoption of cache technology is to match the speed of the processor and the access speed of the memory. The cache is located between the processor and the main memory. It is small in size but fast in speed. With the development of multi-processor, multi-core and many-core technologies, multi-level cache technology has emerged, which often distinguishes between core-level cache and shared cache outside the core, and the memory hierarchy is becoming more and more complex. This makes the consistency problem of existing caches more and more prominent.
[0003] With the increase of processor storage levels, taking the most widely used three-level cache technology on multi-core processors as an example: the first-level cache and the second-level cache are in the same core, which requires data consistency to be maintained between the first-level cache and the second-level cache; data consistency must be maintained between the first-level cache and the second-level cache of different cores; data consistency must be maintained between the cache in the core and the shared third-level cache outside the core. In the verification of cache consistency of multi-core processors, the testing of cache consistency through upper-level application topics is not rich enough and the coverage is not comprehensive enough.
[0004] In the instruction system of multi-core processors, in order to deal with the situation where discrete memory access affects cache performance, non-cacheable memory access instructions and cache control instructions are designed. Variant test programs refer to new test programs generated by changing the program's behavior at the instruction level based on the original test program.
[0005] Since cache consistency testing is difficult to cover all consistency scenarios, it is necessary to continuously expand the coverage. The traditional method is to write the corresponding test program in a high-level language according to the needs of hardware designers, but this method has high requirements for testers. In the cache consistency test of domestic multi-core processors, the upper application-level consistency test program set is not rich enough and the test coverage is not enough. How to expand the test program on the basis of the original test program set, increase the test coverage, and fully verify the cache consistency of the processor is the problem to be solved by the present invention. Summary of the invention
[0006] The purpose of the present invention is to provide a test program batch variation method to solve the problem that the programs in the cache consistency test program set are not rich enough and the coverage is not comprehensive enough.
[0007] To achieve the above object, the technical solution adopted by the present invention is: to provide a test program batch variation method, using a cache consistency test program set as a test program set, the test programs contained in the cache consistency test program set use the same test program library, the test program source codes have the same characteristics, so that the analysis method of the test program source codes has the same rules;
[0008] The following steps are involved:
[0009] S1. Apply analysis rules to analyze the test program source code and determine the core code segment interval;
[0010] S2. For the core code segment interval obtained in S1, a function stack is established for its function call relationship, the function call situation of the core segment code is analyzed, and the function code called by the core segment code is obtained;
[0011] S3. For the test program that changes the program execution path, copy its core code segment and use the if / else structure to distinguish the two identical core code segments, copy the function code called by the core segment code obtained in S2, add a suffix to the function name of one of the function codes, and add a suffix to the function called by the code segment in the if condition in the if / else structure;
[0012] S4. For the test program that does not change the program execution path, add embedded assembly codes to the starting positions of its core segment code and the function code called by the core segment code as the delimitation start mark and the delimitation end mark, respectively, to obtain the variant program source code;
[0013] For the variant method of changing the program execution path, the starting position of the core segment code copied in the if condition of the if / else structure is respectively added with embedded assembly code, and the starting position of the function code with the function name added with a suffix in the function code called by the core segment code is respectively added with embedded assembly code as a delimiting start mark and a delimiting end mark, so as to obtain the variant program source code;
[0014] S5, compiling the variant program source code obtained in S4 into an assembly code, wherein the assembly code includes a delimitation start mark and a delimitation end mark;
[0015] S6, for the assembly code obtained in S5, replace the memory access instruction in the assembly code between the delimiting start marker and the delimiting end marker with a non-cacheable instruction or add cache control instructions before and after the memory access instruction to obtain a variant assembly code;
[0016] S7. Compile the variant assembly code obtained in S6 into an executable file.
[0017] The further improved scheme in the above technical scheme is as follows:
[0018] 1. In the above scheme, steps S1-S7 are applied to each test program in the cache consistency test program set to batch generate different variant test program sets.
[0019] 2. In the above solution, in S3, the judgment condition of the if / else structure is determined by the program input parameters.
[0020] Due to the application of the above technical solution, the present invention has the following advantages compared with the prior art:
[0021] The present invention can batch mutate the test programs in the cache consistency test program set, generate test programs with different cache behaviors, expand the original consistency test program set by multiple times, enhance the test coverage, conduct sufficient verification tests in the pre-silicon verification and post-silicon verification of domestic multi-core processors, discover the design problems in the processor as early as possible, so as to ensure the correctness and usability of the domestic multi-core processors, improve the success rate of one-time tape-out, thereby reducing the chip design cost and shortening the research and development cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Attached Figure 1 A schematic diagram of a test program variant method in the present invention that does not change the program path;
[0023] Attached Figure 2 A schematic diagram of a test program variant method for changing a program path in the present invention;
[0024] Attached Figure 3 This is a flow chart of batch variants of the test procedure of the present invention. DETAILED DESCRIPTION
[0025] Embodiment: The present invention provides a test program batch variation method, using a cache consistency test program set as a test program set, wherein the test programs contained in the cache consistency test program set use the same test program library, and the test program source codes have the same characteristics, so that the analysis method for the test program source codes has the same rules;
[0026] The following steps are involved:
[0027] S1. Apply analysis rules to analyze the test program source code and determine the core code segment interval;
[0028] S2. For the core code segment interval obtained in S1, a function stack is established for its function call relationship, the function call situation of the core segment code is analyzed, and the function code called by the core segment code is obtained;
[0029] S3. For the test program that changes the program execution path, copy its core code segment and use the if / else structure to distinguish the two identical core code segments, copy the function code called by the core segment code obtained in S2, add a suffix to the function name of one of the function codes, and add a suffix to the function called by the code segment in the if condition in the if / else structure;
[0030] S4. For the test program that does not change the program execution path, add embedded assembly codes to the starting positions of its core segment code and the function code called by the core segment code as the delimitation start mark and the delimitation end mark, respectively, to obtain the variant program source code;
[0031] For the variant method of changing the program execution path, the starting position of the core segment code copied in the if condition of the if / else structure is respectively added with embedded assembly code, and the starting position of the function code with the function name added with a suffix in the function code called by the core segment code is respectively added with embedded assembly code as a delimiting start mark and a delimiting end mark, so as to obtain the variant program source code;
[0032] S5, compiling the variant program source code obtained in S4 into an assembly code, wherein the assembly code includes a delimitation start mark and a delimitation end mark;
[0033] S6, for the assembly code obtained in S5, replace the memory access instruction in the assembly code between the delimiting start marker and the delimiting end marker with a non-cacheable instruction or add cache control instructions before and after the memory access instruction to obtain a variant assembly code;
[0034] S7. Compile the variant assembly code obtained in S6 into an executable file.
[0035] Apply steps S1-S7 to each test program in the cache consistency test program set to batch generate different variant test program sets.
[0036] In S3, the judgment condition of the if / else structure is determined by the program input parameters.
[0037] The above embodiment is further explained as follows:
[0038] The basic concept of the present invention is to operate the core memory access instructions in the assembly code compiled by the test program on the basis of the cache consistency test program, generate new assembly code, and then use the new assembly code to generate an executable file.
[0039] Establish a function stack for the core segment code to obtain the calling relationship while preventing the impact of recursive functions; copy the core segment memory access and the functions it calls, and use the if / else structure to control the processor core execution path using running parameters; replace the non-cacheable instructions in the assembly code that defines the core segment, and add cache control instructions before and after the instructions to change the cache behavior of the test program.
[0040] The present invention operates the core memory access instruction in the original test program and changes the cache behavior in the test program to achieve the purpose of enhancing the test coverage;
[0041] The present invention simultaneously copies the core memory access segment in the original test program, so that the same memory access segment in the program generates two identical execution paths, and controls the core to enter different execution paths through operating parameters;
[0042] The present invention performs batch rapid mutations on high-speed cache consistency test programs, thereby expanding the test program set in a short time and enhancing the test coverage.
[0043] The specific implementation of the present invention comprises the following steps:
[0044] 1. Analyze the test program and determine the core code segment;
[0045] 2. Establish a function stack for the function call relationship in the core code segment and obtain the function code called by the core segment code;
[0046] 3. Variant programs are divided into two categories: variant programs that change the program execution path and variant programs that do not change the program execution path. For variant programs that change the program execution path, copy the core memory access code and use the if / else structure to distinguish them. At the same time, copy the function code called by the core memory access code and add a suffix to the function name of one of the function codes;
[0047] 4. Add embedded assembly code at the starting position and the end position of the core code segment and the function code called by it, which serves as the delimiting start mark and the delimiting end mark;
[0048] 5. Compile the marked variant source code into assembly code;
[0049] 6. Replace the memory access instructions between the start mark and the end mark with non-cacheable memory access instructions, or add cache control instructions before or after them;
[0050] 7. Compile the variant assembly code generated in step 5 into an executable file;
[0051] 8. Apply the first 7 steps to the cache consistency test program set to batch generate more and richer variant test program sets.
[0052] When the above-mentioned test program batch mutation method is adopted, the test programs in the cache consistency test program set can be batch mutated to generate test programs with different cache behaviors. On the basis of the original consistency test program set, it can be expanded several times to enhance the test coverage. In the pre-silicon verification and post-silicon verification of domestic multi-core processors, sufficient verification tests are carried out to discover the design problems in the processor as early as possible to ensure the correctness and usability of domestic multi-core processors, improve the success rate of one-time tape-out, and thus reduce the chip design cost and shorten the research and development cycle.
[0053] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for batch variation of test programs, Features: Applying a cache consistency test program set as a test program set, wherein the test programs contained in the cache consistency test program set use the same test program library, and the test program source codes have the same characteristics, so that the analysis method of the test program source codes has the same rules; The following steps are involved: S1. Apply analysis rules to analyze the test program source code and determine the core code segment interval; S2. For the core code segment interval obtained in S1, a function stack is established for its function call relationship, the function call situation of the core segment code is analyzed, and the function code called by the core segment code is obtained; S3. For the test program that changes the program execution path, copy its core code segment and use the if / else structure to distinguish the two identical core code segments, copy the function code called by the core segment code obtained in S2, add a suffix to the function name of one of the function codes, and add a suffix to the function called by the code segment in the if condition in the if / else structure; S4. For the test program that does not change the program execution path, add embedded assembly codes to the starting positions of its core segment code and the function code called by the core segment code as the delimitation start mark and the delimitation end mark, respectively, to obtain the variant program source code; For the variant method of changing the program execution path, the starting position of the core segment code copied in the if condition of the if / else structure is respectively added with embedded assembly code, and the starting position of the function code with the function name added with a suffix in the function code called by the core segment code is respectively added with embedded assembly code as a delimiting start mark and a delimiting end mark, so as to obtain the variant program source code; S5, compiling the variant program source code obtained in S4 into an assembly code, wherein the assembly code includes a delimitation start mark and a delimitation end mark; S6, for the assembly code obtained in S5, replace the memory access instruction in the assembly code between the delimiting start marker and the delimiting end marker with a non-cacheable instruction or add cache control instructions before and after the memory access instruction to obtain a variant assembly code; S7. Compile the variant assembly code obtained in S6 into an executable file.
2. The test program batch variation method according to claim 1, Features: Apply steps S1-S7 to each test program in the cache consistency test program set to batch generate different variant test program sets.
3. The test program batch variation method according to claim 1, Features: In S3, the judgment condition of the if / else structure is determined by the program input parameters.
Citation Information
Patent Citations
Self-checking random test method and random cycle test device
CN112416666A
Parallel memory access assembly program automatic generation system and storage consistency test method
CN112445661A