Instruction processing method, processor core, processor, electronic device and storage medium

By extending the execution cycle of competing instructions and avoiding bus competition, the problem of low processor performance caused by bus competition in the prior art is solved, and the instruction processing efficiency and overall performance of the pipeline are improved.

CN118426841BActive Publication Date: 2024-09-20PHYTIUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822055.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-20
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

In the existing technology, the instruction execution efficiency in the processor is low due to bus competition, which leads to the insertion of bubbles in the pipeline and seriously reduces the performance of the processor.

Method used

The arbitration unit determines the first instruction that fails to compete with other instructions for the bus, and extends its execution cycle to avoid competition with other instructions, ensuring that no bubbles are inserted into the target execution cycle, and improving the efficiency of pipeline instruction processing.

Benefits of technology

This improves the instruction processing efficiency of the processor without inserting cavitations and improves the overall performance of the processor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426841B
    Figure CN118426841B
Patent Text Reader

Abstract

The present application provides an instruction processing method, a processor core, a processor, an electronic device and a storage medium, which are applied to the field of computer technology. The method is applied to the processor core, and an arbitration unit in the processor core determines a first instruction that fails to compete with other instructions for a bus among instructions in each transmission queue, extends the execution cycle of the first instruction, and obtains a target execution cycle that can avoid the first instruction from competing with other instructions for the bus. The target transmission queue transmits the first instruction to a target execution unit, and the target execution unit executes the first instruction according to the target execution cycle and stores the execution result in a storage unit, and the storage unit sends the execution result to the bus according to the target execution cycle. In the method, the instruction that fails the bus competition can still be normally transmitted and executed, and the bus competition is no longer resolved by pausing the pipeline. The entire pipeline is filled with instructions, and the insertion of bubbles in the pipeline is avoided, thereby improving the instruction processing efficiency and thus improving the overall performance of the processor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an instruction processing method, a processor core, a processor, an electronic device and a storage medium. Background Art

[0002] In the process of the processor executing instructions, bus contention is often caused by problems such as inconsistent transmission resources, execution resources, and bus throughput. That is, two or more instructions need to send the execution results of the instructions to the bus at the same time. Bus contention can easily lead to confusion in bus data transmission and even cause the processor to crash.

[0003] In order to solve the problem of bus competition, the existing technology introduces an arbitration mechanism. That is, for multiple instructions competing for the bus, according to the order of entering the transmission queue, the latter instructions are controlled to wait for a number of clock cycles to ensure that the former instructions are executed first and the execution results are uploaded to the bus. After the former instructions are executed, the latter instructions are executed and the corresponding execution results are uploaded to the bus.

[0004] The inventors have discovered that the prior art technical solution to solve bus contention by controlling instructions to wait for a number of cycles before executing will insert bubbles into the entire pipeline on a macro level. Although this is the simplest and easiest method to implement, it greatly affects the instruction processing efficiency of the pipeline, thereby seriously reducing the overall performance of the processor. Summary of the invention

[0005] In view of this, the present application is committed to providing an instruction processing method, processor core, processor, electronic device and storage medium, which avoids bus contention by extending the execution cycle of instructions, uses the entire pipeline to process instructions, avoids the insertion of bubbles, improves the instruction processing efficiency of the pipeline, and improves the overall performance of the processor.

[0006] In a first aspect, the present application provides an instruction processing method, which is applied to a processor core, wherein the processor core includes a storage unit, an arbitration unit, at least one transmit queue and at least one execution unit, and the method includes: the arbitration unit determines a first instruction that fails to compete with other instructions for a bus among the instructions in each of the transmit queues; the arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle, wherein the target execution cycle can avoid the first instruction from competing with other instructions for a bus; the target transmit queue transmits the first instruction to a target execution unit; wherein the first instruction carries the target execution cycle, the target transmit queue is the transmit queue to which the first instruction belongs, and the target execution unit is in an idle state when the first instruction enters; the target execution unit executes the first instruction according to the target execution cycle, and stores the execution result in the storage unit; the storage unit sends the execution result to the bus according to the target execution cycle.

[0007] In an optional embodiment, the arbitration unit determines the first instruction that fails to compete with other instructions for the bus among the instructions in each of the transmitting queues, including: each of the transmitting queues sends instruction information of the target instruction that competes with other instructions for the bus to the arbitration unit; the arbitration unit determines the first instruction that fails to compete for the bus among each of the target instructions based on the instruction information.

[0008] In an optional embodiment, the instruction information includes an instruction identifier that uniquely represents the instruction; the arbitration unit determines the first instruction that fails to compete for the bus in each of the target instructions based on the instruction information, including: determining the first instruction that fails to compete for the bus based on the instruction identifier corresponding to each of the target instructions.

[0009] In an optional embodiment, the arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle, including: the arbitration unit increases the clock cycle according to a preset step rule based on the original execution cycle of the first instruction until the first instruction avoids competing with other instructions for the bus, thereby obtaining the target execution cycle.

[0010] In an optional embodiment, the target execution unit executes the first instruction according to the target execution cycle and stores the execution result in the storage unit, including: the target execution unit executes the first instruction according to the original execution cycle, and sends the execution result and the additional execution cycle to the storage unit; wherein the additional execution cycle includes all clock cycles added according to the preset step rule.

[0011] In an optional implementation, the storage unit sends the execution result to the bus according to the target execution cycle, including: the storage unit stores the execution result and sends the execution result to the bus when the storage time reaches the additional execution cycle.

[0012] In an optional embodiment, the target execution unit sends the execution result and the additional execution cycle to the storage unit, including: the target execution unit determines whether the first instruction carries a first identifier, and the first identifier is used to indicate that the execution result of the first instruction needs to be stored in the storage unit; if the first instruction carries the first identifier, the target execution unit sends the execution result and the additional execution cycle to the storage unit.

[0013] In an optional embodiment, after the target transmit queue transmits the first instruction to the target execution unit, the method further includes: the target transmit queue broadcasts a first notification message, the first notification message is used to wake up other instructions associated with the first instruction, and the first notification message includes an instruction identifier that can uniquely indicate the first instruction.

[0014] In an optional implementation, after the target transmit queue broadcasts the first notification information, the method further includes: the target transmit queue broadcasts the second notification information to each of the execution units, the second notification information being used to instruct execution of a second instruction associated with the first instruction based on the execution result.

[0015] In an optional embodiment, the second notification information includes the instruction identifier of the first instruction; the process of any execution unit executing the second instruction associated with the first instruction based on the execution result includes: the execution unit determines the storage address of the execution result of the first instruction based on the instruction identifier of the first instruction among the execution results of multiple instructions; the execution unit obtains the execution result according to the storage address, and executes the second instruction with the execution result as the source operand of the second instruction.

[0016] In an optional embodiment, the target transmit queue broadcasts a second notification message to each of the execution units, including: the target transmit queue determines the target clock cycle based on the additional execution cycle and a preset sending interval between the second instruction and the first instruction; the target transmit queue broadcasts the second notification message to each of the execution units in the target clock cycle.

[0017] In a second aspect, the present application provides a processor core, which is used to execute the instruction processing method as described in any one of the first aspects of the present application.

[0018] In a third aspect, the present application provides a processor, comprising: at least one processor core as described in the second aspect of the present application.

[0019] In a fourth aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the instruction processing method described in any one of the first aspects of the present application when executing the computer program.

[0020] In a fifth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the instruction processing method described in any one of the first aspects of the present application is implemented.

