Abnormal instruction generation method, device, electronic device and readable medium

By automatically generating exception instructions in the instruction flow generation process, the problem of low efficiency of manually inserting exception instructions is solved, and a more efficient CPU verification process is achieved.

CN118642907BActive Publication Date: 2024-10-15BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411116825.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-10-15
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

In the existing technology, manually inserting abnormal instructions is costly and inefficient, resulting in a reduction in the overall efficiency of the CPU verification process.

Method used

In the instruction flow generation process, based on the target configuration items in the preset instruction flow configuration file, the abnormal instruction form and probability of the instructions to be generated are determined, and instructions that conform to the target abnormal form are automatically generated.

Benefits of technology

It reduces labor costs, improves the efficiency of verification operations, avoids the subjective impact of manual insertion, and improves the randomness and verification effect of illegal instructions in the instruction stream.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642907B_ABST
    Figure CN118642907B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, device, electronic device and readable medium for generating abnormal instructions, and relates to the field of computer technology. In the method, in the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, the abnormal instruction form of the current instruction to be generated is determined as the target abnormal form, and the abnormal probability set for the instruction to be generated is obtained; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture. In the case where the abnormal probability characterization generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that meets the target abnormal form is generated. In this way, the labor cost can be reduced, the implementation efficiency can be improved, and the overall efficiency of the verification operation can be improved.
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 abnormal instruction generation method, device, electronic equipment and readable medium. Background Art

[0002] Currently, there are scenarios where exception instructions are needed. For example, in the central protocol unit (CPU) verification scenario, it is necessary to verify whether the CPU can identify and process the exception instruction during the decoding process based on the exception instruction to ensure the completeness of the verification test.

[0003] In the prior art, abnormal instructions are often inserted manually into the generated instruction stream. However, in this method, the labor cost is high and the implementation efficiency is low, which will reduce the overall efficiency of the verification operation. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, electronic device and readable medium for generating an abnormal instruction, which can reduce labor costs, improve implementation efficiency, and thus improve the overall efficiency of verification operations.

[0005] In order to solve the above problem, an embodiment of the present invention discloses a method for generating an abnormal instruction, the method comprising:

[0006] In the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, the abnormal instruction form existing in the current instruction to be generated is determined as the target abnormal form, and the abnormal probability set for the instruction to be generated is obtained; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture;

[0007] In the case where the abnormal probability representation generates the instruction to be generated as an abnormal instruction, the instruction to be generated that conforms to the target abnormal form is generated based on the target abnormal form and the target configuration item.

[0008] On the other hand, an embodiment of the present invention discloses an abnormal instruction generating device, the device comprising:

[0009] A first determination module is used to determine, in the instruction stream generation link, an abnormal instruction form existing in the current instruction to be generated based on a target configuration item in a preset instruction stream configuration file, as a target abnormal form, and an acquisition module is used to acquire an abnormal probability set for the instruction to be generated; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture;

[0010] The first generating module is used for generating the instruction to be generated conforming to the target abnormal form based on the target abnormal form and the target configuration item when the abnormal probability representation generates the instruction to be generated as an abnormal instruction.

[0011] On the other hand, an embodiment of the present invention discloses an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the aforementioned method.

[0012] The embodiment of the present invention further discloses a readable medium on which executable instructions are stored. When executed by one or more processors, the processors are enabled to execute the method described above.

[0013] The embodiment of the present invention includes the following advantages: in the abnormal instruction generation method provided in the embodiment of the present invention, in the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, the abnormal instruction form of the current instruction to be generated is determined as the target abnormal form, and the abnormal probability set for the instruction to be generated is obtained; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture. In the case where the abnormal probability characterization generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that meets the target abnormal form is generated. In this way, the abnormal instruction can be automatically generated in the instruction stream generation link, because there is no need to manually insert the abnormal instruction. Therefore, the labor cost can be reduced, the implementation efficiency can be improved, and the overall efficiency of the verification operation can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0015] Figure 1 is a flowchart of a method for generating an abnormal instruction provided by an embodiment of the present invention;

[0016] Figure 2 is a block diagram of an abnormal instruction generating device provided by an embodiment of the present invention;

[0017] Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] 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.

[0019] Reference Figure 1 , shows a flowchart of the steps of a method for generating an abnormal instruction provided by an embodiment of the present invention, such as Figure 1 As shown, the method may specifically include the following steps:

[0020] Step 101. In the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, determine the abnormal instruction form existing in the current instruction to be generated as the target abnormal form, and obtain the abnormal probability set for the instruction to be generated; the target configuration item is the configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture.

[0021] Step 102: When the abnormal probability representation generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, generate the instruction to be generated that conforms to the target abnormal form.

[0022] In an embodiment of the present invention, the instruction stream configuration file may be a configuration file for use by an instruction generator, and the instruction generator may also be referred to as an instruction sequence generator. The instruction sequence generator is a preset software or hardware tool that can be used to generate a series of instructions. The instruction sequence generator may construct an instruction sequence based on the instruction stream configuration file, that is, generate an instruction stream. Specifically, in response to starting to generate instructions, the instruction stream generation link may be entered, and the instruction sequence generator may generate instructions one by one according to the instruction stream configuration file, thereby obtaining an instruction sequence, which constitutes an instruction stream. Among them, the process of generating instructions is the instruction stream generation process, and the instruction stream configuration file may be divided into configuration groups (Group), and a configuration group may include a basic segment (base), and a basic segment may include at least one configuration item. In other words, a complete instruction stream may be spliced ​​from instruction fragments corresponding to multiple Groups, and the instruction fragments corresponding to each Group are spliced ​​from instruction fragments corresponding to multiple bases. Each Group in the instruction stream configuration file is provided with an index (index), and the index set for the Group may be used to number the Group starting from 0. The base in each Group is also provided with an index, and the index set for the base in a Group may be used to number the base starting from 0. The configuration items in each base may also be set with an index. For the index set for the configuration items in a base, the configuration items may be numbered starting from 0. [g] represents the index set for the Group, [b] represents the index set for the base, and [i] represents the index set for the configuration item. The total index in the form of [g][b][i] can uniquely locate a configuration item in the instruction flow configuration file. For example, the total index [0][0][2] can represent the configuration item numbered 2 included in the base numbered 0 included in the Group numbered 0.

