Instruction processing method, device, electronic device and readable storage medium

By building dependencies during instruction generation, the problem of insufficient dependencies in randomly generated instruction streams is solved, thus improving the testing performance of the out-of-order execution module.

CN118642762BActive Publication Date: 2024-11-01BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411116884.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-11-01
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

In existing technologies, randomly generated instruction streams contain fewer interdependent instructions, resulting in poor test performance for out-of-order execution modules.

Method used

By storing verification instructions into a queue to be processed in the order of instruction generation, the system retrieves instructions to be determined from the queue in response to dependency building requests, and generates dependencies based on operation registers to build dependencies in the instruction stream.

Benefits of technology

It improves the ease and accuracy of building dependencies in the instruction stream and enhances the testing performance of out-of-order execution modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642762B_ABST
    Figure CN118642762B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides an instruction processing method, device, electronic device and readable storage medium. The method includes: storing the generated verification instructions in a queue to be processed in sequence according to the instruction generation order; in response to a dependency construction request for the current verification instruction, obtaining the instruction to be determined from the queue to be processed based on the dependency construction request; based on the operation register of the instruction to be determined, generating an operation register for the current verification instruction, so that the current verification instruction forms a dependency with the instruction to be determined. In the process of generating the verification instruction, the embodiment of the present invention can build a dependency in the instruction stream, which greatly improves the convenience of the verification personnel in building the instruction stream for testing the out-of-order execution module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an instruction processing method, device, electronic device and readable storage medium. Background Art

[0002] With the development of computer technology, processor verification testing is often required. Currently, many processors have out-of-order execution modules. In order to effectively test the out-of-order execution modules, it is necessary to build interdependent instructions in the instruction stream used for test verification.

[0003] At present, instruction streams are often randomly generated through instruction generation modules. However, there are fewer interdependent instructions in the randomly generated instruction streams, which leads to poor testing results for out-of-order execution modules. Therefore, how to build dependencies in instruction streams has become an urgent problem to be solved. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide an instruction processing method, device, electronic device and readable storage medium to build dependencies in an instruction stream. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a method for processing an instruction is provided, the method comprising:

[0006] The generated verification instructions are stored in a queue to be processed in sequence according to the instruction generation order;

[0007] In response to a dependency building request for a current verification instruction, obtaining a to-be-determined instruction from the to-be-processed queue based on the dependency building request;

[0008] Based on the operation register of the instruction to be determined, an operation register is generated for the current verification instruction, so that the current verification instruction forms a dependency with the instruction to be determined.

[0009] In a second aspect of the present invention, there is also provided an instruction processing device, the device comprising:

[0010] A first storage module, used for storing the generated verification instructions in sequence into a queue to be processed according to the instruction generation order;

[0011] A first acquisition module, configured to respond to a dependency building request for a current verification instruction and acquire the to-be-determined instruction from the to-be-processed queue based on the dependency building request;

[0012] A generating module is used to generate an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined.

[0013] In a third aspect of the present invention, there is also provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0014] Memory, used to store computer programs;

[0015] The processor is used to implement the method described in the first aspect when executing the program stored in the memory.

[0016] In a fourth aspect of the implementation of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect above.

[0017] In a fifth aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect above.

[0018] The instruction processing method provided by the embodiment of the present invention stores the generated verification instructions in sequence into a queue to be processed according to the instruction generation order; in response to a dependency construction request for the current verification instruction, obtains the instruction to be determined from the queue to be processed based on the dependency construction request; generates an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined. In this way, the embodiment of the present invention stores the generated verification instructions in sequence through the queue to be processed, and when receiving the dependency construction request, selects the instruction to be determined from the queue to be processed, and generates an operation register for the current verification instruction based on the instruction to be determined, so that the two can form a dependency based on the operation register, so that the embodiment of the present invention can build a dependency in the instruction stream in the process of generating the verification instruction, which greatly improves the convenience of the verification personnel in building the instruction stream for testing the out-of-order execution module. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] 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 are briefly introduced below.

