Instruction verification method and device, electronic equipment and storage medium

By conducting directional and random testing of the chip instruction set and combining preset simulation software, the in-chip instruction set verification problem is solved, and functional stability and system upgrade are achieved.

CN119201695AActive Publication Date: 2024-12-27北京中科昊芯科技有限公司

Patent Information

Application Number
CN202411225280.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-27
Estimated Expiration
2044-09-03

AI Technical Summary

Technical Problem

The lack of effective methods in the prior art to quickly verify the instruction set in the chip, making it difficult to ensure chip functional stability.

Method used

By obtaining the set of instructions to be verified, conducting directional testing and random testing, and using preset simulation software and assembly files to determine the verification results, it has good scalability and reusability, and can meet the verification brought by adjustments such as the number and depth of loop instructions. System upgrade requirements.

Benefits of technology

实现了对芯片指令集的快速验证,确保了芯片功能的稳定性,并具备良好的扩展性和复用性,适应未来验证系统的升级需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201695A_ABST
    Figure CN119201695A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide an instruction verification method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining a to-be-verified instruction set; respectively carrying out a directional test and a random test on the instruction set to be verified to obtain an assembly file corresponding to the instruction set to be verified; the preset simulation software and the assembly file corresponding to the to-be-verified instruction set are adopted, the verification result corresponding to the to-be-verified instruction set is determined, in the embodiment of the invention, the to-be-verified instruction set is subjected to directional testing and random testing, the directional testing is used for testing centralized special functions, and the random testing is used for testing the centralized special functions. The random verification mode can perform random verification on the cycle depth, the cycle index and the instruction in the cycle body, and the instruction verification mode provided by the invention has good expansibility and reusability, and can meet the requirements of related verification system upgrading brought by adjustment of the cycle index, the cycle depth and the like of the cycle instruction in the future.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip testing technology, and in particular to an instruction verification method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of chip technology, the structure and function of chips are becoming more and more complex. Various programs need to be downloaded into the chip. These programs include various instruction sets. Before the chip leaves the factory, the chip hardware and programs need to be tested. However, there is no specific solution in the existing technology to test the instruction set in the chip. Therefore, how to quickly verify the instruction set in the chip and ensure the stability of the chip function is a problem that needs to be solved urgently. Summary of the invention

[0003] Some embodiments of the present application aim to provide an instruction verification method, device, electronic device and storage medium. Through the technical scheme of the embodiments of the present application, an instruction set to be verified is obtained; the instruction set to be verified is subjected to directed testing and random testing respectively to obtain an assembly file corresponding to the instruction set to be verified; a verification result corresponding to the instruction set to be verified is determined using preset simulation software and the assembly file corresponding to the instruction set to be verified. In the embodiments of the present application, directed testing and random testing are performed on the instruction set to be verified, wherein the directed test is used to test special functions of the set, and the random verification method can perform random verification on the loop depth, the number of loops, and the instructions in the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of upgrading the relevant verification system brought about by future adjustments to the number of loop instructions, the loop depth, etc.

[0004] In a first aspect, some embodiments of the present application provide an instruction verification method, including:

[0005] Get the instruction set to be verified;

[0006] Performing a directional test and a random test on the instruction set to be verified respectively to obtain an assembly file corresponding to the instruction set to be verified;

[0007] A verification result corresponding to the instruction set to be verified is determined by using preset simulation software and an assembly file corresponding to the instruction set to be verified.

[0008] Some embodiments of the present application perform directed testing and random testing on the instruction set to be verified, wherein the directed test is used to test the special functions of the set, and the random verification method can perform random verification on the loop depth, number of loops, and instructions within the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of related verification system upgrades brought about by future adjustments to the number of loop instructions, loop depth, etc.

[0009] Optionally, the performing a directional test on the instruction set to be verified includes:

[0010] A preset directional test case is used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether a branch instruction is included in a loop body, whether the loop body triggers an interrupt, and a boundary test, wherein the boundary test includes at least one or more of a maximum number of loops, a minimum number of loops, a maximum loop depth, and a minimum loop depth.

[0011] Some embodiments of the present application use preset directional test cases to test the interruption and exception triggered by the loop body, and also perform directional verification on boundary conditions such as the maximum and minimum values ​​of the number of loop times / depth.

