Instruction generation method, apparatus and instruction generator for microstructure conflicts

By establishing an abstract model of processor hardware resources and an instruction description table, and by filtering and constructing conflicting instruction pairs, the controllability and accuracy issues of existing instruction generators in microarchitecture conflict scenarios are solved, achieving efficient and flexible instruction generation and verification.

CN120994251BActive Publication Date: 2026-01-30青岛本原微电子有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511516265.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-23
Publication Date
2026-01-30
Estimated Expiration
2045-10-23

AI Technical Summary

Technical Problem

Existing general-purpose instruction generators suffer from poor controllability, insufficient accuracy, low generation efficiency, and poor adaptability when constructing conflict scenarios related to specific processor microarchitectures.

Method used

By establishing an abstract model of processor hardware resources, generating an instruction description table, filtering conflicting instruction sets, constructing conflicting instruction pairs, filling non-conflicting instructions in non-conflicting positions, and outputting a complete instruction sequence, efficient generation of processor microarchitecture conflicts is achieved.

Benefits of technology

It improves the targeting and generation efficiency of microstructure conflict verification, enhances the versatility and scalability of the generation device, and can flexibly adjust the modeling data according to user needs to adapt to different processor architectures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994251B_ABST
    Figure CN120994251B_ABST
Patent Text Reader

Abstract

This invention proposes a method, apparatus, and instruction generator for microarchitectural conflict-oriented instruction generation. It abstracts the processor's hardware resources into accessible or occupiable models, converting each instruction in the target instruction set into structural data, generating an instruction description table (ID table), based on instruction description information. Then, based on user-input conflict constraints, it filters from the I table to obtain a set of conflicting instructions. Conflicting instruction pairs are constructed from these pairs, and the target instruction sequence is traversed, placing the constructed conflicting instruction pairs into the target instruction sequence. Finally, conflict-free instructions are filled into the positions of conflict-free instruction pairs to obtain the final complete target instruction sequence. This invention allows for preset conflict constraints according to user needs, enhancing the controllability and fine-grainedness of conflict instruction generation. It also possesses technical advantages such as improving the efficiency of instruction sequence generation and enhancing the versatility and scalability of the instruction generation apparatus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of processor verification and performance analysis technology, and more specifically, to an instruction generation method, apparatus and instruction generator for microarchitectural conflicts. Background Technology

[0002] In the process of processor architecture design, verification, and performance evaluation, instruction generators are an important tool. They automatically construct various instruction sequences that can run on processor simulation models or hardware platforms to detect the processor's behavioral characteristics in terms of functional correctness, exception handling, and performance bottlenecks.

[0003] Existing general-purpose instruction generators, such as RISCV-DV and FORCE-RISCV, which are based on random instruction streams, typically focus on covering the diversity of instruction sets to trigger as many different functional modules and execution paths as possible. However, these general-purpose generators have certain limitations when constructing conflict scenarios specific to the processor's microarchitecture. Summary of the Invention

[0004] The purpose of this invention is to propose an instruction generation method, apparatus and instruction generator for microstructure conflict, and to solve the technical problems of poor controllability, insufficient accuracy, low generation efficiency and poor adaptability of existing instruction generators when generating specific types of microstructure conflict scenarios.

[0005] The present invention is implemented using the following technical solutions:

[0006] A method for generating instructions oriented towards microstructure conflicts is proposed, including:

[0007] S1, establish an abstract model of processor hardware resources;

[0008] S2, for each instruction in the target instruction set, generate an instruction description table;

[0009] S3, based on conflict constraints, filter the set of conflicting instructions from the instruction description table;

[0010] S4, construct conflicting instruction pairs from the conflicting instruction set by combining them in pairs, and traverse the target instruction sequence to place the conflicting instruction pairs;

[0011] S5, fill the non-conflicting instruction pair placement positions in the target instruction sequence with non-conflicting instructions;

[0012] S6 outputs the complete target instruction sequence and verifies it.

[0013] In some embodiments of the present invention, when modeling processor hardware resources, S1 further includes:

[0014] Each type of hardware resource is abstracted into a resource unit that can be accessed or occupied, and the constraint relationships between each type of hardware resource are defined.

[0015] In some embodiments of the present invention, S2 specifically includes:

[0016] Each instruction in the target instruction set is analyzed to generate several instruction description information; the instruction description information includes instruction opcode and format information, the type and quantity of hardware resources required by the instruction, the timing characteristics of the instruction, and the data dependencies of the instruction.