[0020] Figure 1 is a flowchart of a method for processing instructions in an embodiment of the present invention;

[0021] Figure 2 is a schematic diagram of the structure of an instruction processing device in an embodiment of the present invention;

[0022] Figure 3 Schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of the present invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0025] Method Embodiment

[0026] Figure 1 is a flowchart of a method for processing instructions in an embodiment of the present invention. Figure 1 As shown, the method includes:

[0027] Step 101: Store the generated verification instructions in a queue to be processed in sequence according to the instruction generation order.

[0028] Step 102: In response to a dependency building request for a current verification instruction, obtain a to-be-determined instruction from the to-be-processed queue based on the dependency building request.

[0029] Step 103: Generate an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined.

[0030] It should be noted that in order to utilize instruction-level parallelism, current processors often use out-of-order execution modules to execute two or more instructions simultaneously in a pipeline of arbitrary depth. However, some instructions are dependent on each other and must be executed in sequence. The out-of-order execution module needs to identify the dependent instructions and execute them in the correct sequence. Therefore, in order to test and verify the execution effect of the out-of-order execution module, it is necessary to build dependent instructions.

[0031] For example, there are two instructions, add x2, x4, x5 and sub x7, x2, x1. The program order of these two instructions is add before sub, and the operation purpose is to store the value of the x4 register and the x5 register added into the x2 register, and then store the value of the x2 register minus the value of the x1 register into the x7 register. If these two instructions are not executed in sequence, the value of the x2 register in the sub instruction cannot be guaranteed to be the value at the end of the add instruction execution, and the correctness of the result cannot be guaranteed. At this time, these two instructions form a read after write (RAW) dependency through register x2.

[0032] As another example, there are two instructions, add x2, x3, x4 and sub x2, x5, x6. The program order of these two instructions is add before sub. The purpose of their operation is to store the value after adding the x3 register and the x4 register into the x2 register, and then subtract the value of the x6 register from the x5 register and store it into the x2 register, that is, to overwrite the value written by the first add and rewrite the new value. If these two instructions are not executed in sequence, the value stored in the x2 register cannot be guaranteed to be the value written by sub, and the correctness of the result cannot be guaranteed. At this time, these two instructions form a write-after-write (WAW) dependency through register x2.

[0033] As another example, there are two instructions, add x4, x2, x3 and sub x2, x7, x8. The program order of these two instructions is add before sub. The purpose of their operation is to store the value of the x2 register and the x3 register added into the x4 register, and then subtract the value of the x8 register from the x7 register and store it into the x2 register. If they are not executed in order, the sub instruction is executed before the add instruction, which results in the value of x2 read in add being the value newly written by sub, and the correctness of the result cannot be guaranteed. At this time, these two instructions form a write after read (WAR) dependency through register x2.

[0034] Optionally, there is also a dependency mode called read after read (RAR) dependency, that is, two instructions have the same source register and read the source register one after another. This dependency mode is not an actual dependency mode, but can also be selected by users according to actual needs.

[0035] With respect to the above steps 101 to 103, the embodiment of the present invention can be applied to the instruction generator, and can also be applied to any computer device with data computing and processing capabilities, and the embodiment of the present invention does not limit this. Among them, the verification instructions in the embodiment of the present invention can be randomly generated by the instruction generator, and accordingly, the above instruction generation order refers to the order in which the instruction generator outputs the instructions. Further, the above step 101 refers to storing the verification instructions generated by the instruction generator in the queue to be processed in sequence according to the output order.

[0036] The queue refers to a data structure that can add data (push) and remove data (pop), and the data processing strategy of the queue is usually first-in-first-out. Specifically, the queue to be processed can be created in advance or after receiving a creation request, and the embodiment of the present invention does not limit this. Specifically, the embodiment of the present invention can store the verification instruction in the queue to be processed every time the instruction generator generates a verification instruction.

