A universal testing system and method for hardware language code
By designing a universal testing system for hardware language codes and utilizing the modular structure of FPGA development boards and controllers, efficient and universal testing of hardware language codes is achieved, which solves the problem that existing platforms cannot effectively evaluate student independent hardware designs and hardware code physics. It solves the complexity problem of real machine testing and improves the efficiency and flexibility of hardware development.
Patent Information
- Application Number
- CN202210369564.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-04-08
AI Technical Summary
The existing hardware language code testing platform cannot achieve efficient and universal physical real machine verification, and the existing remote FPGA experimental platform lacks flexibility and reusability, and cannot effectively evaluate students' independent hardware design codes, and the physical reality of the hardware code cannot be effectively evaluated. Machine testing is complex and highly specialized, making it difficult to expand.
A general test system for hardware language code is designed, including FPGA development board and controller, including test input excitation module, tested module, test output detection module, test synchronization module and test data sampling module. Through these modules, the hardware is realized For language code testing and verification, reset, clock and callable auxiliary modules are provided to support clock signals and reset signals of multiple frequencies to realize automated testing of hardware language codes.
It realizes efficient and universal testing of hardware language codes, reduces teachers' manual judgment work, provides automated verification solutions for students' independent hardware designs, improves hardware development efficiency, supports flexible testing and evaluation of different hardware modules, and avoids the need for software Simulation cannot fully simulate hardware timing issues.
Smart Images

