A jump instruction processing method and system based on preferred channel

By decoding and judging jump instructions and selecting execution channels, conditional operations are avoided and branch prediction is completed directly in the branch prediction unit. This solves the problem of low execution efficiency of jump instructions in the existing technology and realizes jump execution in microprocessors. Efficient execution of transfer instructions.

CN114116004BActive Publication Date: 2024-09-10NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111417861.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2024-09-10
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

The existing technology cannot effectively improve pipeline execution efficiency when processing jump instructions, especially in the special cases of conditional jump and unconditional jump instructions, resulting in reduced pipeline execution efficiency.

Method used

By decoding the instruction to be processed, it is judged whether the specified operand register is a zero-coded register, and the optimal execution channel or ordinary execution channel is selected based on the result, avoiding conditional operations and address calculations, and completing branch prediction directly in the branch prediction unit.

Benefits of technology

When the operand register is designated as a zero-coded register, the execution clock cycle of the jump instruction is reduced, the execution efficiency of the jump instruction is improved, and the performance of the microprocessor is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114116004B
    Figure CN114116004B
Patent Text Reader

Abstract

The present invention discloses a jump instruction processing method and system based on a preferred channel. The present invention comprises: judging whether the instruction to be processed is a jump instruction and whether the designated operand register is a zero-coded register in the decoding stage; in the branch execution unit, if the instruction to be processed is a jump instruction and the designated operand register is a zero-coded register, the branch prediction is completed in the optimal execution channel through the branch execution unit of the branch prediction unit; otherwise, the conditional operation is completed in the operation unit in the ordinary execution channel, and then the branch prediction is completed in the branch execution unit of the branch prediction unit. The present invention exchanges space for time. In the special case where the designated operand register is a zero-coded register, the execution of the jump instruction can be reduced by one clock, which effectively improves the execution efficiency of the jump instruction, thereby improving the performance of the microprocessor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microprocessors, and in particular to a jump instruction processing method and system based on a preferred channel. Background Art

[0002] In the existing instruction set architecture, jump instructions are often used to change the control flow and are a type of instruction with a very high frequency of use. If the execution efficiency of jump instructions can be effectively optimized, the performance of the microprocessor can undoubtedly be greatly improved.

[0003] Jump instructions are divided into two categories: conditional jump and unconditional jump. Conditional jump instructions need to make branch predictions based on the result of conditional judgment, while unconditional jumps need to write the branch return address back to the destination specified operand register. It can be seen that a jump instruction contains multiple micro-operations. At the same time, jump instructions have obvious characteristics: the conditional judgments of conditional jump instructions are all simple comparison tests, some of which need to be compared with zero; unconditional jumps sometimes do not need to return from the branch. If the jump instructions that meet these special conditions are executed completely according to normal conditions, there will be no errors in the execution results, but this brings unnecessary burden to the pipeline. Therefore, an execution plan can be designed for jump instructions for these special cases. However, in the actual micro-architecture design, if all conditional jump instructions are pre-judged whether the operand is zero and unconditional jump instructions are pre-judged whether they need to return from the branch, it will not only fail to improve the execution efficiency of the pipeline, but will cause greater consumption of the execution efficiency of the pipeline. Summary of the invention

[0004] The technical problem to be solved by the present invention is: In view of the above-mentioned problems in the prior art, a jump instruction processing method and system based on a preferred channel are provided. The present invention selects the execution scheme of the jump instruction based on decoding, and does not require conditional operations or address calculations, and does not cost extra time. The present invention exchanges space for time. In the special case where the designated operand register is a zero-coded register, the execution of the jump instruction can be reduced by one clock, effectively improving the execution efficiency of the jump instruction, thereby improving the performance of the microprocessor.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A jump instruction processing method based on a preferred channel, comprising:

[0007] 1) Decode the instructions to be processed;

[0008] 2) In the decoding stage, determining whether the designated operand register of the instruction to be processed is a zero-coded register and determining whether the instruction to be processed is a jump instruction;

[0009] 3) The instruction to be processed is transmitted to the branch execution component of the execution module for execution through the transmission module;

[0010] 4) In the branch execution unit, the optimal channel selection is performed based on whether the designated operand register of the instruction to be processed is a zero-coded register and whether the instruction to be processed is a jump instruction: if the instruction to be processed is a jump instruction and the designated operand register of the instruction to be processed is a zero-coded register, the optimal execution channel is directly selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel through the branch execution unit of the branch prediction unit; otherwise, a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the conditional operation is first completed in the operation unit, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the result of the conditional operation.