[0037] Among them, the above-mentioned dependency construction request can be generated based on the processor verification requirements, or it can be generated by receiving instructions from relevant personnel, which may include the opcode of the instruction that needs to build the dependency (i.e., the current verification instruction), and then the embodiment of the present invention can obtain the opcode of the current verification instruction through the dependency construction request, and then determine the current verification instruction. Among them, the above-mentioned instructions to be determined can be randomly selected from the queue to be processed, or they can be selected from it according to the dependency distance or dependency mode specified by the dependency construction request. Specifically, they can be selected according to the actual needs of building dependencies, and the embodiment of the present invention does not limit this. Among them, the above-mentioned dependency distance refers to the distance between the instruction counter (program counter, PC) of the current verification instruction, so the instructions to be determined can be obtained from the processing according to the dependency distance. The above-mentioned dependency mode can be WAW, RAW or WAR, RAR mentioned above, so that the corresponding instructions can be selected from the queue to be processed as the instructions to be determined according to the instructions required to be dependent on different dependency modes.

[0038] Furthermore, after determining the current verification instruction and the instruction to be determined, an operation register can be generated for the current verification instruction based on the operation register of the current verification instruction, so that the two are dependent on each other through the operation register. Specifically, the operation register refers to an operation register composed of registers, and the operation register of the instruction can generally include a source register (Source Register, src) and a destination register (Destination register, dest). Based on the dependency pattern shown above, it can be seen that the dependency can be formed when the operation registers of the two instructions are consistent. Therefore, the embodiment of the present invention can generate a consistent operation register for the current verification instruction based on the operation register of the instruction to be determined.

[0039] Specifically, the destination registers of the two can be kept consistent, or the source register of the current verification instruction can be kept consistent with the destination register of the instruction to be determined. Of course, the destination register of the current verification instruction can also be kept consistent with the source register of the instruction to be determined. This can be done according to the actual dependency construction requirements, or, when the dependency construction request does not indicate a specific dependency mode, all three dependency modes can be satisfied at the same time or one or two dependency modes can be randomly selected. All of them can be set according to the actual situation, and the embodiments of the present invention do not limit this.

[0040] In summary, in an embodiment of the present invention, the generated verification instructions are sequentially stored in a queue to be processed according to the instruction generation order; in response to a dependency construction request for the current verification instruction, the instruction to be determined is obtained from the queue to be processed based on the dependency construction request; based on the operation register of the instruction to be determined, an operation register is generated for the current verification instruction, so that the current verification instruction forms a dependency with the instruction to be determined. In this way, the embodiment of the present invention stores the generated verification instructions sequentially through the queue to be processed, and when receiving a dependency construction request, selects the instruction to be determined from the queue to be processed, and generates an operation register for the current verification instruction based on the instruction to be determined, so that the two can form a dependency based on the operation register, so that the embodiment of the present invention can build dependencies in the instruction stream in the process of generating verification instructions, which greatly improves the convenience of verification personnel in building instruction streams for testing out-of-order execution modules.

[0041] Optionally, the operation of generating an operation register for the current verification instruction based on the operation register of the instruction to be determined so that the current verification instruction forms a dependency with the instruction to be determined may specifically include:

[0042] S21. Generate a dependency pattern for the current verification instruction based on a preset configuration file.

[0043] S22. Based on the dependency pattern, determine an operation register corresponding to the dependency pattern in the current verification instruction as a first operation register.

[0044] S23. Based on the dependency pattern, determine an operation register corresponding to the dependency pattern in the instruction to be determined as a second operation register.

[0045] S24: Set the register identifier of the first operation register of the current verification instruction to the register identifier of the second operation register, so that the current verification instruction and the instruction to be determined form a dependency according to the dependency mode.