[0023] The instruction sequencer can generate instructions according to the configuration items in the instruction stream configuration file. Specifically, the configuration items in the instruction stream configuration file can be traversed, and for a configuration item traversed, instructions are generated based on the configuration information included in the configuration item. In this way, after completing the traversal of all configuration items, instruction stream generation can be achieved. Further, the target configuration item can be the configuration item currently traversed, and the current instruction to be generated can be the instruction required to be generated based on the target configuration item. Accordingly, the configuration item currently traversed is the configuration item set for the current instruction to be generated. For a configuration item, one or more instructions may need to be generated, and the instruction to be generated can be any one of the one or more instructions. Among them, the configuration item may include a type configuration item, an instruction configuration item, and a directional insertion configuration item, and the type configuration item, the instruction configuration item, and the directional insertion configuration item can be represented as include_type, include_instr, and insert_instr, respectively. There may be differences in the configuration information included in different configuration items. For example, the type configuration item may include the set instruction type and the number of instructions. Accordingly, for the type configuration item, a corresponding number of instructions that conform to the instruction type can be generated. The instruction configuration item may include the set instruction name and the number of instructions. Accordingly, for the instruction configuration item, a corresponding number of instructions that meet the instruction name can be generated. The directional insertion configuration item can correspond to an instruction that needs to be directional inserted, that is, the number of instructions defined in the configuration information of the directional insertion configuration item can be determined to be 1, and the directional insertion configuration item may include the instruction name and other information of the instruction, for example, the value of the operand, etc. In this way, support for directional insertion can be achieved based on the directional insertion configuration item.

[0024] In an embodiment of the present invention, the preset instruction architecture may be an instruction architecture supported by an instruction sequence generator, and the preset instruction architecture may be set as needed. Exemplarily, the preset instruction architecture may be a fifth-generation reduced instruction set computing (RISC-V) instruction architecture. The exception probability may represent the probability of generating illegal instructions, and the abnormal instruction may also be referred to as an illegal instruction, and the abnormal instruction form may also be referred to as an illegal instruction form. The exception probability may be pre-set when generating a configuration file, and the higher the exception probability, the higher the possibility of generating illegal instructions. In an embodiment of the present invention, when the exception probability is not 0, when generating an instruction sequence, normal instructions (i.e., legal instructions) and abnormal instructions may be generated. When generating legal instructions, they may be generated according to the instruction specification of the preset instruction architecture.

[0025] Legal instructions refer to instructions that follow the instruction specifications of the preset instruction architecture. Legal instructions comply with the instruction constraints specified in the preset instruction architecture, that is, the instruction code and operand values ​​of legal instructions comply with the instruction specifications, and legal instructions do not have abnormal instruction forms. Accordingly, the abnormal instruction form does not comply with the instruction constraints specified in the preset instruction architecture. Therefore, the instruction that complies with the abnormal instruction form does not comply with the instruction specifications of the preset instruction architecture, that is, the instruction is an abnormal instruction. Accordingly, in an embodiment of the present invention, when the abnormal probability representation generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that complies with the target abnormal form is generated, thereby achieving the direct generation of abnormal instructions in the process of generating the instruction stream.

[0026] Among them, the instruction constraint condition may specifically be a constraint on the instruction bit field in the instruction. For example, the instruction constraint condition may represent the constraint on the opcode and / or operand in the preset instruction architecture. Accordingly, there is a bit field in the abnormal instruction that violates the instruction constraint condition. For example, for a certain instruction, the instruction specification may specify the value requirements of a certain bit field of the instruction, for example, the value of the bit field must be a certain specific value, or the value of the bit field cannot take which values, or the value of the bit field needs to satisfy a specific relationship with the values ​​of other bit fields. A value requirement can be regarded as an instruction constraint condition. If the value of the bit field does not meet these value requirements when generating such instructions, the instruction is an abnormal instruction. An instruction constraint condition may correspond to an abnormal instruction form. Specifically, the abnormal instruction form corresponding to the instruction constraint condition may represent a bit field setting method that does not follow the value requirements of the instruction bit field represented by the instruction constraint condition.

[0027] Furthermore, the instruction constraints of different instructions in the preset instruction architecture may be different, and therefore, the instruction exception forms of different instructions may be different. Accordingly, the target exception form may specifically represent the instruction exception form of the current instruction to be generated.

[0028] In summary, the abnormal instruction generation method provided by the embodiment of the present invention, in the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, determines the abnormal instruction form of the current instruction to be generated as the target abnormal form, and obtains the abnormal probability set for the instruction to be generated; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture. In the case where the abnormal probability characterization generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that meets the target abnormal form is generated. In this way, it is possible to realize the automatic generation of abnormal instructions in the instruction stream generation link, because there is no need to manually insert abnormal instructions. Therefore, it is possible to reduce labor costs, improve implementation efficiency, and thus improve the overall efficiency of verification operations.

[0029] In an embodiment of the present invention, it may also include: when the instruction generation operation for the target configuration item is completed, the next global index of the global index of the target configuration item is determined as the target index; the configuration item indicated by the target index in the instruction flow configuration file is determined as a new target configuration item, and the target configuration item in the preset instruction flow configuration file is re-entered to determine the abnormal instruction form of the current instruction to be generated as a step of target abnormal form.