[0012] Optionally, the randomly testing the instruction set to be verified includes:

[0013] Testing each instruction function in the instruction set to be verified to obtain a test result;

[0014] Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result;

[0015] The test result, the preset verification result and the comparison result are saved in an assembly file.

[0016] Some embodiments of the present application set random constraints in the main function, generate loop body instructions according to the number of loops, output the randomly generated instructions to an assembly file (testcase.S), and calculate the final result by calling each instruction function in the main function, output it to the corresponding assembly file, and finally output the comparison instruction of the instruction calculation result with the C++ calculation result to the assembly file.

[0017] Optionally, the using preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified includes:

[0018] Compiling an assembly file corresponding to the instruction set to be verified using a preset compiler to obtain a disassembly file corresponding to the assembly file;

[0019] The disassembled file is simulated using preset simulation software to obtain a verification result corresponding to the instruction set to be verified.

[0020] In some embodiments of the present application, an instruction compiler is used to compile an assembly file to generate corresponding disassembly and data files, etc., and preset simulation software is used to simulate the disassembly file to obtain a verification result corresponding to the instruction set to be verified. In this way, the verification result of the instruction set to be verified can be clearly understood.

[0021] Optionally, the method further comprises:

[0022] The disassembled file is stored in a storage unit.

[0023] Some embodiments of the present application execute simulation scripts of a simulation platform, initialize data files to storage units, and the kernel fetches instructions from the storage units to execute instructions, and finally outputs execution results.

[0024] In a second aspect, some embodiments of the present application provide an instruction verification device, including:

[0025] An acquisition module, used to acquire an instruction set to be verified;

[0026] A test module, used to perform a directional test and a random test on the instruction set to be verified, respectively, to obtain an assembly file corresponding to the instruction set to be verified;

[0027] The simulation module is used to use preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified.

[0028] Some embodiments of the present application perform directed testing and random testing on the instruction set to be verified, wherein the directed test is used to test the special functions of the set, and the random verification method can perform random verification on the loop depth, number of loops, and instructions within the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of related verification system upgrades brought about by future adjustments to the number of loop instructions, loop depth, etc.

[0029] Optionally, the test module is used to:

[0030] A preset directional test case is used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether a branch instruction is included in a loop body, whether the loop body triggers an interrupt, and a boundary test, wherein the boundary test includes at least one or more of a maximum number of loops, a minimum number of loops, a maximum loop depth, and a minimum loop depth.

[0031] Some embodiments of the present application use preset directional test cases to test the interruption and exception triggered by the loop body, and also perform directional verification on boundary conditions such as the maximum and minimum values ​​of the number of loop times / depth.

[0032] Optionally, the test module is used to:

[0033] Testing each instruction function in the instruction set to be verified to obtain a test result;

[0034] Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result;

[0035] The test result, the preset verification result and the comparison result are saved in an assembly file.

[0036] Some embodiments of the present application set random constraints in the main function, generate loop body instructions according to the number of loops, output the randomly generated instructions to an assembly file (testcase.S), and calculate the final result by calling each instruction function in the main function, output it to the corresponding assembly file, and finally output the comparison instruction of the instruction calculation result with the C++ calculation result to the assembly file.

[0037] Optionally, the simulation module is used to:

[0038] Compiling an assembly file corresponding to the instruction set to be verified using a preset compiler to obtain a disassembly file corresponding to the assembly file;

[0039] The disassembled file is simulated using preset simulation software to obtain a verification result corresponding to the instruction set to be verified.

[0040] In some embodiments of the present application, an instruction compiler is used to compile an assembly file to generate corresponding disassembly and data files, etc., and preset simulation software is used to simulate the disassembly file to obtain a verification result corresponding to the instruction set to be verified. In this way, the verification result of the instruction set to be verified can be clearly understood.

[0041] Optionally, the simulation module is used to:

[0042] The disassembled file is stored in a storage unit.

[0043] Some embodiments of the present application execute simulation scripts of a simulation platform, initialize data files to storage units, and the kernel fetches instructions from the storage units to execute instructions, and finally outputs execution results.

[0044] In a third aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the instruction verification method as described in any embodiment of the first aspect can be implemented.