[0046] Among them, the above-mentioned preset configuration file can be pre-generated, and the configuration file can contain the type of verification instructions required, or the type of verification instructions that need to be eliminated. Accordingly, the instruction generator can generate verification instructions based on the preset configuration file. Furthermore, the above-mentioned preset configuration file can also contain one or more required dependency patterns. Optionally, weights can be further configured for different dependency patterns, so that the embodiment of the present invention can generate a dependency pattern for the current verification instruction based on several dependency patterns and weights configured in the preset configuration file. Specifically, the generation method of the dependency pattern can be based on a roulette wheel selection algorithm, and of course it can also be a random selection, which is not limited by the embodiment of the present invention.

[0047] Furthermore, after the dependency pattern is generated, the operation registers that depend on the dependency pattern in the current verification instruction and the instruction to be determined can be determined based on the dependency pattern. Specifically, when the dependency pattern is RAW, the above-mentioned first operation register can be the source register of the current verification instruction, and the second operation register can be the destination register of the instruction to be determined. Correspondingly, when the dependency pattern is WAW, the above-mentioned first operation register can be the destination register of the current verification instruction, and the second operation register can be the destination register of the instruction to be determined. Correspondingly, when the dependency pattern is WAR, the above-mentioned first operation register can be the destination register of the current verification instruction, and the second operation register can be the source register of the instruction to be determined. Correspondingly, when the dependency pattern is RAR, the above-mentioned first operation register can be the source register of the current verification instruction, and the second operation register can be the source register of the instruction to be determined.

[0048] Specifically, the instruction to be determined may include only one source register, or may include two or more source registers. When the second operation register is the source register of the instruction to be determined, and the instruction to be determined includes at least two source registers, one source register may be randomly selected as the second operation register. This embodiment of the present invention does not impose any restrictions on this.

[0049] Optionally, when the current verification instruction includes at least two operation registers, the embodiment of the present invention may:

[0050] Based on a preset configuration file, respective dependency modes are generated for different operation registers of the current verification instruction.

[0051] Furthermore, for any operation register of the current verification instruction, the corresponding second operation register can be determined from the instruction to be determined based on the respective dependency modes, and the register identifier of the operation register of the current verification instruction can be set based on the register identifier of the second operation register.

[0052] Specifically, for any source register of the current verification instruction, a dependency pattern can be generated for it:

[0053] The above register identifier refers to the unique identifier of the register, which can also be called the register number or register serial number. In an instruction set architecture, the register identifier is fixed and unique. Therefore, in the embodiment of the present invention, the register identifier of the first operation register can be set to the register identifier of the second operation register, that is, the register identifier of the second operation register is assigned to the first operation register, so that the first operation register and the second operation register of the current verification instruction are the same register, so that the current verification instruction and the instruction to be determined can form a dependency through the same register according to the dependency mode.

[0054] In an embodiment of the present invention, a dependency pattern is generated for the current verification instruction based on a preset configuration file; based on the dependency pattern, an operation register corresponding to the dependency pattern in the current verification instruction is determined as the first operation register; based on the dependency pattern, an operation register corresponding to the dependency pattern in the instruction to be determined is determined as the second operation register; the register identifier of the first operation register of the current verification instruction is set to the register identifier of the second operation register, so that the current verification instruction and the instruction to be determined form a dependency according to the dependency pattern. In this way, the embodiment of the present invention can construct a specific dependency pattern through a preset configuration file, thereby improving the flexibility of constructing dependencies in the instruction stream.

[0055] Optionally, the operation of obtaining the to-be-determined instruction from the to-be-processed queue in this embodiment of the present invention may include:

[0056] S31. Obtain verification instructions from the queue to be processed in sequence according to the instruction generation order.

[0057] S32: When the instruction type of the currently acquired verification instruction is consistent with the instruction type of the current verification instruction, determine the currently acquired verification instruction as the instruction to be determined.

[0058] The above instruction type refers to the data type indicated by the instruction. For example, the instruction type may generally include integer, floating point, vector, etc. Different types of instructions are used to process different types of data. Accordingly, the types of operation registers included in different types of instructions are also different. Exemplarily, the operation register included in an integer instruction is also an integer, the operation register included in a floating point instruction is a floating point, and the operation register included in a vector instruction is a vector.