[0011] Optionally, in step 2), determining whether the designated operand register of the instruction to be processed is a zero-coded register in the decoding stage refers to determining whether the designated operand register of the instruction to be processed is a zero-coded register through an independent pre-decoding unit in the decoding module, and determining whether the instruction to be processed is a jump instruction refers to determining whether the instruction to be processed is a jump instruction through a first-level decoding unit in the decoding module.

[0012] Optionally, the pre-decoding unit determines whether the designated operand register of the instruction to be processed is a zero-coded register by determining whether the value of the designated operand corresponding to the designated operand register is 000000; the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed matches a set jump instruction character set, and the jump instruction character set is provided with one or more operation codes corresponding to jump instructions.

[0013] Optionally, the designated operand register of the instruction to be processed in step 2) refers to the first source operand register, the second source operand register or the destination operand register.

[0014] Optionally, the instruction to be processed is a beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the difference dif between the first source operand and the second source operand is first calculated in the operation unit to complete the conditional operation, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the difference dif obtained by the conditional operation, if the difference dif is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

[0015] Optionally, the instruction to be processed is a beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), the optimal execution channel is selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel by the branch execution component of the branch prediction unit, and if the second source operand is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

[0016] Optionally, the instruction to be processed is a jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the first source operand and the offset offset are first calculated by the offset offset obtained in the operation unit based on the immediate number carried by the instruction to be processed to obtain the branch address addr to complete the conditional operation, and then the branch address addr obtained by the conditional operation is entered in the branch execution unit of the branch prediction unit based on the branch address addr, and the branch return address is written into the destination designated operand register, and the branch return address is the instruction to be processed plus 4.

[0017] Optionally, the instruction to be processed is a jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), the optimal execution channel is selected for the instruction to be processed, and in the optimal execution channel, the offset offset is directly used as the branch address addr by the branch execution component of the branch prediction unit to enter the branch based on the branch address addr. At this time, it is determined whether the destination operand register of the instruction to be processed is a zero-coded register. If it is a zero-coded register, the branch return address is not written into the destination designated operand register and the branch is directly exited. The branch return address is the instruction to be processed plus 4. Otherwise, the branch return address is written into the destination designated operand register. The branch return address is the instruction to be processed plus 4.

[0018] In addition, the present invention also provides a jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, wherein the microprocessor stores steps programmed or configured to execute the jump instruction processing method based on the preferred channel.

[0019] In addition, the present invention also provides a computer-readable storage medium, in which a computer program programmed or configured to execute the jump instruction processing method based on the preferred channel is stored.

[0020] Compared with the prior art, the present invention has the following advantages:

[0021] 1. The present invention decodes the instruction, and selects different execution schemes for the jump instruction by judging whether the designated operand register of the jump instruction is a zero-coded register, so that when the source designated operand register of the conditional jump instruction is a zero-coded register, another source operand is directly compared with zero; when the destination designated operand register of the unconditional branch is a zero-coded register, the return address cannot be written back to the destination designated operand register, and it can be determined that the branch does not need to return. The selection basis of the execution scheme of the jump instruction of the present invention is obtained by decoding, and no conditional operation or address calculation is required, and no additional time cost is spent.

[0022] 2. The present invention exchanges space for time. In the special case where the designated operand register is a zero-coded register, the execution of the jump instruction can be reduced by one clock, thereby effectively improving the execution efficiency of the jump instruction and further improving the performance of the microprocessor. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 The figure is a basic flow chart of a method according to a first embodiment of the present invention.

[0024] Figure 2 Schematic diagram of the structure of the relevant components of the processor in the first embodiment of the present invention.

[0025] Figure 3 Schematic diagram of instruction encoding of target instruction (1.0) in embodiment 1 of the present invention.

[0026] Figure 4 This is a schematic diagram of instruction encoding of the target instruction (2.0) in the second embodiment of the present invention.

[0027] Figure 5 This is a schematic diagram of instruction encoding of the target instruction (3.0) in the third embodiment of the present invention.

[0028] Figure 6 This is a schematic diagram of instruction encoding of the target instruction (4.0) in the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0029] Embodiment 1:

[0030] like Figure 1 As shown, the jump instruction processing method based on the preferred channel in this embodiment includes:

[0031] 1) Decode the instructions to be processed;

[0032] 2) In the decoding stage, determining whether the designated operand register of the instruction to be processed is a zero-coded register and determining whether the instruction to be processed is a jump instruction;

[0033] 3) The instruction to be processed is transmitted to the branch execution component of the execution module for execution through the transmission module;

[0034] 4) In the branch execution unit, the optimal channel selection is performed based on whether the designated operand register of the instruction to be processed is a zero-coded register and whether the instruction to be processed is a jump instruction: if the instruction to be processed is a jump instruction and the designated operand register of the instruction to be processed is a zero-coded register, the optimal execution channel is directly selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel through the branch execution unit of the branch prediction unit; otherwise, a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the conditional operation is first completed in the operation unit, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the result of the conditional operation.

[0035] In this embodiment, in step 2), judging whether the designated operand register of the instruction to be processed is a zero-coded register in the decoding stage refers to judging whether the designated operand register of the instruction to be processed is a zero-coded register through an independent pre-decoding unit in the decoding module, and judging whether the instruction to be processed is a jump instruction refers to judging whether the instruction to be processed is a jump instruction through a primary decoding unit in the decoding module. By judging whether the designated operand register of the instruction to be processed is a zero-coded register and judging whether the instruction to be processed is a jump instruction in the decoding stage, it is possible to provide support for the judgment condition by performing optimal channel selection based on whether the designated operand register of the instruction to be processed is a zero-coded register and whether the instruction to be processed is a jump instruction without adding additional clock beats.

[0036] In this embodiment, the pre-decoding unit determines whether the designated operand register of the instruction to be processed is a zero coding register, which means determining whether the value of the designated operand corresponding to the designated operand register is 000000; the first-level decoding unit determines whether the instruction to be processed is a jump instruction, which means determining whether the operation code field opcode of the instruction to be processed matches the set jump instruction character set, and the jump instruction character set is provided with one or more operation codes corresponding to jump instructions, which is specifically related to different instruction set architectures and will not be explained one by one here.

[0037] In this embodiment, the designated operand register of the instruction to be processed in step 2) may be the first source operand register, the second source operand register or the destination operand register. Since they are essentially comparing the above operands, their implementation principles are exactly the same.

[0038] like Figure 2 As shown, the microprocessor 1000 in this embodiment includes the following modules:

[0039] Instruction fetch module 1100: used to fetch instructions to be processed from the memory or instruction cache and then send them to the decoding module 1200.

[0040] Decoding module 1200: used for instruction decoding;

[0041] Transmitting module 1300: used for transmitting instructions, transmitting instruction operations to corresponding execution components in execution module 1400;

[0042] Execution module 1400: used for executing different types of instructions, writing back execution results, and submitting instructions.

[0043] The decoding module 1200 includes a pre-decoding unit 1201 and a first-level decoding unit 1202; the pre-decoding unit 1201 determines whether the operand register specified by the instruction to be processed is a zero-coded register; and the first-level decoding unit 1202 determines whether the instruction to be processed is a jump instruction.

[0044] The execution module includes a branch execution unit 1410 and a calculation unit 1420;

[0045] The branch execution unit 1410 includes a control unit 1411 and a branch prediction unit 1412. The control unit 1411 generates an execution channel selection signal according to the decoding result of the decoding module 1200, and selects the optimal execution channel according to the execution channel selection signal: if the instruction to be processed is a jump instruction, and the operand register specified by the instruction is not a zero-coded register, the control unit 1411 generates a normal channel selection signal, and the optimal execution channel of the jump instruction is the normal channel; if the instruction to be processed is a jump instruction, and the operand register specified by the instruction is a zero-coded register, the control unit 1411 generates a fast channel selection signal, and the optimal execution channel of the jump instruction is the fast channel.

[0046] In this embodiment, the instruction to be processed is a beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the difference dif between the first source operand and the second source operand is first calculated in the operation unit to complete the conditional operation operation, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the difference dif obtained by the conditional operation operation, if the difference dif is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

[0047] In this embodiment, the instruction to be processed is a specific target instruction (1.0), and its format is:

[0048] beq x4,x1,0x40

[0049] The corresponding instruction code (1.1) is as follows Figure 3 shown.