[0017] Each instruction is organized into an instruction description table based on the instruction description information.

[0018] In some embodiments of the present invention, S3 specifically includes:

[0019] Receive conflict constraints input by the user; wherein, the conflict constraints include at least the conflict type, conflict intensity, conflict frequency, and instruction sequence length;

[0020] Filter instructions from the instruction description table based on the conflict type.

[0021] In some embodiments of the present invention, in S5, the conflict-free instruction is set to: not occupy the same hardware resources as the target, not introduce new data dependencies, and maintain the overall executability and legality of the target instruction sequence.

[0022] A device for generating instructions to address microstructure conflicts is proposed, comprising:

[0023] The hardware resource modeling module is used to build an abstract model of the processor hardware resources;

[0024] The instruction modeling module is used to generate an instruction description table for each instruction in the target instruction set;

[0025] The conflict selection module is used to filter the set of conflicting instructions based on conflict constraints;

[0026] The instruction sequence generation module is used to construct conflicting instruction pairs from the conflicting instruction set in a pairwise combination manner, and to traverse the target instruction sequence to place conflicting instruction pairs; and to fill the non-conflicting instruction pair placement positions in the target instruction sequence with non-conflicting instructions.

[0027] The output module is used to output the complete target instruction sequence and verify it.

[0028] In some embodiments of the present invention, when modeling processor hardware resources, the hardware resource modeling module abstracts each type of hardware resource into a resource unit that can be accessed or occupied, and defines the constraint relationship between each type of hardware resource.

[0029] In some embodiments of the present invention, the instruction modeling module includes:

[0030] The analysis unit is used to analyze each instruction in the target instruction set and generate several instruction description information; the instruction description information includes instruction opcode and format information, the type and quantity of hardware resources required by the instruction, the timing characteristics of the instruction, and the data dependencies of the instruction.

[0031] Modeling units are used to organize each instruction into an instruction description table based on instruction description information.

[0032] In some embodiments of the present invention, the apparatus further includes:

[0033] An input module is used for user input of conflict constraints; wherein the conflict constraints include at least conflict type, conflict intensity, conflict frequency, and instruction sequence length;

[0034] The conflict selection module filters instructions from the instruction description table based on the conflict type.

[0035] An instruction generator is proposed, including the microstructure conflict-oriented instruction generation device described above.

[0036] Compared with the prior art, the advantages and positive effects of the present invention are as follows: The instruction generation method, apparatus and instruction generator proposed in this invention for microstructure conflict abstract the processor's hardware resources into an accessible or occupiable model. Using instruction description information as the unit, each instruction in the target instruction set is converted into structural data to generate an instruction description table. Then, based on the conflict constraints input by the user, a set of conflicting instructions is obtained by filtering from the instruction description table. Conflicting instruction pairs are constructed from the set of conflicting instructions in a pairwise manner. The target instruction sequence is traversed, and the constructed conflicting instruction pairs are placed in the target instruction sequence. Finally, conflict-free instructions are filled into the positions of conflict-free instruction pairs to obtain the final complete target instruction sequence. The method of this invention can preset conflict constraints according to user needs, avoiding the uncontrollable problems caused by randomly generating conflicting instructions, and can achieve high-precision adjustment of conflict modes, thereby improving the targeting of verification coverage. In the process of constructing the target instruction sequence, this invention directly selects instruction pairs that meet the conflict constraints and fills the remaining positions with conflict-free instructions, avoiding multiple generation and screening processes, which can significantly improve the generation efficiency of the target instruction sequence. By abstracting hardware resources into models, it can be flexibly adapted to different processor pipeline stages and execution unit structures. For different needs, only the modeling data needs to be adjusted without modifying the generation logic, thereby improving the versatility and scalability of the instruction generation device.

[0037] Other features and advantages of the present invention will become clearer after reading the detailed description of the embodiments of the present invention in conjunction with the accompanying drawings. Attached Figure Description

[0038] The accompanying drawings, as part of this invention, are provided to further illustrate the invention. The illustrative embodiments and descriptions are used to explain the invention but do not constitute an undue limitation thereof. Clearly, the drawings described below are merely some embodiments; those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0039] Figure 1 This is a schematic diagram of the steps of the instruction generation method for microstructure conflicts proposed in this invention;