[0030] Wherein, the global index can be the above-mentioned total index, by taking the next global index as the target index, and determining the configuration item indicated by the target index as the new target configuration item, re-entering the step of determining the abnormal instruction form of the current instruction to be generated as the target abnormal form based on the target configuration item, that is, re-based on the new target configuration item, according to the above-mentioned abnormal instruction generation method, starting instruction generation from step 101. Exemplarily, assuming that the global index of the current target configuration item is [0][0][2], then the next global index can be [0][0][3]. Wherein, the global index can be increased in the order of [i], [b], and [g]. Specifically, at the beginning, it can be traversed from [0][0][0], and then the [i] index bit is added by 1 as the next index value. If the [i] index bit reaches the maximum value of the configuration item number in the base to which it belongs, the [b] index bit is added by 1, and the [i] index position is set to 0. If the [b] index bit reaches the maximum value of the base number in the Group to which it belongs, the [g] index bit is added by 1, and the [b] index position is set to 0. That is to say, in the embodiment of the present invention, in the instruction stream generation link, the instructions are generated in the order of Group, base, and configuration item, that is, the instructions corresponding to the 0th configuration item of the 0th base in the 0th Group are first generated. After the instructions corresponding to all configuration items in the 0th base in the 0th Group are generated, the instructions corresponding to the 0th configuration item of the 1st base in the 0th Group are generated. After the instructions corresponding to all bases in the 0th Group are generated, the instructions corresponding to the 0th configuration item of the 0th base in the 1st Group are generated, and so on, to complete the processing of all configuration items.

[0031] In this way, it is equivalent to sequentially traversing the configuration items in the instruction stream configuration file according to the global index, and the new target configuration item is the configuration item that needs to be processed after the instruction generation operation for the current target configuration item is completed. Specifically, if the number of instructions to be generated meets the number of instructions defined in the configuration information of the target configuration item, it can be determined that the instruction generation operation for the target configuration item is completed. In an embodiment of the present invention, by processing the configuration items in the instruction stream configuration file one by one according to the global index, it can be ensured that the configuration items corresponding to the instructions in the instruction stream finally generated are arranged in the order in the instruction stream configuration file. In this way, based on the position of the configuration item in the instruction stream configuration file, the position of the corresponding instruction in the instruction stream can be controlled.

[0032] Optionally, in some embodiments, the above-mentioned obtaining of the exception probability set for the instruction to be generated may specifically include: step 1011, when the number of the target exception forms is not less than 1, obtaining the exception probability set for the instruction to be generated.

[0033] In an embodiment of the present invention, some instructions may not have instruction constraints. For example, for some architectures, only some instructions have illegal situations, and most instructions do not have illegal situations. For example, for the double-precision floating point maximum value (fmax.d) instruction, the instruction specification does not set the value requirements for any bit field in the fmax.d instruction. Correspondingly, there is no instruction constraint for the fmax.d instruction, that is, there is no abnormal instruction form for the fmax.d instruction. Further, if the number of target abnormal forms of the instruction to be generated is not less than 1, it can be determined that there is at least one abnormal instruction form in the current instruction to be generated, and the instruction to be generated can be generated as an abnormal instruction. Therefore, when the number of target abnormal forms is not less than 1, the abnormal probability set for the instruction to be generated can be obtained. In this way, it is possible to avoid performing unnecessary acquisition operations, thereby avoiding the problem of wasting processing resources. At the same time, it can be ensured that the subsequent operation of generating instructions that conform to the target abnormal form based on the target abnormal form and the target configuration item can be performed normally.

[0034] Optionally, in some embodiments, when the number of the target abnormal forms is not less than 1, obtaining the abnormal probability set for the instruction to be generated may specifically include:

[0035] Step 1011a: When the target configuration item is a directed insertion configuration item, obtain a probability defined in a local variable set for the target configuration item as the abnormal probability.

[0036] Step 1011b: When the target configuration item is not the directed insertion configuration item, obtain the probability defined in the global variable set for the instruction flow configuration file as the abnormal probability.

[0037] In an embodiment of the present invention, directional insertion of abnormal instructions can be supported. Specifically, a probability value can be set in advance for a directional insertion configuration item, and the probability value can be valid only for the instruction corresponding to the directional insertion configuration item. The probability value set for the directional insertion configuration item can be used as a local variable in the instruction stream configuration file. Accordingly, when the target configuration item is a directional insertion configuration item, the probability defined in the local variable can be obtained as the abnormal probability of the current instruction to be generated. In an embodiment of the present invention, when directional insertion of abnormal instructions is performed, the instruction name of the required directional insertion instruction can be specified so that the instruction sequence generator knows what instruction to generate. For example, the directional insertion configuration item can include a defined instruction name: ADD. In this way, the instruction sequence generator can know that an ADD instruction needs to be generated. Further, other information, such as the value of the operand bit field, can also be defined. Exemplarily, the value of the operand bit field can be a register number, an immediate value, etc. In the case where it is necessary to control the directional insertion instruction to have a certain probability of being an abnormal instruction, the probability value in the local variable of the directional insertion configuration item can be set to a probability value greater than 0. Exemplarily, assuming that the probability value in the local variable is 50%, there is a 50% probability of generating an illegal instruction for the directional insertion configuration item.

[0038] Wherein, the probability defined in the local variable can be a parameter of the directional insertion configuration item, for example, the illegal parameter. The specific value of the parameter can be set as needed. For example, when it is necessary to generate 100% of illegal instructions, the value of illegal can be set to 100%, thereby controlling the generation of an illegal instruction for the target configuration item. It should be noted that it is also possible to control the generation of an illegal instruction for the target configuration item by setting an operand value whose value does not meet the corresponding value requirement in the directional insertion configuration item. Wherein, the corresponding value requirement can be the value requirement corresponding to the instruction name defined in the directional insertion configuration item. When the illegal parameter is not 100% and is different from 0, it means that there is a certain probability of generating an illegal instruction based on the target configuration item. It should be noted that when the illegal parameter is empty, it can be determined that the probability defined in the local variable of the directional insertion configuration item is 0.

