A method and system for implementing remainder instruction of RISC-v instruction set
Patent Information
- Application Number
- MYUI2022006162
- Authority / Receiving Office
- MY · MY
- Patent Type
- Utility models
- Current Assignee / Owner
- Priority Date
- 2021-01-18
- Filing Date
- 2021-11-09
- Publication Date
- 2022-07-18
- Estimated Expiration
- 2041-11-09
AI Technical Summary
In the prior art, the execution cycle of the remainder instruction is long, resulting in low CPU performance efficiency. Especially when division and remainder instructions occur frequently, the processor performance is affected.
In the RISC-V instruction set, the remainder instruction is optimized in the renaming stage by adding a remainder instruction acceleration unit. If the division and remainder instructions are paired, the remainder instruction is not issued to the execution unit, but is mapped to the physical register of the division instruction through the destination register. Obtain the remainder and reduce the load on the execution unit.
It improves the execution efficiency of remainder instructions, reduces the execution cycle, and improves the overall performance of the CPU, especially when division and remainder instructions appear frequently.
Smart Images

Figure UI2022006162_DRAWING_001 
Figure UI2022006162_DRAWING_002 
Figure UI2022006162_DRAWING_003
Abstract
Description
A method and system for implementing remainder instructions of RISC-V instruction set Technical Field
[0001] The present invention relates to the field of microprocessor technology, and in particular to a method and system for implementing a remainder instruction of the RISC-V instruction set. Background Art
[0002] Microprocessors have undergone over 50 years of development, and their architecture has undergone rapid evolution alongside semiconductor technology. From single-core to physical and logical multi-core, from in-order to out-of-order execution, and from single-issue to multi-issue, processor performance continues to improve, particularly in the server sector. As data centers and scientific computing demand ever-higher performance, so too do the demands for division and remainder instructions. Simultaneously, their proportion in the instruction set is increasing. Division and remainder instructions have long execution cycles, are data-dependent, and can be variable. These factors significantly impact CPU performance.
[0003] Summary of the Invention
[0004] In response to the shortcomings of the existing technology, the present invention discloses a method and system for implementing the remainder instruction of the RISC-V instruction set, which is used to solve the problem that the remainder instruction cannot use the execution result of the division instruction. Each remainder instruction needs to be executed in the execution unit to obtain the remainder. The execution cycle of the remainder instruction is long, resulting in low efficiency.
[0005] The present invention is achieved through the following technical solutions:
[0006] In a first aspect, the present invention discloses a method for implementing a remainder instruction of a RISC-V instruction set, comprising the following steps:
[0007] S1 executes the CPU out of order, and the instruction enters the instruction decoding unit from the instruction fetch unit for instruction decoding;
[0008] After S2 decoding is completed, the destination register of the instruction is renamed in the renaming unit, and the remainder instruction is optimized at the same time;
[0009] If the remainder instructions in S3 do not meet the optimization conditions, the renamed instructions enter the reservation station and then enter the execution unit for execution;
[0010] After S4 completes execution, the instructions are committed through the reorder cache and the division instruction encoding cache resources allocated in the renaming stage are released.
[0011] Furthermore, in the method, when a division and remainder instruction pair appears, the remainder generated by the division instruction is obtained by mapping the destination register of the remainder instruction to the physical register where the division instruction writes the remainder.
[0012] Furthermore, in the method, when a remainder instruction appears in the renaming stage, the division instruction encoding cache in the remainder instruction acceleration unit is retrieved, and if the encoding of the division instruction and the encoding of the remainder instruction successfully match, then the remainder instruction can be optimized;
[0013] If the encoding of the division instruction and the encoding of the remainder instruction do not match successfully, then the remainder instruction needs to be executed in the execution unit to calculate the remainder.
[0014] Furthermore, in the method, the rule for determining whether the remainder instruction match is unsuccessful is: when consecutive division instructions of different types, consecutive remainder instructions of different types, or a division instruction and a remainder instruction do not match;
[0015] When the division instruction and the remainder instruction are judged to be mismatched, the field indicating whether they are matched in the remainder instruction acceleration unit is set to 0.
[0016] Furthermore, in the method, when a division instruction is written into the division instruction encoding cache, it is necessary to determine whether there is an idle entry and write the division instruction information to the corresponding entry; when the remainder instruction identifier rem_val is valid, it indicates that the current instruction is a remainder instruction. If the valid bit is valid, then the remainder instruction is matched successfully.
[0017] Furthermore, in the method, the division instruction applies for physical registers div_phy_quo and div_phy_rem in the renaming stage to store the quotient and remainder of the division instruction respectively, wherein the div_phy_quo of the division instruction is updated to the division instruction destination register renaming mapping table RAT, and div_phy_rem is stored in the register PHY_REG of the write remainder number of the division instruction encoding cache.
[0018] Furthermore, in the method, when the division instruction enters the renaming stage, if there is no paired remainder instruction, the division instruction writes the division instruction information into the division instruction encoding cache according to the encoding. When the division instruction writes the cache, it first finds an idle position in the cache, and then writes the division instruction encoding DIV_N_OP, the physical register address div_phy_rem for storing the paired remainder instruction result, and the reordering ROB_ID of the division instruction into the cache. At this time, the valid bit of the division instruction encoding cache is set to 1;
[0019] When the remainder instruction enters the renaming stage, the remainder instruction code REM_N_OP and the division instruction code DIV_N_OP are matched and checked according to the pairing rule of the division instruction DIV and the remainder instruction REM; if the remainder instruction is compared and hits, the mapping relationship of the destination register rem_rd is mapped to rem_phy_reg, and updated to the destination register renaming mapping table RAT, the remainder instruction is executed, the instruction execution completion indication in the reorder cache is updated, and the division instruction code cache resources are released.
[0020] Furthermore, in the method, when a refresh, reset, or subsequent new division instruction or remainder instruction occurs, the physical register requested by the division instruction is released, and the division instruction code cache is released;
[0021] When the division instruction is submitted in the ROB, the ROB_ID of the division instruction is obtained according to the submission pointer cm_ptr. The ROB_ID is used to retrieve the division instruction encoding cache. If the division instruction encoding cache is not refreshed due to an exception or a branch instruction prediction error, then the location is released when the remainder instruction is paired;
[0022] When there is an instruction paired with the division instruction being submitted, the paired remainder instruction releases the physical register div_phy_quo. When there is no remainder instruction paired with the division instruction being submitted, the division instruction releases both the physical register div_phy_quo and the physical register div_phy_rem.
[0023] Furthermore, in the method, when a remainder instruction is in the renaming stage and there is no matching division instruction in the division instruction encoding cache, the remainder instruction needs to be sent to the instruction execution unit, the instruction calculates the remainder, and updates the remainder register.
[0024] In a second aspect, the present invention discloses a system for implementing a remainder instruction of a RISC-V instruction set. The system is used to execute the implementation method of the remainder instruction of the RISC-V instruction set described in the first aspect, and includes a register, an execution unit, a division unit, an instruction decoding unit, and an instruction fetch unit.
[0025] The beneficial effects of the present invention are:
[0026] The present invention realizes the function of the remainder instruction by adding a remainder instruction acceleration unit in the renaming stage. When the division and remainder instructions appear in pair, the remainder instruction does not need to be emitted to the subsequent division execution unit, but is mapped to the physical register where the division instruction writes the remainder through the destination register of the remainder instruction, and the remainder generated by the division instruction is obtained, so that the execution efficiency of the remainder instruction is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1 is a diagram of the remainder instruction implementation architecture;
[0029] FIG2 is a diagram of a remainder instruction acceleration processing unit;
[0030] Figure 3 is a diagram of executing a division instruction;
[0031] Figure 4 is a diagram of the division and remainder instructions adjacent to each other;
[0032] Figure 5 is a diagram of non-adjacent pairings of division and remainder instructions;
[0033] Figure 6 shows different patterns of the division instruction and the remainder instruction pairing;
[0034] FIG7 is a diagram showing a pairing check of a division instruction and a remainder instruction. DETAILED DESCRIPTION
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0036] Example 1
[0037] This embodiment discloses a novel method for implementing a remainder instruction. This method implements the remainder instruction's functionality by adding a remainder instruction acceleration unit during the renaming phase, as shown in Figure 1. When a division and remainder instruction pair appears, the remainder instruction does not need to be emitted to the subsequent division execution unit. Instead, the remainder generated by the division instruction is retrieved by mapping the remainder instruction's destination register to the physical register used by the division instruction to write the remainder.
[0038] This embodiment uses a specific RISC V instruction as an example to explain this in detail. In an out-of-order CPU, instructions are decoded from the instruction fetch unit to the instruction decode unit. After decoding, the destination register of the decoded instruction is renamed in the rename unit, and the remainder instruction is optimized during the rename phase. If the remainder instruction does not meet the optimization criteria, the renamed instruction enters the reservation station and then enters the execution unit for execution.
[0039] This embodiment mainly emphasizes the division instruction and the remainder instruction; after the execution is completed, the instruction is submitted through the reorder cache, and resources such as the division instruction encoding cache allocated in the renaming stage are released, as shown in Figure 1.
[0040] This embodiment solves the problem that the remainder instruction cannot use the execution result of the division instruction, each remainder instruction needs to be executed in the execution unit to obtain the remainder, and the execution cycle of the remainder instruction is long, resulting in low efficiency.
[0041] Example 2
[0042] This embodiment generates a new operation code N_OP for the division instruction and the remainder instruction during the instruction decoding stage. For the convenience of explanation, the N_OP of the division and remainder instructions is encoded as shown in Table 1.
[0043] Table 1. Division and remainder instruction encodings.
[0044]
[0045] In this embodiment, the instructions in Table 1 are used as examples. The possible pairings of division and remainder instructions are: 000 and 100, 001 and 101, 010 and 110, and 011 and 111. The encoding of the division instruction in N_OP is called DIV_N_OP; the encoding of the remainder instruction in N_OP is called REM_N_OP.
[0046] In this embodiment, when a remainder instruction appears in the renaming stage, the division instruction encoding cache in the remainder instruction acceleration unit is retrieved. If DIV_N_OP and REM_N_OP match successfully, then the remainder instruction can be optimized. If DIV_N_OP and REM_N_OP do not match successfully, then the remainder instruction needs to be executed in the execution unit to calculate the remainder. The rules for judging whether the remainder instruction match is unsuccessful: when there are consecutive division instructions of different types, consecutive remainder instructions of different types, or the division instruction and the remainder instruction do not match. When the division instruction and the remainder instruction are judged to be mismatched, the field of whether to match in the remainder instruction acceleration unit is set to 0.
[0047] In this embodiment, the division instruction applies for two physical registers div_phy_quo and div_phy_rem in the renaming stage. These two physical registers store the quotient and remainder of the division instruction respectively. The div_phy_quo of the division instruction is updated to the division instruction destination register renaming mapping table RAT. div_phy_rem is stored in the register PHY_REG of the division instruction encoding cache for the number of write remainders. The new encoding N_OP of the division instruction mapped in Table 1 is written to the DIV_N_OP of the division instruction encoding cache. The reordering cache number of the division instruction is also written to the ROB_ID field of the division instruction encoding cache. When the information of the division instruction is written, valid is set to valid, as shown in Figure 2.
[0048] In this embodiment, the division instruction encoding cache in the remainder instruction acceleration unit stores the division instructions and related information that need to be paired. When the division instruction is written to the division instruction encoding cache, it is necessary to determine whether there is an idle entry and write the division instruction information to the corresponding entry. When the remainder instruction identifier rem_val is valid, it means that the current instruction is a remainder instruction. The remainder instruction encoding REM_N_OP matches the division instruction encoding DIV_N_OP in the division instruction encoding cache. At the same time, if the valid bit valid is valid, then the remainder instruction is matched successfully, that is, div_rem_hit is 1. The remainder instruction destination register rem_rd is mapped to the division physical register rem_phy_reg.
[0049] In this embodiment, when a division instruction enters the division execution unit, the quotient and remainder are simultaneously obtained. In addition to forwarding the quotient and remainder to the early wake-up logic, they are also written to the physical register file. The write addresses are div_phy_quo and div_phy_rem, respectively. If a dependency exists on the division instruction in the reservation station, the data is obtained early by comparing div_phy_quo and div_phy_rem. If the physical register addresses match, the data is dispatched to the execution unit for execution.
[0050] Example 3
[0051] This embodiment discloses several implementation scenarios of the division instruction and the remainder instruction: In the first scenario, the division instruction and the remainder instruction appear in pairs and are executed in the same pipeline:
[0052] During the renaming stage, if there is a pair of division and remainder instructions in the pipeline, and there is no other instruction between the division and remainder instructions, then the remainder instruction in the paired instruction does not need to be executed, that is, the remainder instruction does not need to be sent to the subsequent pipeline, and the function of the remainder instruction is completely implemented by the paired division instruction, that is, the adjacent division instruction and remainder instruction as shown in Figure 4.
[0053] During the renaming stage, if the division and remainder instructions in the pipeline are paired, but there are other instructions between the division and remainder instructions, then the remainder instruction in the paired instruction does not need to be executed, that is, the remainder instruction does not need to be sent to the subsequent pipeline, and the function of the remainder instruction is completely implemented by the paired division instruction, that is, as shown in Figure 5, the paired but non-adjacent division instruction and remainder instruction.
[0054] In the second case, the division instruction and the remainder instruction appear in pairs, but not in the same pipeline:
[0055] When a divide instruction enters the renaming phase and there is no matching remainder instruction, the divide instruction writes the divide instruction information to the divide instruction encoding cache according to the encoding in Table 1. When writing to the cache, the divide instruction first finds an empty location in the cache and then writes the divide instruction encoding (DIV_N_OP), the physical register address (div_phy_rem) storing the matching remainder instruction result, and the reordered ROB_ID of the divide instruction. The valid bit in the divide instruction encoding cache is set to 1.
[0056] When the remainder instruction enters the renaming stage, the remainder instruction code REM_N_OP and the division instruction code DIV_N_OP are checked for a match. The division instruction DIV is paired with the remainder instruction REM according to the matching rules in Table 1. If the remainder instruction is a hit, that is, div_rem_hit is 1, it means that the remainder required by the remainder instruction can be generated by the previous division instruction, and the remainder is stored in rem_phy_reg. Therefore, the remainder instruction only needs to map the mapping relationship of the destination register rem_rd to rem_phy_reg and update the destination register renaming mapping table RAT. The remainder instruction is executed and does not need to enter the subsequent execution unit for execution. It only needs to update the instruction execution completion indication in the reorder cache and release the division instruction code cache resources, that is, set valid to 0, as shown in Figure 2. The remainder instruction releases the physical register when the reorder cache is committed.
[0057] The third case is that the division instruction is not paired with the remainder instruction:
[0058] The division instruction itself cannot determine whether it can be paired with the subsequent remainder instruction. Therefore, in the renaming stage, the division instruction applies for a physical register for remainder speculation. When a refresh, reset, or subsequent new division instruction or remainder instruction occurs, the physical register applied for the division instruction is released, and the division instruction encoding cache is released.
[0059] When a divide instruction is submitted to the ROB, the ROB_ID of the divide instruction is obtained based on the submit pointer cm_ptr. The ROB_ID is then used to retrieve the divide instruction encoding cache, as shown in Figure 7. If the divide instruction encoding cache is not released due to an exception flush or a branch instruction misprediction, then this location is released when the remainder instruction is paired. When an instruction is paired with the submitted divide instruction, the divide instruction does not need to release the physical register div_phy_rem, only the physical register div_phy_quo. The paired remainder instruction will also release the physical register div_phy_quo. If no remainder instruction is paired with the submitted divide instruction, the divide instruction must release both the physical register div_phy_quo and the physical register div_phy_rem.
[0060] In the fourth case, the division instruction and the remainder instruction are not paired, and there is only one remainder instruction:
[0061] When a remainder instruction is in the renaming phase and there is no matching divide instruction in the divide instruction encoding cache, the remainder instruction is sent to the instruction execution unit, where the remainder is calculated and updated to the remainder register. The remainder instruction in this case follows the same processing flow as other instructions.
[0062] To further illustrate the principle, assume that the CPU bandwidth is one instruction per clock cycle, and use the RISC V instruction sequence in the following table as an example.
[0063] Table 1 RISC V instruction sequence
[0064] Supplementary description of serial number instruction operand
[0065] 1divwa4,s10,s6 division instruction, encoded as 011 2sda4,-300(s0) 3swa4,-200(s0) 4auipca4,0x1 5lbua5,1731(a4) 6divua5,a5,a4 division instruction, encoded as 001 7c.addia3,4 8addiws10,s5,1 9remus3,a5,a4 remainder instruction, encoded as 1011 0sws3,-4(a3) 11bgeua5,a4,pc-20 12bges10,s9,pc+18 13sllis8,s5,2 14c.lda5,0(a1) 15c.lia4,10 16remus3,a5,a4 remainder instruction, encoded as 1011 7c.addiws8,0 18c.addi4spna3,a5,a4 19c.lis5,1 20c.swsps3,0(sp) 21bgeua5,a4,pc+8 22divuwa5,a5,a4 Division instruction, encoded as 010 23c.addia3,4 24addiws10,s5,1 25remus3,a5,a4 Remainder instruction, encoded as 101 26sws3,-4(a3) ………………
[0066] Table 2 writes the sequence number 1divw division instruction
[0067]
[0068] When the divw division instruction (sequence number 1) is renamed, two physical registers, div_phy_quo_1 and div_phy_rem_1, are allocated. The ROB_ID assigned to the divw instruction (sequence number 1) is rob_id_1. This information is written to the division instruction encoding cache. It is also assumed that a matching remainder instruction exists for this division instruction, with the matching field set to 1. Between instructions 1 and 6, no matching remainder instruction, REMW, appears. When the divw division instruction (sequence number 1) is committed to the ROB, the physical registers div_phy_quo_1 and div_phy_rem_1 are released. When the divu division instruction (sequence number 6) is renamed, two physical registers, div_phy_quo_2 and iv_phy_rem_2, are allocated. The ROB_ID assigned to the divu instruction (sequence number 6) is rob_id_2. This information is also written to the division instruction encoding cache. At the same time, the matching field of the divw instruction with serial number 1 is set to 0, which means that there is no matching remainder instruction for this instruction. The matching field corresponding to the divu division instruction with serial number 6 is set to 1.
[0069] Table 3 writes the sequence number 6divu division instruction
[0070]
[0071] When the remainder instruction (number 9remu) is renamed, a matching divide instruction (number 6divu) is found in the divide instruction encoding cache. The remainder instruction (number 9remu) is decoded into a MOV instruction, mapping the physical register div_phy_rem_2 allocated to the matching divide instruction to the destination register of the remainder instruction (number 9remu). The remainder instruction (number 9remu) does not need to be issued to the divide execution unit for execution. This frees up the resources of the divide instruction (number 6divu) in the divide instruction encoding cache.
[0072] Table 4 release sequence number 6divu division instruction
[0073]
[0074] When the remainder instruction 16remu is renamed, it is found that there is no matching divide instruction in the divide instruction encoding cache. In this case, the instruction needs to be issued to the divide execution unit to calculate the remainder.
[0075] When the divuw division instruction (number 22) is renamed, it allocates two physical registers, div_phy_quo_3 and div_phy_rem_3. The ROB_ID assigned to the divuw instruction is rob_id_3. This information is written to the division instruction encoding cache. It also assumes that a matching remainder instruction exists for this division instruction, indicating whether it is paired or not. The matching field is set to 1.
[0076] Table 5 writes the sequence number 22divuw division instruction
[0077]
[0078] When the remainder instruction (number 25, remu) is renamed, it is discovered that there is no matching divide instruction in the divide instruction encoding cache. This instruction must then be issued to the divide execution unit to calculate the remainder. The match for the remainder instruction (number 22, divuw) is also marked as 0, indicating that there is no matching remainder instruction for this instruction.
[0079] Table 6 Release sequence number 22divuw division instruction
[0080]
[0081] Example 4
[0082] This embodiment discloses a system for implementing a remainder instruction of the RISC-V instruction set. The system is used to execute an implementation method of the remainder instruction of the RISC-V instruction set, and includes a register, an execution unit, a division unit, an instruction decoding unit, and an instruction fetch unit.
[0083] The present invention realizes the function of the remainder instruction by adding a remainder instruction acceleration unit in the renaming stage. When the division and remainder instructions appear in pair, the remainder instruction does not need to be emitted to the subsequent division execution unit, but is mapped to the physical register where the division instruction writes the remainder through the destination register of the remainder instruction, and the remainder generated by the division instruction is obtained, so that the execution efficiency of the remainder instruction is high.
[0084] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for implementing a remainder instruction of a RISC-V instruction set, It is characterized in that The method comprises the following steps: S1 executes the CPU out of order, and the instruction enters the instruction decoding unit from the instruction fetch unit for instruction decoding; After the S2 decoding is completed, the destination register is renamed in the renaming unit, and the remainder instruction is optimized; If the remainder instructions in S3 do not meet the optimization conditions, the renamed instructions enter the reservation station and then enter the execution unit for execution; After S4 executes the completed instructions, they are committed through the reorder cache and the division instruction encoding cache resources allocated in the renaming stage are released.
2. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when a division and remainder instruction pair appears, the remainder generated by the division instruction is obtained by mapping the destination register of the remainder instruction to the physical register where the division instruction writes the remainder.
3. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when a remainder instruction appears in the renaming stage, the division instruction encoding cache in the remainder instruction acceleration unit is retrieved, and if the encoding of the division instruction and the encoding of the remainder instruction successfully match, then the remainder instruction can be optimized; If the encoding of the division instruction and the encoding of the remainder instruction do not match successfully, then the remainder instruction needs to be executed in the execution unit to calculate the remainder.
4. The method for implementing the RISC-V instruction set remainder instruction according to claim 3, It is characterized in that In the method, the rule for determining that the remainder instruction is unsuccessful is: when consecutive division instructions of different types, consecutive remainder instructions of different types, or a division instruction and a remainder instruction do not match; When the division instruction and the remainder instruction are judged to be mismatched, the field indicating whether they are matched in the remainder instruction acceleration unit is set to 0.
5. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when a division instruction is written into the division instruction encoding cache, it is necessary to determine whether there is an idle entry and write the information of the division instruction to the corresponding entry; when the identifier rem_val of the remainder instruction is valid, it indicates that the current instruction is a remainder instruction. If the valid bit valid is valid, then the remainder instruction is matched successfully.
6. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, the division instruction applies for physical registers div_phy_quo and div_phy_rem in the renaming stage to store the quotient and remainder of the division instruction respectively, wherein the div_phy_quo of the division instruction is updated to the division instruction destination register renaming mapping table RAT, and div_phy_rem is stored in the register PHY_REG of the write remainder number of the division instruction encoding cache.
7. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when the division instruction enters the renaming stage, when there is no paired remainder instruction, the division instruction writes the division instruction information into the division instruction encoding cache according to the encoding. When the division instruction writes the cache, first find an idle position from the cache, and then write the division instruction encoding DIV_N_OP, the physical storage address div_phy_rem for storing the paired remainder instruction result, and the division instruction reordering ROB_ID into the cache. At this time, the valid bit valid of the division instruction encoding cache is set to 1; When the remainder instruction enters the renaming stage, the remainder instruction code REM_N_OP and the division instruction code DIV_N_OP are matched and checked according to the pairing rule of the division instruction DIV and the remainder instruction REM; if the remainder instruction is compared and hits, the mapping relationship of the destination register rem_rd is mapped to rem_phy_reg, and updated to the destination register renaming mapping table RAT, the remainder instruction is executed, the instruction execution completion indication in the reorder cache is updated, and the division instruction code cache resources are released.
8. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when a refresh, reset or subsequent new division instruction or remainder instruction occurs, the physical register requested by the division instruction is released, and the division instruction code cache is released; When the division instruction is submitted in the ROB, the ROB_ID of the division instruction is obtained according to the submission pointer cm_ptr, and the ROB_ID is used to retrieve the division instruction encoding cache. If the division instruction encoding cache is not refreshed and released due to abnormal refresh or branch instruction prediction error, then the position is released when the remainder instruction is paired; When there is an instruction paired with the division instruction being submitted, the paired remainder instruction releases the physical register div_phy_quo. When there is no remainder instruction paired with the division instruction being submitted, the division instruction releases both the physical register div_phy_quo and the physical register div_phy_rem.
9. The method for implementing the RISC-V instruction set remainder instruction according to claim 1, It is characterized in that In the method, when a remainder instruction is in the renaming stage and there is no matching division instruction in the division instruction encoding cache, the remainder instruction needs to be sent to the instruction execution unit, the instruction calculates the remainder, and updates the remainder register.
10. A system for implementing a remainder instruction of a RISC-V instruction set, the system being used to execute the method for implementing a remainder instruction of a RISC-V instruction set according to any one of claims 1 to 9, It is characterized in that It includes registers, execution units, division units, instruction decoding units and instruction fetch units.