[0059] Furthermore, in order to ensure the normal execution of dependent instructions, the data types of dependent instructions should also remain consistent. Therefore, in an embodiment of the present invention, verification instructions can be obtained in sequence from the queue to be processed, and when the instruction type of the currently obtained verification instruction is consistent with the instruction type of the current verification instruction, the currently obtained verification instruction is determined as the instruction to be determined. Among them, the above-mentioned currently obtained verification instruction refers to the verification instruction obtained from the queue to be processed according to the order of instruction generation. Specifically, since the queue is usually first-in-first-out, in an embodiment of the present invention, the verification instruction can be obtained from the head of the queue to be processed, and the instruction dependency is constructed based on the algorithm idea of ​​First Input First Output (FIFO).

[0060] Optionally, when the instruction type of the currently acquired verification instruction is inconsistent with the instruction type of the current verification instruction, the operation of sequentially acquiring the verification instructions from the queue to be processed according to the instruction generation order is re-executed.

[0061] Specifically, when the instruction type of the currently acquired verification instruction is inconsistent with the instruction type of the current verification instruction, it indicates that the register types of the operation registers of the two are also inconsistent. At this time, the two cannot use the same register as the operation register in the instruction. Therefore, a dependency cannot be established between the currently acquired verification instruction and the current verification instruction.

[0062] Furthermore, at this time, the above step S31 may be re-executed, that is, re-obtaining the verification instruction from the queue to be processed to determine whether its instruction type is consistent with the current verification instruction.

[0063] Optionally, when the number of executions of the operation of sequentially acquiring verification instructions from the queue to be processed in accordance with the instruction generation order reaches a preset number threshold, a random operation register is generated for the current verification instruction.

[0064] The above-mentioned preset number threshold can be set according to actual needs. Specifically, when the number of executions of the operation of re-obtaining the verification instruction reaches the preset number threshold, it indicates that the instruction types of multiple consecutive verification instructions are different from the current verification instruction and cannot be used to build a dependency. At this time, a random operation register can be directly generated for the current verification instruction, that is, a random selection from the register identifier provided by the instruction set architecture is used as the operation register of the current verification instruction.

[0065] In this way, when the dependency cannot be built, the generation of the instruction stream can be avoided from being affected, thus ensuring the normal generation of the instruction stream.

[0066] In the embodiment of the present invention, verification instructions are sequentially obtained from the queue to be processed according to the instruction generation order; when the instruction type of the currently obtained verification instruction is consistent with the instruction type of the current verification instruction, the currently obtained verification instruction is determined as the instruction to be determined. In this way, by obtaining the verification instruction whose instruction type is consistent with the instruction type of the current verification instruction from the queue to be processed as the instruction to be determined, and building a dependency with the current verification instruction, the problem of low construction efficiency caused by using random distance for dependency construction in the related art is avoided, and the accuracy and efficiency of dependency construction in the instruction stream are improved.

[0067] Optionally, the operation of sequentially storing the generated verification instructions in the queue to be processed according to the instruction generation order may further include:

[0068] S41. Create multiple queues to be processed, where different queues to be processed correspond to different instruction types.

[0069] S42. According to the instruction generation order, the generated verification instructions are sequentially stored in a queue to be processed corresponding to the instruction type of each verification instruction.

[0070] The above operation of obtaining the to-be-determined instruction from the to-be-processed queue may specifically include:

[0071] S43. Based on the instruction type of the current verification instruction, determine a queue to be processed corresponding to the instruction type as a target queue.

[0072] S44: Obtain instructions to be determined from the target queue.

[0073] In actual scenarios, there may be a situation where multiple verification instructions are continuously obtained from the queue to be processed, and their instruction types are inconsistent with the current verification instruction, which reduces the efficiency of dependency construction to a certain extent. To avoid this situation, the embodiment of the present invention can pre-create multiple queues to be processed, and make different queues to be processed correspond to different instruction types.