[0045] In a fourth aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the instruction verification method as described in any embodiment of the first aspect.

[0046] In a fifth aspect, some embodiments of the present application provide a computer program product, comprising a computer program, wherein the computer program, when executed by a processor, can implement the instruction verification method as described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 A flowchart of an instruction verification method provided in an embodiment of the present application;

[0049] Figure 2 A flowchart of another instruction verification method provided in an embodiment of the present application;

[0050] Figure 3 A schematic diagram of the structure of an instruction verification device provided in an embodiment of the present application;

[0051] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.

[0053] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0054] With the continuous development of chip technology, the structure and function of the chip are becoming more and more complex. Various different programs need to be downloaded in the chip, and these programs include various different instruction sets. Before the chip leaves the factory, the hardware and program of the chip need to be tested, but there is no specific solution in the existing technology to test the instruction set in the chip. Therefore, how to quickly verify the instruction set in the chip and then ensure the stability of the chip function is a problem that needs to be solved urgently. In view of this, some embodiments of the present application provide an instruction verification method, which includes obtaining an instruction set to be verified; performing a directional test and a random test on the instruction set to be verified, respectively, to obtain an assembly file corresponding to the instruction set to be verified; using preset simulation software and the assembly file corresponding to the instruction set to be verified, to determine the verification result corresponding to the instruction set to be verified. In the embodiments of the present application, by performing a directional test and a random test on the instruction set to be verified, wherein the directional test is used to test the special functions of the set, and the random verification method can randomly verify the loop depth, the number of loops, and the instructions in the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of upgrading the relevant verification system brought about by future adjustments to the number of loops and the loop depth of the loop instruction.

[0055] like Figure 1 As shown, an embodiment of the present application provides an instruction verification method, the method comprising:

[0056] S101, obtaining an instruction set to be verified;

[0057] Specifically, the instruction set to be verified in the embodiment of the present application is a repeat loop instruction set, the Repeat loop instruction is a hardware loop instruction, the first instruction after the instruction is the first instruction of the loop body, loopend defines the end instruction of the loop body in the form of an offset, and the loop register defines the number of loops. Among them, the value range of the loop register is 1-222, loopend is the offset of the PC program execution, which distinguishes between 16-bit instructions and 32-bit instructions, and the repeat instruction needs to ensure address alignment.

[0058] An instruction set will be loaded into each chip. The instruction set in the chip needs to be verified before leaving the factory, and the terminal device obtains the instruction set to be verified.

[0059] S102, performing a directed test and a random test on the instruction set to be verified respectively, and obtaining an assembly file corresponding to the instruction set to be verified;

[0060] Specifically, after obtaining the instruction set to be verified, the terminal device performs directed testing and random testing on the instruction set to be verified. Since some special functions need to be set in the loop body, the special functions include at least: branch instructions cannot be used in the loop body, such as CSR instructions, and the loop body is interrupted or interrupted by exceptions. When entering the interrupt / exception service program, the LOOP register needs to be protected and restored when returning. Therefore, directed testing is used to verify the special function. At the same time, random verification is used to randomly verify the basic information in the loop body instruction set, such as random verification of the loop depth, number of loops, and instructions in the loop body.

[0061] S103 , using preset simulation software and an assembly file corresponding to the instruction set to be verified, to determine a verification result corresponding to the instruction set to be verified.

[0062] Specifically, after the terminal device performs directed tests and random tests on the instructions to be verified, it generates an assembly file, and then uses the preset compilation software to assemble the assembly file to obtain a disassembly file, and determines whether the assembly file is normal. If the assembly file is normal, the preset simulation software is used to simulate the disassembly file to obtain a data table or a curve, and then determines whether the instruction set to be verified has passed the verification. If it has passed the verification, it means that the chip functions normally and can be put into use.

[0063] Some embodiments of the present application perform directed testing and random testing on the instruction set to be verified, wherein the directed test is used to test the special functions of the set, and the random verification method can perform random verification on the loop depth, number of loops, and instructions within the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of related verification system upgrades brought about by future adjustments to the number of loop instructions, loop depth, etc.

[0064] Another embodiment of the present application further supplements the instruction verification method provided in the above embodiment.