[0050] The instruction fetch module 1100 fetches the instruction code (1.1) of the instruction to be processed (1.0) from the memory or the instruction cache, and the instruction code (1.1) is 00001000000100100000000001100011.

[0051] The pre-decoding unit 1201 of the decoding module 1200 pre-decodes the instruction code (1.1) and determines that the source operand register 1 of the instruction to be processed (1.0) is not a zero-coded register, that is, source1! = 00000; the first-level decoding unit 1202 performs first-level decoding on the instruction code (1.1) and determines that the instruction to be processed (1.0) is a jump instruction, that is:

[0052]

[0053] Therefore, the pending instruction (1.0) satisfies the following encoding constraints:

[0054]

[0055] The transmitting module 1300 in this embodiment transmits the instruction operation to the branch executing component 1410 in the executing module 1400 .

[0056] First, the control unit 1411 in the branch execution unit 1410 selects the normal channel as the optimal execution channel for the instruction (1.0) according to the encoding constraint of the instruction (1.0). The operation unit 1420 calculates the difference dif between the first source operand x1 and the second source operand x4 of the instruction (1.0), that is:

[0057] dif=x1-x4

[0058] Then, the branch execution component 1410 determines whether the program enters the branch according to the difference dif:

[0059]

[0060] This embodiment decodes instructions based on the jump instruction processing method of the preferred channel, selects different execution schemes for the jump instruction by judging whether the operand register of the jump instruction is a zero coding register, exchanges space for time, and enables the pipeline execution of the jump instruction to reduce one clock, thereby effectively improving the execution efficiency of the jump instruction and further improving the performance of the microprocessor.

[0061] In addition, the present embodiment further provides a jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, wherein the microprocessor stores steps programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel. In addition, the present embodiment further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel.

[0062] Embodiment 2:

[0063] This embodiment is basically the same as the first embodiment, and the main differences are: the instruction to be processed is the beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when the optimal channel selection is performed in step 4), the optimal execution channel is selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel by the branch execution component of the branch prediction unit, and if the second source operand is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

[0064] In this embodiment, the instruction to be processed is a specific target instruction (2.0), and its format is:

[0065] beq x4,x0,0x40

[0066] The corresponding instruction code (2.1) is as follows Figure 4 shown.

[0067] The instruction fetch module 1100 fetches the instruction code (2.1) of the instruction to be processed (2.0) from the memory or the instruction cache, and the instruction code (2.1) is 00001000000000100000000001100011.

[0068] The pre-decoding unit 1201 of the decoding module 1200 pre-decodes the instruction code (2.1) and determines that the first source operand register of the instruction to be processed (2.0) is a zero code register, that is, source1 == 00000. The first-level decoding unit 1202 performs a first-level decoding on the instruction code (2.1) and determines that the instruction to be processed (2.0) is a jump instruction, that is, it satisfies:

[0069]

[0070] Therefore, the target instruction (2.0) satisfies the following encoding constraints:

[0071]

[0072] The transmitting module 1300 in this embodiment transmits the instruction operation to the branch executing component 1410 in the executing module 1400 .

[0073] The control unit 1411 in the branch execution unit 1410 selects the fast path as the optimal execution path for the instruction (2.0) according to the instruction (2.0) encoding constraint, that is, directly executes the instruction to be processed in the branch execution unit 1410 of the branch prediction unit to complete the branch prediction. The branch execution unit 1410 determines whether the program enters the branch according to the instruction information:

[0074]

[0075] In addition, the present embodiment further provides a jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, wherein the microprocessor stores steps programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel. In addition, the present embodiment further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel.

[0076] Embodiment three:

[0077] This embodiment is basically the same as the first embodiment, and the main differences are: the instruction to be processed is the jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the first source operand and the offset offset are first calculated by the offset offset obtained in the operation unit based on the immediate number carried by the instruction to be processed to obtain the branch address addr to complete the conditional operation, and then the branch address addr is obtained in the branch execution unit of the branch prediction unit according to the branch address addr to enter the branch, and the branch return address is written into the destination designated operand register, and the branch return address is the instruction to be processed plus 4.

[0078] In this embodiment, the instruction to be processed is a specific target instruction (3.0), and its format is:

[0079] jalr x4,x1,0x40

[0080] The corresponding instruction code (3.1) is as follows Figure 5 shown.