[0021] Based on the above content, the instruction processing method provided by the present application is applied to a processor core, which includes a storage unit, an arbitration unit, at least one transmission queue and at least one execution unit. The arbitration unit determines the first instruction that fails to compete with other instructions for the bus in the instructions of each transmission queue and extends the execution cycle of the first instruction to obtain a target execution cycle that can avoid the first instruction from competing with other instructions for the bus. The target transmission queue transmits the first instruction to the target execution unit and the first instruction carries the target execution cycle. The target execution unit executes the first instruction according to the target execution cycle and stores the execution result in the storage unit. The storage unit sends the execution result to the bus according to the target execution cycle. Since the target execution cycle obtained after the extension can avoid the first instruction from competing with other instructions for the bus, compared with the prior art, in the instruction processing method provided by the present application, instructions that fail the bus competition can still be normally transmitted and executed, and the bus competition is no longer resolved by pausing the pipeline. The entire pipeline is filled with instructions, thereby avoiding the insertion of bubbles in the pipeline, improving the instruction processing efficiency of the pipeline, and thereby improving the overall performance of the processor. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0023] Figure 1 It is a schematic diagram of an instruction processing process in the prior art.

[0024] Figure 2 It is a structural block diagram of a processor core provided by an embodiment of the present invention.

[0025] Figure 3It is a flow chart of an instruction processing method provided by an embodiment of the present invention.

[0026] Figure 4 It is a schematic diagram of processing instructions according to the instruction processing method provided in an embodiment of the present invention.

[0027] Figure 5 It is a flowchart of another instruction processing method provided by an embodiment of the present invention.

[0028] Figure 6 It is a structural block diagram of another processor core provided by an embodiment of the present invention.

[0029] Figure 7 This is a flowchart of another instruction processing method provided by an embodiment of the present invention.

[0030] Figure 8-Figure 10 It is a schematic diagram of processing instructions according to the instruction processing method provided in an embodiment of the present invention.

[0031] Fig.11 It is a structural block diagram of a processor provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0033] As mentioned above, in the process of the processor executing instructions, bus contention is often caused by problems such as inconsistent transmission resources, execution resources, and bus throughput. That is, there are two or more instructions that need to send the execution results of the instructions to the bus at the same time. Bus contention can easily lead to confusion in bus data transmission and even cause the processor to crash.

[0034] In order to solve the problem of bus contention, the processing method of the prior art is to introduce an arbitration mechanism, that is, for multiple instructions competing for the bus, according to the order of entering the transmission queue, the subsequent instructions are controlled to wait for several clock cycles, and the relevant control signals in the pipeline are set to signals that do not affect the pipeline state, that is, bubbles are inserted to ensure that the previous instructions are executed first and the execution results are uploaded to the bus. After the previous instructions are executed, the subsequent instructions are executed and the corresponding execution results are uploaded to the bus.

[0035] Combine the following Figure 1 As shown, the specific processing process of multiple instructions competing for the bus in the prior art is briefly introduced.

[0036] Assume that there are 5 instructions A, B, C, D, and E that need to be executed in sequence, where the execution cycles of A, B, C, and E each include 5 clock cycles (shown as Cycle in the figure), and the execution cycle of D includes 2 clock cycles. In the process of instructions entering the pipeline, the position where the instructions enter the pipeline is fixed, and the entry positions of instructions in different execution cycles are different, while the positions of instructions in the same execution cycle entering the pipeline are the same.

[0037] Based on the above premise, the execution process of instructions A, B, C, D, and E is as follows.

[0038] Cycle 1: A enters the pipeline. At this time, 5 clock cycles are required to execute instruction A, which is indicated in the figure as A having 5 cycles remaining.

[0039] Cycle2: B enters the pipeline. At this time, it takes 5 execution cycles to execute instruction B and 4 clock cycles to execute instruction A.

[0040] Cycle3: C enters the pipeline. At this time, there are 3 instructions being executed in the pipeline. C requires 5 clock cycles to execute, B requires 4 clock cycles, and A requires 3 clock cycles.

[0041] It can be seen that the execution cycle of the three instructions A, B, and C is the same, and the positions where the three enter the pipeline are also the same. After A, B, and C enter the pipeline, the next instruction to enter the pipeline should be D.

[0042] Cycle4: D attempts to enter the pipeline execution, such as Figure 1 As shown in the figure, at this time, the position where D enters the pipeline has been occupied by A, or in other words, the pipeline is almost full, and A needs 2 clock cycles to complete execution and send the execution result to the bus. If D enters the pipeline for execution at this time, after two clock cycles, the execution results of A and D will be obtained at the same time. Both need to send the execution results to the bus, and bus contention occurs at this time. To avoid bus contention, according to the order of entering the emission queue, D will be cancelled in Cycle 4, that is, no instructions are emitted in the Cycle 4 emission queue, which is equivalent to inserting a bubble in the pipeline.

[0043] Cycle5: D tries to enter the pipeline for execution again. Referring to the above content, if D is executed in Cycle5, after two clock cycles, the execution results of D and B will be obtained at the same time, that is, bus contention occurs. In this case, the emission queue cancels the emission of D again, that is, no instructions are emitted in the Cycle5 emission queue, which is equivalent to inserting another bubble in the pipeline.

[0044] Cycle6: D tries to enter the pipeline for execution for the third time. Referring to the above content, if D is executed in Cycle6, after two clock cycles, the execution results of D and C will be obtained at the same time, that is, bus contention occurs. In this case, the emission queue cancels the emission of D again, that is, no instructions are emitted in the Cycle6 emission queue, which is equivalent to inserting the third bubble in the pipeline.

[0045] Cycle7: D tries to enter the pipeline for the fourth time. At this time, C needs one more clock cycle to complete the execution, while D needs two clock cycles. That is to say, D and C will not get the execution results at the same time. D entering the pipeline in Cycle7 will not cause bus contention. Therefore, D enters the pipeline in Cycle7.

[0046] Cycle 8: E enters the pipeline for execution. Since E needs 5 clock cycles to complete execution, and D needs only one clock cycle to complete execution, the two will not compete for the bus. After 5 clock cycles, the above 5 instructions A, B, C, D, and E will all be executed. It can be seen that for these 5 instructions, a total of 13 clock cycles are required to complete execution, and IPC (Instruction per Clock, the number of instructions executed per clock) ≈ 0.38.

[0047] Based on the above content, it can be seen that the existing technology solves bus contention by inserting bubbles in the entire pipeline. Although this is the simplest and easiest to implement method, it greatly affects the instruction processing efficiency of the pipeline, thereby seriously reducing the overall performance of the processor.

[0048] In order to solve the above technical problems, the present application provides an instruction processing method, which is applied to a processor, specifically to a processor core of a processor, and the processor core includes a storage unit, an arbitration unit, at least one transmission queue and at least one execution unit. Compared with the prior art, the instruction processing method provided by the present application can still be normally transmitted and executed when instructions that fail bus contention are no longer resolved by pausing the pipeline. The entire pipeline is filled with instructions, thereby avoiding the insertion of bubbles in the pipeline, improving the instruction processing efficiency of the pipeline, and thereby improving the overall performance of the processor.

[0049] It is understandable that the processor core provided in the present application includes a variety of optional implementations. In a typical implementation, the basic architecture of the processor core can be seen in Figure 2As shown, the processor core includes a storage unit 10, an arbitration unit 11, a transmission queue 12 and an execution unit 13. The execution unit 13 and the storage unit 10 are connected to the bus 14. The specific connection and interaction relationship of each component in the processor core and their respective functions will be detailed in the subsequent content combined with the instruction processing method provided by the present application, and will not be described in detail here. In this application scenario, the instruction processing method provided by the present application may include the following Figure 3 The following steps are shown.

[0050] S100 , an arbitration unit determines, among instructions in a transmission queue, a first instruction that fails in bus contention with other instructions.

[0051] The instruction dispatch queue (IDQ) is a key part of the processor microarchitecture. The instruction dispatch queue stores at least one instruction waiting to be executed. In practical applications, the instructions stored in the instruction dispatch queue can be instructions under the out-of-order processing mechanism or instructions under the sequential processing mechanism. In short, any instructions in the processor that need to be executed through the pipeline are applicable to the instruction processing method provided in this application.