[0065] Optionally, a directed test is performed on the instruction set to be verified, including:

[0066] Preset directed test cases are used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether the loop body includes branch instructions, whether the loop body triggers an interrupt, and boundary testing, and the boundary testing includes at least one or more of the maximum number of loops, the minimum number of loops, the maximum loop depth, and the minimum loop depth.

[0067] Some embodiments of the present application use preset directional test cases to test the interruption and exception triggered by the loop body, and also perform directional verification on boundary conditions such as the maximum and minimum values ​​of the number of loop times / depth.

[0068] Optionally, random testing is performed on the instruction set to be verified, including:

[0069] Test each instruction function in the instruction set to be verified and obtain the test results;

[0070] Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result;

[0071] Save test results, preset verification results, and comparison results in an assembly file.

[0072] Some embodiments of the present application set random constraints in the main function, generate loop body instructions according to the number of loops, output the randomly generated instructions to an assembly file (testcase.S), and calculate the final result by calling each instruction function in the main function, output it to the corresponding assembly file, and finally output the comparison instruction of the instruction calculation result with the C++ calculation result to the assembly file.

[0073] Assembly files need to be compiled by a compiler to generate data files, disassembly files, and other files before simulation.

[0074] Optionally, using preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified includes:

[0075] Compiling an assembly file corresponding to the instruction set to be verified using a preset compiler to obtain a disassembly file corresponding to the assembly file;

[0076] The disassembled file is simulated using preset simulation software to obtain a verification result corresponding to the instruction set to be verified.

[0077] In some embodiments of the present application, an instruction compiler is used to compile assembly files to generate corresponding disassembly and data files, etc., and preset simulation software is used to simulate the disassembly files to obtain verification results corresponding to the instruction set to be verified. In this way, the verification results of the instruction set to be verified can be clearly understood.

[0078] Optionally, the method further comprises:

[0079] Save the disassembled file in the storage unit.

[0080] The data file needs to be initialized and entered into the storage unit. During simulation, the kernel fetches instructions or accesses memory from the storage unit.

[0081] Some embodiments of the present application execute simulation scripts of a simulation platform, initialize data files to storage units, and the kernel fetches instructions from the storage units to execute instructions, and finally outputs execution results.

[0082] An embodiment of the present application provides an instruction verification system based on loop instructions. The system generates random test cases of random loop depth, loop number, and instructions in the loop body by writing assembly-oriented instruction test cases and C++ program constraints to ensure the reliability of verification.

[0083] Figure 2 A flowchart of another instruction verification method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the system includes a simulation platform, which includes a kernel, a storage unit for storing instructions and an instruction compiler (HaawkingIDE). The storage unit for storing instructions includes at least a static random access memory (SRAM). The simulation platform can simulate and run scripts and other files; the storage unit stores programs for writing assembled directed test cases and random test cases.

[0084] Among them: the simulation platform uses the SystemVerilog language to write the testbench simulation environment, instantiates the tested kernel module, instantiates the storage unit, uses the Advanced High Performance Bus (AHB) protocol to connect the core kernel and the storage unit (SRAM), and gives other stimulus signals, such as clock, reset and other signals. The stimulus signal is used to control the execution of each test case. It also includes a simulation script, compiles the simulation platform and calls the VCS software for simulation; a data processing script processes the data file so that the simulation platform can initialize the data to the storage unit.

[0085] The directed test cases provided in the embodiments of the present application require directed verification of boundary conditions such as loop body triggering interrupts, exceptions, and maximum and minimum loop counts / depths.

[0086] The embodiment of the present application also generates a program for generating random loop times, random loop depths, and random loop bodies, which is written in C++ language. Random constraints are set in the main function, and loop body instructions are generated according to the loop times. The randomly generated instructions are output to the assembly file (testcase.S), and the final result is calculated by calling each instruction function in the main function, and output to the corresponding assembly file. Finally, the comparison instruction between the instruction calculation result (actual verification result) and the C++ calculation result (preset verification result) is output to the assembly file.

[0087] The instruction compiler (Haawking IDE) provided in the embodiment of the present application compiles the above-mentioned assembly file to generate corresponding disassembly and data files, etc.