[0081] The instruction fetch module 1100 fetches the instruction code (3.1) of the instruction to be processed (3.0) from the memory or the instruction cache, and the instruction code (3.1) is 00000100000000001000001001100111.

[0082] The pre-decoding unit 1201 of the decoding module 1200 pre-decodes the instruction code (3.1) and determines that the source operand register 1 of the instruction to be processed (3.0) is not a zero-coded register, that is, source1! = 00000; the first-level decoding unit 1202 performs a first-level decoding on the instruction code (3.1) and determines that the instruction to be processed (3.0) is a jump instruction, that is:

[0083]

[0084] Therefore, the pending instruction (3.0) satisfies the following encoding constraints:

[0085]

[0086] The transmitting module 1300 in this embodiment transmits the instruction operation to the branch executing component 1410 in the executing module 1400 .

[0087] First, the control unit 1411 in the branch execution unit 1410 selects the normal channel as the optimal execution channel for the instruction (3.0) according to the encoding constraint of the instruction (3.0). The operation unit 1420 calculates the branch address addr of the instruction (3.0) according to the following formula:

[0088] addr = x1 + offset

[0089] The offset is obtained by processing the immediate value 0x40 in the instruction. This processing is a prior art and will not be described in detail in this embodiment. Then, the branch execution unit 1410 enters the branch according to the branch address addr and writes the branch return address into the destination operand register:

[0090] x4=pc+4

[0091] Among them, pc is the address of the current instruction to be processed.

[0092] In addition, the present embodiment further provides a jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, wherein the microprocessor stores steps programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel. In addition, the present embodiment further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel.

[0093] Embodiment 4:

[0094] This embodiment is basically the same as the first embodiment, and the main difference is that the instruction to be processed is the jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when the optimal channel selection is performed in step 4), the optimal execution channel is selected for the instruction to be processed, and in the optimal execution channel, the offset offset is directly used as the branch address addr by the branch execution component of the branch prediction unit to enter the branch based on the branch address addr. At this time, it is determined whether the destination operand register of the instruction to be processed is a zero-coded register. If it is a zero-coded register, the branch return address is not written into the destination designated operand register and the branch is directly exited. The branch return address is the instruction to be processed plus 4. Otherwise, the branch return address is written into the destination designated operand register. The branch return address is the instruction to be processed plus 4.

[0095] In this embodiment, the instruction to be processed is a specific target instruction (4.0), and its format is:

[0096] jalr x0,x0,0x40

[0097] The corresponding instruction code (4.1) is as follows Figure 6 shown.

[0098] The instruction fetch module 1100 fetches the instruction code (3.1) of the instruction to be processed (3.0) from the memory or the instruction cache, and the instruction code (3.1) is 000001000000000000000000001100111.

[0099] The pre-decoding unit 1201 of the decoding module 1200 pre-decodes the instruction code (4.1) and determines that the source operand register 1 of the instruction to be processed (4.0) is a zero-coded register, that is, source1==00000, and its destination operand register is also a zero-coded register, that is, destination==00000; the first-level decoding unit 1202 performs a first-level decoding on the instruction code (4.1) and determines that the instruction to be processed (4.0) is a jump instruction, that is:

[0100]

[0101]

[0102]

[0103] The transmitting module 1300 in this embodiment transmits the instruction operation to the branch executing component 1410 in the executing module 1400 .

[0104] The control unit 1411 in the branch execution unit 1410 selects the fast path as the optimal execution path for the instruction (4.0) according to the encoding constraint of the instruction (4.0). The branch execution unit 1410 enters the branch according to the branch address addr. At this time, the branch address addr satisfies:

[0105] addr = offset

[0106] Since the destination operand register is a zero-coded register, the branch execution unit 1410 does not need to write the branch return address into the destination operand register at this time.

[0107] In addition, the present embodiment further provides a jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, wherein the microprocessor stores steps programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel. In addition, the present embodiment further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program programmed or configured to execute the aforementioned jump instruction processing method based on a preferred channel.

[0108] It should be noted that the foregoing embodiments are merely examples of determining whether the first source operand register (source operand register) and the destination operand register are zero-coded registers. In addition, the microprocessor performance can also be optimized by determining whether other operand registers are zero-coded registers. The optimization process is consistent with the foregoing example process.