[0052] In one possible implementation, the process of instructions from the transmission queue to the execution unit can be roughly divided into five processes: dispatch, wake-up, selection, transmission, and cancellation judgment. The instructions involved in this application mainly refer to instructions in the transmission queue that have completed resource allocation (completed in the dispatch step) and are in the awakened state. Such instructions are in the waiting state for transmission. In another implementation, the processor supports a forward transmission mechanism. Forward transmission is an instruction processing process that occurs simultaneously with dispatch and wake-up. The instructions selected under the forward transmission mechanism are also in the waiting state for transmission.

[0053] Furthermore, for any instruction entering the emission queue, the emission queue stores the instruction information of the instruction through the corresponding register, wherein the instruction information includes but is not limited to the execution cycle preset when the instruction is created, the preset sending interval between the instruction and other instructions, the source operand required by the instruction, and the specific operation corresponding to the instruction, etc. Of course, other information may also be included, which can be specifically referred to in the relevant technology, and will not be listed here one by one. It should be noted that, in order to facilitate the explanation of the instruction processing method provided by the present application, the present application defines the execution cycle preset when the instruction is created as the original execution cycle.

[0054] Based on the above content, it can be known that there may be multiple instructions in the transmission queue that are in the waiting state at the same time, and the original execution cycle of each instruction is known. Based on this, before transmitting the instruction, the transmission queue can determine whether there are multiple instructions that have been executed in the same clock cycle and request to send the execution result to the bus according to the original execution cycle of each instruction. If so, it is determined that there is bus contention. On the contrary, if not, it is determined that there is no bus contention. Based on this, when the processor core only includes one transmission queue, the transmission queue determines in this step that there is a target instruction of bus contention among the instructions stored in itself, and sends the instruction information of each target instruction to the arbitration unit.

[0055] The arbitration unit is mainly used to arbitrate the bus competition results of each target instruction competing for the bus. After receiving the instruction information of each target instruction provided by the transmission queue, the target instruction that can send the execution result to the bus in a certain same clock cycle is determined according to the obtained instruction information, that is, the target instruction that successfully competes for the bus is determined. Correspondingly, it is also used to determine the target instruction that fails to compete for the bus. For the sake of ease of expression, the target instruction that fails to compete for the bus is defined as the first instruction.

[0056] In an optional implementation, the instruction information provided by the transmitting queue to the arbitration unit includes an instruction identifier that can uniquely represent the instruction. Based on this, the arbitration unit can determine the first instruction that failed to compete for the bus among the target instructions based on the instruction identifiers of the target instructions obtained. For example, the instruction identifier can be the number of the instruction. Based on this, the arbitration unit can use the target instruction with a later number (i.e., a larger number) in each target bus as the first instruction. Since the instruction number can represent the execution order of the instruction, such a setting can ensure that the instruction with a preset execution order is executed first. Of course, other instruction information that can uniquely represent the instruction can also be used as an instruction identifier, which will not be described in detail here. Without exceeding the core idea of ​​the present application, it also falls within the scope of protection of the present application.

[0057] Based on the above content, in the instruction processing method provided by the application, the arbitration unit first determines the first instruction that fails to compete with other instructions for the bus among multiple instructions that are in a waiting state and compete for the bus.

[0058] S110 , the arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle.

[0059] As mentioned above, in the prior art, the emission queue may try to emit the first instruction in multiple clock cycles, but because the pipeline is full or nearly full with previously emitted instructions, if the emission queue determines that the first instruction competes with other instructions for the bus in any clock cycle, the emission of the first instruction will be cancelled in that clock cycle, that is, no instruction is emitted in that clock cycle, thereby generating a bubble in the pipeline. Only after several clock cycles, when it is determined that the first instruction does not compete with other instructions for the bus in the aforementioned manner, the first instruction will be emitted again. Different from the prior art, in the instruction processing method provided by the present application, the arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle that can avoid the first instruction from competing with other instructions for the bus.

[0060] In a possible implementation, the arbitration unit increases the clock cycle according to a preset stepping rule based on the original execution cycle of the first instruction. After each extension of the execution cycle, it is determined according to the above method whether the first instruction still has bus contention with other instructions. If bus contention still exists, the clock cycle is increased again according to the preset stepping rule, and then the bus contention is determined again until the first instruction is prevented from competing with other instructions for the bus and the target execution cycle is obtained.

[0061] As a preferred embodiment, the preset stepping rule can be one clock cycle at a time, that is, one clock cycle is added each time on the basis of the original execution cycle of the first instruction. Of course, the stepping gradient can also be appropriately increased, for example, two clock cycles are added each time. It can be understood that the smaller the stepping gradient of the adjustment clock cycle, the higher the accuracy of the extended execution cycle, and the greater the logic overhead occupied by the target execution cycle. On the contrary, the larger the stepping gradient of the adjustment clock cycle, the lower the accuracy of the extended execution cycle, but the shorter the time for determining the target execution cycle, the smaller the logic overhead occupied. Therefore, in practical applications, it is necessary to comprehensively consider the selection of the stepping gradient in combination with processor hardware resources and instruction execution efficiency and other factors. It can also be understood that in the case of extending the execution cycle of the first instruction by adding one clock cycle each time, the target execution cycle obtained is to ensure that the first instruction avoids competing with other instructions for the bus, and the execution cycle with the least number of clock cycles required.

[0062] In another possible implementation, the transmitting queue can obtain the original execution cycle of each instruction in the queue. Based on this, the transmitting queue can determine whether there are multiple instructions that have been executed in the same clock cycle and request to send the execution result to the bus according to the original execution cycle of each instruction, that is, whether there are instructions competing for the bus. If so, the transmitting queue provides the instructions competing for the bus, that is, the instruction information of the target instruction to the arbitration unit. The arbitration unit can directly determine the number of clock cycles that need to be extended for the instruction with a shorter original execution cycle based on the deviation of the original execution cycle between the instructions competing for the bus, and then obtain the target execution cycle of the corresponding instruction.

[0063] As mentioned above, the present application defines the execution cycle preset when the instruction is created as the original execution cycle. Based on this, all clock cycles added to avoid the first instruction competing with other instructions for the bus are defined as additional execution cycles. In other words, the target execution cycle provided by the present application includes the original execution cycle and the additional execution cycle. This definition will be used in subsequent content and will not be repeated.

[0064] In an optional implementation, after determining the first instruction, the arbitration unit may add a status identifier representing that the first instruction adopts the target execution cycle to the instruction information of the first instruction, and feed the status identifier back to the emission queue. Of course, as another optional implementation, the arbitration unit may not feed back any information to the emission queue after extending the execution cycle of the first instruction. The emission queue may also determine that the first instruction needs to be executed according to the target execution cycle based on the change in the execution cycle of the first instruction.

[0065] S120, the issue queue issues a first instruction to the execution unit.

[0066] After determining a target execution cycle that can avoid the first instruction from competing with other instructions for the bus, the issue queue sends the first instruction to the execution unit. In practical applications, the process of sending instructions is the process of sending related instruction information of the instructions, and the instruction information includes the execution cycle of the instruction. Based on this, the first instruction sent by the issue queue to the execution unit also carries the target execution cycle.

[0067] Further, as mentioned above, the target execution cycle of the first instruction includes the original execution cycle and the additional execution cycle. In order to ensure that the execution unit can accurately distinguish between the two, the first instruction can carry the original execution cycle and the additional execution cycle respectively, that is, on the basis of the instruction information of the first instruction including the original execution cycle, the additional execution cycle is added. As for the specific implementation method of the emission queue adding the target execution cycle or the additional execution cycle to the instruction information of the first instruction, it can be implemented with reference to the relevant technology, and this application does not make specific limitations on this.

[0068] S130, the execution unit executes the first instruction according to the target execution cycle, and stores the execution result in the storage unit.