[0039] Furthermore, the global variable may be a variable in the instruction flow configuration file that is valid for the non-directional insertion configuration item. Accordingly, when the target configuration item is a directional insertion configuration item, the global variable may be ignored, and the probability in the local variable may be used as the abnormal probability. When the target configuration item is not a directional insertion configuration item, the probability defined in the global variable may be obtained as the abnormal probability of the current instruction to be generated. In this way, the abnormal probability of the instruction to be generated corresponding to the non-directional insertion configuration item may be set based on the global variable, thereby ensuring the setting efficiency to a certain extent.

[0040] It should be noted that in the embodiment of the present invention, it is also possible to first detect whether the global variable is configured with a probability. If the probability is not configured in the global variable and the target configuration item is not a directional insertion configuration item, the instruction to be generated is directly generated as a normal instruction, that is, it is processed according to the case where the abnormal probability is 0. In this way, it is equivalent to using the global variable as a switch for generating abnormal instructions, and whether to generate abnormal instructions is controlled by whether the global variable is configured, and the probability of random generation of abnormal instructions can be controlled by the specific value of the global variable.

[0041] Further, in an embodiment of the present invention, the configuration information included in the directional insertion configuration item can be saved in the form of an associative array, and when generating instructions to be generated based on the directional insertion configuration item, the data in the associative array can be extracted for generation. Among them, it can be stored in a preset form: identifier_information indicator global index=specific value. For example, assuming that the directional insertion configuration item is:

[0042] insert_instr:

[0043] inst_type: {name: OR, rs1:2, rs2:2, illegal: 20}

[0044] The content of the inst_type part is used to represent the configuration information, name represents the instruction name, rs1 represents the source register 1, and rs2 represents the source register 2. This directional insertion configuration item indicates that an OR instruction needs to be inserted, and the values ​​of rs1 and rs2 of this instruction need to be 2, and the probability of generating this instruction as an abnormal instruction is configured to be 20. Accordingly, with instr, rs1, rs2, and illegal as the indicator of the instruction name, the indicator of source register 1, the indicator of source register 2, and the indicator of probability, respectively, for this directional insertion configuration item, the associative array can be:

[0045] insert_instr[0][0][2]=OR;

[0046] insert_rs1[0][0][2]=2;

[0047] insert_rs2[0][0][2]=2;

[0048] insert_illegal[0][0][2]=20;

[0049] In the embodiment of the present invention, the configuration information included in the directional insertion configuration item is saved in an associative array manner, which can facilitate the processing of the directional insertion configuration item. And the configuration item is processed according to the global index, so that the position of the directional insertion instruction in the instruction sequence can be controlled based on the position of the directional insertion configuration item, thereby ensuring the controllability of the insertion position. Furthermore, by supporting directional insertion, the user can build the required instruction sequence by using all the directional insertion configuration items.

[0050] Optionally, in some embodiments, the generating the instruction to be generated that conforms to the target exception form based on the target exception form and the target configuration item may specifically include:

[0051] Step 1021. Determine the instruction-related information of the instruction to be generated based on the target configuration item; wherein, when the target configuration item is a type configuration item, the instruction-related information includes the instruction type of the instruction to be generated; and when the target configuration item is an instruction configuration item or a directed insertion configuration item, the instruction-related information includes the instruction name of the instruction to be generated.

[0052] Step 1022: Generate the instruction to be generated based on the instruction related information and the setting method of the instruction bit field represented by the target exception form.

[0053] In an embodiment of the present invention, when the target configuration item is a type configuration item, the instruction-related information of the instruction to be generated may include the instruction type of the instruction to be generated. When the target configuration item is an instruction configuration item or a directional insertion configuration item, the instruction-related information of the instruction to be generated may include the instruction name of the instruction to be generated. Specifically, when the target configuration item is a type configuration item, the instruction type of the current instruction to be generated may be determined based on the instruction type in the target configuration item. When the target configuration item is an instruction configuration item or a directional insertion configuration item, the instruction name of the current instruction to be generated may be determined based on the instruction name in the target configuration item.

[0054] For the type configuration item, a type configuration item may define multiple instruction types, and for the instruction configuration item, a instruction configuration item may define multiple instruction names. Accordingly, in the case of multiple instruction types, the type configuration item may also include the weights of each instruction type defined, and in the case of multiple instruction names, the instruction configuration item may also include the weights of each instruction name defined. Accordingly, for the type configuration item, the sum of the weights of all instruction types in the type configuration item can be calculated, and then the ratio of the weight of each instruction type to the sum of the weights can be calculated to obtain the generation probability corresponding to each instruction type. Accordingly, for the type configuration item, the instruction type of the current instruction to be generated can be determined based on the generation probability corresponding to each instruction type. Exemplarily, a random number within a preset numerical range can be generated for each instruction type, and if the generated random number is not greater than the generation probability corresponding to the instruction type, the instruction type is determined as the instruction type of the instruction to be generated. If there are multiple instruction types whose random numbers are not greater than the corresponding generation probability, one instruction type is randomly selected from these instruction types as the instruction type of the instruction to be generated.

[0055] For the instruction configuration item, the sum of the weights of all instruction names in the instruction configuration item can be calculated, and then the ratio of the weight of each instruction name to the sum of the weights can be calculated to obtain the generation probability corresponding to each instruction name. Accordingly, for the instruction configuration item, the instruction name of the current instruction to be generated can be determined based on the generation probability corresponding to each instruction name. Exemplarily, a random number within a preset numerical range can be generated for each instruction name. If the generated random number is not greater than the generation probability corresponding to the instruction name, the instruction name is determined as the instruction name of the instruction to be generated. If there are multiple instruction names whose random numbers are not greater than the corresponding generation probability, an instruction name is randomly selected from these instruction names as the instruction name of the instruction to be generated. Of course, in the case where the type configuration item defines an instruction type, the instruction type is directly determined as the instruction type of the current instruction to be generated. In the case where the instruction configuration item defines an instruction name, the instruction name is directly determined as the instruction name of the current instruction to be generated.