[0088] According to the loop instruction verification system of the embodiment of the present application, each directional and random test case is effectively organized, each instruction-related scenario of the design to be tested is covered as much as possible, and the results of each test case are more reliable after automatic comparison. Moreover, compared with the traditional debug method of viewing waveforms, the debug efficiency of the automatic comparison method is higher.

[0089] The specific verification process based on the above verification system is as follows:

[0090] Step 1: Write directed test cases for loop instructions through boundary functions.

[0091] Step 2: Generate a large number of assembly files by generating programs in a random manner.

[0092] Step 3: Compile the assembly file through the instruction compiler to generate disassembly and data files.

[0093] Step 4: Execute the simulation script of the simulation platform, initialize the data file to the storage unit, the core fetches instructions from the storage unit and executes the instructions, and finally outputs the execution result.

[0094] The verification system provided in the embodiment of the present application has a simple structure and clear levels, and has a good balance between systematicity, completeness and reliability. In addition, the above-mentioned verification system also has good scalability and reusability, and can meet the needs of related verification system upgrades brought about by future adjustments to the number of loop instructions, loop depth, etc.

[0095] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any manner without conflict, and this application is not limited thereto.

[0096] Another embodiment of the present application provides an instruction verification device, which is used to execute the instruction verification method provided by the above embodiment.

[0097] like Figure 3 , which is a schematic diagram of the structure of the instruction verification device provided in the embodiment of the present application. The instruction verification device includes an acquisition module 301, a test module 302 and a simulation module 303, wherein:

[0098] The acquisition module 301 is used to acquire the instruction set to be verified;

[0099] The test module 302 is used to perform directional testing and random testing on the instruction set to be verified, and obtain an assembly file corresponding to the instruction set to be verified;

[0100] The simulation module 303 is used to use preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified.

[0101] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0102] Some embodiments of the present application perform directed testing and random testing on the instruction set to be verified, wherein the directed test is used to test the special functions of the set, and the random verification method can perform random verification on the loop depth, number of loops, and instructions within the loop body. The instruction verification method provided by the present application has good scalability and reusability, and can meet the needs of related verification system upgrades brought about by future adjustments to the number of loop instructions, loop depth, etc.

[0103] Another embodiment of the present application further supplements the instruction verification device provided in the above embodiment.

[0104] Optionally, a test module to:

[0105] Preset directed test cases are used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether the loop body includes branch instructions, whether the loop body triggers an interrupt, and boundary testing, and the boundary testing includes at least one or more of the maximum number of loops, the minimum number of loops, the maximum loop depth, and the minimum loop depth.

[0106] Some embodiments of the present application use preset directional test cases to test the interruption and exception triggered by the loop body, and also perform directional verification on boundary conditions such as the maximum and minimum values ​​of the number of loop times / depth.

[0107] Optionally, a test module to:

[0108] Test each instruction function in the instruction set to be verified and obtain the test results;

[0109] Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result;

[0110] Save test results, preset verification results, and comparison results in an assembly file.

[0111] Some embodiments of the present application set random constraints in the main function, generate loop body instructions according to the number of loops, output the randomly generated instructions to an assembly file (testcase.S), and calculate the final result by calling each instruction function in the main function, output it to the corresponding assembly file, and finally output the comparison instruction of the instruction calculation result with the C++ calculation result to the assembly file.

[0112] Optionally, a simulation module for:

[0113] Compiling an assembly file corresponding to the instruction set to be verified using a preset compiler to obtain a disassembly file corresponding to the assembly file;

[0114] The disassembled file is simulated using preset simulation software to obtain a verification result corresponding to the instruction set to be verified.

[0115] In some embodiments of the present application, an instruction compiler is used to compile assembly files to generate corresponding disassembly and data files, etc., and preset simulation software is used to simulate the disassembly files to obtain verification results corresponding to the instruction set to be verified. In this way, the verification results of the instruction set to be verified can be clearly understood.

[0116] Optionally, a simulation module for:

[0117] Save the disassembled file in the storage unit.

[0118] Some embodiments of the present application execute simulation scripts of a simulation platform, initialize data files to storage units, and the kernel fetches instructions from the storage units to execute instructions, and finally outputs execution results.