[0069] The execution unit is a key module in the processor for performing actual calculations and related operations, wherein the type and number of execution units depend on the specific architecture of the microprocessor. Generally, the execution unit may include a logic arithmetic unit, a floating point unit, a storage unit, a branch unit, and a vector unit, etc. Of course, other types of execution units may also be included, which are not listed here one by one. The execution unit described in this application specifically refers to an execution unit that can execute a first instruction and a subsequent second instruction.

[0070] In another optional implementation, a dynamic allocation unit is further provided in the processor core. After the transmission queue transmits the instruction to the execution unit, the instruction first enters the dynamic allocation unit for decoding, and the dynamic allocation unit further sends the obtained decoding result to the subsequent execution unit, and the execution unit specifically executes the corresponding instruction. For the specific implementation of the dynamic allocation unit and the data interaction between the dynamic allocation unit and the execution unit, reference can be made to the relevant technology, and this application does not make specific limitations on this.

[0071] After receiving the first instruction, the execution unit may execute the first instruction according to the target execution cycle carried by the first instruction, and store the obtained execution result in the storage unit.

[0072] As mentioned above, the target execution cycle of the first instruction includes the original execution cycle and the additional execution cycle. Based on this, the execution unit executes the first instruction according to the original execution cycle to obtain the execution result of the first instruction. As for the specific implementation of the execution unit executing the first instruction according to the original execution cycle, please refer to the above content and related technical implementations, which will not be expanded here.

[0073] After obtaining the execution result of the first instruction, the execution unit sends the execution result and an additional execution cycle to the storage unit, so that the storage unit stores the execution result of the first instruction.

[0074] It can be understood that in the instruction processing method provided in the present application, the instructions executed by the execution unit can be divided into two types, the first type is instructions that successfully compete for the bus and do not compete for the bus with other instructions, and the second type is instructions that fail to compete for the bus with other instructions, such as the first instruction described in this embodiment. For the first type of instructions, the execution unit sends the obtained execution result to the bus immediately after executing the instruction according to the original execution cycle carried by the instruction and obtaining the execution result. For the second type of instructions, after obtaining the execution result, the execution result cannot be sent directly to the bus, but is first stored in the storage unit.

[0075] Based on the above situation, before executing any instruction, the execution unit needs to determine which of the above methods is used to execute the resulting instruction. In an optional implementation, the transmit queue adds a first identifier to the instruction information of the instruction that failed to compete for the bus, and indicates through the first identifier that the execution result of the corresponding instruction needs to be stored in the storage unit.

[0076] After receiving the first instruction, the execution unit first determines whether the first instruction carries the first identifier. If the first instruction carries the first identifier, it means that the execution unit needs to send the execution result of the first instruction and an additional execution cycle to the storage unit.

[0077] S140. The storage unit sends the execution result to the bus according to the target execution cycle.

[0078] As mentioned above, the target execution cycle of the first instruction includes an original execution cycle and an additional execution cycle, and the storage unit sends the execution result to the bus according to the target execution cycle, specifically, sends the execution result to the bus according to the additional execution cycle.

[0079] Specifically, after obtaining the execution result of the first instruction sent by the execution unit, the storage unit allocates storage space for the execution result according to the occupancy of the internal storage register, and stores the execution result in the storage space. At the same time, the storage time of the execution result in the storage unit is counted, and the execution result is sent to the bus when the storage time reaches the additional execution cycle. In other words, after the storage unit stores the execution result of the first instruction in the storage space allocated to it, the clock cycle is counted according to the additional execution cycle, and after the additional execution cycle is consumed, the execution result is uploaded to the bus, and the entire execution process of the first instruction is completed.

[0080] It should be noted that, in this embodiment, the processor core only includes one emission queue and one execution unit, and the number of instructions competing for the bus is relatively small. The first instruction that failed to compete for each bus can be uniquely characterized by an additional execution cycle. Based on this, the additional execution cycle of the first instruction provided in this embodiment mainly includes two functions. One is the timing standard as the storage duration mentioned in the above content, and the other is a reference basis for the execution unit to obtain the execution result. Specifically, when the storage unit stores the execution result, the additional execution cycle of the first instruction is used as the identification information of the execution result. In the specific implementation, a binding relationship between the additional execution cycle and the execution result can be established. Since the additional execution cycle of each instruction determined to avoid bus competition is unique and has a one-to-one correspondence with the corresponding instruction, the additional execution cycle is used as the identification of the execution result of the first instruction, and the storage address of the execution result can be determined according to the additional execution cycle. The specific application of the second function will be detailed in the subsequent content, and will not be described in detail here. As for the application scenario where the processor core includes multiple transmit queues and multiple execution units, which makes it difficult to correspond the additional execution cycles to the first instruction one-to-one, the storage unit can also mark the stored execution results in other ways. The specific implementation method will be expanded in the subsequent content and will not be described in detail here.

[0081] It can be seen that the execution unit executes the first instruction according to the original execution cycle, and the storage unit sends the execution result of the first instruction to the bus according to the additional execution cycle. In other words, the target execution cycle is the actual cycle from the first instruction entering the execution unit to the execution result being uploaded to the bus.

[0082] Based on the above execution process, it can be seen that although the present application extends the overall execution cycle of the first instruction, it does not change the number of clock cycles required to specifically execute the first instruction and determine the execution result, that is, it does not change the original execution cycle of the first instruction. Such a setting can avoid any impact on the initial setting of the first instruction and the corresponding instruction set. The specific execution process of executing the first instruction according to the original execution cycle can be fully implemented with reference to the relevant technology. Different from the processing method of uploading the execution result to the bus immediately after obtaining the execution result of the first instruction in the related technology (which is also the essential reason for the bus contention), after obtaining the execution result of the first instruction, the execution unit sends the execution result to the bus according to the additional execution cycle, that is, the execution result is sent to the bus only when the clock cycle reaches the additional execution cycle.

[0083] To summarize, the instruction processing method provided by the present application, after determining the first instruction that failed to compete with other instructions for the bus, avoids the first instruction from competing with other instructions for the bus by extending the execution cycle, and normally transmits and executes the first instruction. Compared with the prior art, the instruction that failed the bus competition can still be normally transmitted and executed, and the bus contention is no longer resolved by pausing the pipeline. The entire pipeline is filled with instructions, thereby avoiding the insertion of bubbles in the pipeline, improving the instruction processing efficiency of the pipeline, and thereby improving the overall performance of the processor.

[0084] The following combines the above examples and Figure 4 , introduces the instruction processing process implemented by the instruction processing method provided by this application.

[0085] Continuing with the previous example, assume that there are 5 instructions A, B, C, D, and E that need to be executed in sequence, where the original execution cycles of A, B, C, and E each include 5 clock cycles (shown as Cycle in the figure), and the original execution cycle of D includes 2 clock cycles.

[0086] Based on the above premise, according to the instruction processing method provided in this application, the execution process of instructions A, B, C, D, and E is as follows.

[0087] Cycle 1: A enters the pipeline. At this time, 5 clock cycles are required to execute instruction A, which is indicated in the figure as A having 5 cycles remaining.

[0088] Cycle2: B enters the pipeline. At this time, it takes 5 execution cycles to execute instruction B and 4 clock cycles to execute instruction A.

[0089] Cycle3: C enters the pipeline. At this time, there are 3 instructions being executed in the pipeline. C requires 5 clock cycles to execute, B requires 4 clock cycles, and A requires 3 clock cycles.

[0090] It can be seen that the execution cycle of the three instructions A, B, and C is the same, and the positions where the three enter the pipeline are also the same. After A, B, and C enter the pipeline, the next instruction to enter the pipeline should be D.