[0056] Furthermore, the abnormal instruction form can be used to indicate the setting mode of the instruction bit field. The setting mode of the instruction bit field indicated by the abnormal instruction form can be set based on the instruction constraint condition corresponding to the abnormal instruction form. The setting mode of the instruction bit field indicated by the abnormal instruction form can be specifically used to characterize the abnormal value requirement of the instruction bit field. If the abnormal value requirement is met, the value of the instruction bit field does not meet the value requirement of the instruction bit field indicated by the instruction constraint condition, that is, the value of the instruction bit field is an abnormal value, thereby ensuring that the instruction finally generated is an abnormal instruction. Exemplarily, assuming that the instruction constraint condition is that the destination register (rd) is not equal to 0, then the abnormal instruction form can be: rd=0, that is, the setting mode of the instruction bit field indicated by the abnormal instruction form (that is, the abnormal value requirement) is to set rd to 0.

[0057] Further, in the case where the target configuration item is a type configuration item, an instruction type belonging to the instruction to be generated can be generated based on the instruction type of the instruction to be generated, and there is an instruction whose instruction bit field conforms to the setting mode of the instruction bit field represented by at least one target exception form. In the case where the target configuration item is an instruction configuration item or a directional insertion configuration item, an instruction name that conforms to the instruction to be generated can be generated, and there is an instruction whose instruction bit field conforms to the setting mode of the instruction bit field represented by at least one target exception form. Exemplarily, it is assumed that for the OR instruction, there is an instruction constraint condition: rd cannot be 0, that is, the OR instruction has an abnormal instruction situation: rd=0. Accordingly, the instruction sequence generator can assign a value of 0 to the rd bit field of the instruction when the current instruction to be generated is an OR instruction, that is, when an OR instruction needs to be generated at present, and the values ​​of other bit fields can be randomly generated, for example, they can be legal values ​​that follow the preset instruction architecture, thereby realizing the generation of the instruction to be generated as an illegal instruction.

[0058] It should be noted that, in the case where the target configuration item is a directional insertion configuration item, if the target configuration item also includes the operand value of the defined operand bit field, then an instruction that conforms to the instruction name, has an instruction bit field that conforms to the setting mode of the instruction bit field represented by at least one target exception form, and the value of the operand bit field defined in the target configuration item in the instruction is consistent with the operand value in the target configuration item. Further, in the case where there are multiple target exception situations, when generating the instruction to be generated, at least one target exception situation can be selected for the instruction to be generated, so as to generate an instruction in which there is an instruction bit field that conforms to the setting mode of the instruction bit field represented by the selected at least one target exception form. Exemplarily, all target exception situations can be selected, or at least one target exception situation can be randomly selected from the target exception situations.

[0059] In the embodiment of the present invention, the instruction related information of the instruction to be generated is determined based on the target configuration item. The instruction to be generated can be generated by combining the instruction related information and the setting mode of the instruction bit field represented by the target abnormal form, thereby ensuring the generation efficiency of the abnormal instruction to a certain extent.

[0060] Optionally, in some embodiments, the embodiments of the present invention further include:

[0061] Step S21: Determine whether to generate the instruction to be generated as an abnormal instruction based on the abnormal probability.

[0062] Step S22: If yes, determine the abnormal probability representation to generate the instruction to be generated as an abnormal instruction.

[0063] Step S23: If not, then based on the target configuration item, generate the instruction to be generated that complies with the instruction specification of the preset instruction architecture.

[0064] Specifically, if the abnormal probability is 0, it is directly determined that the instruction to be generated is not generated as an abnormal instruction, that is, the abnormal probability characterizes that the instruction to be generated is not generated as an abnormal instruction. If the abnormal probability is not 0, a random number can be generated for the instruction to be generated within a preset numerical range. Among them, the preset numerical range can be [0,1). If the generated random number is less than the abnormal probability, it is determined that the instruction to be generated is generated as an abnormal instruction. Accordingly, it can be determined that the abnormal probability characterizes that the instruction to be generated is generated as an abnormal instruction to control the execution of the above step 102. Conversely, if the random number is not less than the abnormal probability, it is determined that the instruction to be generated is not generated as an abnormal instruction, that is, the instruction to be generated is generated as a normal instruction. Accordingly, the instruction to be generated that meets the instruction specification of the preset instruction architecture can be directly generated based on the target configuration item, that is, a legal instruction is generated.

[0065] Specifically, when generating instructions to be generated that conform to the instruction specifications of the preset instruction architecture based on the target configuration item, when the target configuration item is a type configuration item, the instruction type of the current instruction to be generated can be determined based on the instruction type in the target configuration item. Then generate an instruction belonging to the instruction type of the instruction to be generated, and the values ​​of each bit field in the instruction are all legal values ​​that follow the preset instruction architecture. When the target configuration item is an instruction configuration item or a directional insertion configuration item, the instruction name of the current instruction to be generated can be determined based on the instruction name in the target configuration item. Then generate an instruction that conforms to the instruction name of the instruction to be generated, and the values ​​of each bit field in the instruction are all legal values ​​that follow the preset instruction architecture. Among them, the implementation method of determining the instruction type of the instruction to be generated and the implementation method of determining the instruction name of the instruction to be generated can refer to the above description, which will not be repeated here.

[0066] It should be noted that, in the case where the target configuration item is a directed insertion configuration item, if the target configuration item also includes operand values ​​of defined operand bit fields, an instruction that conforms to the instruction name and in which the values ​​of the operand bit fields defined in the target configuration item are consistent with the operand values ​​in the target configuration item can be generated. The values ​​of the operand bit fields that are not defined in the target configuration item can be randomly generated legal values ​​that comply with the preset instruction architecture.