[0040] Figure 2 This is the functional structure of the instruction generation device for microstructure conflicts proposed in this invention. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments will be clearly and completely described below with reference to the accompanying drawings. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0042] This invention addresses the microstructure conflict scenarios generated by instruction generators, such as data conflicts and structural conflicts. It proposes an instruction generation method for microstructure conflicts, which can efficiently generate instruction sequences that meet specified conflict types, conflict intensities, and occurrence frequencies based on preset constraints.

[0043] Specifically, such as Figure 1 As shown, it includes:

[0044] S1: Establish an abstract model of processor hardware resources.

[0045] Modeling hardware resources. Hardware resources (i.e., microstructures) include Register File (RF), Arithmetic Logic Unit (ALU), Load Store Unit (LSU), Floating Point Unit (FPU), Branch Unit (BU), Pipeline Stage, and shared resources (such as caches and memory access channels).

[0046] During modeling, each type of hardware resource is abstracted into a resource unit that can be accessed or occupied, and the constraint relationships between each type of hardware resource are defined; for example, the LSU can only accept a limited number of memory access requests within the same cycle.

[0047] S2: Generate an instruction description table for each instruction in the target instruction set.

[0048] The target instruction set is the set of all instructions supported by the kernel to be verified. In a RISC-V-based kernel, it supports basic arithmetic and logical operations, memory access instructions, and control instructions. Optionally, it also includes integer multiplication instructions, floating-point extension instructions, and custom extension instructions.

[0049] The instruction description table contains the following fields:

[0050] 1. Basic information: Opcode and instruction format.

[0051] 2. Resource information: The type, quantity, and duration of hardware resources occupied by the instruction.

[0052] 3. Timing information: execution delay and pipeline stage occupancy.

[0053] 4. Dependency information: Read After Write (RAW), Write After Read (WAR), Write After Write (WAW), and other data dependencies.

[0054] This step analyzes each instruction in the target instruction set, generates several instruction descriptions, and organizes each instruction into structured data, namely an instruction description table, to facilitate its use in subsequent generation processes.

[0055] S3: Filter the instruction set from the instruction description table based on the conflict constraints.

[0056] Obtain the user input constraints such as conflict type, conflict intensity, conflict frequency, and instruction sequence length. Conflict types include data conflicts and structural conflicts, while conflict intensity includes factors such as dependency distance and concurrency.

[0057] Based on the conflict type input by the user, relevant instructions are filtered from the instruction description table generated by S2. For example, if the conflict type is an LSU structure conflict, then all instructions that use load memory units, such as LW and SW, are selected.

[0058] S4: Construct conflicting instruction pairs from the conflicting instruction set by combining them in pairs, and traverse the target instruction sequence to place the conflicting instruction pairs.

[0059] From the instruction set obtained by S3 filtering, random pairwise combinations are made to generate several conflicting instruction pairs.

[0060] For each pair of conflicting instructions, the target instruction sequence is traversed. Based on the same cycle in which the two instructions use the same resources, a relative position is found where the conflicting instruction pair can be placed. This means the cycle in which the two instructions execute at the same time, ensuring that the conflicting instruction pair is triggered in the timing sequence. For example, scheduling two LSU instructions to be issued in the same cycle of the pipeline triggers a structural conflict.

[0061] The target instruction sequence is the final output instruction sequence, consisting of conflicting instruction pairs and conflict-free instructions. In the initial stage, the target instruction sequence is a placeholder sequence without any actual instructions.

[0062] For a set of conflicting instruction pairs, there may be more than one possible relative position. This invention generates multiple target instruction sequences for a set of conflicting instruction pairs, taking into account all possible conflicting positions.

[0063] S5: Fill the non-conflicting instruction pair placement positions in the target instruction sequence with conflict-free instructions.

[0064] Place conflict-free instructions in non-critical positions, that is, non-critical positions other than where conflicting instruction pairs are placed, to ensure that no additional conflicts will occur in non-critical positions, thereby ensuring the legality and integrity of the target instruction sequence.

[0065] These conflict-free instructions have the following characteristics:

[0066] 1. It does not occupy the same hardware resources as the target.

[0067] 2. No new data dependencies are introduced.

[0068] 3. Maintain the overall executability and legality of the target instruction sequence.

[0069] S6: Output the complete target instruction sequence.