[0091] Cycle 4: According to the method provided in this application, the execution cycle of D is extended. The original execution cycle of D is 2 cycles, and the additional execution cycle is 3 cycles. Accordingly, the target execution cycle is 5 cycles. Since the target execution cycle is the execution cycle required for the complete execution of D, the position where D enters the pipeline needs to be based on Figure 4 The change shown is that the instructions A, B, and C enter the pipeline at the same position. In addition, the execution result of D is uploaded to the bus according to the target execution cycle and does not compete with other instructions for the bus.

[0092] Cycle5: E enters the pipeline, and the pipeline executes each instruction in sequence. After 5 clock cycles, the above 5 instructions A, B, C, D, and E will all be executed.

[0093] It can be seen that for these 5 instructions, according to the instruction processing method provided in this application, a total of 10 clock cycles are required to complete the execution, IPC=0.5. Compared with the prior art, the instruction processing method provided in this application can not only avoid instruction competition for the bus, but also significantly improve the instruction processing efficiency.

[0094] Furthermore, the present application also provides another instruction processing method, combining Figure 5 As shown, in Figure 3 Based on the illustrated embodiment, the instruction processing method provided in this embodiment also includes the following steps.

[0095] S150, the transmission queue broadcasts the first notification information.

[0096] After the transmission queue transmits the first instruction to the execution unit, the first notification information is broadcast to wake up other instructions associated with the first instruction through the first notification information. It can be seen from the above content that the transmission queue is responsible for the transmission management of each instruction in the pipeline. There may be instructions in the transmission queue that are associated with the first instruction and are not in the awakened state. Since there is only one transmission queue in the processor core, the broadcast object of the first notification information is the transmission queue itself, specifically each instruction stored in the transmission queue. It can be understood that when the transmission queue broadcasts the first notification information, it is not necessary to distinguish whether each instruction is associated with the first instruction. It only needs to broadcast the first notification information to each instruction separately. The instructions that are associated with the first instruction will naturally be awakened, and accordingly, other instructions that are not associated with the first instruction will naturally not be awakened. As for the specific implementation of the instruction being awakened in response to the first notification information, reference can be made to the relevant technology, and this application does not limit this.

[0097] Compared with the related art, the transmission queue broadcasting first notification information in the present application mainly includes the following advantages.

[0098] First, in the related art, the instruction that fails to compete for the bus will not be emitted. Therefore, only one instruction execution result can be obtained in the same clock cycle. Accordingly, only one instruction corresponding to the notification information is broadcast in the same clock cycle, and only other instructions associated with the one instruction can be awakened. However, through the instruction processing method provided by the present application, the first instruction that fails to compete for the bus will also be emitted, and the execution results of multiple instructions can be obtained at the same time in the same clock cycle. Accordingly, the notification information corresponding to multiple instructions can be broadcast in the same clock cycle, and then other instructions associated with multiple instructions can be awakened. That is, the present method increases the broadcast path of the first notification information, and the broadcast path increases according to the type of the original execution cycle of each instruction in the transmission queue, and the number of awakened instructions increases, which can effectively reduce the number of instructions that are not awakened in the transmission queue, and help improve the transmission efficiency of instructions.

[0099] Secondly, the first notification information also carries the additional execution cycle of the first instruction. Therefore, the first notification information can enable other instructions associated with the first instruction to be informed of changes in the execution cycle of the first instruction, thereby providing a basis for the orderly execution of each instruction.

[0100] S160. The transmit queue sends second notification information to the execution unit.

[0101] After the aforementioned steps, the execution unit executes the first instruction according to the original execution cycle of the first instruction and stores the corresponding result in the storage unit. Although the execution result of the first instruction has not yet entered the bus, it is already in a usable state and can be used as a source operand of other instructions associated with the first instruction. Based on this, the emission queue sends a second notification message to the execution unit, instructing the execution unit to execute the second instruction associated with the first instruction based on the execution result of the first instruction through the second notification message.

[0102] In practical applications, the instructions stored in the transmission queue and having an associated relationship also include a preset transmission interval between the associated instructions in the instruction information, and the preset transmission interval is used to determine the transmission timing of the instruction to be transmitted later. In the present application, the first instruction is transmitted first as a producer, and correspondingly, the second instruction is transmitted later as a consumer, and the execution result of the first instruction will be used as the source operand of the second instruction. As mentioned above, within the duration corresponding to the additional execution cycle, the execution result of the first instruction is already available, so the additional execution cycle is also the time when the second notification information can be sent. Based on this, in an optional implementation, the transmission queue determines the target clock cycle based on the additional execution cycle of the first instruction (obtained when broadcasting the first notification information) and the preset transmission interval between the second instruction and the first instruction (recorded in the instruction information of the second instruction), and sends a second notification message to the execution unit in the target clock cycle, indicating that the execution unit can obtain the execution result of the first instruction from the storage unit when executing the second instruction, and execute the second instruction based on the obtained execution result. The present application can accurately determine the timing relationship between the first instruction and the second instruction through the producer's additional execution cycle and the consumer's preset sending interval, which helps to improve the accuracy and efficiency of instruction execution.

[0103] Furthermore, as mentioned above, when the processor core includes only one transmit queue and one execution unit, the additional execution cycle can be used as a unique identifier of the instruction execution result. Therefore, in this embodiment, the additional execution cycle can also be used as the instruction identifier of the instruction. When the storage unit stores the execution result of the instruction, it establishes a binding relationship between the execution result and the instruction identifier, that is, the additional execution cycle, and there is also a one-to-one correspondence between the additional execution cycle and the instruction. Based on this, the second notification information sent by the transmit queue also includes the additional execution cycle of the first instruction. After obtaining the second notification information, the execution unit can determine the storage address of the execution result of the first instruction based on the additional execution cycle of the first instruction among the execution results of multiple instructions, and then after the subsequent second instruction enters the execution unit, the execution result of the first instruction is obtained according to the aforementioned storage address, and the second instruction is executed with the execution result of the first instruction as the source operand of the second instruction.

[0104] It can be seen that the second notification information provided in this embodiment mainly includes two functions: one is to notify the execution unit that it can use the execution result stored in the storage unit for the execution of subsequent instructions; the other is to indicate the storage location of the execution result of the instruction in the storage unit, or in other words, to identify the target execution result in the storage unit.

[0105] To sum up, the instruction processing method provided in the embodiment of the present application can indicate to the producer, that is, the storage location of the execution result of the previous instruction in the storage unit through an additional execution cycle of the first instruction. Even if the execution result of the producer has not been written to the bus, the consumer, that is, the subsequent instruction can also obtain the corresponding execution result in advance and use it for calculation, thereby significantly improving bus utilization and overall performance.

[0106] Further, as another typical embodiment, the basic architecture of the processor core provided by the present application can also be seen in Figure 6 As shown, the processor core provided in this embodiment includes a storage unit 10, an arbitration unit 11, at least two transmission queues ( Figure 6 is shown with n issue queues, n ≥ 2) and at least two execution units ( Figure 6 , m execution units are shown, m≥2), and at the same time, this embodiment also shows p buses, where p≥1.