[0067] In the CPU verification scenario, when verifying the decoding module of the CPU, it is necessary to test whether the decoding module can correctly detect illegal instructions when processing illegal instructions, and pull up the illegal instruction related signal. At present, it is necessary to rely on the verification engineer to manually insert illegal instructions to build an instruction stream with illegal instructions for testing. This manual insertion method is relatively cumbersome, so the implementation efficiency is low, and accordingly, the overall verification efficiency will be reduced. And the subjectivity of manual insertion is high, which will lead to poor randomness of illegal instructions in the instruction stream. In the embodiment of the present invention, in the instruction stream generation link, it is determined whether to generate the instruction to be generated as an abnormal instruction based on the abnormal probability. In the case of determining that the instruction to be generated is generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that meets the target abnormal form is generated, otherwise the instruction to be generated that meets the instruction specification of the preset instruction architecture is generated. In this way, the abnormal instruction is automatically generated based on the abnormal probability, without manual insertion. Therefore, the labor cost can be reduced, the implementation efficiency can be improved, and the overall verification efficiency can be improved. At the same time, by introducing the abnormal probability, the subjective influence of manual insertion can be avoided, thereby improving the randomness of illegal instructions in the instruction stream and improving the verification effect.

[0068] It should be noted that in the embodiment of the present invention, it can also be determined whether to generate the instruction to be generated as an abnormal instruction based on the abnormal probability. If so, then perform the operation based on the target configuration item in the preset instruction flow configuration file to determine the abnormal instruction form of the current instruction to be generated, so as to generate illegal instructions according to the abnormal instruction form that can be generated by the instruction. Specifically, if the instruction to be generated has a target abnormal form, then based on the target abnormal form and the target configuration item, generate the instruction to be generated that meets the target abnormal form. If there is no abnormal instruction situation for the instruction to be generated, then the instruction to be generated is generated as a normal instruction.

[0069] Optionally, in some embodiments, the above-mentioned determination of the abnormal instruction form existing in the current instruction to be generated based on the target configuration item in the preset instruction flow configuration file as the target abnormal form includes:

[0070] Step 1012: Determine identification information of the instruction to be generated based on the target configuration item as target information.

[0071] Step 1013: search for an abnormal instruction set including the target information from a preset abnormal instruction set as a target instruction set; one abnormal instruction set represents an abnormal instruction form, one abnormal instruction set includes identification information of a target abnormal instruction, and the target abnormal instruction includes instructions in the abnormal instruction form represented by the abnormal instruction set.

[0072] Step 1014: Determine the abnormal instruction form represented by the target instruction set as the target abnormal form.

[0073] In an embodiment of the present invention, instruction-related information of the instruction to be generated can be first obtained based on the target configuration item. Among them, the specific implementation method of obtaining instruction-related information can refer to the above description, which will not be repeated here. Then, the identification information of the instruction to be generated can be determined based on the instruction-related information as the target information. Specifically, in the case where the target configuration item is a type configuration item, the instruction-related information of the instruction to be generated is the instruction type of the instruction to be generated. Accordingly, the instruction name of the instruction type belonging to the instruction to be generated can be used as the identification information of the instruction to be generated to obtain the target information. In the case where the target configuration item is not a type configuration item, the instruction-related information of the instruction to be generated is the instruction name of the instruction to be generated. Accordingly, the instruction name of the instruction to be generated can be directly used as the identification information of the instruction to be generated to obtain the target information.

[0074] Further, the preset exception instruction set may be generated based on an architecture manual of a preset instruction architecture. In an embodiment of the present invention, the identification information may be an instruction name. Accordingly, for any exception instruction set, the exception instruction set may include the instruction name of the instruction in the exception instruction form represented by the exception instruction set. Accordingly, the target information may be compared with the identification information included in each exception instruction set. If the exception instruction set contains identification information consistent with the target information, it may be determined that the exception instruction set includes the target information, and the exception instruction set may be determined as the target instruction set. It should be noted that, in the case where the target configuration item is a type configuration item, when subsequently generating instructions to be generated, instruction generation may be performed according to the instruction name that hits the preset exception instruction set, that is, an instruction name is generated that hits the preset exception instruction set, and there is an instruction whose instruction bit field conforms to the setting method of the instruction bit field represented by at least one target exception form.

[0075] In the embodiment of the present invention, by presetting the abnormal instruction set, when determining the target abnormal form, the identification information of the instruction to be generated is determined as the target information, and the target instruction set including the target information is searched from the abnormal instruction set based on the target information, and the abnormal instruction form represented by the target instruction set is the target abnormal form. In this way, the target abnormal form can be determined more conveniently and efficiently.

[0076] Optionally, in some embodiments, the above-mentioned preset abnormal instruction set is set by the following steps:

[0077] Step S31: Based on the instruction specification of the preset instruction architecture, determine the instruction constraint conditions of each instruction defined in the preset instruction architecture.

[0078] Step S32: creating an initial set based on the instruction constraints of each of the instructions; one initial set corresponds to one instruction constraint.

[0079] Step S33: For any of the initial sets, the identification information of the instructions whose instruction constraints match the instruction constraints corresponding to the initial set is stored in the initial set to obtain an abnormal instruction set; the abnormal instruction set is used to represent the abnormal instruction form that does not meet the instruction constraints corresponding to the initial set.

[0080] In an embodiment of the present invention, the architecture manual of the preset instruction architecture may also be referred to as an instruction set manual, and the architecture manual may define the instruction specifications of each instruction in the preset instruction architecture. Among them, the instruction specification may include the instruction constraints that the instruction needs to follow. Exemplarily, the instruction specification stipulates that there are reserved values ​​in the bit fields of some instructions in the preset instruction architecture, the values ​​of the destination registers or source registers of some instructions cannot be 0, the immediate values ​​of some instructions cannot be 0, some bit fields of some instructions are different fixed values ​​for different architecture bit widths, and some instructions have constraint values ​​(for example, some instructions satisfy the load-store multiple (Load-Store Multiple, LMUL) is less than the minimum effective word length (SEWmin) or the element length (ELEN), the register value is a reserved value), etc. For example, for the ADD instruction and the ADDI instruction, these two instructions add the values ​​of the two source registers (rs1 and rs2) and store them in rd. Since the value of register No. 0 is fixed to 0, it can only be read but not written. If rd is register No. 0, the value obtained after addition cannot be stored in rd, resulting in data loss. Therefore, for these two instructions, the instruction constraint condition can be: the value of the destination register (rd) cannot be 0.