[0070] The generated target instruction sequence is output in a predetermined format, such as an assembly instruction sequence or a binary machine code sequence.

[0071] The target instruction sequence can be run through a simulator to confirm the conflict triggering situation and ensure that it meets the user's expected conflict type and constraint conditions.

[0072] In conjunction with the aforementioned instruction generation method for microstructure conflicts, this invention also proposes an instruction generation apparatus for microstructure conflicts, such as... Figure 2 As shown, it consists of a hardware resource modeling module 1, an instruction modeling module 2, a conflict selection module 3, an instruction sequence generation module 4, and an output module 5. Specifically:

[0073] Hardware Resource Modeling Module 1 is used to establish abstract models of the processor's internal hardware resources, describing the usage rules of resources such as registers, execution units, and pipelines. These abstract models of hardware resources include, but are not limited to: register files, execution units (arithmetic logic units, memory access units, floating-point units, etc.), pipeline stages, and shared resources (such as caches and memory access channels).

[0074] During the modeling process, each type of hardware resource is abstracted into a resource unit that can be accessed or occupied, and the constraint relationships between resources are defined.

[0075] Instruction modeling module 2 is used to parse the target instruction set and generate instruction description information. Based on the instruction description information, each instruction is organized into structured data to generate an instruction description table.

[0076] The instruction description table records the hardware resources used and execution characteristics of each instruction. Specifically, by analyzing each instruction in the target instruction set, the generated instruction description information includes at least the following fields:

[0077] 1. Basic information: Opcode and instruction format.

[0078] 2. Resource information: The type, quantity, and duration of hardware resources occupied by the instruction.

[0079] 3. Timing information: execution delay and pipeline stage occupancy.

[0080] 4. Dependency information: Read After Write (RAW), Write After Read (WAR), Write After Write (WAW), and other data dependencies.

[0081] Organize the above instruction description information into structured data for later use in the generation process.

[0082] The conflict selection module 3 is used to filter relevant conflict instruction sets from the instruction description table based on conflict constraints such as conflict type, conflict intensity, conflict frequency, and instruction sequence length input by the user.

[0083] The instruction sequence generation module 4 consists of a combination generation unit 41 and a filling unit 42. The combination generation unit 41 is used to randomly combine two conflicting instruction pairs from the selected instruction set to form conflicting instruction pairs, and to traverse the target instruction sequence to place conflicting instruction pairs. The filling unit 42 is used to fill non-conflicting instructions that will not cause additional conflicts at non-critical positions where non-conflicting instruction pairs are placed, ensuring the legality and executability of the sequence.

[0084] Output module 5 is used to output the complete target instruction sequence and optionally verify the conflict effect in the simulator.

[0085] In some embodiments of the present invention, when modeling processor hardware resources, the hardware resource modeling module 1 abstracts each type of hardware resource into a resource unit that can be accessed or occupied, and defines the constraint relationship between each type of hardware resource.

[0086] In some embodiments of the present invention, the instruction modeling module 2 includes:

[0087] The target instruction set analysis unit 21 is used to analyze each instruction in the target instruction set and generate several instruction description information. The instruction description information includes instruction opcode and format information, the type and quantity of hardware resources required by the instruction, the timing characteristics of the instruction, and the data dependencies of the instruction.

[0088] Modeling unit 22 is used to organize each instruction into an instruction description table based on instruction description information.

[0089] In some embodiments of the present invention, the instruction generation apparatus further includes:

[0090] Input module 6 is used for user input of conflict constraints; wherein, the conflict constraints include at least conflict type, conflict intensity, conflict frequency and instruction sequence length; conflict selection module 3 selects instructions from the instruction description table according to the conflict type.

[0091] The instruction generation method and apparatus for microstructure conflicts proposed in this invention achieve the following improvements compared to existing general-purpose instruction generators:

[0092] 1. Enhanced controllability of conflict types. This invention, through precise modeling of instructions and hardware resources, can generate a sequence of conflicting instruction pairs of a specified type based on user-input constraints, avoiding the uncontrollable problems caused by relying on random generation.

[0093] 2. It enables fine-grained adjustment of conflict characteristics. This invention can control the frequency, dependency distance, duration, and other characteristics of conflicts according to set parameters, thereby achieving fine-grained adjustment of conflict patterns and improving the targeting of verification coverage.