[0074] Exemplarily, three, four or six queues to be processed may be created in advance, one of which may be configured to store integer instructions, another to be processed to store floating-point instructions, and accordingly, another to be processed to store vector instructions, and so on.

[0075] In this case, when performing dependency construction for the current verification instruction in an embodiment of the present invention, the pending queue corresponding to the instruction type of the current verification instruction can be determined from all pending queues as the target queue based on the instruction type of the current verification instruction, and the pending instruction can be directly obtained from the target queue.

[0076] In an embodiment of the present invention, multiple queues to be processed are created, and different queues to be processed correspond to different instruction types; each verification instruction generated is stored in sequence in the queues to be processed corresponding to the instruction types of each verification instruction in the order of instruction generation; based on the instruction type of the current verification instruction, the queue to be processed corresponding to the instruction type is determined as the target queue; and the instruction to be determined is obtained from the target queue. In this way, by creating multiple queues to be processed corresponding to different instruction types, and storing each verification instruction in the corresponding queues to be processed, the instruction to be determined is directly obtained from the target queue corresponding to the instruction type of the current verification instruction, which can ensure that the instruction to be determined is consistent with the instruction type of the current verification instruction, thereby greatly improving the one-time success rate and efficiency of dependency construction, and ensuring the density of dependency construction in the instruction stream.

[0077] Optionally, in an embodiment of the present invention, the queue to be processed includes multiple record items, one record item corresponds to a verification instruction, one record item includes multiple table items, and different table items correspond to different operands of the verification instruction.

[0078] Specifically, since an instruction often has one or more operation registers, in an embodiment of the present invention, a verification instruction can be stored in a record item in the queue to be processed. The record item is equivalent to an index, and one record item corresponds to a complete instruction. In this case, a record item can contain multiple table items, so that one or more operation registers contained in a verification instruction can be stored in different table items of the same record item.

[0079] For example, as shown in Table 1, a form of a queue to be processed is shown:

[0080] Table 1: Queue to be processed

[0081]

[0082] As shown in Table 1, one row represents a record item, and one record item includes multiple table items such as the destination register (rd), source register 1 (rs1), source register 2 (rs2), and source register 3 (rs3). Correspondingly, the operation registers of each verification instruction can be stored in the corresponding table item. In addition, as shown in Table 1, a record item can also include the instruction name (name) of the instruction, which is used to characterize different instructions. Specifically, a record item can be in the form of a structure. The embodiment of the present invention can use a structure to save multiple record items, and store the structure as a whole in a queue.

[0083] In this way, the embodiment of the present invention can solve the problem of preserving instruction information through the queue to be processed, without using multiple arrays to respectively save different register information. This can not only save storage space, but also ensure that multiple table entries in the same record item belong to one instruction, avoiding the situation where storage information is misplaced due to the use of multiple arrays for storage.

[0084] Device Embodiment

[0085] Figure 2 FIG. 1 is a schematic diagram of the structure of an instruction processing device in an embodiment of the present invention. Figure 2 As shown, the device 20 may include:

[0086] The first storage module 201 is used to store the generated verification instructions in sequence into a queue to be processed according to the instruction generation order;

[0087] A first acquisition module 202, configured to respond to a dependency building request for a current verification instruction and acquire a to-be-determined instruction from the to-be-processed queue based on the dependency building request;

[0088] The generating module 203 is configured to generate an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined.

[0089] Optionally, the generating module includes:

[0090] A pattern generation submodule, used to generate a dependency pattern for the current verification instruction based on a preset configuration file;

[0091] A first determination submodule, configured to determine, based on the dependency mode, an operation register in the current verification instruction corresponding to the dependency mode as a first operation register;

[0092] A second determination submodule, configured to determine, based on the dependency pattern, an operation register in the instruction to be determined that corresponds to the dependency pattern as a second operation register;