Figure BDA0003587550690000121 
Figure HDA0003587550700000011 
Figure HDA0003587550700000012
Abstract
Description
Technical Field
[0001] The invention belongs to the field of program code testing, and in particular relates to a universal testing system and method for hardware language codes. Background Art
[0002] Testing the code is a necessary process in the software and hardware development process. There are many online evaluation platforms for software languages, such as Zhejiang University's PAT (Programming Ability Test, LeetCode's practice website, Niuke.com's recruitment practice website, etc. These online evaluation platforms can provide software execution tests for C / C++, Java, Python, JavaScript and other software languages.
[0003] At present, there are online evaluation platforms for hardware programming languages (hardware languages), such as Jutge and HDLbit, which provide software simulation verification for Verilog language, and can only verify small-scale circuits without physical verification. At present, there are many implementation methods of remote FPGA experimental platforms, such as: a remote FPGA experimental platform built by a lightweight server provided by publication number CN111666685A, an Intel Soc FPGA remote online configuration and debugging method provided by publication number CN111427839A, or an FPGA cloud laboratory platform designed specifically for teaching provided by publication number CN111445364A. These public technical solutions cannot provide test modes that meet certain specifications.
[0004] Currently, there are online testing platforms for hardware languages, which can be downloaded to FPGA development boards to automatically test specific codes. Existing remote FPGA platforms are rarely used to evaluate students' codes for specific engineering problems. Some existing remote FPGA teaching platforms can perform simple automatic evaluations of experiments within the course, but cannot provide test solutions for problems encountered in actual production, and cannot be well expanded, that is, only specific experiments may be able to be evaluated. For example, the FPGA scalable cloud experiment platform ZyCube of the University of Science and Technology of China, in which each cloud node is composed of an ARM processor and a tightly coupled reconfigurable structure, can provide students with hands-on hardware and software programming experience, but cannot automatically evaluate students' experimental results. It is a very labor-intensive task for teachers to check and run each student's code.
[0005] Existing remote FPGA experimental platforms, such as Jiangsu University's WeLab remote experimental platform, have excellent experimental operation interfaces, but their main purpose is to enable students to understand the principles of computer composition. There are many pre-set hardware circuit experiments in the system, and users can click to download and then observe the experimental phenomena through the virtual panel. You can program the CPU that has been designed in the system and observe the data changes. However, there are limitations on students' independent hardware design, so they cannot verify their own hardware code to a certain extent.
[0006] Compared with software code testing methods, existing methods of physical real-machine testing of hardware code are more complicated. They need to comprehensively consider issues such as the collaborative design of hardware and software, hardware-software interaction, synchronization and data communication between different devices, etc., and are often specialized, that is, a set of testing solutions can only be used for chips with a specific task, lacking flexibility and reusability.
[0007] The most commonly used method for existing hardware module testing is software simulation. However, after the simulation passes, the code may not pass when executed on the real machine. Even if there is no hardware problem on the physical development board, there are still problems with physical timing. For example, if the hardware code needs to call the physical peripheral (such as reading data in the memory), all the details of the physical device may not be fully simulated through software simulation alone. Summary of the invention
[0008] In view of the above, an object of the present invention is to provide a universal testing system and method for hardware language codes, so as to realize efficient and universal testing of hardware language codes.
[0009] To achieve the above-mentioned purpose of the invention, the embodiment provides a universal test system for hardware language code, including an FPGA development board and a controller; the FPGA development board includes a test input stimulus module, a tested module, a test output detection module, a test synchronization module and a test data sampling module;
[0010] The test input stimulus module is used to output a clock signal, an input control signal, and test input data to the module under test according to the test application scenario;
[0011] The tested module is used to be designed by the user, obtain the designed hardware language code, and test the hardware language code based on the clock signal, input control signal and test input data, and output the test state, output control signal and test output data to the test output detection module;
[0012] The output detection module is used to compare the test output data with the correct output data, output the comparison result as the test result to the controller, and analyze the test status to obtain the test progress and output it to the controller;
[0013] The test synchronization module is used to synchronize test input data and test output data to facilitate data management and comparison;
[0014] The test data sampling module is used to sample test input data, test output data and corresponding correct output data, and form test data to output to the controller;
[0015] The controller is used to control the test process of the hardware language code implemented by the FPGA development board, and is also used to determine whether the test is passed according to the received test results and test progress, and output the final test results.
[0016] In one embodiment, the test synchronization module synchronizes the test input data input at the current moment and the corresponding test output data through the test tag, so as to correspond the test input data with the corresponding test output data;
[0017] The test synchronization module performs synchronization marking on the test input data input at the next moment and the corresponding test output data through the next set of tags, so as to correspond the test input data with the corresponding test output data.
[0018] In one embodiment, the test input stimulus module is used to generate a test tag at the current moment, and output the test tag to the test synchronization module when the test input data is input to the module under test at the current moment;
[0019] The test synchronization module is used to forward the received test tag to the test output detection module;
[0020] The test output detection module is used to mark the test output data obtained by calculating the test input data through the hardware language code using the received test labels, and is also used to generate the next set of labels at the next moment after the test input data test at the current moment is completed and send them to the test synchronization module;
[0021] The test synchronization module is also used to forward the next set of labels received to the test input stimulus module;
[0022] The test input stimulus module is used to mark the test input data at the next moment according to the next set of labels received.
[0023] In one embodiment, the test input stimulus module is further used to perform frequency division and delay processing on the clock signal and the input control signal according to the test requirements, and the processed clock signal and input control signal are input to the module under test.
[0024] In one embodiment, the FPGA development board also includes multiple callable auxiliary modules, and a single callable auxiliary module has a single auxiliary function or provides files required for the adaptation of the FPGA development board to assist the tested module in implementing the writing of hardware language codes.
[0025] In one embodiment, the FPGA development board also includes a reset module, which is used to output a reset signal under the control of the controller, and the reset signal includes a system reset signal, a reset signal to be tested, and a timing reset signal; wherein the system reset signal is used to control the start of the execution of the test function of the general test system, the reset signal to be tested is used to control the start of the test of the test case, and the timing reset signal is used to control the start of the timing.
[0026] In one embodiment, the FPGA development board further includes a clock module, and the clock module is used to provide clock signals of multiple frequencies for the test process to drive the test to proceed smoothly.
[0027] To achieve the above-mentioned purpose of the invention, the embodiment further provides a universal testing method for hardware language codes, wherein the universal testing method adopts the above-mentioned universal testing system and comprises the following steps:
[0028] The tested module obtains the hardware language code that can realize the test application scenario written by the user through the tested module or the callable auxiliary module;
[0029] After receiving the test task, the controller burns the executable file to the FPGA development board and controls the reset module to output a reset signal to start the test;
[0030] Under the tag synchronization of the test synchronization module, and under the control of the tag by the test input stimulus module and the test output detection module, the hardware language code of the module under test is run and monitored to implement the test process, and the test results and test progress are output to the controller;
[0031] The test data sampling module samples and saves the test input data, test output data and correct output data of the test process;
[0032] After the test is completed, the test data sampling module transmits the saved data to the controller;
[0033] The controller determines whether the test passes based on the test results and test progress, and outputs the final test results.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] The universal test system provided in the embodiment provides a new solution for school teachers to evaluate students' hardware programming ability. Students only need to complete the hardware language code writing according to the test questions through the remote universal test system, and the universal test system can verify the written hardware language code through the physical hardware platform. There is no need for teachers to manually identify the code or compile and download it one by one, and teachers can design key data in advance to avoid omissions in manual identification.
[0036] Among them, the key data is understood as: for each hardware code module, it is probably impossible to run all the input data to judge whether it is correct or not, because the amount of data may be very large. For example, a 32-bit adder cannot calculate all values. Therefore, on common software testing platforms, some boundary data are often run, such as the adder's 0+0, 0+1, 0-1, 2147483647+1, etc. This is the key data here, and different hardware modules have different key data.
[0037] The universal testing system provided in the embodiment provides a new model for enterprises to develop hardware. Product managers only need to provide instructions and some usage examples for new products. Developers then design new products according to the instructions through the tested modules of the universal testing system and implement testing of new products through other modules.
[0038] The universal testing system provided in the embodiment provides a hardware language code editing function and a hardware language code testing function, thereby realizing efficient and universal testing of hardware language codes. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 It is a schematic diagram of the structure of a universal testing system for hardware language codes provided in an embodiment;
[0041] Figure 2 is a flowchart of a general testing method for hardware language codes provided by an embodiment;
[0042] Figure 3 is a signal schematic diagram provided by an embodiment;
[0043] Figure 4 and Figure 5 This is the code simulation result provided by the experimental example. DETAILED DESCRIPTION
[0044] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0045] Figure 1 Schematic diagram of the structure of a universal testing system for hardware language codes provided in an embodiment. Figure 1 As shown, the universal test system provided in the embodiment includes an FPGA development board and an FPGA development board controller; wherein the FPGA development board includes a test input stimulus module, a tested module, a test output detection module, a test synchronization module, a test data sampling module, a reset module, a clock module, and a plurality of callable auxiliary modules. The functions of each module are described in detail below:
[0046] The reset module is used to output a reset signal to the test input stimulus module. The reset signal is used to represent a test start signal and is provided by the reset module and the controller on the FPGA development board through the GPIO port, that is, the controller controls the reset module to output the reset signal through the GPIO port. In the embodiment, the reset signal includes a system reset signal, a reset signal to be tested, and a timing reset signal; wherein the system reset signal is used to control the start of the execution test function of the general test system, the reset signal to be tested is used to control the start of the test of the test case, and the timing reset signal is used to control the start of the timing.
[0047] The clock module is used to output clock signals with multiple frequencies for the test process to drive the test to proceed smoothly. The clock signal output by the clock module is sent to the test input stimulus module.
[0048] The test input excitation module is used to output clock signals, input control signals, and test input data to the module under test according to the test application scenario. Among them, the input control signal is used to send control instructions to the module under test, including starting the test, the next set of test data is in place, which function to test, etc. The test input data refers to the function used to test the implementation of the hardware language code edited by the module under test, which can be input from the outside. According to the requirements of the test application scenario, that is, according to the implementation function of the hardware language code, the test input excitation module is also used to divide and delay the clock signal and the input control signal, and the processed clock signal and input control signal are input to the module under test. For example, when it is necessary to measure the number of clock cycles taken by the module under test to complete a certain function, the reset of the module under test needs to be after the timing reset. In addition, it is necessary to test the highest frequency at which the module under test can operate normally at different frequency clocks.
[0049] The tested module is used for user design to obtain the designed hardware language code, that is, the user (student or designer) designs through the interface provided by the tested module to design the hardware language code of the test application scenario. The tested module is also used to test the hardware language code based on the clock signal, input control signal and test input data, and output the test status, output control signal and test output data to the test output detection module. Among them, the test status marks the validity of the test output data, that is, it indicates whether the test output data is intermediate result data or final result data, and the test output data refers to the data obtained after the test input data is calculated by the written hardware language code. The output control signal refers to the signal used to inform the subsequent module whether the current output is valid, and is used to notify the test output detection module to read the valid output and ignore the intermediate irrelevant data during the test.
[0050] The output detection module is used to compare the test output data with the correct output data, output the comparison result as the test result to the controller, and analyze the test status to obtain the test progress and output it to the controller. Among them, the correct output data refers to the correct result of implementing the test application function written by the tested module on the test input data. For example, when the test application function is an addition formula, the addition formula can be written by the tested module to form a hardware language code to implement the addition function, and the correct output data refers to the result calculated by the addition formula.
[0051] Since the test status indicates the status of the test output data, that is, whether it is an intermediate result or a final result, when the analysis of the test status indicates that the test output data is intermediate result data, the test progress indicates that the test has not yet been completed; when the analysis of the test status indicates that the test output data is final result data, the test progress indicates that the test has been completed.
[0052] The test synchronization module is used to synchronize and mark the test input data and the test output data, ensuring that the test process can correspond the test samples including the test input data and the test results one by one, which is convenient for data management and data comparison. In the embodiment, the test synchronization module synchronizes and marks the test input data input at the current moment and the corresponding test output data through the test label to correspond the test input data with the corresponding test output data. Specifically, the test input stimulus module is used to generate a test label at the current moment, and when the test input data is input to the tested module at the current moment, the test label is output to the test synchronization module; the test synchronization module is used to forward the received test label to the test output detection module; the test output detection module is used to use the received test label to mark the test output data obtained by executing the calculation of the test input data through the hardware language code.
[0053] In the embodiment, the test synchronization module synchronizes and marks the test input data input at the next moment and the corresponding test output data through the next set of labels, so as to correspond the test input data with the corresponding test output data. Specifically, the test output detection module is used to generate the next set of labels at the next moment and send them to the test synchronization module after the test input data test at the current moment is completed; the test synchronization module is used to forward the received next set of labels to the test input excitation module; the test input excitation module is used to mark the test input data at the next moment according to the received next set of labels.
[0054] The test data sampling module is used to sample test input data, test output data and corresponding correct output data, and form test data to output to the controller.
[0055] The controller is used to control the test process of the hardware language code implemented by the FPGA development board, and is also used to determine whether the test passes according to the received test results and test progress, and output the final test results.
[0056] In the embodiment, a single callable auxiliary module has a single auxiliary function or provides files required for the adaptation of the FPGA development board, such as pin constraint files, to assist the tested module in writing hardware language codes. The single auxiliary function includes a two-to-one multiplexer, a 3-8 decoder, and the like.
[0057] Figure 2 is a flowchart of a general testing method for hardware language codes provided by an embodiment; Figure 3 is a signal schematic diagram provided in the embodiment. The general test method provided in the embodiment applies the above general test system, such as Figure 2 and Figure 3 As shown, the following steps are included:
[0058] Step 1, writing the tested module;
[0059] In the embodiment, the interface of the tested module is provided to the user for function writing. The user uses the callable auxiliary module defined in the test title to design the hardware language code for the tested module to realize the design and writing of the hardware language code. The tested module obtains the hardware language code that can realize the test application scenario written by the user through a single tested module, or a tested module and at least one callable auxiliary module;
[0060] Step 2: Preparation before testing
[0061] In the embodiment, after receiving the test task, the controller burns the executable file to the FPGA development board, and controls the reset module to output a reset signal to start the test.
[0062] Step 3: Testing process of the tested module monitored by the tag
[0063] In an embodiment, when the test starts, under the tag synchronization of the test synchronization module, and the test input stimulus module and the test output detection module are under the control of the tag, the hardware language code of the module under test is run and monitored to implement the test process, and the test results and test progress are output to the controller.
[0064] Specifically, when the test input excitation module receives the reset signal, it generates a test label for the current moment, and when the test input data is input to the tested module at the current moment, the test label is output to the test synchronization module, and the test synchronization module is used to forward the received test label to the test output detection module; the tested module executes the test process based on the input test input data, clock signal and input control signal, and outputs the module status, output control signal and test output data to the test output detection module, and the output detection module uses the received test label to mark the test output data obtained by calculating the test input data through the hardware language code; and after the test input data test at the current moment is completed, the next set of labels for the next moment is generated and sent to the test synchronization module; the test synchronization module forwards the next set of labels received to the test input excitation module; the test input excitation module marks the test input data at the next moment according to the next set of labels received.
[0065] Step 4: Sampling process of test data.
[0066] In an embodiment, the test data sampling module can use the highest frequency clock signal provided by the clock module as the sampling clock to sample and save the test input data, test output data and correct output data of the test process, and after the test is completed, the test data sampling module transmits the saved data to the controller through GPIO in a certain format.
[0067] Step 5: Determine whether the test is passed
[0068] In the embodiment, the controller determines whether the test is passed according to the test result and the test progress, and outputs the final test result.
[0069] The communication test system and method provided in the above embodiment can test the hardware language code on the FPGA development board and complete the verification at the physical level of the real machine. The test system and method can be oriented to the teaching scenario, and realize the test of the automated real machine physical verification of the hardware language code designed by the tested module by the students.
[0070] The universal test system and method provided in the embodiment are also aimed at practical problems encountered in engineering. Hardware function design can be carried out according to the provided test system, and the test release can be carried out on the remote universal test system. The test system development and verification can be carried out by technical personnel within the company, thereby improving the efficiency of hardware development.
[0071] The universal test system and method provided in the embodiment does not need to consider the pin constraint problem of the hardware platform. For different FPGA development boards, the hardware constraints are automatically matched through the callable auxiliary modules, so that the designers can concentrate on the core logic function design.
[0072] The universal test system provided in the embodiment is an online evaluation system for the hardware code language. It can also perform software simulation on the Verilog code through other tools such as the open source software verilator on github. The logic evaluation of the code can also be completed through simulation. However, software simulation cannot fully simulate the timing on the hardware, that is, software simulation may not be 100% able to work correctly physically.
[0073] Different from the traditional hardware testing solution (the traditional solution is to produce chips and then test them), the system and method provided in the embodiment are targeted at FPGA, have programmable characteristics, and improve flexibility.
[0074] Experimental example
[0075] This is a test question for a 4-16 decoder, but it involves two 8-bit output data. This scenario occurs when a single physical chip pin is insufficient, and the high bit of the code is needed as a chip select signal. For example, a 5-32 decoder can be designed as four 3-8 decoders, and the highest two bits are used as the selection signal of the 3-8 decoder.
[0076]
[0077] Through the general test system provided by the above embodiment, the code simulation results are as follows Figure 4 As shown, the simulation results only show some key ports, among which the test output detection module is used to detect whether the test output data of the tested module is the same as the standard correct output data, which is indicated by the ans flag. If ans is 1, it means the test data is correct, otherwise it means the data is wrong. The testReady in the top-level port of the FPGA indicates whether the test is completed. It is used to communicate with the controller. If the signal is high, the controller starts data transmission and sends a clock signal to the FPGA through the testClk in the top-level port. The FPGA outputs data through the testData signal.
[0078] Figure 4 Describes the results of a test of correct code. Figure 5 In the case where the test result is wrong, the correct tested module code is modified. The hardware code testing method provided in the embodiment can accurately find the location of the error and ensure the accuracy of the test result.
[0079] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A universal testing system for hardware language codes, characterized in that: It includes an FPGA development board and a controller; the FPGA development board includes a test input stimulus module, a tested module, a test output detection module, a test synchronization module and a test data sampling module; The test input stimulus module is used to output a clock signal, an input control signal, and test input data to the module under test according to the test application scenario; The tested module is used to be designed by the user, obtain the designed hardware language code, and test the hardware language code based on the clock signal, input control signal and test input data, and output the test state, output control signal and test output data to the test output detection module; The output detection module is used to compare the test output data with the correct output data, output the comparison result as the test result to the controller, and analyze the test status to obtain the test progress and output it to the controller; The test synchronization module is used to synchronize test input data and test output data to facilitate data management and data comparison, including: synchronize test input data input at the current moment and corresponding test output data through test tags to correspond the test input data with the corresponding test output data; synchronize test input data input at the next moment and corresponding test output data through the next set of tags to correspond the test input data with the corresponding test output data; The test data sampling module is used to sample test input data, test output data and corresponding correct output data, and form test data to output to the controller; The controller is used to control the test process of the FPGA development board to implement the hardware language code, and is also used to determine whether the test is passed according to the received test results and test progress, and output the final test results; The test input stimulus module is used to generate a test tag at the current moment, and when the test input data is input to the module under test at the current moment, the test tag is output to the test synchronization module; the test synchronization module is used to forward the received test tag to the test output detection module; the test output detection module is used to mark the test output data obtained by calculating the test input data through the hardware language code using the received test tag, and is also used to generate the next set of tags at the next moment after the test of the test input data at the current moment is completed and send them to the test synchronization module; The test synchronization module is also used to forward the next set of labels received to the test input stimulus module; the test input stimulus module is used to mark the test input data at the next moment according to the next set of labels received; The test input stimulus module is also used to perform frequency division and delay processing on the clock signal and the input control signal according to the test requirements, and the processed clock signal and input control signal are input to the module under test; The FPGA development board also includes a plurality of callable auxiliary modules, each of which has a single auxiliary function or provides files required for the adaptation of the FPGA development board to assist the tested module in implementing the writing of hardware language codes; The FPGA development board also includes a reset module, which is used to output a reset signal under the control of the controller, and the reset signal includes a system reset signal, a reset signal to be tested, and a timing reset signal; wherein the system reset signal is used to control the start of the execution of the test function of the general test system, the reset signal to be tested is used to control the start of the test of the test case, and the timing reset signal is used to control the start of the timing.
2. The universal testing system for hardware language codes according to claim 1, characterized in that: The FPGA development board also includes a clock module, which is used to provide clock signals of multiple frequencies for the test process to drive the test to proceed smoothly.
3. A general testing method for hardware language code, characterized in that: The universal testing method adopts the universal testing system according to claim 1 or 2, comprising the following steps: The tested module obtains the hardware language code that can realize the test application scenario written by the user through the tested module or the callable auxiliary module; After receiving the test task, the controller burns the executable file to the FPGA development board and controls the reset module to output a reset signal to start the test; Under the tag synchronization of the test synchronization module, and under the control of the tag by the test input stimulus module and the test output detection module, the hardware language code of the module under test is run and monitored to implement the test process, and the test results and test progress are output to the controller; The test data sampling module samples and saves the test input data, test output data and correct output data of the test process; After the test is completed, the test data sampling module transmits the saved data to the controller; The controller determines whether the test passes based on the test results and test progress, and outputs the final test results.