[0107] Combination Figure 6 As shown, the arbitration unit 11 is respectively connected to each transmission queue for communication, and any transmission queue can perform two-way data exchange with the arbitration unit 11 ( Figure 6 Any launch queue can send instructions to any execution unit. In practical applications, the launch queue mainly selects the target execution unit from among the execution units based on the idle state of the execution unit. Since the communication relationship between the launch queue and the execution unit is flexible and variable, Figure 6 Indicated by dotted lines. Any execution unit sends the execution result of the instruction to the bus according to the bus matching situation and the idle situation of the bus. The communication relationship between the two is also flexible and variable, so it is also shown by dotted lines. In a preferred embodiment, the number of execution units is greater than the number of buses. Such a setting can ensure that enough execution units can be provided to execute instructions. At the same time, the execution unit is redundantly set relative to the bus, which can improve the utilization rate of the bus and make more full use of bus resources.

[0108] Each execution unit is connected to a storage unit, respectively, and can store the execution result of the instruction in the storage unit. At the same time, each execution unit can also obtain the execution result stored in the storage unit 10 according to the calling relationship between the instructions. It should be noted that in order to more clearly demonstrate the hardware architecture of the processor core provided in this embodiment, with respect to the connection relationship between the storage unit and each execution unit, the figure only shows the communication connection between the storage unit 10 and the execution unit m. In actual applications, the storage unit 10 can be respectively communicated with each execution unit to provide the execution result of the instruction to the corresponding execution unit.

[0109] The specific connection and interaction relationship of each component in the processor core, their respective functions, and the instruction execution process that has not been clearly explained will be elaborated in detail in the subsequent content in conjunction with another instruction processing method provided by this application, and will not be described in detail here. Figure 6 In the application scenario corresponding to the embodiment shown, the instruction processing method provided by the present application may include the following: Figure 7 The following steps are shown.

[0110] S200 , the arbitration unit determines, from the instructions in each transmit queue, a first instruction that fails to compete with other instructions for a bus.

[0111] As mentioned above, for any instruction entering the transmit queue, the transmit queue stores the instruction information of the instruction through the corresponding register, where the instruction information includes but is not limited to the execution cycle preset when the instruction is created, the preset sending interval between the instruction and other instructions, the source operands required for the instruction, and the specific operation corresponding to the instruction, etc. Of course, other information may also be included. Please refer to the relevant technology for details, which will not be listed here one by one.

[0112] In the case where the processor core includes multiple emission queues, for any emission queue, there may be multiple instructions in the emission queue waiting for emission at the same time, and the original execution cycle of each instruction is known. More importantly, any emission queue can also know the original execution cycle of each instruction in other emission queues in the processor core. Based on this, before any emission queue emits an instruction, it can determine whether there are multiple instructions that have been executed in the same clock cycle and request to send the execution result to the bus according to the original execution cycle of the instructions in each emission queue. If so, it is determined that there is bus contention. On the contrary, if not, it is determined that there is no bus contention. Further, it can also be combined with the execution status of the instructions that have been issued and entered into a certain execution unit for execution (for example, the instruction needs to be executed after how many clock cycles, send the execution result to the bus and release the execution unit) to determine whether the instructions compete for the bus. Based on this, each emission queue sends the instruction information of the target instruction that competes for the bus with other instructions (including the instructions stored by itself and the instructions stored by other emission queues) in the instructions stored by itself to the arbitration unit.

[0113] After receiving the instruction information of each target instruction provided by each transmit queue, the arbitration unit determines the target instruction that failed to compete for the bus, that is, the first instruction, according to the obtained instruction information. As for the specific implementation process of the arbitration unit determining the first instruction according to the instruction information of the target instruction, it can be implemented with reference to the relevant content of S100 in the above embodiment, which will not be repeated here.

[0114] S210 , the arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle.

[0115] In an optional implementation, S210 may be implemented with reference to the relevant contents of the aforementioned embodiment S110, which will not be repeated here.

[0116] S220 , the target issue queue issues a first instruction to the target execution unit.

[0117] In this embodiment, the target emission queue refers to the emission queue to which the first instruction belongs. As mentioned above, in the prior art, if an instruction in the emission queue fails to compete for the bus, the emission of the instruction will be suspended, causing the instruction pipeline to be in a short pause state and inserting a bubble in the pipeline. Compared with the prior art, the instruction processing method provided by the present application, after determining the first instruction that failed the bus competition, still allows the target emission queue to which the first instruction belongs to normally emit the first instruction. Similar to the above embodiment, the first instruction still carries the target execution cycle.

[0118] As mentioned above, the number of execution units is usually greater than the number of buses. Therefore, in any clock cycle, there is a high possibility that there are execution units in an idle state. It can be seen that redundant settings of execution units are helpful for improving the processing efficiency of instructions. In the present application, the execution unit that is in an idle state when the first instruction enters is used as the target execution unit. In other words, the execution unit that is in an idle state and can execute the first instruction is used as the target execution unit, and the target launch queue sends the first instruction to the target execution unit. As for the specific implementation method of selecting a target execution unit that is in an idle state and can execute the first instruction among multiple execution units, it can be implemented with reference to the relevant technical implementation, which will not be described in detail here.

[0119] S230. The target execution unit executes the first instruction according to the target execution cycle, and stores the execution result in the storage unit.

[0120] After receiving the first instruction, the target execution unit may execute the first instruction according to the target execution cycle carried by the first instruction, and store the obtained execution result in the storage unit.

[0121] As mentioned above, the target execution cycle of the first instruction includes the original execution cycle and the additional execution cycle. Based on this, the target execution unit executes the first instruction according to the original execution cycle to obtain the execution result of the first instruction. As for the specific implementation of the target execution unit executing the first instruction according to the original execution cycle, please refer to the aforementioned content and related technical implementations, which will not be expanded here.

[0122] After obtaining the execution result of the first instruction, the target execution unit sends the execution result and an additional execution cycle to the storage unit, so that the storage unit stores the execution result of the first instruction.

[0123] Referring to the foregoing, in the instruction processing method provided in the present application, the instructions executed by the target execution unit can be divided into two types, the first type is instructions that successfully compete for the bus and do not compete for the bus with other instructions, and the second type is instructions that fail to compete for the bus with other instructions, such as the first instruction described in this embodiment. For the first type of instructions, the target execution unit sends the obtained execution result to the bus immediately after executing the instruction according to the original execution cycle carried by the instruction and obtaining the execution result. For the second type of instructions, after obtaining the execution result, the execution result cannot be sent directly to the bus, but is first stored in the storage unit.

[0124] Based on the above situation, before executing any instruction, the target execution unit needs to determine which of the above methods is used to execute the resulting instruction. In an optional implementation, the target transmit queue adds a first identifier to the instruction information of the instruction that failed to compete for the bus, and indicates through the first identifier that the execution result of the corresponding instruction needs to be stored in the storage unit.

[0125] After receiving the first instruction, the target execution unit first determines whether the first instruction carries the first identifier. If the first instruction carries the first identifier, it means that the target execution unit needs to send the execution result of the first instruction and an additional execution cycle to the storage unit.

[0126] Furthermore, in this embodiment, since the processor core includes multiple emission queues, there may be multiple first instructions that enter the execution unit for execution, and each first instruction corresponds to a corresponding additional execution cycle. In this case, it is difficult for the additional execution cycle to uniquely represent a certain first instruction, that is, there is no longer a one-to-one correspondence between the first instruction and the additional execution cycle. Therefore, it is not possible to use the additional execution cycle as an identifier for storing the execution result as in the aforementioned embodiment. Based on this, as an optional implementation method, the target execution unit can also send the instruction identifier of the first instruction to the storage unit, and the storage unit stores the execution result of the first instruction based on the instruction identifier of the first instruction. Of course, other information that can uniquely represent the first instruction can also be provided to the storage unit, which will not be described in detail here. Without exceeding the core idea of ​​the present application, it also falls within the scope of protection of the present application.

[0127] S240. The storage unit sends the execution result to the bus according to the target execution cycle.

[0128] As mentioned above, the target execution cycle of the first instruction includes an original execution cycle and an additional execution cycle, and the storage unit sends the execution result to the bus according to the target execution cycle, specifically, sends the execution result to the bus according to the additional execution cycle.

[0129] Specifically, after obtaining the execution result of the first instruction sent by the target execution unit, the storage unit allocates storage space for the execution result according to the occupancy of the internal storage register, and stores the execution result in the storage space. At the same time, the storage time of the execution result in the storage unit is counted, and the execution result is sent to the bus when the storage time reaches the additional execution cycle. In other words, after the storage unit stores the execution result of the first instruction in the storage space allocated to it, the clock cycle is counted according to the additional execution cycle, and after the additional execution cycle is consumed, the execution result is uploaded to the bus, and the entire execution process of the first instruction is completed.

[0130] It should be noted that, in this embodiment, it is difficult to uniquely characterize the first instruction that fails each competing bus through an additional execution cycle. Based on this, as an optional implementation, when storing the execution result, the storage unit uses the instruction identifier of the first instruction as the identification information of the execution result. In a specific implementation, a binding relationship between the instruction identifier and the execution result can be established, and the storage address of the execution result can be determined according to the instruction identifier.

[0131] It can be seen that the target execution unit executes the first instruction according to the original execution cycle, and the storage unit sends the execution result of the first instruction to the bus according to the additional execution cycle. In other words, the target execution cycle is the actual cycle from the first instruction entering the execution unit to the execution result being uploaded to the bus.

[0132] Based on the above execution process, it can be seen that compared with the aforementioned embodiment, the instruction processing method provided in this embodiment can process multiple emission queues at the same time, support concurrent processing of multiple instructions, and can further improve instruction processing efficiency and improve bus utilization.

[0133] S250: The target transmission queue broadcasts first notification information.

[0134] After the target transmission queue transmits the first instruction to the target execution unit, the first notification information is broadcasted to wake up other instructions associated with the first instruction through the first notification information. It can be seen from the above content that each transmission queue is responsible for the transmission management of each instruction in the pipeline. There may be instructions associated with the first instruction and not in the awakened state in any transmission queue. Since the processor core includes multiple transmission queues, the broadcast object of the first notification information is all transmission queues in the processor core, specifically each instruction stored in each transmission queue. For other related implementation processes of this step, please refer to the related content of the above embodiment S150, which will not be repeated here.

[0135] S260: The target issue queue broadcasts second notification information to each execution unit.

[0136] After the above steps, the target execution unit executes the first instruction according to the original execution cycle of the first instruction and stores the corresponding result in the storage unit. Although the execution result of the first instruction has not yet entered the bus, it is already in an available state and can be used as a source operand of other instructions associated with the first instruction. Based on this, the target emission queue sends a second notification message to each execution unit in the processor core respectively, and indicates through the second notification message that each execution unit can execute the second instruction associated with the first instruction based on the execution result of the first instruction. As for the specific implementation of the target emission queue broadcasting the second notification message to each execution unit, the relevant content of S160 in the above embodiment can be referred to, and will not be repeated here.

[0137] Furthermore, as described above, in the present embodiment, the processor core includes multiple transmit queues and multiple execution units, which makes it difficult for the additional execution cycle of the first instruction to uniquely represent the first instruction and the execution result of the first instruction. Based on this, as an optional implementation, the second notification information includes the instruction identifier of the first instruction. Since the storage unit indicates the storage address of the execution result with the instruction identifier when storing the execution result, it is necessary to use the execution unit of the execution result of the first instruction. Among the execution results of multiple instructions, the storage address of the execution result of the first instruction can be determined based on the instruction identifier of the first instruction, and the execution result of the first instruction is further obtained according to the obtained storage address, thereby completing the execution of the second instruction.

[0138] To sum up, the instruction processing method provided in the embodiment of the present application can indicate the producer, that is, the storage location of the execution result of the previous instruction in the storage unit through the instruction identifier of the first instruction. Even if the execution result of the producer has not been written to the bus, the consumer, that is, the subsequent instruction can also obtain the corresponding execution result in advance and use it for calculation, thereby significantly improving the bus utilization and overall performance.

[0139] Combine the following Figures 8 to 10 The example shown briefly illustrates the application of this application Figure 7 The instruction processing method provided by the illustrated embodiment performs the main process of instruction processing.

[0140] exist Figures 8 to 10 In the example shown, the processor core includes n issue queues and m execution units. Issue queue 1 includes X instructions with an original execution cycle of 2 cycles, issue queue 2 includes Y instructions with an original execution cycle of 3 cycles, and issue queue n includes Z instructions with an original execution cycle of 2 cycles. Figures 8 to 10The idle state of each execution unit in different clock cycles is also shown. Taking execution unit 2 as an example, it is occupied in clock cycles 2-3 and idle in the rest of the time. This means that instruction Y cannot enter execution unit 2 in 3 cycles, and correspondingly, instruction X cannot enter execution unit 2 in 2 cycles. The same is true for other execution units, which will not be repeated here. As mentioned above, in the process of instructions entering the pipeline, the position where the instructions enter the pipeline (the corresponding cycle position) is fixed, and the entry positions of instructions in different execution cycles are different, while the positions where instructions in the same execution cycle enter the pipeline are the same.

[0141] Combination Figure 8-Figure 10 As shown, it can also be seen that the longest original execution cycle of the instruction is defined as t Cycle. At the same time, there are a total of m execution units, so a two-dimensional network structure with a capacity of t×m can be constructed. Through this structure, each emission queue can clearly determine the idle state of each bus and execution unit. As for the specific implementation of determining the target execution unit based on the two-dimensional network structure, reference can be made to the relevant technical implementation, which will not be described in detail here. Of course, the idle state of the bus and execution unit can also be determined by other methods, which will not be listed here one by one.

[0142] Based on the above, see Figure 8 As shown, each issue queue can obtain instruction information of any instruction in itself and other issue queues, such as the original execution cycle of the instruction, based on which each issue queue determines the target instruction that competes with other instructions for the bus. In this embodiment, the original execution cycle of the X instruction is the same as that of the Z instruction, so the issue queue 1 uses the X instruction as the target instruction and sends the instruction information of the X instruction to the arbitration unit, and correspondingly, the issue queue n uses the Z instruction as the target instruction and sends the instruction information of the Z instruction to the arbitration unit.

[0143] Combination Fig. 9 As shown, based on the above arbitration rules, the arbitration unit determines that the X instruction successfully competes for the bus, and the Z instruction fails to compete for the bus, that is, the Z instruction is the first instruction. Based on this, the X instruction enters the execution unit 1 in the 2 cycle (the execution unit 1 is in an idle state at this time), and the Y instruction also enters the execution unit 1 in the 3 cycle. The Z instruction fails to compete for the bus, and the other execution units are all in the occupied state at the 2 cycle. The Z instruction cannot enter any execution unit for execution. Fig. 9 Indicated by ×.

[0144] Combination Fig.10As shown, the arbitration unit extends the execution cycle of the Z instruction, and the corresponding target execution cycle is 4 cycles, that is, the original execution cycle is 2 cycles, the additional execution cycle is 2 cycles, and the execution unit 1 is in an idle state during 4 cycles. Therefore, the execution unit 1 can be used as the target execution unit, and the emission queue n (that is, the target emission queue) emits the Z instruction to the target execution unit.

[0145] After the Z instruction enters the target execution unit, it is executed by the target execution unit. The subsequent execution result storage and sending process can refer to the above content and will not be repeated here.

[0146] The present application also provides a processor, see Fig.11 As shown, the processor provided by the present application includes at least one processor core ( Fig.11 Including one Figure 2 The processor core of the illustrated embodiment is shown as an example, and the processor core includes a storage unit 10, an arbitration unit 11, a transmission queue 12, and an execution unit 13.

[0147] Combination Fig.11 As shown, the processor provided in this embodiment also includes: a storage channel 15 used when the execution unit 13 sends the instruction execution result to the storage unit 10, an upload channel 16 for the storage unit 10 to send the execution result to the bus 14, a bypass channel 17 for the execution unit 13 to obtain the instruction execution result, a bypass channel 18 for the execution unit 13 to directly obtain the instruction execution result, and a dynamic allocation unit 19.

[0148] The transmission queue 12 transmits the first instruction to the dynamic allocation unit 19 , and at the same time, broadcasts the aforementioned first notification information through the broadcast channel 20 . After obtaining the first instruction, the dynamic allocation unit 19 decodes the first instruction and sends the decoded first instruction to the execution unit 13 .

[0149] It should be noted that Fig.11 What is shown is only a schematic diagram of the execution unit 13. In terms of specific hardware implementation, the input information involved in the execution unit 13 includes multiple types, such as operation data, first notification information, instruction basic information, and instruction bypass information, etc., which will not be described in detail here. For the parts that are not elaborated in detail in this application, they can all be implemented by referring to relevant technologies.

[0150] Among them, the operation data can come from all modules where the operation instructions that support the instruction processing method provided by this application are located. In actual implementation, selecting instructions and operation data related to high-frequency instruction operation modules can obtain better energy efficiency while saving logical overhead.

[0151] The basic information of instructions includes but is not limited to instruction operation type, operation unit information, original execution cycle, additional execution cycle, instruction encoding, etc. In this method, the basic information of instructions accompanies the instruction flow, thereby realizing the instruction processing method provided by the above embodiment.

[0152] The bypass information includes bypass-related control information of the instruction, including but not limited to bypass enable, bypass source, bypass purpose, bypass timing and other information.

[0153] The execution unit 13 executes the first instruction according to the original execution cycle of the first instruction, and the execution result is stored in the storage unit 10 through the storage channel 15. The storage unit 10 further uploads the execution result to the bus 14 through the upload channel 16 according to the additional execution cycle.

[0154] The execution unit 13 obtains the execution result of the first instruction through the bypass channel 17 in response to the aforementioned second notification information, and executes the second instruction based on the execution result of the first instruction after the second instruction enters the execution unit 13 .

[0155] Combination Fig.11 As shown, the output of the execution unit 13 includes three parts. The first part is bypassed through the bypass channel 18 and the execution result is used for the execution of subsequent instructions. The second part is to store the execution result of the instruction to the storage unit 10 through the storage channel 15. The third part is to directly upload the execution result to the bus 14.

[0156] To sum up, compared with the processors in the related art, the processor provided by the present application stores the execution results of instructions that failed bus contention through a storage unit, and sends the execution results to the bus according to the additional execution cycle of the instruction, so that the instructions that failed bus contention can still be emitted and executed normally, and the bus contention is no longer resolved by pausing the pipeline. The entire pipeline is filled with instructions, thereby avoiding the insertion of bubbles in the pipeline, improving the instruction processing efficiency of the pipeline, and thereby improving the overall performance of the processor.

[0157] The present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the instruction processing method provided in any of the above embodiments when executing the computer program.

[0158] In some embodiments, this embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash disk, an SD (Secure Digital Memory Card) card, an MMC (Multimedia Card) card, etc., in which one or more instructions for implementing the above steps are stored. When the one or more instructions are executed by one or more processors, the processors execute the instruction processing method described above. For the relevant specific implementation, please refer to the above description, which will not be repeated here.

[0159] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the steps of the instruction processing method according to various embodiments of the present application described in the above content of this specification.

[0160] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0161] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications and improvements. For example, the various devices or components described above may be implemented by hardware, or by software, firmware, or a combination of some or all of the three.

[0162] In addition, although the present disclosure makes various references to certain units in the system according to embodiments of the present disclosure, any number of different units can be used and run on the client and / or server. The units are only illustrative, and different aspects of the system and method can use different units.

[0163] Flowcharts are used in this disclosure to illustrate the steps of the method according to the embodiments of the present disclosure. It should be understood that the preceding or following steps are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may also be added to these processes.

[0164] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, etc. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any particular form of combination of hardware and software.

[0165] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or highly formal sense, unless explicitly defined as such herein.

[0166] The above is an explanation of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure are described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined in the claims. It should be understood that the above is an explanation of the present disclosure and should not be considered to be limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.

Claims

1. A command processing method, characterized in that: Applied to a processor core, the processor core includes a storage unit, an arbitration unit, at least one transmit queue, and at least one execution unit, the method includes: The arbitration unit determines, among the instructions in each of the transmit queues, a first instruction that fails to compete with other instructions for a bus; The arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle, wherein the target execution cycle can prevent the first instruction from competing with other instructions for a bus; The target issue queue issues the first instruction to the target execution unit; The first instruction carries the target execution cycle, the target emission queue is the emission queue to which the first instruction belongs, and the target execution unit is in an idle state when the first instruction enters; The target execution unit executes the first instruction according to the target execution cycle, and stores the execution result in the storage unit; The storage unit sends the execution result to a bus according to the target execution cycle.

2. The method according to claim 1, characterized in that The arbitration unit determines, from the instructions of each of the transmit queues, a first instruction that fails to compete with other instructions for a bus, including: Each of the transmission queues sends instruction information of a target instruction competing with other instructions for a bus to the arbitration unit respectively; The arbitration unit determines a first instruction that fails in bus contention among the target instructions based on the instruction information.

3. The method according to claim 2, characterized in that The instruction information includes an instruction identifier that uniquely represents the instruction; The arbitration unit determines, based on the instruction information, a first instruction in each of the target instructions that fails to compete for the bus, including: Based on the instruction identifiers corresponding to the target instructions, a first instruction that fails in bus contention is determined.

4. The method according to claim 1, characterized in that: The arbitration unit extends the execution cycle of the first instruction to obtain a target execution cycle, including: The arbitration unit increases the clock cycle according to a preset stepping rule based on the original execution cycle of the first instruction until the first instruction avoids competing with other instructions for the bus, thereby obtaining a target execution cycle.

5. The method according to claim 4, characterized in that The target execution unit executes the first instruction according to the target execution cycle and stores the execution result in the storage unit, including: The target execution unit executes the first instruction according to the original execution cycle, and sends the execution result and the additional execution cycle to the storage unit; The additional execution cycle includes all clock cycles added according to the preset step rule.

6. The method according to claim 5, characterized in that The storage unit sends the execution result to the bus according to the target execution cycle, including: The storage unit stores the execution result, and sends the execution result to a bus when the storage time reaches the additional execution cycle.

7. The method according to claim 5, characterized in that The target execution unit sends the execution result and the additional execution cycle to the storage unit, including: The target execution unit determines whether the first instruction carries a first identifier, where the first identifier is used to indicate that an execution result of the first instruction needs to be stored in the storage unit; If the first instruction carries the first identifier, the target execution unit sends the execution result and the additional execution cycle to the storage unit.

8. The method according to claim 5, characterized in that After the target issue queue issues the first instruction to the target execution unit, the method further includes: The target transmit queue broadcasts first notification information, where the first notification information is used to wake up other instructions associated with the first instruction, and the first notification information includes an instruction identifier that can uniquely indicate the first instruction.

9. The method according to claim 8, characterized in that After the target transmission queue broadcasts the first notification information, the method further includes: The target issue queue broadcasts second notification information to each of the execution units, where the second notification information is used to instruct to execute a second instruction associated with the first instruction based on the execution result.

10. The method according to claim 9, characterized in that The second notification information includes an instruction identifier of the first instruction; The process of any of the execution units executing a second instruction associated with the first instruction based on the execution result includes: The execution unit determines, among the execution results of the plurality of instructions, a storage address of the execution result of the first instruction based on the instruction identifier of the first instruction; The execution unit obtains the execution result according to the storage address, and executes the second instruction using the execution result as a source operand of the second instruction.

11. The method according to claim 9, characterized in that The target transmit queue broadcasts a second notification message to each of the execution units, including: The target issue queue determines a target clock cycle based on the additional execution cycle and a preset sending interval between the second instruction and the first instruction; The target issue queue broadcasts a second notification message to each of the execution units in the target clock cycle.

12. A processor core, characterized in that: The processor core is used to execute the instruction processing method according to any one of claims 1 to 11.

13. A processor, characterized in that: include: At least one processor core as claimed in claim 12.

14. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the instruction processing method according to any one of claims 1 to 11 when executing the computer program.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the instruction processing method according to any one of claims 1 to 11 is implemented.