A method and device for testing the function and performance of a central processing unit (CPU)
By using random testing software and detection comparison programs in CPU testing, identifying abnormal test programs in FPGA simulation testing, and debugging them in simulation testing, the problem of long development cycles in existing testing methods is solved, enabling rapid location of CPU error points and shortening of the development cycle.
Patent Information
- Application Number
- CN202211724004.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Among the existing CPU function and performance testing methods, simulation testing is slow but fast to debug, while analog testing is fast but slow to debug, resulting in a long development cycle.
Functional and performance tests are performed in FPGA simulation tests using random test software. Abnormal test programs are identified through random test programs and detection comparison programs, and then debugging is carried out in simulation tests to narrow down the range of error points.
By using fine-grained random testing and comparison programs, the time for CPU error location was shortened, debugging speed was improved, and the development cycle was shortened.
Smart Images

Figure CN115964237B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of processor technology, and in particular to a method, system, apparatus, computing device, and computer-readable storage medium for testing the function and performance of a central processing unit (CPU). Background Technology
[0002] The Central Processing Unit (CPU) serves as the core brain of many devices, and its importance is self-evident. The reliability, stability, versatility, and comprehensiveness of the CPU's functions affect the final quality of the entire device. Therefore, the functional and performance testing of the CPU becomes extremely complex and rigorous.
[0003] Existing methods for functional and performance testing of CPUs typically involve first performing software-based simulation testing, followed by FPGA (Field Programmable Gate Array)-based emulation testing. In simulation testing, initial testing is conducted first. After observing and analyzing the results to identify functional and performance issues, debugging is performed on the problematic areas. Once the CPU's functionality and performance meet preset standards after debugging, simulation testing is then performed. However, because simulation testing is not observable or analytical, it cannot quickly pinpoint the specific error points in the CPU. Therefore, the debugging process is relatively cumbersome, requiring multiple attempts to gradually approach the error point.
[0004] In summary, simulation testing is slower due to the large amount of virtual data, but faster because it is observable and analyzable. In analog testing, which is based on real physical modules, the testing speed is extremely fast, but the debugging speed is extremely slow because it is not observable or analyzable. Testing the CPU's functionality and performance in this way would result in a longer development cycle. Summary of the Invention
[0005] This invention provides a method for testing the functionality and performance of a central processing unit (CPU) to shorten the development cycle.
[0006] In a first aspect, embodiments of the present invention provide a method for testing the functionality and performance of a central processing unit (CPU), including:
[0007] In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test, so that the first CPU under test can perform functional and performance tests by executing the at least one random test software; any one of the random test software contains n random test programs, each random test program corresponding to a detection and comparison program; the detection and comparison program is used to compare the execution result of the first CPU under test on the random test program with the standard result corresponding to the random test program, and determine the abnormal random test program whose execution result is inconsistent with the standard result;
[0008] After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained;
[0009] In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault points of the second CPU under test that are abnormal in operation; the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board.
[0010] In the above technical solution, the random testing software includes n random test programs, which are randomly generated, reducing the development pressure on developers. Each random test program is followed by a corresponding detection and comparison program. The detection and comparison program includes the standard result of the random test program running normally. By comparing the execution result of the first CPU under test for each random test program with the standard result, it can be determined whether the first CPU under test runs normally in that random test program. If the comparison is inconsistent, it indicates that the first CPU under test is running abnormally in that random test program, and the abnormal random test program can be reproduced in simulation testing. This embodiment divides each random testing software into more fine-grained random test programs, and judges the execution result of each random test program through the detection and comparison program. This identifies the abnormal random test programs that are running abnormally, narrowing down the scope of CPU error location. The abnormal random test programs are configured to the simulation system, causing the second CPU under test in the simulation system to run the abnormal random test programs. Because the granularity of the abnormal random test programs is fine, the testing time for the second CPU under test is shortened, thereby accelerating the development cycle. Since the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board, the abnormal fault points identified by debugging the second CPU under test during simulation testing are also the abnormal fault points of the first CPU under test.
[0011] In some embodiments, the random testing software is generated in the following manner:
[0012] Generate a random test program;
[0013] The random test program is run using an architecture-level precision model to obtain the standard results of the random test program; the standard results are then annotated in the detection and comparison program corresponding to the random test program.
[0014] The detection and comparison program is placed after the random test program corresponding to the detection and comparison program. The process returns to the step of generating random test programs, and each random test program is placed after the detection and comparison program of the previous random test program, until n random test programs and n detection and comparison programs are generated. The n random test programs and the n detection and comparison programs form the random test software.
[0015] In some embodiments, placing the detection and comparison program after the random test program corresponding to the detection and comparison program further includes:
[0016] The reset procedure for clearing the CPU state is placed after the detection and comparison procedure;
[0017] Each random test procedure is placed after the detection and comparison procedure of the previous random test procedure, including:
[0018] Each random test procedure is placed after the reset procedure following the detection and comparison procedure of the previous random test procedure.
[0019] In some embodiments, the standard results include at least one of the following:
[0020] The standard memory of the CPU under test, the standard status controller of the CPU under test, the standard general-purpose registers of the CPU under test, the standard special-purpose registers of the CPU under test, and the standard computer page table data.
[0021] Secondly, embodiments of the present invention also provide a functional and performance testing system for a central processing unit (CPU), comprising: a programmable array logic (FPGA) board, a simulation system, and a test server; the FPGA board includes a first CPU under test; the simulation system includes a second CPU under test; the first CPU under test is a hardware implementation of the second CPU under test on the FPGA board;
[0022] The test server is used for:
[0023] In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test, so that the first CPU under test can perform functional and performance tests by executing the at least one random test software; any one of the random test software contains n random test programs, each random test program corresponding to a detection and comparison program; the detection and comparison program is used to compare the execution result of the first CPU under test on the random test program with the standard result corresponding to the random test program, and determine the abnormal random test program whose execution result is inconsistent with the standard result;
[0024] After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained;
[0025] In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault points of the second CPU under test that are malfunctioning.
[0026] In some embodiments, the test server generates the random test software in the following manner:
[0027] Generate n random test programs;
[0028] For each of the n random test programs, the random test program is run using an architecture-level precision model to obtain the standard result of the random test program; the standard result is then annotated in the detection and comparison program corresponding to the random test program.
[0029] The detection and comparison program is placed after the random test program corresponding to the detection and comparison program, so that n random test programs and n detection and comparison programs corresponding to the n random test programs form the random test software.
[0030] In some embodiments, placing the detection and comparison program after the random test program corresponding to the detection and comparison program further includes:
[0031] The reset procedure for clearing the CPU state is placed after the detection and comparison procedure.
[0032] In some embodiments, the standard results include at least one of the following:
[0033] The CPU under test includes its memory, status controller, general-purpose registers, special-purpose registers, and page table data.
[0034] Thirdly, embodiments of the present invention also provide a functional and performance testing device for a central processing unit (CPU), comprising:
[0035] Processing unit, used for:
[0036] In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test, so that the first CPU under test can perform functional and performance tests by executing the at least one random test software; any one of the random test software contains n random test programs, each random test program corresponding to a detection and comparison program; the detection and comparison program is used to compare the execution result of the first CPU under test on the random test program with the standard result corresponding to the random test program, and determine the abnormal random test program whose execution result is inconsistent with the standard result;
[0037] After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained;
[0038] In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault points of the second CPU under test that are abnormal in operation; the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board.
[0039] Fourthly, embodiments of the present invention also provide a computing device, comprising:
[0040] Memory, used to store computer programs;
[0041] The processor is used to call the computer program stored in the memory and execute the functional and performance testing methods for the central processing unit (CPU) listed above according to the obtained program.
[0042] Fifthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer-executable program, the computer-executable program being used to cause a computer to perform the functional and performance testing methods for a central processing unit (CPU) listed in any of the above embodiments. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1A flowchart illustrating a method for testing the functionality and performance of a central processing unit (CPU) according to an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of a system architecture for testing the function and performance of a central processing unit (CPU) provided in an embodiment of the present invention;
[0046] Figure 3a A flowchart illustrating a method for testing the functionality and performance of a central processing unit (CPU) according to an embodiment of the present invention;
[0047] Figure 3b A schematic diagram of a random testing procedure provided in an embodiment of the present invention;
[0048] Figure 3c A schematic diagram of a random testing software provided in an embodiment of the present invention;
[0049] Figure 3d A schematic diagram of a random testing software provided in an embodiment of the present invention;
[0050] Figure 3e A schematic diagram of a random testing software provided in an embodiment of the present invention;
[0051] Figure 4 A flowchart illustrating a method for testing the functionality and performance of a central processing unit (CPU) according to an embodiment of the present invention;
[0052] Figure 5 This is a schematic diagram of a device for testing the function and performance of a central processing unit (CPU) according to an embodiment of the present invention.
[0053] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0054] To make the objectives, implementation methods and advantages of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the described exemplary embodiments are only some embodiments of this application, and not all embodiments.
[0055] Based on the exemplary embodiments described in this application, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the appended claims. Furthermore, although the disclosures in this application are presented by way of one or more exemplary examples, it should be understood that each aspect of these disclosures can also constitute a complete implementation on its own.
[0056] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0057] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities and do not necessarily imply a specific order or sequence, unless otherwise indicated. It should be understood that such terms can be used interchangeably where appropriate, for example, to implement the application in a sequence other than those given in the embodiments illustrated or described herein.
[0058] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclusively include, for example, a product or device that includes a series of components is not necessarily limited to those that are explicitly listed, but may include other components that are not explicitly listed or that are inherent to such product or device.
[0059] In simulation testing, the CPU under test (DUT) and its peripherals in the simulation system are virtually constructed without any real physical modules; it is a virtual simulation. The states of any register, logic gate, and memory space of the DUT and its peripherals can all be observed and traced throughout the entire clock cycle using Electronic Design Automation (EDA) tools. Therefore, based on hypothetical scenarios, pre-simulation offers high controllability and observability, is easy to debug, and has recoverable coverage, making it suitable for the early stages of hardware development. However, the large amount of virtual data requires significant machine time, resulting in slower testing speeds. In summary, pre-simulation is slow for testing but fast for debugging.
[0060] After multiple iterations of test-debugging in simulation testing, some repairs were made to the CPU under test. Once the performance of the CPU under test reached the preset standard, the CPU under test and peripherals were downloaded to the FPGA board and configured as real physical modules. They were then tested in a real physical environment under the configuration of the test software – this is FPGA-based simulation testing. Because the CPU under test and all peripherals are real physical modules, based on hardware acceleration, the testing speed is fast. However, debugging is slower, for example, using a single-step debugging method. Single-step debugging typically uses the Joint Test Action Group (JTAG) interface and the Universal Asynchronous Receiver / Transmitter (UART) interface of the FPGA board for input and output. At a specific runtime point, specific observable hardware, such as the status registers, general-purpose registers, and memory space of the CPU under test, is output and then analyzed again. This requires repeated iterative debugging using the output content to gradually approach the error point. The debugging process is extremely time-consuming. Therefore, simulation testing is faster than simulation testing, but debugging is slower.
[0061] In summary, this application provides a method for testing the functionality and performance of a CPU, thereby shortening the development cycle. In simulation testing, debugging is no longer performed; the debugging process is instead conducted within the simulation test.
[0062] Specifically, simulation testing is performed first. After multiple iterations of test-debugging in the simulation testing, some repairs are made to the CPU under test. Once the performance of the CPU under test reaches the preset standard, the CPU under test and peripherals are downloaded to the FPGA board and configured as real physical modules. Test software is then configured for the CPU under test and each peripheral, and testing is conducted in a real physical environment, which is called simulation testing. In simulation testing, errors may be due to problems with the test software or hardware errors of the CPU that the simulation system failed to capture during the simulation testing phase. If unreasonable hardware errors are found, the corresponding register values or memory values in the test software that caused the errors are reproduced in the simulation test. The goal is to simulate the software and hardware scenarios on the FPGA as closely as possible on the EDA platform of the simulation test. Because simulation testing is observable and analyzable, the debugging speed is relatively fast.
[0063] For example, in a simulation test, 10 test software programs were set up for the CPU under test and its peripherals. After the test was completed, it was found that the CPU under test malfunctioned in response to the second test software. Therefore, the second test software and some of its corresponding register or memory values were reproduced in the simulation test. This allowed the specific error point of the CPU under test to be found during the simulation test.
[0064] However, the above method has a problem: the codebase of each test software is very large. After locating the anomaly in the simulation test, reproducing the anomaly in the simulation test results in extremely slow testing speed when running such a large amount of code. For example, if the code of the test software that located the anomaly is 10,000 lines, we don't know which specific line of code the CPU under test encountered the anomaly, making it impossible to accurately pinpoint the specific error. Therefore, repeatedly running these 10,000 lines of code in the simulation test is itself a test, and the testing speed is extremely slow; the more code there is, the slower the execution becomes. Furthermore, due to the large amount of code and the numerous influencing factors involved, it is difficult to reproduce the scenario in the simulation test.
[0065] In summary, another method for testing the functionality and performance of a central processing unit (CPU) is provided, such as... Figure 1 As shown, this test method can be used as follows: Figure 2 The aforementioned test system is used to perform the test. Figure 2 The test system includes: a programmable array logic FPGA board, a simulation system, and a test server. The FPGA board includes a first CPU under test; the simulation system includes a second CPU under test; the first CPU under test is a hardware implementation of the second CPU under test on the FPGA board. The test server mainly performs the following tasks: Figure 1 The test method shown.
[0066] The method includes:
[0067] Step 101: In the simulation test of the programmable array logic FPGA, at least one random test software is configured for the first CPU under test, so that the first CPU under test can perform functional and performance tests by executing the at least one random test software; any one of the random test software contains n random test programs, and each random test program corresponds to a detection and comparison program; the detection and comparison program is used to compare the execution result of the first CPU under test on the random test program with the standard result corresponding to the random test program, and determine the abnormal random test program whose execution result is inconsistent with the standard result;
[0068] Step 102: After the first CPU under test finishes executing the at least one random test software, obtain the abnormal random test program;
[0069] Step 103: In the software-based simulation test, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault point of the second CPU under test running abnormally; the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board.
[0070] In the above technical solution, the random testing software includes n random test programs, which are randomly generated, reducing the development pressure on developers. Each random test program is followed by a corresponding detection and comparison program. The detection and comparison program includes the standard result of the random test program running normally. By comparing the execution result of the first CPU under test for each random test program with the standard result, it can be determined whether the first CPU under test runs normally in that random test program. If the comparison is inconsistent, it indicates that the first CPU under test is running abnormally in that random test program, and the abnormal random test program can be reproduced in simulation testing. This embodiment divides each random testing software into more fine-grained random test programs, and judges the execution result of each random test program through the detection and comparison program. This identifies the abnormal random test programs that are running abnormally, narrowing down the scope of CPU error location. The abnormal random test programs are configured to the simulation system, causing the second CPU under test in the simulation system to run the abnormal random test programs. Because the granularity of the abnormal random test programs is fine, the testing time for the second CPU under test is shortened, thereby accelerating the development cycle. Since the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board, the abnormal fault points identified by debugging the second CPU under test during simulation testing are also the abnormal fault points of the first CPU under test.
[0071] Before performing functional and performance tests on the CPU under test, the test server will first generate at least one set of test software. The steps for generating such test software are described below. This test software contains multiple more granular test programs and can be used in both simulation and mock-up tests.
[0072] Specific steps are as follows: Figure 3a As shown, it includes:
[0073] Step 301: Generate a random test program;
[0074] A random test program is generated by randomly selecting and combining instructions. This random test program contains at least one instruction. Since the test software is generated by the machine without manual configuration, development time is saved and the development workload of researchers is reduced. Figure 3b A schematic diagram of a random test program generated using the method described above is shown.
[0075] Step 302: Run the random test program using the architecture-level accurate model to obtain the standard results of the random test program; mark the standard results in the detection and comparison program corresponding to the random test program;
[0076] The architecture-level precise model here is generally provided by the CPU architecture owner, such as ARM, MIPS, or the RISC-V open-source community. Running any random test program within the architecture-level precise model yields the standard result corresponding to that test program. That is, the result that should be obtained when the CPU is running normally without any abnormalities. The standard result can be the CPU's memory, state controller, general-purpose registers, special-purpose registers, and computer page table data, etc. For example, after running random test program 1 in the architecture-level precise model, the CPU's memory is a1, state controller is b1, general-purpose registers are c1, special-purpose registers are d1, and computer page table data is e1.
[0077] Each random test procedure corresponds to a detection and comparison procedure. The standard result obtained by running a certain random test procedure on the architecture-level accurate model is labeled in the detection and comparison procedure corresponding to that random test procedure. For example, the standard result corresponding to random test procedure 1 is labeled in the detection and comparison procedure 1 corresponding to random test procedure 1.
[0078] Step 303: Place the detection and comparison program after the random test program corresponding to the detection and comparison program, return to the step of generating random test programs, and place each random test program after the detection and comparison program of the previous random test program, until n random test programs and n detection and comparison programs are generated. The n random test programs and the n detection and comparison programs form the random test software.
[0079] Figure 3c The placement of the detection and comparison program 1 corresponding to the random test program 1 is shown. The detection and comparison program 1 is placed after the random test program 1.
[0080] Continue generating random test program 2, placing it after detection and comparison program 1. Run random test program 2 on the architecture-level accurate model, annotate the obtained standard results in detection and comparison program 2, and place detection and comparison program 2 after random test program 2. Generate random test program 3, placing it after detection and comparison program 2. Run random test program 3 on the architecture-level accurate model, annotate the obtained standard results in detection and comparison program 3, and place detection and comparison program 3 after random test program 3. Repeat the above steps until n random test programs and n detection and comparison programs are generated. The n random test programs and n detection and comparison programs constitute the random test software.
[0081] Figure 3d This paper presents a possible randomized testing software consisting of n randomized testing programs and n detection and comparison programs.
[0082] At least one random test software was run in the simulation system for simulation testing, which was relatively slow. However, because the simulation system is observable and analyzable, the debugging speed was extremely fast. Through continuous testing and debugging iterations, the functionality and performance of the CPU under test were brought to the preset standards. Then, the CPU under test was downloaded to the FPGA board for simulation testing.
[0083] In simulation testing, one possible approach is to configure at least one random test software used in the simulation test onto the first CPU under test on the FPGA board. The first CPU under test then runs this random test software. Another possible approach is to regenerate new random test software. In the simulation test, the new random test software is configured for the first CPU under test. In other words, the random test software used in simulation testing and simulation testing can be different.
[0084] The following describes how to determine the fault point of the CPU under test in a simulation test.
[0085] In the simulation test, at least one random test software is configured for the first CPU under test. The random test software is generated in the manner described above. The first CPU under test runs these random test software programs. When each random test program in each random test software runs, an execution result is obtained. When the detection and comparison program runs, it can be used to determine whether the execution result of the first CPU under test running the random test program is consistent with the standard result. If they are inconsistent, the random test program is identified as an abnormal random test program.
[0086] After the first CPU under test has finished running all the random test software, the test server can obtain all the abnormal random test programs. Generally, the detection and comparison program can be configured to perform the following actions: when it is determined that the execution result is inconsistent with the standard result, the random test program corresponding to the detection and comparison program is displayed on the test server's display interface, so that developers can quickly locate the abnormal random test program.
[0087] For example, the abnormal test programs are random test programs 1 and 2 in random test software 1; and random test programs 3 and 4 in random test software 5.
[0088] After obtaining the abnormal random test program, it is simulated again. The abnormal random test program is configured for the second CPU under test in the simulation system, allowing it to run. Because the simulation test is observable and analyzable, the specific fault point of the second CPU under test can be quickly determined, resulting in faster debugging. Since the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board, the fault point of the second CPU under test is also the fault point of the first CPU under test.
[0089] Alternatively, anomaly random test software and its corresponding detection and comparison program can be configured for the second CPU under test in the simulation system. This allows the second CPU under test to run both the anomaly random test software and its corresponding detection and comparison program.
[0090] It can be observed that the above method, by dividing the test software into more granular random test programs, increases the number of detection and comparison nodes, reduces the test granularity, and makes it easier to focus on and highlight problems. Without setting n random test programs, the amount of code in the abnormal random software running in each simulation test is too large, making it difficult to quickly locate the problem. However, setting n random test programs allows direct identification of the more granular random test program, and the problematic random test program can be run directly in the simulation system, resulting in less code and faster execution speed. Therefore, the development cycle is shortened.
[0091] In some embodiments, to sever the hardware dependency between small-particle random test programs and avoid the influence of the previous random test program on the next, the detection and comparison program can be placed after the random test program corresponding to the detection and comparison program, and further include placing a reset program for clearing the CPU state after the detection and comparison program. Therefore, placing each random test program after the detection and comparison program of the previous random test program includes placing each random test program after the reset program following the detection and comparison program of the previous random test program.
[0092] Specifically, a reset procedure is set after each detection and comparison program to clear the state changes caused by the first CPU under test running the detection and comparison program and the corresponding random test program. For example, after the first CPU under test runs random test program 1 and detection and comparison program 1, its memory and other hardware resources are greatly consumed, which affects the performance of running random test program 2. To avoid this impact, we set a reset procedure 1 after detection and comparison program 1 to clear the occupation of memory and other hardware resources of the first CPU under test. Figure 3e A schematic diagram of a possible random testing software is shown.
[0093] In the initial simulation test, because the functionality of the CPU under test is not yet mature, the number of random test programs can be relatively small, i.e., n can be small. As the functionality of the CPU under test gradually improves, the number of random test programs can be larger during simulation testing.
[0094] In some embodiments, the standard results include at least one of the following:
[0095] The standard memory of the CPU under test, the standard status controller of the CPU under test, the standard general-purpose registers of the CPU under test, the standard special-purpose registers of the CPU under test, and the standard computer page table data.
[0096] The execution result must include at least one of the following:
[0097] The CPU under test includes its execution memory, execution status controller, execution general-purpose registers, execution special registers, and execution computer page table data.
[0098] The detection and comparison program compares each execution result with a standard result. When a result matches the standard result, it compares the next result with the standard result. If a result does not match the standard result, it reports the corresponding random test program and the inconsistent result. The reported results are compiled into a table for developers to view, allowing them to quickly locate the abnormal random test program and the abnormal execution result.
[0099] Figure 4 A flowchart illustrating a possible process for generating an anomalous random test procedure and its execution results is shown, including:
[0100] Step 401: Obtain the execution results of each item in the random test program 1 executed by the CPU under test;
[0101] Step 402: Compare the value of the execution memory of the CPU under test in the execution result with the value of the standard memory in the standard result. If they are inconsistent, write the value of the random test program 1 and the execution memory into the exception table.
[0102] Step 403: Compare the value of the execution status controller of the CPU under test in the execution result with the value of the standard status controller in the standard result. If they are inconsistent, write the random test program 1 and the value of the execution status controller into the exception table.
[0103] Step 404: Compare the value of the execution general-purpose register of the CPU under test in the execution result with the value of the standard general-purpose register in the standard result. If they are inconsistent, write the random test program 1 and the value of the execution general-purpose register into the exception table.
[0104] Step 405: Compare the value of the execution special register of the CPU under test in the execution result with the value of the standard special register in the standard result. If they are inconsistent, write the random test program 1 and the value of the execution special register into the exception table.
[0105] Step 406: Compare the value of the execution computer page table data of the CPU under test in the execution result with the value of the standard computer page table data in the standard result. If they are inconsistent, write the values of the random test program 1 and the execution computer page table data into the exception table.
[0106] Table 1 shows one possible exception table.
[0107] Table 1
[0108] Random test program for exceptions An abnormal execution result occurred. Specific value Random test program 1 Execution Memory 12% Execute general-purpose registers 1 Random test program 2 Execution Memory 14% Execute computer page table data 2
[0109] Based on Table 1, the execution results of the abnormal random test program at the point of failure can be located more accurately. This allows for a more realistic reproduction of the environment in simulation testing, improving the accuracy of identifying the specific fault point of the CPU.
[0110] Based on the same technological concept Figure 5 An exemplary embodiment of the present invention illustrates the structure of a functional and performance testing apparatus for a central processing unit (CPU), which can perform a process for functional and performance testing of a CPU.
[0111] like Figure 5 As shown, the device specifically includes:
[0112] Processing unit 501 is used for:
[0113] In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test, so that the first CPU under test can perform functional and performance tests by executing the at least one random test software; any one of the random test software contains n random test programs, each random test program corresponding to a detection and comparison program; the detection and comparison program is used to compare the execution result of the first CPU under test on the random test program with the standard result corresponding to the random test program, and determine the abnormal random test program whose execution result is inconsistent with the standard result;
[0114] After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained;
[0115] In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault points of the second CPU under test that are abnormal in operation; the first CPU under test is the hardware implementation of the second CPU under test on the FPGA board.
[0116] In some embodiments, the processing unit 501 is specifically used for:
[0117] Generate a random test program;
[0118] The random test program is run using an architecture-level precision model to obtain the standard results of the random test program; the standard results are then annotated in the detection and comparison program corresponding to the random test program.
[0119] The detection and comparison program is placed after the random test program corresponding to the detection and comparison program. The process returns to the step of generating random test programs, and each random test program is placed after the detection and comparison program of the previous random test program, until n random test programs and n detection and comparison programs are generated. The n random test programs and the n detection and comparison programs form the random test software.
[0120] In some embodiments, the processing unit 501 is further configured to:
[0121] The reset procedure for clearing the CPU state is placed after the detection and comparison procedure;
[0122] The processing unit is specifically used to: place each random test program after the reset program following the detection and comparison program of the previous random test program.
[0123] In some embodiments, the standard results include at least one of the following:
[0124] The standard memory of the CPU under test, the standard status controller of the CPU under test, the standard general-purpose registers of the CPU under test, the standard special-purpose registers of the CPU under test, and the standard computer page table data.
[0125] Based on the same technical concept, embodiments of this application provide a computer device, such as... Figure 6 As shown, it includes at least one processor 601 and a memory 602 connected to at least one processor. In this embodiment, the specific connection medium between the processor 601 and the memory 602 is not limited. Figure 6 Taking the connection between the processor 601 and the memory 602 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.
[0126] In this embodiment of the application, the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, at least one processor 601 can perform the steps of the above-described method for testing the function and performance of the central processing unit (CPU).
[0127] The processor 601 is the control center of the computer device. It can connect to various parts of the computer device using various interfaces and lines. By running or executing instructions stored in the memory 602 and calling data stored in the memory 602, it performs functional and performance tests on the central processing unit (CPU). In some embodiments, the processor 601 may include one or more processing units. The processor 601 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.
[0128] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0129] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 602 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0130] Based on the same technical concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer-executable program, the computer-executable program being used to cause a computer to perform the methods for functional and performance testing of a central processing unit (CPU) as listed in any of the above methods.
[0131] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application 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.
[0132] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should 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 illustrations. Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0133] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0134] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0135] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for testing the functionality and performance of a central processing unit (CPU), characterized in that, include: In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test (CPU), enabling the CPU under test to perform functional and performance tests by executing the at least one random test software. Each random test software contains n random test programs, each corresponding to a detection and comparison program. The detection and comparison program is used to compare the execution result of the random test program by the first CPU under test with the corresponding standard result of the random test program, identifying abnormal random test programs whose execution results are inconsistent with the standard result. The standard result includes at least one of the following: the standard memory of the CPU under test, the standard state controller of the CPU under test, the standard general-purpose registers of the CPU under test, the standard special-purpose registers of the CPU under test, and standard computer page table data. The standard result is obtained by running the random test program using an architecture-level precise model, and the standard result is marked in the detection and comparison program corresponding to the random test program. After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained; In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault point of the abnormal operation of the second CPU under test. The fault point of the abnormal operation of the second CPU under test is the fault point of the abnormal operation of the first CPU under test. The first CPU under test is the hardware implementation of the second CPU under test on the FPGA board.
2. The method as described in claim 1, characterized in that, The random testing software is generated in the following manner: Generate a random test program; The detection and comparison program is placed after the random test program corresponding to the detection and comparison program. The process returns to the step of generating random test programs, and each random test program is placed after the detection and comparison program of the previous random test program, until n random test programs and n detection and comparison programs are generated. The n random test programs and the n detection and comparison programs form the random test software.
3. The method as described in claim 2, characterized in that, Placing the detection and comparison program after the random test program corresponding to the detection and comparison program further includes: The reset procedure for clearing the CPU state is placed after the detection and comparison procedure; Each random test procedure is placed after the detection and comparison procedure of the previous random test procedure, including: Each random test procedure is placed after the reset procedure following the detection and comparison procedure of the previous random test procedure.
4. A functional and performance testing system for a central processing unit (CPU), characterized in that, include: Programmable array logic FPGA boards, simulation systems, and test servers; The FPGA board includes a first CPU under test; the simulation system includes a second CPU under test; the first CPU under test is a hardware implementation of the second CPU under test on the FPGA board; The test server is used for: In the simulation testing of a programmable array logic FPGA, at least one random test software is configured for a first CPU under test (CPU), enabling the CPU under test to perform functional and performance tests by executing the at least one random test software. Each random test software contains n random test programs, each corresponding to a detection and comparison program. The detection and comparison program is used to compare the execution result of the random test program by the first CPU under test with the corresponding standard result of the random test program, identifying abnormal random test programs whose execution results are inconsistent with the standard result. The standard result includes at least one of the following: the standard memory of the CPU under test, the standard state controller of the CPU under test, the standard general-purpose registers of the CPU under test, the standard special-purpose registers of the CPU under test, and standard computer page table data. The standard result is obtained by running the random test program using an architecture-level precise model, and the standard result is marked in the detection and comparison program corresponding to the random test program. After the first CPU under test finishes executing the at least one random test software, an abnormal random test program is obtained; In software-based simulation testing, the abnormal random test program is configured for the second CPU under test, so that the second CPU under test runs the abnormal random test program, thereby debugging the fault point of the abnormal operation of the second CPU under test. The fault point of the abnormal operation of the second CPU under test is the fault point of the abnormal operation of the first CPU under test.
5. The system as described in claim 4, characterized in that, The test server generates the random test software in the following manner: Generate n random test programs; The detection and comparison program is placed after the random test program corresponding to the detection and comparison program, so that n random test programs and n detection and comparison programs corresponding to the n random test programs form the random test software.
6. The system as described in claim 4, characterized in that, Placing the detection and comparison program after the random test program corresponding to the detection and comparison program further includes: The reset procedure for clearing the CPU state is placed after the detection and comparison procedure.
7. A computing device, characterized in that, include: Memory, used to store computer programs; A processor is configured to invoke a computer program stored in the memory and execute the method according to any one of claims 1 to 3 in accordance with the obtained program.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer-executable program for causing a computer to perform the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Chip software and hardware simulation environment based on UVM and FPGA
CN107463473A
Simulation test method and system for processor cooperative chip and related components
CN111639470A
Self-checking random test method and random cycle test device
CN112416666A