[0093] The setting module is used to set the register identifier of the first operation register of the current verification instruction to the register identifier of the second operation register, so that the current verification instruction and the instruction to be determined form a dependency according to the dependency mode.

[0094] Optionally, the first acquisition module includes:

[0095] A second acquisition submodule is used to sequentially acquire verification instructions from the queue to be processed according to the instruction generation order;

[0096] The third determination submodule is used to determine the currently acquired verification instruction as the instruction to be determined when the instruction type of the currently acquired verification instruction is consistent with the instruction type of the current verification instruction.

[0097] Optionally, the device further comprises:

[0098] The execution module is used for re-executing the operation of sequentially acquiring verification instructions from the queue to be processed according to the instruction generation sequence when the instruction type of the currently acquired verification instruction is inconsistent with the instruction type of the current verification instruction.

[0099] Optionally, the first storage module includes:

[0100] Create a submodule to create multiple queues to be processed. Different queues to be processed correspond to different instruction types.

[0101] The second storage submodule is used to store the generated verification instructions in sequence into a to-be-processed queue corresponding to the instruction type of each verification instruction according to the instruction generation order.

[0102] The first acquisition module includes:

[0103] A fourth determination submodule, configured to determine, based on the instruction type of the current verification instruction, a to-be-processed queue corresponding to the instruction type as a target queue;

[0104] The third acquisition submodule is used to acquire the to-be-determined instruction from the target queue.

[0105] Optionally, the pattern generation submodule is specifically used to:

[0106] In the case that the current verification instruction includes at least two operation registers, respective dependency patterns are generated for different operation registers of the current verification instruction based on a preset configuration file.

[0107] Optionally, the queue to be processed includes multiple record items, one record item corresponds to a verification instruction, one record item includes multiple table items, and different table items correspond to different operation registers of the verification instruction.

[0108] In summary, the instruction processing device provided by the embodiment of the present invention stores the generated verification instructions in sequence into a queue to be processed according to the instruction generation order; in response to a dependency construction request for the current verification instruction, obtains the instruction to be determined from the queue to be processed based on the dependency construction request; generates an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined. In this way, the embodiment of the present invention stores the generated verification instructions in sequence through the queue to be processed, and when receiving the dependency construction request, selects the instruction to be determined from the queue to be processed, and generates an operation register for the current verification instruction based on the instruction to be determined, so that the two can form a dependency based on the operation register, so that the embodiment of the present invention can build a dependency in the instruction stream in the process of generating the verification instruction, which greatly improves the convenience of the verification personnel in building the instruction stream for testing the out-of-order execution module.

[0109] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0110] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0111] Regarding the instruction processing device in the above 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.

[0112] An embodiment of the present invention further provides an electronic device, comprising: a processor and a memory for storing instructions executable by the processor, wherein the processor is configured to execute the above instruction processing method.

[0113] Reference Figure 3 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the instruction processing method of the aforementioned embodiment.

[0114] It should be noted that the electronic devices in the embodiments of the present application include mobile electronic devices and non-mobile electronic devices.

[0115] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmble Gate Array) or other editable devices, transistor logic devices, hardware components or any combination thereof. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0116] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0117] The memory may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable ReadOnly), a CD-ROM (Compact Disa Read Only), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0118] The embodiment of the present invention also provides a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), the processor can execute Figure 1 The instruction processing method shown.

[0119] The present invention also provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to execute Figure 1 The instruction processing method shown.

[0120] An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned instruction processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0121] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0122] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0123] It should be understood by those skilled in the art that the embodiments of the present invention can be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0124] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0128] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0129] It should be noted that the various data-related processes in the embodiments of the present application are all carried out in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.

[0130] Finally, 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 terminal 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 terminal 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 terminal device including the elements.