[0081] Accordingly, the architecture manual of the preset instruction architecture can be sorted out. Specifically, the instruction specifications of each instruction in the preset instruction architecture can be subjected to text recognition to extract the instruction constraints defined in the instruction specifications of each instruction and the instruction name of the instruction, and obtain the instruction constraints and instruction names of each instruction. Of course, the instruction constraints input by the user for each instruction can also be received, and the instruction names of each instruction can be extracted. Among them, the instruction constraints input by the user for each instruction can be extracted by the user based on the instruction specifications of the preset instruction architecture.

[0082] Then, the instruction constraints of all instructions can be summarized, and the instruction constraint set obtained by the summary can be deduplicated. Since the instruction constraints of different instructions may be repeated, by deduplicating the instruction constraint set obtained by the summary, repeated instruction constraints can be avoided in the instruction constraint set, so that one instruction constraint in the instruction constraint can represent an instruction constraint. For any instruction constraint in the instruction constraint set, a corresponding initial set can be created for the instruction constraint. Among them. The initial set can be an empty set or an empty array associated with the instruction constraint. Then, for any initial set, the instruction name of the instruction whose instruction constraint matches the instruction constraint corresponding to the initial set can be stored in the initial set, thereby obtaining an abnormal instruction set. Accordingly, the abnormal instruction set can specifically represent the abnormal instruction form that does not meet the instruction constraint corresponding to the initial set. Exemplarily, it is assumed that the instruction constraint corresponding to the initial set A is rd not equal to 0. Accordingly, the instruction names of all instructions whose instruction constraints are rd not equal to 0 can be stored in the initial set A to obtain an abnormal instruction set a. Among them, the abnormal instruction set a can specifically represent the abnormal instruction form in which rd is equal to 0. In this way, each abnormal instruction set includes the instruction name that can generate illegal instructions. It should be noted that an instruction may have multiple instruction constraints, so the instruction names included in different abnormal instruction sets may be repeated. It should be noted that the above steps S31 to S33 can be pre-executed before the above step 101.

[0083] In the embodiment of the present invention, the instruction constraints of all instructions are determined in advance based on the instruction specification of the preset instruction architecture, and the abnormal situation of the instruction can be characterized based on the instruction constraints. Furthermore, for any instruction constraint, the identification information of the instruction with the instruction constraint is stored in the corresponding initial set to obtain the abnormal instruction set, which can facilitate the subsequent determination of the abnormal instruction form of the instruction to be generated based on the abnormal instruction set.

[0084] Reference Figure 2 , shows a block diagram of an abnormal instruction generating device provided by an embodiment of the present invention, such as Figure 2 As shown, the device may specifically include:

[0085] A first determination module 201 is used to determine, in the instruction stream generation link, based on a target configuration item in a preset instruction stream configuration file, an abnormal instruction form existing in the current instruction to be generated as a target abnormal form, and an acquisition module 202 is used to acquire an abnormal probability set for the instruction to be generated; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture;

[0086] The first generating module 203 is configured to generate the instruction to be generated that conforms to the target abnormal form based on the target abnormal form and the target configuration item when the abnormal probability representation generates the instruction to be generated as an abnormal instruction.

[0087] Optionally, the first determining module 201 is specifically configured to:

[0088] Determine identification information of the instruction to be generated based on the target configuration item as target information;

[0089] Searching for an abnormal instruction set including the target information from a preset abnormal instruction set as a target instruction set; one of the abnormal instruction sets represents an abnormal instruction form, one of the abnormal instruction sets includes identification information of a target abnormal instruction, and the target abnormal instruction includes an instruction in the abnormal instruction form represented by the abnormal instruction set;

[0090] The abnormal instruction form represented by the target instruction set is determined as the target abnormal form.

[0091] Optionally, the acquisition module 202 is specifically used to: when the number of the target abnormal forms is not less than 1, acquire the abnormal probability set for the instruction to be generated.

[0092] Optionally, the acquisition module 202 is further configured to:

[0093] In the case where the target configuration item is a directed insertion configuration item, obtaining a probability defined in a local variable set for the target configuration item as the abnormal probability;

[0094] In a case where the target configuration item is not the directed insertion configuration item, a probability defined in a global variable set for the instruction flow configuration file is obtained as the abnormal probability.

[0095] Optionally, the first generating module 203 is used to:

[0096] Determine the instruction-related information of the instruction to be generated based on the target configuration item; wherein, when the target configuration item is a type configuration item, the instruction-related information includes the instruction type of the instruction to be generated; and when the target configuration item is an instruction configuration item or a directed insertion configuration item, the instruction-related information includes the instruction name of the instruction to be generated;

[0097] The instruction to be generated is generated based on the instruction related information and the setting mode of the instruction bit field represented by the target exception form.

[0098] Optionally, the device further comprises:

[0099] A second determination module, configured to determine whether to generate the instruction to be generated as an abnormal instruction based on the abnormal probability;

[0100] A third determining module is used for determining that if yes, the abnormal probability representation generates the instruction to be generated as an abnormal instruction;

[0101] The second generating module is used to generate the to-be-generated instruction that complies with the instruction specification of the preset instruction architecture based on the target configuration item if no.

[0102] Optionally, the preset exception instruction set is set by the following modules:

[0103] A fourth module is used to determine the instruction constraint conditions of each instruction defined in the preset instruction architecture based on the instruction specification of the preset instruction architecture;

