Instruction processing method, device, electronic device and readable storage medium
By generating and data enhancement of the initial instruction flow, the problems of multiple test scenarios in chip testing are solved, and the testing efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411116871.X
- 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
The existing instruction processing methods cannot meet the needs of multiple test scenarios in chip testing, and cannot perform multiple tests on the preset functions of the preset module in the processor core.
Generate an initial instruction stream by obtaining the configuration file and performing data enhancement processing on the initial instruction stream based on the preset data enhancement mode to generate an optimized instruction stream to meet the needs of multiple test scenarios.
It realizes testing of preset modules in the processor core, improves testing efficiency and accuracy, and solves the problem that cannot meet multiple testing needs in the prior art.
Smart Images

Figure CN118626154B_ABST
Abstract
Description
Technical Field
[0001] The present application 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] During the chip development process, the chip's functions and performance need to be tested through test instructions.
[0003] In the related art, test instructions are written for the designed chip test scenario using a high-level language (such as C, C++, or other high-level languages), the test instructions are compiled into an instruction stream through a compiler, and the chip is tested by running the instruction stream.
[0004] However, the instruction stream compiled by the compiler can only test the fixed test scenarios corresponding to the instruction stream, and cannot meet the testing requirements for multiple test scenarios during the chip testing process. That is, the instruction processing method of the related technology cannot meet the testing requirements of the chip. Summary of the invention
[0005] The embodiments of the present application provide an instruction processing method, device, electronic device and readable storage medium to solve the problem that the instruction processing method in the prior art cannot meet the testing requirements of the chip.
[0006] In a first aspect, an embodiment of the present application provides an instruction processing method, including:
[0007] Obtaining a configuration file; the configuration file includes configuration information for generating an initial instruction stream, the initial instruction stream being used to test a preset function of a preset module in a processor core;
[0008] Generate an initial instruction stream based on the configuration information in the configuration file through an instruction sequence generator;
[0009] According to a preset data enhancement mode, data enhancement processing is performed on the initial instruction stream to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream.
[0010] In a second aspect, an embodiment of the present application provides an instruction processing device, the device comprising:
[0011] An acquisition module, used to acquire a configuration file; the configuration file includes configuration information for generating an initial instruction stream, and the initial instruction stream is used to test a preset function of a preset module in a processor core;
[0012] A generating module, configured to generate an initial instruction stream based on the configuration information in the configuration file through an instruction sequence generator;
[0013] The data enhancement module is used to perform data enhancement processing on the initial instruction stream according to a preset data enhancement mode to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor;
[0015] a memory for storing instructions executable by the processor;
[0016] The processor is configured to execute the instructions to implement the method of the first aspect.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the method of the first aspect.
[0018] In an embodiment of the present application, an initial instruction stream for testing a preset function of a preset module in a processor core is generated according to an instruction sequence generator and a configuration file. Compared with the method of writing test instructions in a high-level language and compiling the test instructions by a compiler to obtain an instruction stream in the related art, an initial instruction stream that meets the test requirements can be quickly generated through an instruction sequence and a configuration file. Through a preset data enhancement mode, the initial instruction stream is subjected to data enhancement processing, and a new test scenario can be added on the basis of the test scenario corresponding to the initial instruction stream. Therefore, based on the optimized instruction stream obtained by performing data enhancement processing on the initial instruction stream, a variety of test scenarios can be tested for the preset function, which solves the problem that the related art cannot meet the test requirements for a variety of test scenarios during the chip design and testing process, and solves the problem that the instruction processing method in the related art cannot meet the test requirements of the chip.
[0019] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1It is a flowchart of the steps of an instruction processing method provided in an embodiment of the present application;
[0022] Figure 2 is a flowchart of another instruction processing method provided by an embodiment of the present application;
[0023] Figure 3 This is a flowchart of another instruction processing method provided by an embodiment of the present application;
[0024] Figure 4 is a block diagram of an instruction processing device provided in an embodiment of the present application;
[0025] Figure 5 is a block diagram of an electronic device provided by an embodiment of the present invention;
[0026] Figure 6 is a block diagram of another electronic device according to another embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0028] The terms "first", "second", etc. in the specification and claims of the present application 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 under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally a class, 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 kinds of relationships can exist, for example, A and / or B can be represented: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the front and back associated objects are a kind of "or" relationship. In the embodiment of the present application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0029] The instruction processing method provided in the embodiment of the present application is described in detail below through specific embodiments in conjunction with the accompanying drawings.
[0030] Figure 1 is a flowchart of a method for processing instructions provided by an embodiment of the present application. Figure 1 As shown, the method may include:
[0031] Step 101: Get the configuration file.
[0032] The configuration file includes configuration information for generating an initial instruction stream, and the initial instruction stream is used to test preset functions of preset modules in a processor (Central Processing Unit, CPU) core.
[0033] The preset module may be an execution module, a compilation module, a renaming module, or other functional modules. The preset function is a function that the preset module can implement, for example, if the preset module is an execution module, the preset function may be a function of performing addition, multiplication, or division operations.
[0034] The configuration information may include the number of initial instructions in the initial instruction stream, instructions, instruction types, a preset data enhancement mode for performing data enhancement on the initial instruction stream, and other information used to generate the initial instruction stream or to perform data enhancement on the initial instructions.
[0035] Step 102: Generate an initial instruction stream based on the configuration information in the configuration file through an instruction sequence generator.
[0036] The configuration file includes configuration information for generating an initial instruction stream, which is an instruction stream for testing preset functions of preset modules in the processor core. Correspondingly, the instruction sequencer is an instruction sequencer based on a test unit (Unit Test, UT).
[0037] An initial instruction stream corresponding to the configuration information in the configuration file is generated by an instruction generator. For example, the configuration information includes at least one of the following: instructions, instruction types, and instructions to be inserted in a directional manner, and the instructions, instruction types, and instructions to be inserted in a directional manner each have information on the number of instructions configured. An initial instruction stream including a plurality of initial instructions is generated by the instruction generator according to the instructions, instruction types, and / or instructions to be inserted in a directional manner, and the number of initial instructions is equal to the number of instructions in the configuration information.
[0038] Step 103, according to a preset data enhancement mode, the initial instruction stream is subjected to data enhancement processing to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream.
[0039] According to a preset data enhancement mode, data enhancement processing is performed on the initial instruction stream to increase the number of initial instructions in the initial instruction stream and / or change the execution order of the initial instructions in the initial instruction stream, thereby increasing the test scenarios corresponding to the instruction stream.
[0040] Furthermore, according to a preset data enhancement mode, data enhancement processing is performed on the initial instruction stream, which may include: increasing the number of initial instructions in the initial instruction stream, adjusting the execution order of the initial instructions, and after increasing the number of initial instructions, adjusting the increased initial instructions, or other data enhancement modes that change the number of initial instructions and / or adjust the execution order of the initial instructions.
[0041] In summary, in an embodiment of the present application, an initial instruction stream for testing a preset function of a preset module in a processor core is generated according to an instruction sequencer and a configuration file. Through a preset data enhancement mode, the initial instruction stream is subjected to data enhancement processing, and a new test scenario can be added on the basis of the test scenario corresponding to the initial instruction stream. Therefore, based on the optimized instruction stream obtained by performing data enhancement processing on the initial instruction stream, a variety of test scenarios can be used to test the preset function, which solves the problem that the related art cannot meet the test requirements of multiple test scenarios during the chip design and testing process, and solves the problem that the instruction processing method in the related art cannot meet the test requirements of the chip.
[0042] Compared with the method in the related art of writing test instructions in a high-level language and compiling the test instructions through a compiler to obtain an instruction stream, an initial instruction stream that meets the test requirements can be quickly generated through an instruction sequence and a configuration file. Obtain an initial instruction stream for a preset function of a preset module, perform data enhancement processing on the initial instruction stream according to a preset data enhancement mode, and test the preset function of the preset module based on the obtained optimized instruction stream. The optimized instruction stream is obtained by performing data enhancement on the initial instruction stream. The initial instruction stream is an instruction stream that tests the preset function of the preset module, so the optimized instruction stream is also an instruction stream that tests the preset function of the preset module. Based on the optimized instruction stream, the preset function of the preset module can be tested in a targeted manner. Compared with the method of obtaining an instruction stream for testing the processor as a whole (Integral, IT), testing the processor core as a whole through the instruction stream, and analyzing the test results of the preset function of the preset module according to the overall test results, this embodiment is based on the optimized instruction stream generated for the preset function of the preset module, and can quickly test the preset function of the preset module.
[0043] Compared with obtaining an instruction stream for testing the entirety after processing, the method of parsing the instructions for testing the preset functions of the preset modules in the overall instruction stream and testing the preset functions of the preset modules based on the parsed instructions, this embodiment avoids the problem of being unable to test the preset functions of the preset modules in a targeted manner due to parsing failure, saves instruction parsing steps, improves instruction processing efficiency, and thereby improves the testing efficiency of the preset functions of the preset modules.
[0044] In addition, an IT-based instruction sequence generator can be used to generate an instruction stream for testing the processor as a whole, but this instruction stream needs to be run based on a specific simulator. In order to meet the requirements of the simulator, the instructions in the instruction stream need to be specially processed. For example, a specific type of instruction needs to be initialized, which will affect the test efficiency. For example, when the instruction stream is run through the simulator, some instructions that need to be tested will be identified as abnormal instructions and deleted, which will cause the test scenario corresponding to the original instruction stream to change. This embodiment generates a configuration file for the preset function of the preset module. Based on the instruction sequence generator, the execution order of each instruction in the instruction stream can be configured according to the test scenario required by the user, and then the initial instruction stream of the test scenario that meets the user's needs is generated. Based on the initial instruction stream, an optimized instruction stream processed with data enhancement is obtained to test the preset function of the preset module to meet the test scenario required by the user.
[0045] Figure 2 is a flowchart of a method for processing instructions provided by an embodiment of the application, such as Figure 2 As shown, the method may include:
[0046] Step 201, obtaining a configuration file.
[0047] For example, the configuration file includes multiple groups of configuration information, there are multiple preset functions, and one group of configuration information corresponds to one preset function.
[0048] For example, the preset module is an execution module in the processor core, and the preset functions include an addition operation function, a multiplication operation function, and a division operation function. Then the configuration file may include three sets of configuration information, and the three sets of configuration information respectively include configuration information for generating initial instruction streams of the addition operation function, the multiplication operation function, and the division operation function. It should be noted that there may be multiple preset functions, and they are not limited to the three proposed in this embodiment.
[0049] Step 202: Generate an initial instruction stream corresponding to each set of configuration information based on each set of configuration information through an instruction sequence generator.
[0050] For example, a set of configuration information corresponds to a preset function to be tested. The instruction sequence generator generates initial instruction streams corresponding to each set of configuration information based on each set of configuration information, thereby obtaining multiple initial instruction streams, and each initial instruction stream corresponds to a preset function.
[0051] That is, through the instruction sequence generator, multiple initial instruction streams for multiple preset functions can be obtained, and an initial instruction stream for a preset function can be marked as an instruction block.
[0052] Step 203, performing data enhancement processing on each initial instruction stream to obtain an enhanced instruction stream corresponding to each initial instruction stream;
[0053] According to the method of the aforementioned step 103, data enhancement processing may be performed on each initial instruction stream.
[0054] Optionally, the initial instruction stream includes multiple initial instructions; step 203 performs data enhancement processing on the initial instruction stream to obtain an optimized instruction stream, including the following sub-steps:
[0055] Sub-step A1, performing at least one of the following operations on multiple initial instructions in the initial instruction stream to obtain an optimized instruction stream: increasing the number of initial instructions, adjusting the execution order of the initial instructions.
[0056] For example, the initial instructions may be copied, and the instruction stream formed by the initial instructions before and after the copy is determined as the optimized instruction stream. For another example, the execution order of the initial instructions may be disrupted, and the instruction stream formed by the disrupted initial instructions is determined as the optimized instruction stream.
[0057] For another example, the initial instructions can be copied, and the execution order of the initial instructions before and after the copy can be shuffled as a whole to obtain two groups of shuffled instruction streams. The two groups of shuffled instruction streams can be spliced and interleaved according to a preset interleaving strategy to shuffle the execution order of the initial instructions. The interleaved and spliced instruction stream obtained by first performing the copy operation and then performing the sequence shuffling operation can be determined as the optimized instruction stream.
[0058] For example, the initial instruction stream includes initial instructions: A1, A2, A3...AN; A1, A2, A3 and AN are respectively the 1st instruction, the 2nd instruction, the 3rd instruction and the Nth instruction in the initial instruction stream; after copying the initial instruction stream, the instruction stream obtained includes initial instructions: B1, B2, B3...BN, B1, B2, B3, BN are respectively the 1st instruction, the 2nd instruction, the 3rd instruction and the Nth instruction in the copied instruction stream.
[0059] The execution order of the initial instructions in the initial instruction stream is disrupted, and the disrupted instruction stream is obtained as follows: A1, A3, AN...A2; after the copied initial instruction stream is disrupted, the disrupted instruction stream is obtained as follows: B2, B3, BN...B1.
[0060] The preset interleaving and splicing strategy is to interleave and splice two groups of shuffled instruction streams according to the preset instruction sequence numbers. For example, the instructions with the same sequence numbers in the two groups of shuffled instruction streams are spliced, and the optimized instruction stream after splicing is: A1, B2, A3, B3, AN, BN...A2, B1.
[0061] Step 204 , splicing the multiple enhanced instruction streams to obtain a spliced optimized instruction stream, so as to test the multiple preset functions of the preset module according to the optimized instruction stream.
[0062] There are multiple initial instruction streams, and there are also multiple enhanced instruction streams generated based on the initial instruction streams. The initial instruction streams correspond to the enhanced instruction streams one-to-one, and the initial instruction streams correspond to the preset functions of the preset modules one-to-one. Then the enhanced instruction streams also correspond to the preset functions of the preset modules one-to-one.
[0063] For example, the initial instruction stream includes three groups of initial instruction streams (ie, three Groups) generated for the addition operation function, the multiplication operation function, and the division operation function of the execution function. Three groups of enhanced instruction streams are generated based on the three groups of initial instruction streams. The three groups of enhanced instruction streams are spliced to obtain an optimized instruction stream.
[0064] For example, the configuration information includes a preset data enhancement mode, and the preset data enhancement modes recorded in the configuration information of different preset functions may be different or the same. An instruction sequence generator is used to generate an initial instruction stream according to the configuration information, and the initial instruction stream is subjected to data enhancement processing using the corresponding preset data enhancement mode to obtain an enhanced instruction stream, and the enhanced instruction stream is spliced to obtain an optimized instruction stream. Based on this method, the complexity, randomness, and effectiveness of the optimized instruction stream are improved.
[0065] For example, each set of configuration information corresponds to a group, and a group has a corresponding preset total number. An instruction sequence generator is used to generate an initial instruction stream in the group according to the preset total number, and the initial instruction stream is subjected to data enhancement processing to obtain an enhanced instruction stream, which is an instruction stream fragment for a preset function in a preset module. The instruction data of each instruction in the instruction stream fragment is stored in a structure queue in the form of a structure, wherein the instruction data may include PC information, a 32-bit instruction code, and its disassembly code of each instruction.
[0066] Furthermore, each time an instruction is generated, it is stored (pushed) into the instruction saving queue in the form of a structure. After the instruction stream of a group is generated, data enhancement operations are performed on the instructions saved in the instruction saving queue of the group according to the data enhancement mode configured for the group and the number of repeated generation. The number of repetitions refers to the number of times the initial instruction stream is repeatedly generated during the data enhancement process.
[0067] After performing data enhancement operation on the instructions saved in the instruction saving queue of the group, the instructions processed with data enhancement are saved into a file to obtain the instruction stream fragment after enhancement processing.
[0068] In the related art, a compiler compiles test instructions written in a high-level language to obtain an instruction stream for testing the entire processor core. Based on the instruction stream generated for the entire processor core, it is impossible to perform separate data enhancement processing on the instructions in the instruction stream corresponding to the preset functions of the preset modules.
[0069] In this embodiment, an instruction sequence generator is used to generate initial instruction streams corresponding to each group of configuration information based on each group of configuration information, and data enhancement processing is performed on each initial instruction stream to obtain enhanced instruction streams corresponding to each initial instruction stream. The initial instruction stream is a group (instruction block) generated for a preset function of a preset module, and the enhanced instruction stream is an instruction stream obtained by performing separate data enhancement processing on a group, which solves the problem in the related art that it is impossible to perform separate data enhancement processing on instructions corresponding to the preset function of the preset module in the instruction stream, and the enhanced instruction stream includes more test scenarios than the initial instruction stream. The enhanced instruction stream is spliced to obtain a spliced optimized instruction stream. Based on the optimized instruction stream, multiple test scenarios of the preset module can be tested, which solves the problem that the related art cannot meet the testing requirements of multiple test scenarios during the chip design and testing process, and solves the problem that the instruction processing method in the related art cannot meet the testing requirements of the chip.
[0070] Furthermore, the instruction sequence generator is a UT-based instruction sequence generator. In the process of verifying the processor core (CPU) of the chip, an initial instruction stream for a preset function of a preset module is generated by the UT-based instruction sequence generator. By performing data enhancement on the initial instruction stream, an optimized instruction stream including a variety of test scenarios can be obtained, so as to perform more comprehensive and in-depth verification tests on the CPU, ensuring the functional correctness and system stability of the CPU in various complex scenarios. The CPU performance can also be optimized based on the verification test results, thereby improving the quality and reliability of the CPU.
[0071] Optionally, obtaining the configuration file in step 201 may include the following sub-steps:
[0072] Sub-step 2011, obtaining the instruction type.
[0073] For example, there may be multiple instruction types, and each instruction type may have a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeatedly appeared in the initial instruction stream.
[0074] For example, the instruction type can be an integer (int) type, a floating point (FP) type, or other types. The weight value corresponding to each instruction type can be set according to user needs.
[0075] Furthermore, the weight value is positively correlated with the probability of the instruction type being selected when the instruction sequence generator generates the initial instruction according to the configuration file.
[0076] Sub-step 2012, configuring instruction quantity information for the instruction type, and obtaining a configuration file including the instruction type and the instruction quantity information.
[0077] For example, the configuration file may also include instructions, as well as instructions for directional insertion.
[0078] For example, the configuration file includes configuration information of multiple groups. The configuration information of the group may include an instruction type (include_type), an instruction (Includ_instr), and a directional insertion instruction (insert_instr).
[0079] The number of instructions can be configured for the instruction type, instruction, and directional inserted instruction in the configuration file. When the configuration file is parsed by the instruction sequencer, instructions are randomly selected within the range of the number of configured instructions to obtain the total number of instructions; wherein the total number of instructions is equal to the sum of the numbers of randomly selected instructions. Further, after parsing the configuration file, the instruction sequencer saves the instruction numbers of the randomly selected instructions.
[0080] For example, the number of instructions configured for instruction type is 40 to 80, the number of instructions configured for instruction is 20 to 40, and the number of instructions configured for directional insertion is 1. The configuration file is parsed by the instruction sequence generator, and the randomly generated instructions are 45, 25, and 1 respectively. The total number of initial instructions for the group is 71. Among them, after the instruction sequence generator parses the configuration file, it saves the number of instructions for the instruction type (45), the number of instructions for the instruction (25), and the number of instructions for the directional insertion instruction (1).
[0081] Following sub-step 2012, for example, the instruction type includes multiple types, each instruction type has a corresponding weight value; the instruction quantity information is an instruction quantity interval; in step 202, the initial instruction stream is generated based on the configuration file by the instruction sequence generator, which may include the following sub-steps:
[0082] Sub-step 2021, obtaining the target instruction quantity from the instruction quantity interval.
[0083] For example, the number of instructions configured for the instruction type is 40 to 80, and the number of target instructions obtained therefrom may be 45.
[0084] For example, the number of instructions for instruction type, initial instruction, and directional inserted instruction are 45, 25, and 1 respectively. The instruction stream can be generated according to the attributes configured in the instruction type. For example, the instruction type includes an integer (int) attribute and a floating point (fp) attribute, where the weight of the integer attribute is 30 and the weight of the floating point attribute is 40. When generating the instruction stream corresponding to the instruction type, first select an attribute according to the weight, and then randomly select an initial instruction from the preset instruction set corresponding to the attribute.
[0085] Sub-step 2022, each time the initial instruction generation operation is performed, determining a target instruction type selected for the current initial instruction generation operation from a plurality of instruction types.
[0086] The probability of an instruction type being selected is positively correlated with the weight value corresponding to the instruction type.
[0087] Sub-step 2023, according to the target instruction type, select a preset instruction from the preset instruction set corresponding to the target instruction type, and determine the selected preset instruction as the initial instruction.
[0088] For example, different instruction types have their own corresponding preset instruction sets, which are pre-built instruction sets for corresponding instruction types.
[0089] Sub-step 2024, when the total number of initial instructions obtained is equal to the target number of instructions, the initial instruction generation operation is stopped, and the instruction stream composed of all the initial instructions is determined as the initial instruction stream.
[0090] For example, the target number of instructions is 45. After 45 initial instructions are obtained according to sub-step 2022 and sub-step 2023, the instruction stream consisting of the obtained 45 initial instructions is determined as the initial instruction stream.
[0091] Optionally, obtaining the configuration file in step 201 may further include the following sub-steps:
[0092] Sub-step 2013, obtaining multiple preset instructions in the preset instruction set, each preset instruction has a corresponding instruction type.
[0093] Each instruction type has a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeatedly appeared in the initial instruction stream.
[0094] Sub-step 2014, determining the instruction information to be deleted of the instruction to be deleted from the plurality of preset instructions.
[0095] For example, the preset instruction set may include preset instructions for performing addition operations and preset instructions for performing multiplication operations. If the addition operation function of the execution module needs to be verified, the multiplication instruction may be determined as an instruction to be deleted.
[0096] For another example, the preset instruction set may include addition operation instructions, specifically including addition operation instructions of integer type, floating point type and vector type. If the addition operation functions of integer type and floating point type need to be verified, the addition operation instructions of vector type can be determined as instructions to be deleted.
[0097] Sub-step 2015, generating the configuration file including the instruction information to be deleted.
[0098] The instruction information to be deleted is used to instruct the instruction sequence generator to delete the preset instruction corresponding to the instruction information to be deleted from multiple preset instructions, and to construct an initial instruction stream according to the remaining multiple preset instructions.
[0099] Optionally, obtaining the configuration file in step 201 may further include the following sub-steps:
[0100] Sub-step 2016, obtaining multiple preset instructions in the preset instruction set.
[0101] Among them, each preset instruction has a corresponding instruction type, and the instruction type can be an integer type, a floating point type, a vector type or other types.
[0102] Each instruction type has a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeated in the initial instruction stream. For example, the weight value is positively correlated with the number of times it is repeated.
[0103] Sub-step 2017, obtaining a preset position where an instruction needs to be inserted in a direction in the preset instruction, and the instruction to be inserted in a direction.
[0104] For example, the instruction to be inserted includes an instruction and an instruction type, and a weight value corresponding to the instruction type.
[0105] Sub-step 2018, generating a configuration file including instructions for preset positions and directional insertion.
[0106] There are N preset instructions, and the preset position is the position between the Ath and Bth instructions. Based on the configuration file, the instruction to be inserted is inserted between the Ath preset instruction and the Bth preset instruction through the instruction sequence generator to obtain the initial instruction stream. The initial instruction stream includes multiple preset instructions and the instruction to be inserted inserted in the preset position.
[0107] For example, the initial instruction stream includes multiple initial instructions; when there is only one group of initial instruction streams, the enhanced instruction stream obtained in step 203 is an optimized instruction stream obtained by performing data enhancement processing on the initial instruction stream. Correspondingly, step 203 includes the following sub-steps (sub-steps 2031 to 2032):
[0108] Sub-step 2031, generating a new instruction stream including at least part of the initial instructions.
[0109] A copy operation may be performed on at least a portion of the initial instructions to obtain new instructions that are the same as the initial instructions.
[0110] The newly added instructions may include part or all of the initial instructions. For example, the newly added instructions include all the initial instructions. Referring to Table 1, the initial instructions include 7 initial instructions corresponding to the program counter (PC) from 0x80000000 to 0x80000024. Based on these 7 initial instructions, 7 newly added instructions with PC from 0x80000028 to 0x80000052 are obtained:
[0111]
[0112] Sub-step 2032, concatenating the initial instruction stream and the newly added adjusted instruction stream to obtain the optimized instruction stream.
[0113] Furthermore, the initial instruction in the initial instruction stream may be generated X times continuously to implement a repeat operation on the initial instruction stream, thereby obtaining an optimized instruction stream, wherein the size of X may be configured according to user requirements.
[0114] The optimized instruction stream thus obtained includes initial instructions and newly added instructions generated based on the initial instructions. Referring to Table 1, 14 instructions including 7 initial instructions and 7 newly added instructions in Table 1 constitute the optimized instruction stream in this embodiment.
[0115] Furthermore, in the case where there are multiple groups of initial instruction streams, the optimized instruction stream obtained from sub-steps 2031 to 2032 is an enhanced instruction stream that corresponds one-to-one to the initial instruction stream.
[0116] Optionally, the initial instruction stream includes multiple initial instructions; in step 203, data enhancement processing is performed on the initial instruction stream to obtain an optimized instruction stream, including the following sub-steps (sub-steps 2033 to 2035):
[0117] Sub-step 2033, generating a new instruction stream including at least part of the initial instructions.
[0118] The method of this sub-step can refer to the description of the aforementioned sub-step 2031 and will not be repeated here.
[0119] Sub-step 2034, adjusting the execution order of at least part of the initial instructions in the newly added instruction stream to obtain a first adjusted instruction stream.
[0120] For example, at least some of the initial instructions are repeatedly operated to obtain new instructions that are the same as at least some of the initial instructions and have the same execution order as at least some of the initial instructions. The instruction stream formed by these new instructions is the new instruction stream in this embodiment. Adjusting the execution order between the new instructions is equivalent to performing a disorderly operation on the new instructions. Based on the disorderly operation, the dependency relationship between the new instructions and the new instructions can be changed. Based on the new instructions after the order adjustment, the test scenario can be increased.
[0121] For example, the execution order of the newly added instructions can be adjusted based on a preset adjustment strategy. The preset adjustment strategy can be a random adjustment, exchanging the newly added instructions in pairs according to a preset exchange sequence number, or other adjustment strategies, and the adjustment strategy is not limited here.
[0122] Sub-step 2035: concatenate the initial instruction stream and the first adjusted instruction stream to obtain the optimized instruction stream.
[0123] Specifically, the order of the initial instructions in the initial instruction stream may be disrupted and generated X times in succession, and the order of the initial instructions generated each time is different, so as to implement a shuffle operation on the initial instruction stream and obtain an optimized instruction stream.
[0124] For example, the newly added instructions include all the initial instructions. Referring to Table 2, the initial instructions include 7 initial instructions corresponding to the program counter (PC) from 0x80000000 to 0x80000024. Based on these 7 initial instructions, 7 newly added instructions are obtained. The execution order of the 7 newly added instructions is adjusted to obtain 7 newly added instructions with PC from 0x80000028 to 0x80000052 after the order is adjusted. Then the optimized instructions include the 14 instructions shown in Table 2:
[0125]
[0126] Furthermore, in the case where there are multiple groups of initial instruction streams, the optimized instruction stream obtained according to sub-steps 2033 to 2035 is an enhanced instruction stream that corresponds one-to-one to the initial instruction stream.
[0127] Optionally, the initial instruction stream includes multiple initial instructions; in step 203, data enhancement processing is performed on the initial instruction stream to obtain an optimized instruction stream, including the following sub-steps (sub-steps 2036 to 2038):
[0128] Sub-step 2036, generating a new instruction stream including at least part of the initial instructions.
[0129] The method of this step has been explained in the aforementioned step 2031 and will not be repeated here.
[0130] Sub-step 2037, adjusting the execution order of at least part of the initial instructions in the initial instruction stream to obtain a second adjusted instruction stream.
[0131] For example, the execution order of at least part of the initial instructions in the initial instruction stream may be adjusted based on a preset adjustment strategy, which may be a random adjustment, exchanging two instructions in the instruction set according to a preset instruction exchange sequence number, or other adjustment strategies.
[0132] Sub-step 2038, adjusting the execution order of at least part of the initial instructions in the newly added instruction stream to obtain a third adjusted instruction stream.
[0133] The execution order of at least part of the initial instructions in the newly added instruction stream can be adjusted based on a preset adjustment strategy. The preset adjustment strategy can be random adjustment, exchanging two instructions in the newly added instruction stream according to a preset instruction exchange sequence number, or other adjustment strategies.
[0134] Sub-step 2039, according to a preset instruction interspersing strategy, intersperse each instruction in the third adjusted instruction stream into the second adjusted instruction stream to obtain the optimized instruction stream.
[0135] Specifically, X initial instruction streams may be repeatedly generated, and initial instructions in each initial instruction stream may be processed out of order, and then initial instructions in every two instruction streams after the out of order processing may be cross-mixed to implement an interleaving operation on the initial instruction streams, thereby obtaining an optimized instruction stream.
[0136] For example, the newly added instructions include all the initial instructions. The execution of the instruction set of the newly added instructions and the initial instructions includes the 14 instructions shown in Table 1. The 14 instructions are sequentially adjusted to obtain the optimized instruction flow shown in Table 3:
[0137]
[0138] Furthermore, in the case where there are multiple groups of initial instruction streams, the optimized instruction stream obtained according to sub-steps 2036 to 2038 is an enhanced instruction stream that corresponds one-to-one to the initial instruction stream.
[0139] Data enhancement processing is performed on the initial instruction stream to more comprehensively cover various test scenarios. For example, the initial instruction stream only includes test scenarios composed of the initial instructions and the dependencies between the initial instructions. Through the shuffling and interleaving operations in the aforementioned embodiments, test scenarios that cannot be included in the initial instruction stream or the optimized instruction stream obtained by repeated operations can be obtained. Furthermore, through shuffling and interleaving processing, test scenarios that cannot be considered through manual construction can be obtained.
[0140] Different preset data enhancement modes can be used to perform data enhancement processing on the initial instruction stream to perform mixed cross processing on the initial instructions to obtain optimized instructions including different test scenarios. Furthermore, the initial instructions included in different test scenarios are different, and / or the execution order between the initial instructions is different, wherein the execution order between the initial instructions is different, and the dependency relationship between the initial instructions is different. By performing data enhancement processing on the initial instruction stream through different preset data enhancement modes, it can be ensured that during the CPU design process, by optimizing instructions, the preset functions of each preset module in the CPU can be verified in various complex test scenarios, and the correctness and stability of the CPU design under various complex conditions can be ensured.
[0141] Figure 3 is a flowchart of the specific steps of an instruction processing method provided in an embodiment of the present application, such as Figure 3 The method may include:
[0142] Step S1, generating a configuration file including multiple groups of configuration information.
[0143] For example, corresponding configuration information can be generated for each preset function in the configuration file, thereby obtaining configuration information of multiple groups (blocks), one preset function corresponds to one group. Each group of configuration information has an information identifier, and the information identifier can be the ID (Identity Document, ID) of the group corresponding to the configuration information.
[0144] Furthermore, when developing an instruction sequencer, the configuration information of each group can be configured separately in the configuration file, and an identifier can be configured for each group, so that the instruction sequencer can obtain the configuration information to be processed according to the identifier.
[0145] The configuration information may include information such as the instruction information in the group, the preset data enhancement mode, the number of data enhancements, and the number of instructions.
[0146] The instruction information may include instruction type, instruction, and directional inserted instruction, and the instruction number includes the number corresponding to the instruction type, the number corresponding to the instruction, and the number corresponding to the directional inserted instruction. For details, please refer to the description of the aforementioned step 2012, which will not be repeated here.
[0147] Step S2, generating a plurality of initial instruction sequences according to the configuration information in the file through an instruction sequence generator based on unit testing.
[0148] Specifically, according to the UT-based instruction sequence generator, an initial instruction sequence including a preset total number of initial instructions is generated according to the preset total number in the configuration information. The initial instruction sequence is equivalent to the initial instruction stream in the above-mentioned embodiment.
[0149] For example, the configuration information has an ID of a corresponding group. When it is necessary to generate an initial instruction sequence for a preset function, the configuration information corresponding to the group ID is obtained from multiple configuration information in the configuration file according to the ID of the group corresponding to the preset function, and the initial instruction sequence for the preset function is generated based on the configuration information.
[0150] Step S3, performing data enhancement processing on each initial instruction sequence to obtain instruction stream fragments corresponding to each initial instruction sequence.
[0151] According to the preset data enhancement mode and the number of data enhancements in the configuration information, data enhancement is performed on the initial instructions in the initial instruction sequence to obtain a data-enhanced instruction stream fragment.
[0152] Step S4, splicing all instruction stream fragments to obtain a complete instruction stream file.
[0153] The complete instruction stream file obtained by splicing all instruction stream fragments is the optimized instruction stream in the aforementioned embodiment.
[0154] refer to Figure 4 , which shows an instruction processing device provided in an embodiment of the present application, the device 30 includes:
[0155] The acquisition module 301 is used to acquire a configuration file; the configuration file includes configuration information for generating an initial instruction stream, and the initial instruction stream is used to test the preset functions of the preset modules in the processor core;
[0156] A generating module 302, configured to generate an initial instruction stream based on configuration information in a configuration file through an instruction sequence generator;
[0157] The data enhancement module 303 is used to perform data enhancement processing on the initial instruction stream according to a preset data enhancement mode to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream.
[0158] Optionally, the configuration file includes multiple groups of configuration information, there are multiple preset functions, and one group of configuration information corresponds to one preset function; the generating module 302 may include:
[0159] A first generating submodule is used to generate an initial instruction stream corresponding to each set of configuration information based on each set of configuration information through an instruction sequence generator;
[0160] The data enhancement module 303 may include:
[0161] The first acquisition submodule is used to perform data enhancement processing on each initial instruction stream to obtain an enhanced instruction stream corresponding to each initial instruction stream;
[0162] The second acquisition submodule is used to splice multiple enhanced instruction streams to obtain a spliced optimized instruction stream, so as to test multiple preset functions of the preset module according to the optimized instruction stream.
[0163] Optionally, the initial instruction stream includes multiple initial instructions; the data enhancement module 303 may include:
[0164] The first data enhancement submodule is used to perform at least one of the following operations on multiple initial instructions in the initial instruction stream to obtain an optimized instruction stream: increase the number of initial instructions, adjust the execution order of the initial instructions, and after increasing the number of initial instructions, adjust the execution order of the initial instructions.
[0165] The initial instruction stream includes multiple initial instructions; the data enhancement module 303 may include:
[0166] A second generating submodule, for generating new instructions that are identical to at least part of the initial instructions;
[0167] A first adjustment submodule is used to adjust the execution order of at least part of the newly added instructions to obtain newly added instructions after the order is adjusted;
[0168] The first determination submodule is used to determine the instruction stream consisting of the initial instructions and the newly added instructions after the order is adjusted as the optimized instruction stream.
[0169] Optionally, the initial instruction includes multiple initial instructions; the data enhancement module 303 may include:
[0170] A third generation submodule, used to generate new instructions that are identical to at least part of the initial instructions;
[0171] The third acquisition submodule is used to acquire an instruction set including the newly added instructions and the initial instructions, and adjust the execution order of the instructions in the instruction set to obtain a plurality of instructions after the order is adjusted;
[0172] The second determining submodule is used to determine the instruction stream formed by the plurality of instructions after the sequence adjustment as the optimized instruction stream.
[0173] Optionally, the initial instruction stream includes multiple initial instructions; the data enhancement module 303 may include:
[0174] a fourth generating submodule, for generating new instructions that are identical to at least part of the initial instructions;
[0175] The third determining submodule is used to determine the instruction stream consisting of the initial instructions and the newly added instructions as the optimized instruction stream.
[0176] Optionally, the acquisition module 301 may include:
[0177] A fourth acquisition submodule is used to acquire at least one initial instruction, each initial instruction has a corresponding instruction type, each instruction type has a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeatedly appeared in the initial instruction stream;
[0178] The fifth generation submodule is used to generate a configuration file including at least part of the following configuration information: a preset total number of all initial instructions in the initial instruction stream, the initial instruction, the instruction type and the weight value.
[0179] Optionally, the generating module 302 may include:
[0180] A fifth acquisition submodule, used to acquire a preset number of initial instructions of each instruction type according to a preset total number and a weight value through an instruction sequence generator;
[0181] a sixth generating submodule, for generating a plurality of initial instructions according to a preset number of initial instructions of each instruction type;
[0182] The fourth determining submodule is used to determine an instruction stream consisting of multiple initial instructions as an initial instruction stream.
[0183] Optionally, the generating module 302 may include:
[0184] A sixth acquisition submodule is used to acquire multiple preset instructions in the preset instruction set, each preset instruction has a corresponding instruction type; each instruction type has a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeated in the initial instruction stream;
[0185] A deletion submodule is used to obtain instructions to be deleted from multiple preset instructions;
[0186] The seventh generation submodule is used to generate a configuration file including preset instructions, instructions to be deleted, and instruction types; wherein the information of instructions to be deleted is used to instruct the instruction sequence generator to delete the preset instructions corresponding to the information of instructions to be deleted from multiple preset instructions, and construct an initial instruction stream based on the remaining multiple preset instructions.
[0187] Optionally, the generating module 302 may include:
[0188] A seventh acquisition submodule is used to acquire multiple preset instructions in the preset instruction set; each preset instruction has a corresponding instruction type; each instruction type has a corresponding weight value, and the weight value is related to the number of times the initial instruction corresponding to the instruction type is repeated in the initial instruction stream;
[0189] An eighth acquisition submodule, used to acquire a preset position where an instruction needs to be inserted in the preset instruction, and generate an instruction to be inserted;
[0190] The eighth generation submodule is used to generate a configuration file including preset instructions, instructions to be inserted, and instruction types.
[0191] In an embodiment of the present application, an initial instruction stream for testing a preset function of a preset module in a processor core is generated according to an instruction sequence generator and a configuration file. Compared with the method of writing test instructions in a high-level language and compiling the test instructions by a compiler to obtain an instruction stream in the related art, an initial instruction stream that meets the test requirements can be quickly generated through an instruction sequence and a configuration file. Through a preset data enhancement mode, the initial instruction stream is subjected to data enhancement processing, and a new test scenario can be added on the basis of the test scenario corresponding to the initial instruction stream. Therefore, based on the optimized instruction stream obtained by performing data enhancement processing on the initial instruction stream, a variety of test scenarios can be tested for the preset functions, which solves the problem that the related art cannot meet the test requirements for a variety of test scenarios during the chip design and testing process, and solves the problem that the instruction processing method in the related art cannot meet the test requirements of the chip.
[0192] Figure 5 4 is a block diagram of an electronic device 400 according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0193] Reference Figure 5 , the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .
[0194] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.
[0195] The memory 404 is used to store various types of data to support the operation of the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, multimedia, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0196] The power supply component 406 provides power to the various components of the electronic device 400. The power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.
[0197] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the demarcation of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a multimedia mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0198] The audio component 410 is used to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is used to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.
[0199] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0200] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of user contact with the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0201] The communication component 416 is used to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0202] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to implement an instruction processing method provided in an embodiment of the present application.
[0203] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the above instructions can be executed by a processor 420 of an electronic device 400 to perform the above method. For example, the non-transitory storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0204] Figure 6 is a block diagram of an electronic device 500 according to an exemplary embodiment. For example, the electronic device 500 may be provided as a server. Figure 6 The electronic device 500 includes a processing component 522, which further includes one or more processors, and a memory resource represented by a memory 532 for storing instructions that can be executed by the processing component 522, such as an application. The application stored in the memory 532 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 522 is configured to execute instructions to perform an instruction processing method provided in an embodiment of the present application.
[0205] The electronic device 500 may also include a power supply component 526 configured to perform power management of the electronic device 500, a wired or wireless network interface 550 configured to connect the electronic device 500 to a network, and an input / output (I / O) interface 558. The electronic device 500 may operate based on an operating system stored in the memory 532, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0206] An embodiment of the present application also provides a computer program product, including a computer program and an instruction processing method implemented when the computer program is executed by a processor.
[0207] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0208] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0209] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
[0210] The above is a detailed introduction to an instruction processing method, device, electronic device and computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, 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 application.
Claims
1. A command processing method, characterized in that: include: Obtaining a configuration file; the configuration file includes configuration information for generating an initial instruction stream, the initial instruction stream being used to test a preset function of a preset module in a processor core; Generate an initial instruction stream based on the configuration information in the configuration file through an instruction sequence generator; According to a preset data enhancement mode, the initial instruction stream is subjected to data enhancement processing to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream; The configuration file includes multiple groups of configuration information, there are multiple preset functions, and one group of the configuration information corresponds to one preset function; The generating of the initial instruction stream based on the configuration file by the instruction sequence generator includes: Generate, by the instruction sequence generator, the initial instruction stream corresponding to each group of the configuration information based on each group of the configuration information; The performing data enhancement processing on the initial instruction stream to obtain an optimized instruction stream includes: Performing data enhancement processing on each of the initial instruction streams to obtain enhanced instruction streams corresponding to each of the initial instruction streams; The plurality of enhanced instruction streams are spliced together to obtain a spliced optimized instruction stream, so as to test the plurality of preset functions of the preset module according to the optimized instruction stream.
2. The method according to claim 1, characterized in that The initial instruction stream includes a plurality of initial instructions; the initial instruction stream is subjected to data enhancement processing according to a preset data enhancement mode to obtain an optimized instruction stream, including: Perform at least one of the following operations on a plurality of initial instructions in the initial instruction stream to obtain an optimized instruction stream: increase the number of the initial instructions, and adjust the execution order of the initial instructions.
3. The method according to claim 1, characterized in that The initial instruction stream includes a plurality of initial instructions; the initial instruction stream is subjected to data enhancement processing according to a preset data enhancement mode to obtain an optimized instruction stream, including: generating a new instruction stream including at least part of the initial instructions; Adjusting the execution order of at least part of the initial instructions in the newly added instruction stream to obtain a first adjusted instruction stream; The initial instruction stream and the first adjusted instruction stream are concatenated to obtain the optimized instruction stream.
4. The method according to claim 1, characterized in that The initial instruction includes a plurality of initial instructions; and the initial instruction stream is subjected to data enhancement processing according to a preset data enhancement mode to obtain an optimized instruction stream, including: generating a new instruction stream including at least part of the initial instructions; Adjusting the execution order of at least part of the initial instructions in the initial instruction stream to obtain a second adjusted instruction stream; Adjusting the execution order of at least part of the initial instructions in the newly added instruction stream to obtain a third adjusted instruction stream; According to a preset instruction interspersing strategy, each instruction in the third adjusted instruction stream is interspersed into the second adjusted instruction stream to obtain the optimized instruction stream.
5. The method according to claim 1, characterized in that The obtaining of the configuration file comprises: Get the instruction type; The instruction quantity information is configured for the instruction type to obtain a configuration file including the instruction type and the instruction quantity information.
6. The method according to claim 5, characterized in that The instruction types include multiple types, and each instruction type has a corresponding weight value; The instruction quantity information is an instruction quantity interval; The generating of the initial instruction stream based on the configuration information in the configuration file by the instruction sequence generator includes: Obtaining a target instruction quantity from the instruction quantity interval; Each time an initial instruction generation operation is performed, a target instruction type selected for the current initial instruction generation operation is determined from a plurality of instruction types; the probability of the instruction type being selected is positively correlated with the weight value corresponding to the instruction type; According to the target instruction type, selecting a preset instruction from a preset instruction set corresponding to the target instruction type, and determining the selected preset instruction as the initial instruction; When the total number of acquired initial instructions is equal to the target number of instructions, the initial instruction generation operation is stopped, and the instruction stream composed of all the initial instructions is determined as the initial instruction stream.
7. An instruction processing device, characterized in that: The device comprises: An acquisition module, used to acquire a configuration file; the configuration file includes configuration information for generating an initial instruction stream, and the initial instruction stream is used to test a preset function of a preset module in a processor core; A generating module, configured to generate an initial instruction stream based on the configuration information in the configuration file through an instruction sequence generator; A data enhancement module, used to perform data enhancement processing on the initial instruction stream according to a preset data enhancement mode to obtain an optimized instruction stream, so as to test the preset function of the preset module according to the optimized instruction stream; The configuration file includes multiple groups of configuration information, there are multiple preset functions, and one group of the configuration information corresponds to one preset function; the generation module includes: A first generating submodule, configured to generate, through the instruction sequence generator, the initial instruction stream corresponding to each group of the configuration information based on each group of the configuration information; The data enhancement module comprises: A first acquisition submodule is used to perform data enhancement processing on each of the initial instruction streams to obtain an enhanced instruction stream corresponding to each of the initial instruction streams; The second acquisition submodule is used to splice the multiple enhanced instruction streams to obtain a spliced optimized instruction stream, so as to test the multiple preset functions of the preset module according to the optimized instruction stream.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 6.
