Simulation test method, device, computer equipment and storage medium
Patent Information
- Application Number
- CN202011402550.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-02
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2040-12-02
Smart Images

Figure CN112541311B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of solid-state hard disks, and in particular to a simulation test method, apparatus, computer equipment, and storage medium. Background Art
[0002] The early stage of existing solid-state drive development is generally carried out on FPGA (Field Programmable Gate Array) or simulation software. The simulation test simply performed by the simulation software in the test computer is not realistic enough. The debugging methods in the simulation test of FPGA hardware alone are limited, and the test results cannot be viewed intuitively, which will cause the development and testing project to lag behind and extend the development cycle. Summary of the invention
[0003] In order to solve the above technical problems, the present application provides a simulation test method, apparatus, computer device and storage medium.
[0004] In a first aspect, the present application provides a simulation test method, which is applied to test a computer, comprising:
[0005] Get the firmware code;
[0006] When a test script is detected, the firmware code is driven according to the test script to generate a first drive instruction;
[0007] Sending the first driving instruction to a programmable logic device, where the first driving instruction is used to drive a hardware code in the programmable logic device;
[0008] A test result from the programmable logic device is received and the test result is displayed.
[0009] Optionally, after obtaining the firmware code, the method further includes:
[0010] Creating a test unit, wherein the test unit is used to provide a test tool;
[0011] The test unit and the firmware code are initialized.
[0012] Optionally, after obtaining the firmware code, the method further includes:
[0013] When the test script is not detected, obtaining a default script;
[0014] The second driving instruction is generated according to the default script.
[0015] Optionally, sending the first driving instruction to a programmable logic device includes:
[0016] The first driving instruction is sent to the second communication interface of the programmable logic device through the first communication interface.
[0017] In a second aspect, a simulation test method is provided, which is applied to a programmable logic device, and the method comprises:
[0018] Get the hardware code;
[0019] receiving a first driving instruction from a test computer;
[0020] driving the hardware code according to the first driving instruction to generate a test result;
[0021] The test result is sent to the test computer.
[0022] Optionally, before obtaining the hardware code, the method further includes:
[0023] When the programmable logic device is powered on, the programmable logic device is initialized.
[0024] In a third aspect, the present application provides a simulation device, the simulation device comprising:
[0025] A firmware code acquisition module, used to acquire firmware code;
[0026] A drive instruction generating module, configured to drive the firmware code according to the test script to generate a first drive instruction when a test script is detected;
[0027] A driving instruction sending module, used for sending the first driving instruction to a programmable logic device, wherein the first driving instruction is used for driving a hardware code in the programmable logic device;
[0028] The test result receiving module is used to receive the test result from the programmable logic device and display the test result.
[0029] In a fourth aspect, the present application provides a simulation device, comprising:
[0030] A hardware code acquisition module is used to acquire hardware codes;
[0031] A driving instruction receiving module, used for receiving a first driving instruction from a test computer;
[0032] A real test module, used to drive the hardware code according to the first drive instruction and generate a test result;
[0033] The test result sending module is used to send the test result to the test computer.
[0034] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0035] Get the firmware code;
[0036] When a test script is detected, the firmware code is driven according to the test script to generate a first drive instruction;
[0037] Sending the first driving instruction to a programmable logic device, where the first driving instruction is used to drive a hardware code in the programmable logic device;
[0038] A test result from the programmable logic device is received and the test result is displayed.
[0039] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0040] Get the firmware code;
[0041] When a test script is detected, the firmware code is driven according to the test script to generate a first drive instruction;
[0042] Sending the first driving instruction to a programmable logic device, where the first driving instruction is used to drive a hardware code in the programmable logic device;
[0043] A test result from the programmable logic device is received and the test result is displayed.
[0044] The above-mentioned simulation test method, device, computer equipment and storage medium, the method includes: obtaining firmware code; when a test script is detected, driving the firmware code according to the test script to generate a first drive instruction; sending the first drive instruction to a programmable logic device, the first drive instruction is used to drive the hardware code in the programmable logic device; receiving the test results from the programmable logic device, and displaying the test results. Based on the above-mentioned simulation test method, software testing and hardware testing are combined, hardware testing is driven by software simulation, the authenticity of simulation testing is improved by hardware testing, the test results are observed in real time by the test computer, and test adjustments are made in time, thereby reducing the test development time of the test project and improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0046] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0047] Figure 1 An application environment diagram of a simulation test method in an embodiment;
[0048] Figure 2 A schematic diagram of a flow chart of a simulation test method in an embodiment;
[0049] Figure 3 A schematic diagram of a flow chart of a simulation test method in an embodiment;
[0050] Figure 4 is a structural block diagram of a simulation device in an embodiment;
[0051] Figure 5 is a structural block diagram of a simulation device in an embodiment;
[0052] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0054] Figure 1 FIG. 1 is an application environment diagram of a simulation test method in an embodiment. Figure 1 , the simulation test method is applied to a simulation test system. The simulation test system includes a test computer 110 and a programmable logic device 120. The test computer 110 and the programmable logic device 120 are connected by a connecting line. The test computer 110 is a PC (Personal Computer), and the test computer 110 can be at least one of a desktop, a laptop, a small laptop, a tablet computer or an ultrabook. In this embodiment, the programmable logic device 120 uses an FPGA (Field Programmable Gate Array).
[0055] In one embodiment, Figure 2A flow chart of a simulation test method in an embodiment is shown in FIG. Figure 2 , provides a simulation test method. This embodiment mainly applies this method to the above Figure 1 Taking the test computer 110 in the example as an example, the simulation test method specifically includes the following steps:
[0056] Step S210, obtaining firmware code.
[0057] Specifically, the firmware code is the driver code written into the EROM or EPROM (Programmable Read Only Memory), which is responsible for controlling and coordinating the functions of the integrated circuit.
[0058] Step S220: When a test script is detected, the firmware code is driven according to the test script to generate a first driving instruction.
[0059] Specifically, the test script includes a driving instruction for a specific test, and the driving instruction is used to drive the automated test tool to execute, that is, the driving instruction in the test script is used to drive the firmware code to execute the automated test, which is equivalent to the test script sending a stimulus to the firmware code, and the firmware code responds to the stimulus to execute the corresponding test output first driving instruction. The test script is a computer-readable instruction that automatically executes the test process (or part of the test process). The test script can be created (recorded) or automatically generated using a test automation tool, or programmed in a programming language, or it can be completed by combining the first three methods. The test script can be customized according to the actual situation, and the programming language can be specifically one or more combinations of C language, java, c++, python, BASIC, etc.
[0060] Step S230: sending the first driving instruction to a programmable logic device, where the first driving instruction is used to drive the hardware code in the programmable logic device.
[0061] Specifically, the programmable logic device is an FPGA, the first driving instruction is the execution result of the firmware code, the first driving instruction drives the hardware code in the FPGA, and the hardware circuit is driven by the hardware code to realize hardware testing, wherein the hardware code is an assembly code or logic operation that can realize the operation of the logic circuit, and the hardware circuit includes components such as multipliers, registers, and address generators.
[0062] Step S240, receiving a test result from the programmable logic device and displaying the test result.
[0063] Specifically, the FPGA sends the test results to the test unit of the test computer, which organizes and analyzes them to obtain the analyzed test results, and displays the analyzed test results on the display screen. The hardware test is driven by software simulation, and the authenticity of the simulation test is improved through hardware testing, thereby improving the quality of the tested product. The test results are observed in real time by the test computer, and test adjustments can be made in time according to the observed test results, thereby reducing the test development time of the test project and improving the test efficiency.
[0064] In one embodiment, after acquiring the firmware code, a test unit is created, the test unit is used to provide a test tool; and the test unit and the firmware code are initialized.
[0065] Specifically, the test unit includes a variety of test tools. After initializing the test unit and the firmware code, the test unit selects the corresponding test tool according to the firmware code to perform subsequent software testing. The firmware code and the test unit are initialized to ensure that the previous test result will not affect the current test.
[0066] In one embodiment, after acquiring the firmware code, when the test script is not detected, a default script is acquired; and the second driving instruction is generated according to the default script.
[0067] Specifically, after obtaining the firmware code and initializing the test unit and the firmware code, when no test script is detected, a default script is obtained. The default script is a test script local to the test computer. The default script is used to drive the firmware code to generate a second drive instruction. The second drive instruction is used to drive the hardware code in the FPGA. Different test scripts correspond to different test contents. Therefore, different test scripts drive the firmware code to generate different drive instructions, that is, generate different excitation signals, and drive the hardware code in the FPGA to perform hardware testing according to the excitation signals.
[0068] In one embodiment, the first driving instruction is sent to a second communication interface of a programmable logic device via a first communication interface.
[0069] Specifically, the test computer is connected to the second communication interface of the FPGA through the first communication interface. The first communication interface and the second communication interface are of the same type. The communication interface can be a serial port or an Ethernet interface. The serial port can be a USB interface. The Ethernet interface can be any one of an SC fiber optic interface, an RJ-45 interface, an FDDI interface, an AUI interface or a BNC interface.
[0070] In one embodiment, reference Figure 3 , provides a simulation test method, this embodiment mainly applies this method to the above Figure 1Taking the programmable logic device 120 in FIG. 1 as an example, the method includes:
[0071] Step S310, obtaining hardware code.
[0072] Specifically, the hardware code is an assembly code or logic operation that can realize the operation of the logic circuit. The hardware code can be generated by the user writing code to the FPGA, or obtained by transmission from the test computer through the communication interface of the FPGA.
[0073] Step S320, receiving a first driving instruction from a test computer.
[0074] Specifically, the first driving instruction is transmitted to the FPGA through the first communication interface of the test computer, and the first driving instruction is the driving result after the test script in the test computer drives the firmware code. The first driving instruction is an excitation signal used to drive the FPGA to implement hardware testing.
[0075] Step S330: driving the hardware code according to the first driving instruction to generate a test result.
[0076] Specifically, the FPGA drives the hardware code according to the first driving instruction. The hardware code is used to drive the hardware circuit. The hardware code is an assembly code or logic operation that can realize the operation of the logic circuit. The hardware circuit includes components such as a multiplier, a register, and an address generator.
[0077] Step S340: sending the test result to the test computer.
[0078] Specifically, the test result is the output result after the FPGA drives the hardware circuit according to the hardware code. The test result is sent to the test computer according to the communication interface of the FPGA, so that the test computer organizes the received test results and displays them, thereby realizing hardware testing in the FPGA at the same time as software testing in the test computer. Hardware testing in the FPGA improves the authenticity of the simulation test, and the test results are returned to the test computer, which can be observed intuitively and adjusted in time according to the test results, thereby reducing the test development time of the test project and improving the test efficiency.
[0079] In one embodiment, before obtaining the hardware code, the programmable logic device is initialized when the programmable logic device is powered on.
[0080] Specifically, the FPGA is initialized when it is powered on, and the traces of the last test are deleted to ensure the accuracy of the current test result and prevent the last test result from affecting the current test.
[0081] Figure 2 and Figure 31 and 2 are flowcharts of a simulation test method in an embodiment. It should be understood that although Figure 2 and Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 and Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0082] In one embodiment, referring to Figure 4 This embodiment provides a simulation device, which includes:
[0083] The firmware code acquisition module 410 is used to acquire the firmware code;
[0084] A first driving instruction generating module 420 is used to drive the firmware code according to the test script to generate a first driving instruction when a test script is detected;
[0085] A driving instruction sending module 430, used for sending the first driving instruction to a programmable logic device, where the first driving instruction is used for driving a hardware code in the programmable logic device;
[0086] The test result receiving module 440 is used to receive the test result from the programmable logic device and display the test result.
[0087] In one embodiment, the apparatus further comprises:
[0088] A creation module, used for creating a test unit, wherein the test unit is used for providing a test tool;
[0089] The first initialization module is used to initialize the test unit and the firmware code.
[0090] In one embodiment, the apparatus further comprises:
[0091] A script acquisition module, used for acquiring a default script when the test script is not detected;
[0092] The second driving instruction generating module 420 is configured to generate the second driving instruction according to the default script.
[0093] In one embodiment, the driving instruction sending module 430 includes:
[0094] The transmission unit is used to send the first driving instruction to the second communication interface of the programmable logic device through the first communication interface.
[0095] In one embodiment, referring to Figure 5 This embodiment provides a simulation device, which includes:
[0096] A hardware code acquisition module 510 is used to acquire a hardware code;
[0097] A driving instruction receiving module 520 is used to receive a first driving instruction from a test computer;
[0098] A real test module 530, configured to drive the hardware code according to the first drive instruction and generate a test result;
[0099] The test result sending module 540 is used to send the test result to the test computer.
[0100] In one embodiment, the apparatus further comprises:
[0101] The second initialization module is used to initialize the programmable logic device when the programmable logic device is powered on.
[0102] Figure 6 FIG. 1 shows an internal structure diagram of a computer device in one embodiment. The computer device is Figure 1 The test computer 110 in FIG. Figure 6 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a simulation test method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a simulation test method. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0103] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In one embodiment, the simulation device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 6 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the simulation device, such as, Figure 4 The firmware code acquisition module 410, the drive instruction generation module 420, the drive instruction sending module 430 and the test result receiving module 440 are shown. The computer program composed of various program modules enables the processor to execute the steps in the simulation test method of each embodiment of the present application described in this specification.
[0105] Figure 6 The computer device shown can be Figure 4 The firmware code acquisition module 410 in the simulation device shown in the figure acquires the firmware code. The computer device can drive the firmware code according to the test script and generate a first drive instruction through the drive instruction generation module 420 when a test script is detected. The computer device can send the first drive instruction to the programmable logic device through the drive instruction sending module 430, and the first drive instruction is used to drive the hardware code in the programmable logic device. The computer device can receive the test results from the programmable logic device through the test result receiving module 440 and display the test results.
[0106] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: obtaining firmware code; when a test script is detected, driving the firmware code according to the test script to generate a first drive instruction; sending the first drive instruction to a programmable logic device, wherein the first drive instruction is used to drive hardware code in the programmable logic device; receiving a test result from the programmable logic device, and displaying the test result.
[0107] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: creating a test unit, the test unit being used to provide a test tool; and initializing the test unit and the firmware code.
[0108] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the test script is not detected, obtaining a default script; and generating the second driving instruction according to the default script.
[0109] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: sending the first driving instruction to the second communication interface of the programmable logic device through the first communication interface.
[0110] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining hardware code; receiving a first driving instruction from a test computer; driving the hardware code according to the first driving instruction to generate a test result; and sending the test result to the test computer.
[0111] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: when the programmable logic device is powered on, initializing the programmable logic device.
[0112] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining firmware code; when a test script is detected, driving the firmware code according to the test script to generate a first drive instruction; sending the first drive instruction to a programmable logic device, wherein the first drive instruction is used to drive the hardware code in the programmable logic device; receiving a test result from the programmable logic device, and displaying the test result.
[0113] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: creating a test unit, the test unit being used to provide a test tool; initializing the test unit and the firmware code.
[0114] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: when the test script is not detected, obtaining a default script; and generating the second driving instruction according to the default script.
[0115] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: sending the first driving instruction to the second communication interface of the programmable logic device through the first communication interface.
[0116] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining hardware code; receiving a first driving instruction from a test computer; driving the hardware code according to the first driving instruction to generate a test result; and sending the test result to the test computer.
[0117] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: when the programmable logic device is powered on, initializing the programmable logic device.
[0118] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0119] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0120] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A simulation test method, It is characterized in that Applied to testing a computer, the method comprises: Get the firmware code; When a test script is detected, the firmware code is driven according to the test script to generate a first drive instruction, wherein the drive instruction in the test script is used to drive the firmware code to perform an automated test, and the first drive instruction is an execution result of the firmware code; Sending the first driving instruction to a programmable logic device, where the first driving instruction is used to drive a hardware code in the programmable logic device; Receive test results from the programmable logic device and display the test results.
2. The method according to claim 1, It is characterized in that After obtaining the firmware code, the method further includes: Creating a test unit, wherein the test unit is used to provide a test tool; The test unit and the firmware code are initialized.
3. The method according to claim 1, It is characterized in that After obtaining the firmware code, the method further includes: When the test script is not detected, obtaining a default script; A second driving instruction is generated according to the default script.
4. The method according to claim 1, It is characterized in that The sending the first driving instruction to the programmable logic device includes: The first driving instruction is sent to the second communication interface of the programmable logic device through the first communication interface.
5. A simulation test method, It is characterized in that Applied to a programmable logic device, the method comprises: Get the hardware code; Receiving a first driving instruction from a test computer, wherein the first driving instruction is an execution result of the firmware code executing the automated test according to the driving instruction in the test script; driving the hardware code according to the first driving instruction to generate a test result; The test result is sent to the test computer.
6. The method according to claim 5, It is characterized in that Before obtaining the hardware code, the method further includes: When the programmable logic device is powered on, the programmable logic device is initialized.
7. A simulation device, It is characterized in that Applied to testing a computer, the simulation device comprises: A firmware code acquisition module, used to acquire firmware code; A drive instruction generation module, used for, when a test script is detected, driving the firmware code according to the test script to generate a first drive instruction, wherein the drive instruction in the test script is used to drive the firmware code to perform an automated test, and the first drive instruction is an execution result of the firmware code; A driving instruction sending module, used for sending the first driving instruction to a programmable logic device, wherein the first driving instruction is used for driving a hardware code in the programmable logic device; The test result receiving module is used to receive the test result from the programmable logic device and display the test result.
8. A simulation device, It is characterized in that Applied to a programmable logic device, the simulation device comprises: A hardware code acquisition module is used to acquire hardware codes; A driving instruction receiving module, used for receiving a first driving instruction from a test computer, wherein the first driving instruction is an execution result of the firmware code executing the automated test according to the driving instruction in the test script; A real test module, used to drive the hardware code according to the first drive instruction and generate a test result; The test result sending module is used to send the test result to the test computer.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
FPGA (Field Programmable Gate Array) online verification structure and method based on serial communication interface
CN104504187A