[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. 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, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in 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.

[0110] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A jump instruction processing method based on a preferred channel, characterized in that: include: 1) Decode the instructions to be processed; 2) In the decoding stage, determine whether the specified operand register of the instruction to be processed is a zero-coded register and whether the instruction to be processed is a jump instruction; 3) The transmission module transmits the instructions to be processed to the branch execution component of the execution module for execution; 4) In the branch execution unit, the optimal channel selection is performed based on whether the designated operand register of the instruction to be processed is a zero-coded register and whether the instruction to be processed is a jump instruction: if the instruction to be processed is a jump instruction and the designated operand register of the instruction to be processed is a zero-coded register, the optimal execution channel is directly selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel through the branch execution unit of the branch prediction unit; otherwise, a common execution channel is selected for the instruction to be processed, and in the common execution channel, the conditional operation is first completed in the operation unit, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the result of the conditional operation; In step 2), judging whether the designated operand register of the instruction to be processed is a zero-coded register in the decoding stage refers to judging whether the designated operand register of the instruction to be processed is a zero-coded register through an independent pre-decoding unit in the decoding module, and judging whether the instruction to be processed is a jump instruction refers to judging whether the instruction to be processed is a jump instruction through a primary decoding unit in the decoding module; The pre-decoding unit determines whether the designated operand register of the instruction to be processed is a zero-coded register by determining whether the value of the designated operand corresponding to the designated operand register is 000000; the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed matches the set jump instruction character set, and the jump instruction character set is provided with one or more operation codes corresponding to jump instructions.

2. The jump instruction processing method based on the preferred channel according to claim 1 is characterized in that: The designated operand register of the instruction to be processed in step 2) refers to the first source operand register, the second source operand register or the destination operand register.

3. The jump instruction processing method based on the preferred channel according to claim 1, characterized in that: The instruction to be processed is a beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the difference dif between the first source operand and the second source operand is first calculated in the operation unit to complete the conditional operation operation, and then the branch prediction is completed in the branch execution unit of the branch prediction unit according to the difference dif obtained by the conditional operation operation, and if the difference dif is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

4. The jump instruction processing method based on the preferred channel according to claim 1, characterized in that: The instruction to be processed is a beq instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction, which means determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), the optimal execution channel is selected for the instruction to be processed, and the branch prediction is completed in the optimal execution channel by the branch execution component of the branch prediction unit, and if the second source operand is 0, the branch address of the instruction to be processed is entered, otherwise the branch address of the instruction to be processed is not entered.

5. The jump instruction processing method based on the preferred channel according to claim 1 is characterized in that: The instruction to be processed is a jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is not 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction by determining whether the operation code field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), a normal execution channel is selected for the instruction to be processed, and in the normal execution channel, the offset offset obtained based on the immediate number carried by the instruction to be processed in the operation unit is used to calculate the sum of the first source operand and the offset offset to obtain the branch address addr to complete the conditional operation, and then according to the branch address addr obtained by the conditional operation, the branch is entered in the branch execution unit of the branch prediction unit based on the branch address addr, and the branch return address is written into the destination designated operand register, and the branch return address is the instruction to be processed plus 4.

6. The jump instruction processing method based on the preferred channel according to claim 1, characterized in that: The instruction to be processed is a jalr instruction of the RISC-V instruction set architecture, the designated operand register of the instruction to be processed refers to the first source operand register, and the value of the first source operand corresponding to the first source operand register is 000000, and the first-level decoding unit determines whether the instruction to be processed is a jump instruction, which means determining whether the opcode field opcode of the instruction to be processed is 1100111 and the value of the function field fuction is 000; when performing the optimal channel selection in step 4), the optimal execution channel is selected for the instruction to be processed, and in the optimal execution channel, the offset offset is directly used as the branch address addr by the branch execution component of the branch prediction unit to enter the branch based on the branch address addr. At this time, it is determined whether the destination operand register of the instruction to be processed is a zero-coded register. If it is a zero-coded register, the branch return address is not written into the destination designated operand register and directly exits. The branch return address is the instruction to be processed plus 4, otherwise the branch return address is written into the destination designated operand register. The branch return address is the instruction to be processed plus 4.

7. A jump instruction processing system based on a preferred channel, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor stores therein steps programmed or configured to execute the jump instruction processing method based on the preferred channel as described in any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program programmed or configured to execute the jump instruction processing method based on the preferred channel as described in any one of claims 1 to 6.