[0104] A creation module, used for creating an initial set based on the instruction constraint conditions of each of the instructions; one initial set corresponds to one instruction constraint condition;

[0105] A storage module is used to store the identification information of instructions whose instruction constraints match the instruction constraints corresponding to the initial set for any of the initial sets, and obtain an abnormal instruction set; the abnormal instruction set is used to represent the abnormal instruction form that does not meet the instruction constraints corresponding to the initial set.

[0106] In summary, in the abnormal instruction generating device provided by the embodiment of the present invention, in the instruction stream generating link, based on the target configuration item in the preset instruction stream configuration file, the abnormal instruction form existing in the current instruction to be generated is determined as the target abnormal form, and the abnormal probability set for the instruction to be generated is obtained; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture. In the case where the abnormal probability characterization generates the instruction to be generated as an abnormal instruction, based on the target abnormal form and the target configuration item, the instruction to be generated that meets the target abnormal form is generated. In this way, it is possible to realize the automatic generation of abnormal instructions in the instruction stream generating link, because there is no need to manually insert abnormal instructions. Therefore, it is possible to reduce labor costs, improve implementation efficiency, and thus improve the overall efficiency of the verification operation.

[0107] Reference Figure 3 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the abnormal instruction generation method of the above embodiment. The executable instructions can form a program.

[0108] An embodiment of the present invention provides a readable medium having executable instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the abnormal instruction generation method of the aforementioned embodiment.

[0109] 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.

[0110] 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 take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. It should be noted that all actions of acquiring signals, information or data in this application are carried out under the premise of complying with the corresponding data protection laws and policies of the country of residence and with the authorization given by the owner of the corresponding device. 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 box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 process 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.

[0111] 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 1A function specified in one or more boxes.

[0112] 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.

[0113] 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.

[0114] 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.

[0115] The above describes in detail an abnormal instruction generation method, an abnormal instruction generation device, an electronic device and a readable 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 method for generating an abnormal instruction, characterized in that: The method comprises: In the instruction stream generation link, based on the target configuration item in the preset instruction stream configuration file, the abnormal instruction form existing in the current instruction to be generated is determined as the target abnormal form, and the abnormal probability set for the instruction to be generated is obtained; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture; In the case where the abnormal probability representation generates the instruction to be generated as an abnormal instruction, the instruction to be generated that conforms to the target abnormal form is generated based on the target abnormal form and the target configuration item.

2. The method according to claim 1, characterized in that: The step of determining the abnormal instruction form of the current instruction to be generated based on the target configuration item in the preset instruction flow configuration file as the target abnormal form includes: Determine identification information of the instruction to be generated based on the target configuration item as target information; Searching for an abnormal instruction set including the target information from a preset abnormal instruction set as a target instruction set; one of the abnormal instruction sets represents an abnormal instruction form, one of the abnormal instruction sets includes identification information of a target abnormal instruction, and the target abnormal instruction includes an instruction in the abnormal instruction form represented by the abnormal instruction set; The abnormal instruction form represented by the target instruction set is determined as the target abnormal form.

3. The method according to claim 1, characterized in that The acquiring the exception probability set for the instruction to be generated includes: when the number of the target exception forms is not less than 1, acquiring the exception probability set for the instruction to be generated.

4. The method according to claim 3, characterized in that The step of obtaining the abnormal probability set for the instruction to be generated when the number of the target abnormal forms is not less than 1 includes: In the case where the target configuration item is a directed insertion configuration item, obtaining a probability defined in a local variable set for the target configuration item as the abnormal probability; In a case where the target configuration item is not the directed insertion configuration item, a probability defined in a global variable set for the instruction flow configuration file is obtained as the abnormal probability.

5. The method according to claim 1, characterized in that The step of generating the instruction to be generated that conforms to the target abnormal form based on the target abnormal form and the target configuration item includes: Determine the instruction-related information of the instruction to be generated based on the target configuration item; wherein, when the target configuration item is a type configuration item, the instruction-related information includes the instruction type of the instruction to be generated; and when the target configuration item is an instruction configuration item or a directed insertion configuration item, the instruction-related information includes the instruction name of the instruction to be generated; The instruction to be generated is generated based on the instruction related information and the setting mode of the instruction bit field represented by the target exception form.

6. The method according to claim 1, characterized in that The method further comprises: Determining whether to generate the instruction to be generated as an abnormal instruction based on the abnormal probability; If so, determining the abnormal probability representation to generate the instruction to be generated as an abnormal instruction; If not, the to-be-generated instruction that complies with the instruction specification of the preset instruction architecture is generated based on the target configuration item.

7. The method according to claim 2, characterized in that The preset exception instruction set is set in the following manner: Determining, based on the instruction specification of the preset instruction architecture, instruction constraints of each instruction defined in the preset instruction architecture; Creating an initial set based on the instruction constraints of each of the instructions; one initial set corresponds to one instruction constraint; For any of the initial sets, the identification information of the instructions whose instruction constraints match the instruction constraints corresponding to the initial set is stored in the initial set to obtain an abnormal instruction set; the abnormal instruction set is used to represent the abnormal instruction form that does not meet the instruction constraints corresponding to the initial set.

8. An abnormal instruction generating device, characterized in that: The device comprises: A first determination module is used to determine, in the instruction stream generation link, an abnormal instruction form existing in the current instruction to be generated based on a target configuration item in a preset instruction stream configuration file, as a target abnormal form, and an acquisition module is used to acquire an abnormal probability set for the instruction to be generated; the target configuration item is a configuration item set for the instruction to be generated, and the abnormal instruction form is an instruction form that does not meet the instruction constraint conditions specified by the preset instruction architecture; The first generating module is used for generating the instruction to be generated conforming to the target abnormal form based on the target abnormal form and the target configuration item when the abnormal probability representation generates the instruction to be generated as an abnormal instruction.

9. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the method according to any one of claims 1 to 7.

10. A readable medium, characterized in that: Executable instructions are stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 7.