[0094] 3. Improved generation efficiency. This invention significantly improves sequence generation efficiency by directly selecting instruction pairs that meet the conflict conditions during the instruction sequence construction process and filling the remaining positions with conflict-free instructions, thus avoiding multiple generation and filtering processes.

[0095] 4. Enhanced architectural adaptability. This invention, by abstracting and modeling hardware resources, can flexibly adapt to different processor pipeline stages and execution unit structures. Only the modeling data needs to be adjusted without modifying the generation logic, thereby improving the tool's versatility and scalability.

[0096] This invention also proposes an instruction generator, which, through the aforementioned instruction generation device for microstructure conflicts, efficiently generates instruction sequences that conform to specified conflict types, conflict intensities, and occurrence frequencies under user-preset constraints, thereby enabling efficient verification of conflict scenarios with high controllability, high accuracy, and high adaptability.

[0097] It should be noted that the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. A method for generating instructions oriented towards microstructure conflicts, characterized in that, The method comprises: S1, establishing an abstract model of processor hardware resources; S2, generating an instruction description table for each instruction in the target instruction set; S3, screening conflict instruction sets from the instruction description table based on conflict constraint conditions; S4, constructing conflict instruction pairs in a two-by-two combination manner from the screened conflict instruction sets, and placing the conflict instruction pairs in the target instruction sequence; S5, filling non-conflict instructions in the non-conflict instruction pair placement positions of the target instruction sequence; S6, outputting the complete target instruction sequence; S3 specifically comprises: receiving user input conflict constraint conditions; wherein the conflict constraint conditions at least include conflict type, conflict strength, conflict frequency, and instruction sequence length; screening instructions from the instruction description table according to the conflict type.

2. The microstructure conflict-oriented instruction generation method according to claim 1, characterized by, When modeling the processor hardware resources, S1 further comprises: abstracting each type of hardware resource into a resource unit that can be accessed or occupied, and defining the constraint relationship between each type of hardware resource.

3. The microstructure conflict oriented instruction generation method according to claim 1, wherein, S2 specifically comprises: analyze each instruction in the target instruction set to generate a number of instruction description information; the instruction description information includes instruction opcode and format information, instruction required occupied hardware resource type and quantity, instruction timing characteristics and instruction data dependency relationship; organize each instruction into an instruction description table based on the instruction description information.

4. The microstructure conflict oriented instruction generation method according to claim 1, wherein, In S5, the non-conflict instructions are set to: not occupy the same hardware resources as the target conflict, not introduce new data dependency relationships, and maintain the overall executability and legality of the target instruction sequence.

5. An instruction generation apparatus oriented to micro-architectural conflicts, characterized by, The method comprises: a hardware resource modeling module for establishing an abstract model of processor hardware resources; an instruction modeling module for generating an instruction description table for each instruction in the target instruction set; a conflict selection module for screening conflict instruction sets from the instruction description table based on conflict constraint conditions; an instruction sequence generation module for constructing conflict instruction pairs in a two-by-two combination manner from the conflict instruction sets, and placing the conflict instruction pairs in the target instruction sequence; and filling non-conflict instructions in the non-conflict instruction pair placement positions of the target instruction sequence; an output module for outputting the complete target instruction sequence and verifying; The apparatus further comprises: an input module for user input conflict constraint conditions; wherein the conflict constraint conditions at least include conflict type, conflict strength, conflict frequency, and instruction sequence length; the conflict selection module screens instructions from the instruction description table according to the conflict type.

6. The microstructure conflict oriented instruction generation apparatus according to claim 5, wherein, When modeling the processor hardware resources, the hardware resource modeling module abstracts each type of hardware resource into a resource unit that can be accessed or occupied, and defines the constraint relationship between each type of hardware resource.

7. The microstructure conflict oriented instruction generation apparatus according to claim 5, wherein, The instruction modeling module comprises: a target instruction set analysis unit for analyzing each instruction in the target instruction set to generate a number of instruction description information; the instruction description information includes instruction opcode and format information, instruction required occupied hardware resource type and quantity, instruction timing characteristics and instruction data dependency relationship; a modeling unit for organizing each instruction into an instruction description table based on the instruction description information.

8. An instruction generator, characterized by The instruction generation apparatus for microstructure conflict comprises any one of claims 5-7.

Citation Information

Patent Citations

  • Result self-checking instruction sequence filling method based on pipeline constraints

    CN112445528A

  • Random instruction generation method, device and system for function verification

    CN117313595A