[0119] Regarding the device in this embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0120] It should be noted that each implementable method in this embodiment may be implemented separately, or may be implemented in combination in any manner without conflict, and this application is not limited thereto.

[0121] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the operation of the method corresponding to any embodiment of the instruction verification method provided in the above embodiments can be implemented.

[0122] An embodiment of the present application further provides a computer program product, wherein the computer program product includes a computer program, wherein when the computer program is executed by a processor, the operation of the method corresponding to any embodiment of the instruction verification method provided in the above embodiments can be implemented.

[0123] like Figure 4 As shown, some embodiments of the present application provide an electronic device 400, which includes: a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420, wherein the processor 420 can implement a method of any embodiment included in the above-mentioned instruction verification method when reading the program from the memory 410 through a bus 430 and executing the program.

[0124] Processor 420 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 420 can be a microprocessor.

[0125] The memory 410 may be used to store instructions executed by the processor 420 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 420 of the disclosed embodiment may be used to execute instructions in the memory 410 to implement the method shown above. The memory 410 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.

[0126] The above are only embodiments of the present application and are not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0127] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0128] It should be noted that, in this article, relational terms such as first and second, etc. 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.

Claims

1. A method for verifying an instruction, characterized in that: The method comprises: Get the instruction set to be verified; Performing a directional test and a random test on the instruction set to be verified respectively to obtain an assembly file corresponding to the instruction set to be verified; A verification result corresponding to the instruction set to be verified is determined by using preset simulation software and an assembly file corresponding to the instruction set to be verified.

2. The instruction verification method according to claim 1, characterized in that: The performing a directional test on the instruction set to be verified includes: A preset directional test case is used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether a branch instruction is included in a loop body, whether the loop body triggers an interrupt, and a boundary test, wherein the boundary test includes at least one or more of a maximum number of loops, a minimum number of loops, a maximum loop depth, and a minimum loop depth.

3. The instruction verification method according to claim 1, characterized in that: The randomly testing the instruction set to be verified includes: Testing each instruction function in the instruction set to be verified to obtain a test result; Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result; The test result, the preset verification result and the comparison result are saved in an assembly file.

4. The instruction verification method according to claim 1, characterized in that: The using of preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified includes: Compiling an assembly file corresponding to the instruction set to be verified using a preset compiler to obtain a disassembly file corresponding to the assembly file; The disassembled file is simulated using preset simulation software to obtain a verification result corresponding to the instruction set to be verified.

5. The instruction verification method according to claim 4, characterized in that: The method further comprises: The disassembled file is stored in a storage unit.

6. An instruction verification device, characterized in that: The device comprises: An acquisition module, used to acquire an instruction set to be verified; A test module, used to perform a directional test and a random test on the instruction set to be verified, respectively, to obtain an assembly file corresponding to the instruction set to be verified; The simulation module is used to use preset simulation software and an assembly file corresponding to the instruction set to be verified to determine a verification result corresponding to the instruction set to be verified.

7. The instruction verification device according to claim 6, characterized in that: The test module is used to: A preset directional test case is used to verify the preset functions of the instruction set to be verified, wherein the preset functions of the instruction set to be verified include at least whether a branch instruction is included in a loop body, whether the loop body triggers an interrupt, and a boundary test, wherein the boundary test includes at least one or more of a maximum number of loops, a minimum number of loops, a maximum loop depth, and a minimum loop depth.

8. The instruction verification device according to claim 6, characterized in that: The test module is used to: Testing each instruction function in the instruction set to be verified to obtain a test result; Compare the test result with a preset verification result corresponding to the instruction function to obtain a comparison result; The test result, the preset verification result and the comparison result are saved in an assembly file.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can implement the instruction verification method described in any one of claims 1 to 5 when executing the program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the program, when executed by a processor, can implement the instruction verification method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Instruction set verification method and device based on RISC-V processor

    CN115408264A

  • RISC-V architecture processor core-based function verification method and platform

    CN115658414A

  • Random interrupt debugging verification system based on RISC-V architecture

    CN117422025A

  • Processor verification system based on RISC-V architecture

    CN117422026A

  • Verification system, verification method, electronic device, and storage medium

    WO2024046362A1

Cited By

  • Random instruction sequence generation method, generator and verification system

    CN121050774A