[0131] The above is a detailed introduction to an instruction processing method, device, electronic device and readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A command processing method, characterized in that: The method comprises: The generated verification instructions are stored in a queue to be processed in sequence according to the instruction generation order; In response to a dependency building request for a current verification instruction, obtaining a to-be-determined instruction from the to-be-processed queue based on the dependency building request; Based on a preset configuration file, a dependency mode is generated for the current verification instruction; the dependency mode is one of write-after-read dependency, write-after-write dependency, read-after-write dependency, and read-after-read dependency; Based on the dependency pattern, determining an operation register corresponding to the dependency pattern in the current verification instruction as a first operation register; Based on the dependency pattern, determining an operation register corresponding to the dependency pattern in the instruction to be determined as a second operation register; The register identifier of the first operation register of the current verification instruction is set to the register identifier of the second operation register, so that the current verification instruction and the instruction to be determined form a dependency according to the dependency mode.

2. The method according to claim 1, characterized in that The obtaining the to-be-determined instruction from the to-be-processed queue includes: Obtaining verification instructions from the queue to be processed in sequence according to the instruction generation order; When the instruction type of the currently acquired verification instruction is consistent with the instruction type of the current verification instruction, the currently acquired verification instruction is determined as the instruction to be determined.

3. The method according to claim 2, characterized in that The method further comprises: When the instruction type of the currently acquired verification instruction is inconsistent with the instruction type of the current verification instruction, the operation of sequentially acquiring the verification instructions from the queue to be processed according to the instruction generation sequence is re-executed.

4. The method according to claim 1, characterized in that: The step of storing the generated verification instructions in a queue to be processed in sequence according to the instruction generation order includes: Create multiple pending queues, and different pending queues correspond to different instruction types; According to the instruction generation order, the generated verification instructions are sequentially stored in the waiting queue corresponding to the instruction type of each verification instruction; The obtaining the to-be-determined instruction from the to-be-processed queue includes: Based on the instruction type of the current verification instruction, determining a to-be-processed queue corresponding to the instruction type as a target queue; Obtain the to-be-determined instruction from the target queue.

5. The method according to claim 1, characterized in that In a case where the current verification instruction includes at least two operation registers, generating a dependency mode for the current verification instruction based on a preset configuration file includes: Based on a preset configuration file, respective dependency modes are generated for different operation registers of the current verification instruction.

6. The method according to any one of claims 1 to 5, characterized in that: The queue to be processed includes multiple record items, one record item corresponds to a verification instruction, one record item includes multiple table items, and different table items correspond to different operation registers of the verification instruction.

7. An instruction processing device, characterized in that: The device comprises: A first storage module, used for storing the generated verification instructions in sequence into a queue to be processed according to the instruction generation order; A first acquisition module, configured to respond to a dependency building request for a current verification instruction and acquire the to-be-determined instruction from the to-be-processed queue based on the dependency building request; A generating module, configured to generate an operation register for the current verification instruction based on the operation register of the instruction to be determined, so that the current verification instruction forms a dependency with the instruction to be determined; The generating module comprises: A mode generation submodule, used to generate a dependency mode for the current verification instruction based on a preset configuration file; the dependency mode is one of write-after-read dependency, write-after-write dependency, read-after-write dependency, and read-after-read dependency; A first determination submodule, configured to determine, based on the dependency mode, an operation register in the current verification instruction corresponding to the dependency mode as a first operation register; A second determination submodule, configured to determine, based on the dependency pattern, an operation register in the instruction to be determined that corresponds to the dependency pattern as a second operation register; The setting module is used to set the register identifier of the first operation register of the current verification instruction to the register identifier of the second operation register, so that the current verification instruction and the instruction to be determined form a dependency according to the dependency mode.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-6 when executing a program stored in a memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for generating random test cases to verify SDRAM

    CN109063323A

  • Apparatus and method for program order queue (POQ) to manage data dependencies in processor having multiple instruction queues

    CN111752617A

  • Storage renaming implementation method, processor and computer equipment

    CN114116002A

  • CPU instruction micro-benchmark test method and system oriented to AArch64 architecture

    CN114217856A

  • Verification method and device for execution component in processor, equipment and storage medium

    CN115840593A