Instruction processing method, apparatus, circuit, transmitter, chip, medium and product

By setting a detection circuit on the transmitter and using the execution level of the instruction and the operation clock to determine the dependency relationship, the problem of complex inter-instruction dependencies in the very long instruction word architecture is solved, which improves the robustness and efficiency of the processor and reduces the chip size.

CN116991480BActive Publication Date: 2026-11-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211051669.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-11-20
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

In very long instruction word (VLSI) architectures, the handling of dependencies between instructions is complex, leading to complex hardware routing, increased chip size, and poor robustness.

Method used

By placing detection circuits on the transmitter to maintain the current state information of computing resources, and using the execution level of instructions and the computing clock to determine dependencies, resource conflicts can be avoided and hardware wiring pressure can be reduced.

Benefits of technology

It improves the processor's robustness, reduces chip size, and enhances instruction processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116991480B_ABST
    Figure CN116991480B_ABST
Patent Text Reader

Abstract

The application discloses an instruction processing method, device, circuit, transmitter, chip, medium and product. The method comprises the following steps: obtaining operation information of a to-be-transmitted instruction, wherein the operation information is used for indicating related operation resources of the to-be-transmitted instruction; determining current state information of the related operation resources, wherein the current state information is determined according to an execution stage number and an operation clock of a current processing instruction; and pausing processing of the to-be-transmitted instruction when it is determined according to the current state information that the to-be-transmitted instruction and the current processing instruction have a dependency relationship. According to the embodiment of the application, the execution stage number and the operation clock in the operation information of the current processing instruction are used to maintain the state information of the operation resources, the dependency relationship between instructions is determined, the execution of the later stage is prevented from constantly feeding back the execution situation to the transmitter through wiring, the coupling degree between the transmission module and the subsequent execution unit in the transmitter is reduced, the efficiency of processing the transmission instruction is improved, the wiring pressure is reduced, and the size of the chip is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the general field of computer technology, and more particularly to instruction processing methods, circuits, transmitters, chips, media, and program products. Background Technology

[0002] The Very Long Instruction Word (VLIW) architecture is widely used. In related technologies, the dependencies between instructions in the VLIW architecture at the time of issuance are determined and processed by the compiler; or they are processed by the configuration of a hardware scoreboard in conjunction with the subsequent processing units on the pipeline.

[0003] For a compiler, it needs to have high processing power. However, for the cooperation between the subsequent arithmetic unit and the scoreboard, the subsequent arithmetic unit needs to continuously feed back the execution status of the instructions to the issuing unit through wiring. This results in poor robustness between the arithmetic unit and the issuing unit, complex hardware wiring, and an increase in chip size. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide an instruction processing method, apparatus, circuit, transmitter, chip, medium and program product. By arranging a detection circuit for detecting the dependencies between instructions on the transmitter of the processing chip, the current status information of the current processing instruction's occupation of computing resources is maintained, so as to centrally manage the dependencies between instructions, reduce the hardware wiring pressure and improve the stability of the processor.

[0005] In a first aspect, embodiments of this application provide an instruction issuance processing method, the method comprising:

[0006] Obtain the operation information of the command to be launched, which is used to indicate the relevant computing resources related to the command to be launched.

[0007] The current status information of the relevant computing resources is determined based on the execution level and computing clock of the current processing instruction, which are obtained before the current processing instruction is processed.

[0008] If the current status information determines that the instruction to be launched has a dependency relationship with the currently processed instruction, then the processing of the instruction to be launched is paused.

[0009] Secondly, embodiments of this application provide an instruction processing apparatus, comprising:

[0010] The acquisition module is used to acquire the operation information of the command to be launched, which is used to indicate the relevant computing resources related to the command to be launched.

[0011] The determination module is used to determine the current status information of the relevant computing resources. The current status information is determined based on the execution level and computing clock of the current processing instruction, which are obtained before the current processing instruction is processed.

[0012] The processing module is used to pause the processing of the instruction to be transmitted when it is determined from the current status information that there is a dependency between the instruction to be transmitted and the currently processed instruction.

[0013] Thirdly, this application provides an example of a detection circuit, comprising: a processor and a computer program stored in a memory and executable on the processor, the processor being used to execute the instruction processing method as described in the first aspect.

[0014] Fourthly, embodiments of this application provide a transmitter, including: the detection circuit and signal processing module described in the third aspect.

[0015] Fifthly, embodiments of this application provide a chip including the transmitter as described in the fourth aspect.

[0016] In a sixth aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon for implementing the instruction processing method as described in the first aspect.

[0017] In a seventh aspect, embodiments of this application provide a computer program product that includes instructions that, when executed, implement the instruction processing method as described in the first aspect.

[0018] The instruction processing method, apparatus, circuit, transmitter, chip, medium, and product provided in this application maintain the current state information of computing resources through a detection circuit on the transmitter. This current state information is determined based on the execution level and clock speed of all currently processed instructions, characterizing the occupancy of computing resources by all currently processed instructions. When an instruction is ready to be transmitted, the current state information of the computing resources related to the instruction is read, and the existence of a dependency between the currently processed instruction and the instruction to be transmitted is determined based on this information. If the detection result indicates a dependency, the processing of the instruction to be transmitted is paused, thus avoiding resource conflicts between instructions. This method maintains the state information of computing resources based on the execution level and clock speed of the current instruction. The execution level and clock speed of the instruction are different from the execution status of the instruction; they are the operational information of the instruction itself and can be obtained without relying on feedback from subsequent execution units. Therefore, the solution provided in this application can determine the dependency between instructions without relying on the execution status reported by subsequent execution units, thereby reducing the coupling between the transmission module and subsequent execution units in the transmitter, improving robustness, and ultimately improving the efficiency of transmission instruction processing. In addition, since the detection circuit does not require the subsequent execution unit to report the execution status of the instruction, the wiring overhead caused by this is avoided, thus reducing the chip size. Attached Figure Description

[0019] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0020] Figure 1 The diagram shown is a schematic diagram of the instruction processing pipeline according to an embodiment of this application;

[0021] Figure 2 The diagram shown is a clock illustration of a data hazard according to an embodiment of this application;

[0022] Figure 3 The diagram shown is a clock illustration of a data hazard according to another embodiment of this application;

[0023] Figure 4 The diagram shown is a schematic representation of a structural hazard in an embodiment of this application.

[0024] Figure 5 The diagram shown is a flowchart illustrating the instruction processing method according to an embodiment of this application.

[0025] Figure 6 The diagram shown is a flowchart illustrating the instruction processing method of some embodiments of this application;

[0026] Figure 7 The diagram shown is a schematic diagram of the data hazard detection circuit structure according to an embodiment of this application;

[0027] Figure 8 The diagram shown is a flowchart of an instruction processing method according to another embodiment of this application.

[0028] Figure 9 The diagram shown is a clock diagram illustrating the handling of read-after-write data hazards according to an embodiment of this application.

[0029] Figure 10 The diagram shown is a flowchart of an instruction processing method according to another embodiment of this application.

[0030] Figure 11 The diagram shown is a clock diagram illustrating the handling of write-after-write data hazards according to an embodiment of this application.

[0031] Figure 12 The diagram shown is a schematic diagram of a structural hazard detection circuit according to an embodiment of this application;

[0032] Figure 13 The diagram shown is a flowchart of an instruction processing method according to another embodiment of this application.

[0033] Figure 14 The diagram shown is a clock diagram illustrating the handling of structural hazards in an embodiment of this application.

[0034] Figure 15 The diagram shown is a schematic diagram of the device structure of the detection circuit according to an embodiment of this application;

[0035] Figure 16 The diagram shown is a schematic diagram of the computer system of the transmitter in an embodiment of this application. Detailed Implementation

[0036] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the relevant disclosure and not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the disclosure are shown in the accompanying drawings.

[0037] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0038] It is understandable that a key direction for improving CPU performance is to enhance fine-grained parallelism at the instruction level, such as using pipelined data processing methods in the transmitter.

[0039] like Figure 1 The diagram shows a typical pipeline structure for transmitter command processing. Its main processing flow is as follows:

[0040] The front-end first performs instruction fetching and decoding, then sends the instruction to the issue unit, which can be understood as the first stage of the pipeline. When the instruction meets the issue conditions, it is issued to the subsequent execution unit. Next, based on the operand information of the instruction, the front-end reads registers from the register file to obtain the operands, execution stage, and related computational resources required by the instruction. After obtaining the operation information, the front-end performs the corresponding operations at each stage of the instruction sequentially. After the calculation is completed, the result is written back to the destination register in the register file.

[0041] It is understandable that different instructions have different operation processes, that is, different execution levels and related computing resources. For example, complex instructions may require more than ten execution pipelines to complete the operation, while simple addition instructions may only require one pipeline to complete the operation.

[0042] For example, Figure 2 The instruction processing clock diagram shown can be understood as having four levels of execution, with each level corresponding to a send unit, a read operation unit, a first-level processing unit, and a write-back unit.

[0043] Since each stage of the instruction processing pipeline EX to N may produce a result, the output of each stage of the pipeline needs to be selected by an N-to-1 multiplexer to select the data that needs to be written back.

[0044] It is understandable that, based on the pipelined instruction processing in the CPU, in order to further improve processing efficiency, a Very Long Instruction Word (VLIW) architecture can be used for instruction packaging and issuance.

[0045] In this Very Long Instruction Word (VLIW) architecture, an instruction packet can define multiple instructions, which can be distributed to different execution units for parallel execution. Figure 1 The pipeline shown synchronously processes multiple instructions to effectively improve CPU processing speed.

[0046] It is understandable that in a Very Long Instruction Word (VLIW) architecture, or in the pipelined instruction structure described above, since multiple instructions are distributed to different computing resources for parallel processing, the instructions that need to be processed in parallel cannot have dependencies (such as data hazards or structural hazards) when multiple computing resources execute multiple instructions, in order to ensure the normal operation of data business processing.

[0047] Building upon this, when issuing instructions, it's necessary to pre-determine the dependencies between instructions. For example, does the instruction to be issued depend on any instructions currently being processed on the pipeline's computing resources? If so, processing of the instruction to be issued is paused, and the process enters a waiting state. Processing then resumes once the dependency is resolved, ensuring the normal operation of data business logic and avoiding risks such as data hazards or structural hazards.

[0048] It is understandable that a data hazard can include both source register conflicts and destination register conflicts.

[0049] The main source register conflict occurs in read-after-write (RAW) situations, where the destination register of the previous instruction is the source register of the next instruction, and the previous instruction has not yet completed its write operation to the register when the next instruction is issued.

[0050] like Figure 2 As shown, an instruction is issued at time T0 with source operands a0 and a1 and destination operand a2; another instruction is issued at time T1 with source operands a2 and a3 and destination operand a4. Clearly, the source operand a2 of the second instruction is the same as the destination operand of the first instruction, both being a2. This means that when the second instruction executes, it needs to read the result of the first instruction's operation. Therefore, in the pipeline, if the second instruction reads a2 before the first instruction writes it back to the register, the second instruction will read an old value for a2, resulting in a data hazard.

[0051] Correspondingly, from the perspective of registers in the instruction processing pipeline, the relevant computational resources for the first instruction—namely, the destination register R2 where the result a2 needs to be written—are the same as the relevant computational resources for the second instruction—namely, the source register R2 where data needs to be read. Therefore, during instruction processing, if the second instruction reads the source register before the first instruction writes back to the destination register, the operand read by the second instruction will be an old value, resulting in a data hazard.

[0052] One type of destination register conflict is write-after-write (WAW). Because different instructions require different execution stages to complete, i.e., different clock cycles, two instructions with the same destination register in the instruction processing pipeline may have a write conflict when writing back to the destination register after completing their operations on the corresponding arithmetic unit. That is, the destination register of the previous instruction is the same as that of the next instruction, and the previous instruction has not yet completed its write-back operation when the next instruction writes to the destination register.

[0053] like Figure 3As shown, after an instruction is issued at time T0, its destination register is R2. At time T1, the issuing unit receives a new instruction, and its destination register is also R2, which is the same as the destination register of the instruction issued at time T0. If the instruction is issued directly at time T1, the write-back time of the first instruction will be in the same clock cycle as the write-back time of the instruction at time T0, resulting in a WAW (Wait-and-See) data hazard.

[0054] A structural hazard can be understood as a situation where two instructions require the same computational resources for processing within the same clock cycle, such as the same arithmetic unit, such as an addition unit or a multiplication unit, which are units with data processing functions. This application does not impose any restrictions on this.

[0055] like Figure 4 As shown, T0 and T1 issue the first instruction (instruction0) and the second instruction (instruction1) respectively. The hardware resources required for the second stage of processing (EX2) in the pipeline of the first instruction and the first stage of processing (EX1) in the pipeline of the first instruction are the same set of resources, both being arithmetic units C1, such as adders. According to the current pipeline clock, a resource conflict occurs between the two, that is, a structural hazard occurs.

[0056] It is understandable that, in order to resolve the dependencies between the aforementioned instructions and avoid conflicts such as data hazards or structural hazards, related technologies use hardware to handle these issues. For example, each processing unit in the later stages of the processing pipeline can feed back the execution status of each instruction to a scoreboard in the transmitter, and then use the scoreboard to determine whether there is a dependency between the currently processed instruction and the instruction to be transmitted.

[0057] It is understandable that using the method of feedback execution status from the post-processor would result in more signal lines returned by the post-processor unit for processing chips with more complex pipelines, which would increase the difficulty of layout and routing and ultimately increase the chip area. Furthermore, using the post-processor unit to feedback execution status increases the coupling between the transmitting unit and the post-processor unit, resulting in poor robustness.

[0058] In this embodiment, to avoid the aforementioned shortcomings in related technologies, the dependencies between instructions in the transmitter are accurately and effectively handled proactively. A designed detection circuit maintains state information characterizing the resource usage of each instruction during execution, based on its own operational information (execution level and clock speed). Before instruction is issued, the current state information maintaining the relevant resource usage of the instruction to be issued, maintained in the detection circuit, is proactively acquired. This information is then used to determine whether a dependency exists between the instruction to be issued and all currently processed instructions, allowing for direct processing or paused processing. This achieves centralized management of instruction dependencies in hardware, reducing compiler scheduling complexity, coupling between downstream processing units and the issuing unit, and wiring density. This significantly improves processor robustness, reduces chip area, and effectively enhances instruction processing efficiency.

[0059] To better understand the instruction processing method provided in the embodiments of this application, the following will be used... Figures 5 to 14 A detailed explanation is provided.

[0060] Figure 5 The diagram shown is a flowchart illustrating the instruction processing method according to an embodiment of this application. Figure 5 As shown, this method can be executed by the detection circuit on the transmitter in the processing chip, and the method specifically includes:

[0061] S110, Obtain the operation information of the command to be launched, which is used to indicate the relevant computing resources related to the command to be launched.

[0062] S120, based on the operation information, determine the current status information of the relevant computing resource. The current status information is determined according to the execution level of the current processing instruction and the computing clock.

[0063] S130, when it is determined from the current status information that there is a dependency between the instruction to be launched and the currently processed instruction, the processing of the instruction to be launched is paused.

[0064] Specifically, when the detection circuit receives a command to be transmitted from the processor, it can first obtain the operation information of the command to be transmitted by querying the fields in the command.

[0065] The operational information of an instruction is its own inherent information, which can be used to indicate its related computing resources and the execution level during the execution process.

[0066] For example, it can be used to indicate the source registers and destination registers involved in the processing of the instruction to be issued into the processing pipeline, as well as the arithmetic units involved in the processing.

[0067] The operation information may specifically include a write delay table, the source register identifier for reading data, the destination register identifier, and the structure delay table.

[0068] The identifier of the source register or destination register can be an index number, which is used to determine the relevant register of the instruction to be issued.

[0069] The write delay table indicates the number of execution stages required for the instruction to write back to the destination register after execution. The structure delay table indicates the operation clock of the instruction to be issued during processing, that is, the operation units involved after entering the processing pipeline, and the clock of executing each operation unit.

[0070] Furthermore, once the operation information is obtained, the current status information of the relevant computing resources related to the command to be launched can be determined based on the obtained operation information.

[0071] It is understandable that the detection circuit maintains the current state information of all computing resources based on the operation information of the instruction itself. After obtaining the operation information, it can determine the current state information of the computing resources related to the instruction to be issued, so as to indicate the occupation of the computing resources related to the instruction to be issued by the current processing instruction. Thus, the current state information can be used to determine the dependency relationship between the instruction to be issued and the currently executed instruction.

[0072] For example, the current status information can indicate the writing status of the destination source register and destination register of the instruction to be sent in the current processing instruction, as well as the occupancy status of the arithmetic unit.

[0073] This current processing instruction can be understood as the current entry Figure 1 In the processing pipeline structure shown, one or more instructions are being processed, that is, one or more instructions that are currently occupying the computing resources on the processing pipeline.

[0074] Understandable, for example Figure 1 The processing pipeline structure shown can process multiple instructions simultaneously, which is equivalent to the number of execution units on the pipeline. For example, it can process N instructions simultaneously, meaning that there can be one or more instructions being processed at any given time.

[0075] To avoid wiring pressure on the processing chip, the current state information in this embodiment is maintained in a detection circuit that is independent of the computing resource structure of the execution units at each stage of the processing pipeline, and can reflect the occupancy of each computing resource used by the processing unit in the processing pipeline during execution.

[0076] In this embodiment, to maintain current state information in the detection circuit that characterizes the occupancy of each computing resource in the instruction processing pipeline, the clock pattern of each instruction in the pipeline is combined with the execution level of the pipeline and the clock cycle corresponding to each computing unit. This clock pattern of each processing instruction is then recorded using the design structure in the detection circuit as state information characterizing the current instruction's occupancy of computing resources. This allows the detection circuit to update the current state information in real time using the execution level and clock of the current processing instruction, providing a basis for determining whether there is a dependency relationship between the current processing instruction and the instruction to be issued. This enables the transmitter to proactively detect dependencies between instructions without relying on feedback from subsequent execution units.

[0077] It can be understood that the execution level number represents the total number of execution units through which an instruction enters the pipeline, from the issue unit to the final write-back operation. The computation clock can be understood as the specific clock frequency at which each computation unit performs operations related to the instruction; that is, the clock cycle of the computational resources corresponding to each stage of the instruction's pipeline processing.

[0078] For example, Figure 2 As shown, a certain instruction requires four execution stages from the issue unit to the final write-back of the destination register. The execution time of each stage is t, which is the clock cycle t, or the operation clock t. That is, in the first clock cycle, the issue operation is performed; in the second clock cycle, the read operation is performed; in the third clock cycle, a single-level processing is performed, such as performing addition using the addition unit; and in the fourth clock cycle, the write-back operation of the destination register is performed. The detection circuit can use this number of execution stages and the operation clock, and then combine this with the instruction's own information regarding the execution stages and the clock changes of the computing resources during the processing, to maintain status information reflecting the instruction's usage of computing resources.

[0079] It can also be understood that in order to maintain the current state information of each instruction in the detection circuit by utilizing the execution level and operation clock of each instruction entering the pipeline, the execution level and operation clock need to be queried before the instruction enters the pipeline for operation. This allows the detection circuit to respond to the change pattern of the instruction's execution level and clock after the instruction enters the pipeline processing flow, record the instruction's current state information, and ultimately make the state update in the detection circuit independent of the actual execution on the processing pipeline of the instruction.

[0080] Finally, in this example, if it is determined from the current state information that there is a dependency between the instruction to be launched and any currently processed instruction, such as a data conflict or a structural conflict, then the processing of the instruction to be launched is paused; otherwise, the instruction to be launched can be processed directly.

[0081] In this embodiment, the method uses a detection circuit in the transmitter to maintain the status information of computing resources based on the execution level and clock speed of the current instruction. The execution level and clock speed are different from the instruction's execution status; they are the instruction's own operational information and can be obtained without relying on feedback from subsequent execution units. Therefore, the solution provided in this application can determine the dependencies between instructions without relying on the execution status reported by subsequent execution units, thereby reducing the coupling between the transmitting module and subsequent execution units in the transmitter, improving robustness, and ultimately increasing the efficiency of transmitting instruction processing. Furthermore, since the detection circuit does not require subsequent execution units to report instruction execution status, it also avoids the resulting wiring overhead and reduces chip size.

[0082] Furthermore, such as Figure 6 As shown, in some embodiments of this application, when there is a dependency between the instruction to be launched and the current processing instruction, and the processing of the instruction to be launched is paused, the status information is updated according to the current processing instruction's occupation of relevant computing resources; or when there is no dependency and the instruction to be launched is processed directly, the status information is updated according to the current processing instruction's occupation of relevant computing resources. That is, the method further includes:

[0083] S140, update the status information according to the current processing instruction's usage of relevant computing resources.

[0084] S150: If it is determined from the current status information that there is no dependency between the instruction to be launched and the currently processed instruction, then the instruction to be launched will be processed directly.

[0085] S160, update the status information according to the usage of relevant computing resources by the command to be launched.

[0086] Specifically, S110 and S120 in this embodiment are similar to the execution process in the above embodiment, and will not be described again here. Furthermore, when it is determined from the current state information that there is a dependency between the currently processed instruction and the instruction to be launched, it means that the instruction to be launched cannot be launched directly and needs to wait. At this time, in the detection circuit, as the clock progresses, the current state information still needs to be updated. That is, the instruction to be launched enters a waiting state, while the currently processed instruction is still being processed in the processing pipeline. Therefore, in the detection circuit, the current state information is updated with the instruction processing clock cycle as the update cycle, so that the state information in the detection circuit can reflect the occupancy of computing resources in the processing pipeline in real time.

[0087] Furthermore, if it is determined from the current status information that there is no dependency between the currently processed instruction and the instruction to be launched, then the instruction to be launched can be processed directly.

[0088] For example, in some embodiments, when it is determined that there is no dependency, the command to be launched can be directly launched, allowing it to enter the pipeline, i.e., the launch unit. Alternatively, in other embodiments, the processing of the command to be launched may involve placing it into a launch queue in preparation for launch.

[0089] Furthermore, when the instruction to be issued is determined to be processed and enters the pipeline, in order to ensure that the status information in the detection circuit is updated in real time to reflect the latest status, the status information can be updated synchronously based on the operation information. For example, the current status information can be updated based on the execution level of the instruction to be issued and the operation clock, so that the instruction to be issued becomes the current processing instruction and is processed on the processing pipeline, and the current status information reflects its processing status.

[0090] In this embodiment, different information is used to update the current state information based on the different determination results of the dependency relationship between the instruction to be launched and the current processing instruction. This allows the current state information to reflect the real-time usage of computing resources by the instructions being processed in the processing pipeline, providing a usable basis for detecting the dependency relationship between subsequent instructions to be processed and the current processing instruction. Ultimately, this achieves centralized management of the dependency relationship between instructions, improves instruction processing efficiency, and reduces chip area.

[0091] Optionally, the relevant computing resources in this embodiment may include relevant registers involved in the processing and relevant computing units. The relevant registers may be the source register corresponding to the read operand and the destination register corresponding to the write-back operand. The computing unit may be the actual hardware resources used in the processing, such as adders and multipliers.

[0092] Correspondingly, if the relevant computing resources include relevant registers, the corresponding current status information may include first status information used to characterize whether the current processing instruction has completed the write operation of the relevant register. That is, the first status information can be used to determine whether there is a data conflict dependency between the current processing instruction and the instruction to be issued.

[0093] Optionally, in some embodiments, multiple counters can be set in the detection circuit to record the clock pattern during the processing of the current instruction. That is, the value recorded by the counters is used as the first state information to determine the occupancy of the relevant registers by the current instruction, and then as the basis for judging the inter-instruction dependency relationship between the instruction and the instruction to be issued, which is whether there is a data conflict.

[0094] like Figure 7 As shown, the designed detection circuit structure includes multiple counters, i.e., in the instruction processing pipeline ( Figure 1 As shown, each register in the register group is configured with a corresponding counter, so that each counter corresponds to each register one by one, and the status information of the corresponding register occupancy is recorded by using the value of the counter.

[0095] Correspondingly, in this embodiment, the first status information can be the value of the counter corresponding to the relevant register of the instruction to be transmitted, which represents the number of clock cycles required for the currently processed instruction to complete the writing of the relevant register.

[0096] Specifically, in order to characterize the occupancy status of the register corresponding to the currently processed instruction by using the numerical change of the counter corresponding to the register, the method further includes:

[0097] S01, obtain the execution level of the currently processed instruction, and set the counter corresponding to the destination register related to the currently processed instruction according to the execution level of the currently processed instruction.

[0098] S02, update the value of the counter according to the update status of the operation clock of the current processing instruction. The value of the counter is the current status information of the destination register.

[0099] Specifically, when each instruction enters the transmitter and enters the processing pipeline, the detection circuit reads the execution level from the instruction's operation information and writes the execution level into the counter corresponding to the relevant register of that instruction, so that the initial value of the counter corresponding to the register is set to the execution level of the currently processed instruction.

[0100] That is, Figure 7 As shown, each time the detection circuit receives an instruction, it determines the relevant registers and execution level by querying the instruction's operation information. It then determines the counter corresponding to the relevant register for that instruction and inputs the execution level into the circuit corresponding to that counter, i.e., into a 2-to-1 selector. The selector compares the currently input value with the value corresponding to the remaining execution level of the currently processed instruction, and selects the larger value to output to the counter, thus completing the counter setting.

[0101] Furthermore, as instructions enter the pipeline for processing, the usage of related computing resources changes over time. Therefore, it is necessary to update the current state information, i.e., the value of the counter, in real time, based on the processing progress of the current instruction. In other words, the value of the counter can be updated according to the update of the computing clock of the current instruction.

[0102] For example, in some embodiments, the value of the counter can be made to decrease as the first level of execution is completed, that is, as the clock of the current processing instruction is clocked.

[0103] like Figure 9 As shown, the instruction issued at time T0 has 4 operations, which sets the counter corresponding to its destination register to 4. As the instruction is executed in the processing pipeline, the counter value is decremented by one after each stage of execution, i.e., after one clock cycle, thus updating the first state information.

[0104] It is understood that in this embodiment, the following is utilized: Figure 7 The detection circuit configured as shown, and the execution level of the current processing instruction are used to set the value of the counter. The change in the value is then used as the current status information to determine whether there is a dependency relationship between the current processing instruction and the instruction to be issued, that is, to determine whether there is a data hazard. Specifically, this can include two cases: read-after-write and write-after-write.

[0105] For example, in some embodiments, the source register of the instruction to be issued is determined. That is, when the relevant register is the source register of the instruction to be issued, the value of the counter corresponding to the relevant register can be used as the basis for determining whether a read-after-write operation will occur between the instruction to be issued and the currently processed instruction. Figure 8 As shown, the instruction processing method may specifically include:

[0106] S11, obtain the operation information of the instruction to be transmitted, which includes the identifier of the source register of the instruction to be transmitted.

[0107] S12, read the value of the counter corresponding to the source register.

[0108] S13, if the value of the counter is a preset reference value, then it is determined that the instruction to be sent has no dependency relationship with the currently processed instruction.

[0109] Specifically, when the detection circuit receives a command to be transmitted, during the detection process, it first obtains the operation information of the command to be transmitted, and then determines the source register of the command to be transmitted based on the content of the operation information. For example, by querying the identifier of the source register in the operation information, such as the index number, the corresponding register in the processing pipeline is determined as the source register of the command to be transmitted.

[0110] Furthermore, once the source register of the instruction to be issued is determined, the value of the counter corresponding to the source register can be read as the first status information. If the value of the counter read is a preset reference value, it means that the instruction to be issued has no dependency relationship with the currently processed instruction, and the instruction to be issued is processed directly; otherwise, it means that the instruction to be issued has a dependency relationship with the currently processed instruction, and the processing of the instruction to be issued is paused.

[0111] The difference between this reference value and the initial value is related to the remaining execution levels of the currently processed instruction.

[0112] It is understandable that the method of setting the initial value of the counter is as described above. Figure 7 The detection circuit shown represents the execution level of the current processing instruction. As the processing progresses, the level gradually decreases, allowing the current value of the counter to be related to the number of clock cycles required for the current processing instruction to complete the write operation.

[0113] It is understood that the preset reference value and the value on the counter change with the clock cycle, and can be flexibly set according to the actual situation. This application embodiment does not limit this.

[0114] For example, if the preset reference value is set to zero, when the value corresponding to the source register read becomes zero, it means that the current processing instruction has completed the write operation to the source register. There is no dependency between the current processing instruction and the instruction to be issued. That is, when the instruction to be issued is issued directly, the value read from the source register is the latest value. There will be no read-after-write situation, that is, there will be no data hazard.

[0115] For example, such as Figure 2 During the instruction issuance process shown, one instruction is issued at T0 with source operands a0 and a1 and destination operand a2; another instruction is issued at T1 with source operands a2 and a3 and destination operand a4. Clearly, the source operand a2 of the second instruction is the same as the destination operand of the first instruction, both being a2. If the second instruction reads a2 before the first instruction writes it back to the register, the second instruction will read an old value of a2, resulting in a data hazard.

[0116] In the embodiments of this application, the following can be utilized: Figure 7 The detection circuit shown uses a counter corresponding to each register to record first state information that can represent its current and future occupancy status. Then, the first state information can be used to determine whether the instruction to be issued at time T1 has a dependency relationship with the instruction being issued at time T0 that is in the process of execution.

[0117] That is, Figure 9 As shown above, in the above Figure 2In the scenario shown, the instruction issued at time T0, assuming the operation information of the instruction is read, determines its destination register as R2, and the execution level is 3, meaning that processing the instruction requires three clock cycles in the processing pipeline, then the initial value of the counter corresponding to the destination register R2 is set to 3. Furthermore, after being issued at time T0, the counter value decreases by one number every clock cycle. The specific settings can be flexibly configured, and this embodiment does not impose any limitations on this.

[0118] Furthermore, suppose that after one clock cycle, at time T1, a second instruction needs to be issued, and the source register of this instruction is R2, meaning that operand a2 needs to be read from R2. In this case, to ensure the successful execution of the instruction, the detection circuit needs to read the value of the counter corresponding to register R2.

[0119] It's understandable that after one clock cycle, the counter value becomes 2. This value of 2 serves as the first state information, indicating that the instruction emitted at time T0 has not yet completed the write operation to register R2 in the processing pipeline, and there are still 2 execution stages remaining, i.e., 2 clock cycles remaining. In other words, the currently processed instruction is dependent on the instruction to be emitted, and cannot be processed directly.

[0120] Furthermore, based on the determined remaining execution stages, the instruction to be issued is made to enter a waiting state, and is processed after waiting for 2 clock cycles. If the instruction to be issued is issued, after entering the processing pipeline, it first enters the issuing unit, and then reads the operand a2 from R2.

[0121] In this embodiment, when a command to be issued needs to read a value from a source register, the detection circuit can utilize a counter configured in each register. The value recorded by the counter serves as the criterion for determining whether the value in that register is the latest value. This value determines whether the current processing instruction has completed the write operation to that register and when it will be completed. Based on the counter value, the circuit can determine whether to process the command to be issued directly or wait for several clock cycles before processing. The detection circuit directly uses the counter value related to the execution stage to determine the dependencies between instructions, completely avoiding the complex reporting of processing results by each arithmetic unit during the actual pipeline processing of the current instruction, thus improving instruction processing efficiency. Furthermore, it avoids the need for wiring between the register and the transmitter in the read-write dependency determination process. After each write operation, the result is reported to the transmitter via wiring, ultimately achieving centralized management of inter-instruction dependencies, reducing chip wiring complexity, and decreasing chip size.

[0122] In other embodiments, when the destination register of the instruction to be transmitted is determined, i.e., the relevant register is the destination register, the value of the counter corresponding to the relevant register can be used as the basis for determining whether a write-after-write will occur between the instruction to be transmitted and the currently processed instruction, such as... Figure 10 As shown, in this embodiment, the instruction processing method may specifically include:

[0123] S21, Obtain the operation information of the instruction to be sent, which includes the identifier of the destination register of the instruction to be sent and the execution level of the instruction to be sent.

[0124] S22, read the value of the counter corresponding to the destination register.

[0125] S23, determine the first clock for the current processing instruction to perform a write operation on the destination register based on the value of the counter.

[0126] S24, determine the second clock for the instruction to be sent to perform a write operation on the destination register based on the execution level of the instruction to be sent.

[0127] S25, if there is a clock conflict between the first clock and the second clock, it is determined that the instruction to be transmitted is dependent on the currently processed instruction, and the processing of the instruction to be transmitted is suspended.

[0128] Specifically, when the detection circuit receives a command to be transmitted, during the detection process, it first acquires the operation information of the command to be transmitted, and then determines the destination register and execution stage of the command based on the content of the operation information. For example, by querying the identifier of the destination register in the operation information, such as the index number, the corresponding register in the processing pipeline is determined, which is the destination register of the command to be transmitted. The clock required for the command to be transmitted to be written back to the destination register, i.e., the second clock, is determined by querying the write delay table.

[0129] Furthermore, once the destination register of the instruction to be transmitted is determined, the value of the counter corresponding to the destination register can be read as the first status information, and then the clock for writing the current processing instruction back to the destination register, i.e., the first clock, can be determined based on the value.

[0130] Understandable, based on Figure 7 The detection circuit shown has a counter value corresponding to the destination register that can represent the number of clock cycles required for the current instruction to perform a write operation on that register.

[0131] Furthermore, after the detection circuit determines the first clock and the second clock, it compares the first clock and the second clock to determine whether there is a clock conflict between the first clock and the second clock, that is, to determine whether there is a write-after-write data conflict between the current processing instruction and the instruction to be transmitted.

[0132] This clock conflict indicates that the timing of the currently processed instruction and the instruction to be issued overlaps when they perform a write operation to the destination register, or that the timing of the currently processed instruction performing a write operation to the destination register is later than the timing of the instruction to be issued performing a write operation to the destination register.

[0133] For example, when the detection circuit receives a command to be issued, it determines the execution level to be 4 by querying the operation information. This means that during the pipeline processing of the command to be issued, a write operation will be performed on the destination register after the fourth clock cycle and three clock cycles. If the detection circuit then uses the counter corresponding to the determined destination register and reads that the counter value is also 4, it indicates that the currently processed command and the command to be issued will perform write operations on the destination register at the same time, meaning that there is a dependency between the currently processed command and the command to be issued.

[0134] It is understandable that, similar to the above-described implementation of detecting read-write dependencies, the initial value of the counter is set to the execution level of the current processing instruction, and gradually decreases as the processing progresses, so that the current value of the counter can be related to the time required for the current processing instruction to complete the write operation.

[0135] For example, such as Figure 3 As shown, after an instruction is sent at time T0, the execution level required to write the instruction back to the destination register R2 is 4. At time T1, one clock cycle later, the detection circuit in the transmitter receives another instruction, whose destination register is also R2, the same as the instruction sent at time T0. The execution level required to write the instruction to be sent at time T1 back to the destination register is 3. If this instruction is sent directly at time T1, the time it takes to write the instruction back to the destination register will be the same as the time required to write the instruction back to the destination register, resulting in a WAW (Web Application Firewall) data hazard.

[0136] In the embodiments of this application, the following can be utilized: Figure 7 The detection circuit shown uses a counter corresponding to each register to record the number of clock cycles required to write the current processing instruction back to the corresponding register.

[0137] Specifically, such as Figure 11 As shown, in Figure 3 In the illustrated embodiment, after the first instruction is issued at time T0, the counter 2 corresponding to its destination register R2 can be set to the execution level 4 of that instruction. Then, at time T1, after one clock cycle, another instruction is received. It is determined that its destination register is also R2, which is the same as the destination register of the instruction issued at time T0. The execution level required to write the instruction to be issued at time T1 back to the destination register is 3, which is the second clock cycle.

[0138] At this point, the value of the counter corresponding to register R2 can be read as 3, which is the first clock.

[0139] Clearly, based on the reading results, it is determined that there is a conflict between the first clock and the second clock, and therefore a dependency between the instruction to be transmitted and the currently processed instruction. Based on the detection result, the detection circuit suspends the processing of the instruction to be transmitted and enters a waiting state.

[0140] Furthermore, after one clock cycle, the counter corresponding to the destination register becomes 2, indicating that after two more execution stages, the current processing instruction can execute the write operation on the destination register. Therefore, the instruction to be issued can be issued so that when it performs the write operation, it is in the third clock cycle, thus avoiding data conflict between the two.

[0141] Furthermore, when it is determined that there are no data hazards in the two instructions, the method can also update the value of the counter corresponding to the destination register according to the execution level of the instruction to be issued. The value of the counter is the current status information of the destination register.

[0142] Specifically, when it is determined that the command to be launched can be processed directly, that is, when the command to be launched enters the launch unit of the processing pipeline, the execution level of the command to be launched can be input as a new value. Figure 7 In the two-to-one selector shown, the value is compared with the value of the remaining execution level corresponding to the currently being maintained instruction, and the larger value is used as the current status information of the destination register and written into the counter corresponding to the destination register.

[0143] In this embodiment, when an instruction to be issued needs to read a value from a destination register, the detection circuit can utilize a counter configured in each register. The counter records the remaining number of stages related to the write operation to the destination register performed by the processing instruction. This value serves as the basis for determining when a write operation is performed on that register. Based on the counter value, the circuit can determine whether the instruction to be issued and the currently processed instruction are simultaneously performing write operations on that register. This allows the circuit to decide whether to process the instruction to be issued directly or wait for several clock cycles. The detection circuit directly uses the counter value to determine the dependencies between instructions, completely avoiding the need for wiring between the register and the transmitter during the actual pipeline processing of the current instruction. After each write operation, the circuit reports the result to the transmitter, resolving write-after-write data hazards. Ultimately, this achieves centralized management of inter-instruction dependencies, improves instruction processing efficiency, reduces chip wiring complexity, and decreases chip size.

[0144] Understandable, such as Figure 7 The detection circuit shown can, for the two types of data hazards mentioned in the above embodiments, actively detect data hazards in the instruction and perform the above processing method to determine whether there are read-after-write and write-after-write data hazards that are synchronous or asynchronous between the instruction to be issued and the current multiple processing instructions.

[0145] For example, upon receiving a command to be issued, after obtaining the operation information of the command, the value of the counter corresponding to the source register of the command to be issued can be read to detect whether there is a read-after-write data hazard with a currently processed command; and the value of the counter corresponding to the destination register of the command to be issued can be read to detect whether there is a write-after-write data hazard with a currently processed command. Finally, the detection results of the two counters are output to the selector, so that the selector outputs the detection result, that is, if either data hazard exists, it indicates that the command to be issued has a dependency relationship with the currently processed command, and processing is paused.

[0146] Furthermore, in the embodiments of this application, the value of the counter in the detection circuit is updated directly using the execution level of the current processing instruction when it is determined that there is a dependency between the instruction to be transmitted and the currently processed instruction.

[0147] Furthermore, after waiting for several clock cycles, when the instruction to be issued is executed, the counters corresponding to the relevant registers can be updated according to the execution level of the instruction to be issued.

[0148] Furthermore, if the detection determines that there are no read-after-write or write-after-write conflicts between the currently processed instruction and the instruction to be issued, indicating that there is no dependency between the currently processed instruction and the instruction to be issued, then the instruction to be issued can be processed directly, and the counters corresponding to the relevant registers can be updated according to the execution level of the instruction to be issued.

[0149] In this embodiment, after receiving a command to be transmitted, the detection circuit determines whether the operands to be read by the command are up-to-date by reading the counter values ​​of the relevant source registers. It also determines whether a write operation is being performed on the destination register simultaneously with the currently being processed command by reading the counter values ​​of the destination registers. This determines whether to process the command directly or wait several clock cycles before processing. The detection circuit directly uses the counter values ​​to determine read-after-write and write-after-write dependencies between instructions, avoiding the need for wiring between registers and the transmitter during the actual pipeline processing of the current instruction. After each write operation, the circuit reports the result to the transmitter, resolving write-after-write data hazards. Ultimately, this achieves centralized management of inter-instruction dependencies, improves instruction processing efficiency, reduces chip wiring complexity, and decreases chip size.

[0150] On the other hand, it is understandable that in the instruction processing chip architecture, in order to save internal resources and reduce chip size, some or all of the hardware resources, i.e., arithmetic units, can be reused during instruction processing. For example, in a certain instruction processing chip, the adder arithmetic unit can be used as a reused hardware resource by two or more instructions, which may lead to the risk of simultaneous use, i.e., structural hazards.

[0151] Optionally, in some embodiments of this application, in order to achieve structural hazard detection, such as Figure 12 As shown, multiple bit-mapped registers can be set in the detection circuit, so that each bit-mapped register corresponds to a hardware resource in the instruction processing chip, i.e., a conflict node of the arithmetic unit. That is, each hardware resource conflict node corresponds to a bit-mapped register. Then, the clock flag stored in the bit-mapped register serves as the second state information to characterize the hardware resource occupancy of the currently processed instruction on the processing pipeline. Furthermore, the clock flag recorded in the bit-mapped register can be used as the basis for judging the dependency relationship between the current instruction and the instruction to be issued, i.e., whether there is a structural conflict.

[0152] In this embodiment of the application, the relevant computing resources of the instruction to be launched may also include relevant computing units, and the corresponding current status information may include second status information used to characterize the current processing instruction’s occupation of the relevant computing units. That is, the second status information can be used to determine whether there is a structural conflict dependency between the current processing instruction and the instruction to be launched.

[0153] For example, such as Figure 12 In the structural conflict detection circuit shown, a corresponding bit mapping register is configured for each hardware resource conflict node, so that each hardware resource conflict node corresponds one-to-one with each bit mapping register.

[0154] In practice, the embodiments of this application provide, as shown in the example... Figure 12 The structural conflict detection circuit shown, in actual operation, the process of generating and maintaining the corresponding second state information may specifically include the following steps:

[0155] S04, obtain the operation clock of at least one arithmetic unit related to the currently processed instruction.

[0156] S05, for each of the at least one arithmetic units, set the register corresponding to the arithmetic unit according to the clock identifier of the arithmetic clock of the arithmetic unit, and the value of the register is the status information.

[0157] Specifically, after receiving an instruction in the detection circuit, the operation clock of each arithmetic unit of the instruction can be obtained by querying the instruction's structure delay table.

[0158] For example, in a processing pipeline configured with four stages, if an instruction is received at time T0 that involves hardware resource conflicts between two arithmetic units, such as the first stage of processing executed in the third clock cycle (e.g., addition) and the second stage of processing executed in the fourth clock cycle (e.g., multiplication),...

[0159] This allows us to obtain that the clock speed of the addition unit for this instruction is 0100, and the clock speed of the multiplication unit for this instruction is 1000.

[0160] Furthermore, after obtaining the operation clock corresponding to each operation unit, if the operation units of the instruction all have hardware resource reuse, such as the addition operation unit and the multiplication operation unit reusing hardware resources as mentioned above, then the bit mapping register corresponding to the reused hardware resources is configured with the operation clock obtained in the above steps.

[0161] For example, the bit mapping register corresponding to the adder can be configured as 0100, and the bit mapping register corresponding to the multiplier can be configured as 1000.

[0162] Understandable, such as Figure 12 In the detection circuit shown, a shift unit is also configured on each detection path. After the above configuration is completed and the instruction processing flow is entered, in order to enable the clock flag of the bit mapping register to represent the current processing instruction's occupation of the arithmetic unit's hardware resources, the clock flag will be shifted to the right by the operation of the shift unit with the clock cycle, so as to realize the update of the second state information.

[0163] In other words, each bit-mapped register, when actually running, has a clock flag that includes a high-level flag and a low-level flag. The high-level flag indicates the clock status of the corresponding arithmetic unit. The clock flag will shift over time, specifically based on the clock cycle. That is, after one clock cycle, the high-level clock flag will be shifted to the right once to indicate the change in the occupancy of the hardware resources corresponding to the bit-mapped register over time.

[0164] For example, the bit-mapped register 0100 corresponding to the adder mentioned above will become 0010 after one clock cycle, which means that the adder hardware resources will be used when the time shifts to the second clock cycle from the current moment.

[0165] It can also be understood that the bit width of each bit-mapped register configured in the detection circuit is the same as the maximum number of pipeline stages in the chip. For example, if the pipeline in Figure 1 has N stages, then the bit-mapped register is set to have a bit width of N bits. This ensures that during actual instruction processing, if a bit is 1, it indicates that at the corresponding clock cycle, an instruction needs to occupy the register resources of that stage.

[0166] For example, such as Figure 4 The pipeline for processing a certain instruction shown has four stages, meaning that the bit-mapped register set at each node with resource conflicts is 4 bits wide. If at a certain moment, the clock flag of a register in the detection circuit is 0100, it indicates that an instruction will occupy the hardware resource corresponding to that bit-mapped register after three clock cycles, starting from the current moment.

[0167] Furthermore, it can be understood that the clock flag in the bit mapping register of the detection circuit in this application embodiment can be updated directly using the clock of the current processing instruction when it is determined that there is a dependency between the instruction to be transmitted and the current processing instruction; or, after waiting for several clock cycles, when the instruction to be transmitted is processed, the clock flag in the bit mapping register can be updated according to the clock of the instruction to be transmitted.

[0168] Furthermore, in some other embodiments of this application, the detection circuit provided in the above embodiments can be used to detect the critical dependencies of structural conflicts between the instruction to be issued and the current processing instruction, so as to realize the detection of inter-instruction dependencies and hardware segmentation in the instruction processing pipeline execution process, and finally realize the active detection of inter-instruction dependencies in the detection circuit.

[0169] In this embodiment of the application, after the detection circuit receives the instruction to be transmitted and reads its operation information, it finds that the instruction will use shared hardware resources during execution, that is, it may share the same hardware resources with other instructions, so it is necessary to detect structural conflicts.

[0170] Then as Figure 13 As shown, in this embodiment, the instruction processing method may specifically include:

[0171] S31, obtain the operation information of the command to be transmitted, including the clock of the relevant arithmetic unit occupied by the command to be transmitted.

[0172] S32, read the current clock flag of the bit-mapped register corresponding to the relevant arithmetic unit.

[0173] S33, if there is a clock conflict between the clock of the relevant arithmetic unit occupied by the currently processed instruction and the clock of the relevant arithmetic unit occupied by the instruction to be transmitted, then the current status information determines that the instruction to be transmitted and the currently processed instruction have a dependency relationship.

[0174] Specifically, after receiving the command to be transmitted, the detection circuit will query the structure delay table of the command to be transmitted to obtain the clock of the relevant arithmetic unit occupied by the command to be transmitted.

[0175] Furthermore, after determining the relevant arithmetic unit of the instruction to be transmitted, if the relevant arithmetic unit is a reused hardware resource, the bit mapping register corresponding to the arithmetic unit is further determined, and the current clock flag of the bit mapping register corresponding to the relevant arithmetic unit can be read.

[0176] The clock of the relevant arithmetic unit occupied by the acquired instruction to be issued, as well as the current clock flag of the bit mapping register corresponding to the relevant arithmetic unit, can be used as the basis for whether there will be a structural conflict between the instruction to be issued and the currently processed instruction.

[0177] For example, such as Figure 5 and Figure 14 As shown, after the first instruction was transmitted at time T0, the second instruction was received at time T1, that is, the second instruction was received as a command to be transmitted after the first instruction was transmitted.

[0178] If the hardware resources used by the first instruction in the fourth stage of the processing pipeline, i.e., the second stage of processing, are the same as those used by the second instruction in the third stage of the processing pipeline, i.e., the first stage of processing, both being arithmetic unit C1, such as both being adder arithmetic units.

[0179] For the first instruction, at the time of transmission, the bit-mapped register corresponding to the adder arithmetic unit is configured to 1000, indicating that the start time of processing is the beginning and the arithmetic unit will be used in the fourth clock cycle. Furthermore, as the clock progresses, this clock flag shifts to the right; that is, it will be updated to 0100 in the second clock cycle and to 0010 in the third clock cycle.

[0180] For the second transmit command, by reading the structure delay table of the command to be transmitted, the clock of the relevant arithmetic unit used in the first-level processing is 0100, which means that when the command to be transmitted enters the transmit unit of the processing pipeline to start processing, the corresponding adder arithmetic unit will be used in the third clock.

[0181] It is understandable that if the clock flag of the bit-mapped register of the corresponding adder unit is 0100 on the second clock cycle after the first instruction is issued, then the clock flag of the bit-mapped register of the adder unit that receives the second instruction will also be 0100.

[0182] If the second instruction is directly issued and enters the issue unit of the processing pipeline, then both the first and second instructions will use the adder simultaneously in the third clock cycle, resulting in a structural conflict. In this embodiment, by reading the clock flag of the bit-mapped register corresponding to the arithmetic unit, it is possible to directly determine whether there is a dependency between the instruction to be issued and the currently processed instruction.

[0183] Furthermore, in this embodiment of the application, in order to avoid the above-mentioned structural conflicts, when the current clock flag of the bit mapping register corresponding to the arithmetic unit is read and it indicates that there is a dependency relationship, the current clock flag can be analyzed to determine how many clock cycles must pass before the instruction to be transmitted can be processed.

[0184] like Figure 14 As shown, after pausing the issuance of the second instruction, after one clock cycle, i.e. at time T2, the clock flag of the bit-mapped register of the arithmetic unit is updated to 0010, which means that the first instruction will use the adder resource in two clock cycles. At this time, since the clock of the second instruction indicates that the second instruction will use the adder resource in the third clock cycle, the second instruction can be issued without causing a structural conflict.

[0185] Furthermore, during the implementation of this method, when it is determined that the instruction to be transmitted is to be processed, the clock flag of the bit-mapped register needs to be updated according to its clock and the current clock flag of the bit-mapped register. Specifically, bitwise execution or operation is performed to write the clock of the instruction to be transmitted into the bit-mapped register.

[0186] For example, such as Figure 14 As shown, when the second instruction is issued at time T2, the current clock flag (0010) of the bit-mapped register is bitwise ORed with the clock (0100) of the second instruction to obtain 0110, which updates the bit-mapped register to 0110.

[0187] It is understandable that upon receiving the command to launch, the system would utilize methods such as... Figure 12When the detection circuit shown detects structural conflicts, it can execute multiple detection paths. That is, by reading the clock flag of the bit-mapped register corresponding to each arithmetic unit involved in the instruction to be issued that has hardware resource conflicts, the result of each detection path is output to the AND logic gate. This ensures that as long as there is a structural conflict in one arithmetic unit, the detection result is that there is a dependency relationship. This ensures that all arithmetic units involved in the instruction to be issued are detected. As a result, after it is determined that there is no dependency relationship and the process enters, there is no structural conflict in any arithmetic unit.

[0188] It's understandable. Figure 12 Two detection paths are provided merely as examples, and this application does not limit the scope of the embodiments.

[0189] In this embodiment of the instruction processing method, after receiving a command to be transmitted, the detection circuit reads the clock flag of the relevant bit-mapped register to determine whether the command to be transmitted and the currently processed command are simultaneously using the arithmetic unit. This determines whether to process the command to be transmitted directly or wait for several clock cycles before processing. The detection circuit directly uses the clock flag of the bit-mapped register to determine the dependencies between instructions, completely avoiding the need for wiring between the register and the transmitter during the actual pipeline processing of the current instruction. Furthermore, after each write operation, the circuit reports the execution result to the transmitter, resolving the write-after-write structural hazard. Ultimately, this achieves centralized management of inter-instruction dependencies, improves instruction processing efficiency, reduces chip wiring complexity, and decreases chip size.

[0190] It is understandable that, in order to detect all dependencies and avoid data and structural conflicts during the actual processing of instructions, after receiving the instruction to be sent, the above embodiments can be executed to detect data and structural conflicts between the instruction to be sent and the currently processed instruction, thereby avoiding various dependencies and preventing business conflicts from occurring during instruction processing.

[0191] It is also understood that in the actual processing of instructions, the methods of the above embodiments can be combined or selectively executed, and the embodiments of this application do not limit this.

[0192] On the other hand, this application also provides an instruction processing device 200, such as Figure 15 As shown, the device includes:

[0193] The first acquisition module 210 is used to acquire operation information of the command to be launched, wherein the operation information is used to indicate the relevant computing resources related to the command to be launched.

[0194] The determining module 220 is used to determine the current status information of the relevant computing resources, wherein the current status information is determined based on the execution level of the current processing instruction and the computing clock.

[0195] The first processing module 230 is used to pause processing the instruction to be launched when it is determined from the current status information that there is a dependency between the instruction to be launched and the current processing instruction.

[0196] Optionally, in the instruction processing apparatus of this application embodiment, the related computing resources include related registers, and the current status information includes first status information, which is used to characterize whether the current processing instruction has completed writing to the related registers.

[0197] Optionally, in the instruction processing apparatus of this application embodiment, the first state information is the value of the counter corresponding to the relevant register. The initial value of the value is related to the execution level of the current processing instruction corresponding to the counter, and the value decreases as the operation clock of the current processing instruction decreases. The operation clock is used to execute an operation unit related to the current processing instruction.

[0198] Optionally, in the instruction processing apparatus of this application embodiment, the determining module 220 is specifically used for:

[0199] Read the current value of the counter corresponding to the relevant register.

[0200] Optionally, in the instruction processing apparatus of this application embodiment, when the relevant register is the source register of the instruction to be issued; if the value of the counter is a preset reference value, it is determined that the instruction to be issued and the currently processed instruction have no dependency relationship, and the difference between the reference value and the initial value is related to the remaining execution level of the currently processed instruction.

[0201] Optionally, in the instruction processing apparatus of this application embodiment, when the relevant register is the destination register of the instruction to be transmitted,

[0202] The first processing module 230 is specifically used for:

[0203] The first clock for the current processing instruction to perform a write operation on the relevant register is determined based on the value of the counter.

[0204] The second clock for the instruction to be transmitted to perform a write operation on the relevant register is determined based on the execution level of the instruction to be transmitted.

[0205] If there is a clock conflict between the first clock and the second clock, it is determined that the instruction to be transmitted is dependent on the currently processed instruction.

[0206] Optionally, in the instruction processing apparatus of this application embodiment, the related computing resources further include related computing units, and the current status information includes second status information, which is used to characterize the current processing instruction's occupancy of the related computing units.

[0207] Optionally, in the instruction processing apparatus of this application embodiment, the second state information is the clock identifier of the bit-mapped register corresponding to the relevant arithmetic unit, and the clock identifier is used to characterize the clock of the current processing instruction executing the relevant arithmetic unit.

[0208] Optionally, in the instruction processing apparatus of this application embodiment, the determining module 220 is specifically used for:

[0209] Read the current clock flag of the bit-mapped register corresponding to the relevant register.

[0210] Optionally, in the instruction processing apparatus of this application embodiment, the operation information includes the clock of the related arithmetic unit occupied by the instruction to be launched. If there is a clock conflict between the clock of the related arithmetic unit occupied by the currently processed instruction and the clock of the related arithmetic unit occupied by the instruction to be launched, then the current state information determines that there is a dependency relationship between the instruction to be launched and the currently processed instruction.

[0211] Optionally, the instruction processing apparatus in this application embodiment further includes:

[0212] The second acquisition module 240 is used to acquire the execution level of the current processing instruction and set the counter corresponding to the destination register related to the current processing instruction according to the execution level of the current processing instruction;

[0213] The first update module 250 is used to update the value of the counter according to the update status of the operation clock of the current processing instruction, wherein the value of the counter is the current status information of the destination register.

[0214] Optionally, the instruction processing apparatus in this application embodiment further includes:

[0215] The third acquisition module 260 is used to acquire the operation clock of at least one arithmetic unit related to the current processing instruction;

[0216] The second update module 270 is used to set the register corresponding to each of the at least one arithmetic units according to the clock identifier of the arithmetic clock of the arithmetic unit, wherein the value of the register is the status information.

[0217] Optionally, the instruction processing apparatus in this application embodiment further includes:

[0218] The second processing module 280 is used to process the instruction to be launched when the status information of the relevant computing resources indicates that there is no dependency between the instruction to be launched and the current processing instruction.

[0219] The third update module 290 updates the status information based on the occupancy of the relevant computing resources by the command to be launched.

[0220] On the other hand, embodiments of this application also provide a detection circuit, including a processor and a computer program stored in a memory and executable on the processor, the processor being used to execute the instruction processing method as described in the above embodiments.

[0221] It is understood that the detection circuit provided in the embodiments of this application may further include, in terms of hardware, the following: Figure 5 and Figure 10 The diagram shows multiple counters and multiple bit-mapped registers. Each counter corresponds one-to-one with a register in the instruction processing pipeline of the transmitter, and each bit-mapped register corresponds one-to-one with a resource conflict node in the instruction processing pipeline of the transmitter.

[0222] On the other hand, the transmitter provided in this application embodiment includes the detection circuit and signal processing module as described in the above embodiments. For example, the signal processing module can be as follows: Figure 1 The hardware structure of the instruction processing pipeline is shown.

[0223] It is understood that the transmitter may integrate the detection circuit described in the above embodiments, or the detection circuit may be connected to the transmitter circuit through a hardware interface to enable signal transmission, thereby enabling the transmitter to use the detection circuit to determine the dependencies between instructions when processing instructions.

[0224] Furthermore, this application also provides a chip that integrates the transmitter of the above embodiments.

[0225] It is understood that when the chip in the embodiments of this application processes instructions on the signal processing module in the transmitter, it can use the detection circuit integrated therein to determine the dependency relationship between instructions.

[0226] The following is for reference. Figure 16 , Figure 16 This is a schematic diagram of the structure of a computer system 300 with a detection circuit or chip according to an embodiment of this application.

[0227] like Figure 16As shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 302 or programs loaded from storage section 303 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the system 300. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0228] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.

[0229] Specifically, according to embodiments of this application, the above reference flow Figure 3-8 The described process can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a machine-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 303, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the system of this application.

[0230] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0231] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0232] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor; for example, a processor can be described as including a first acquisition module, a determination module, and a detection module. The names of these units or modules do not necessarily limit the specific unit or module itself. For example, the determination module can also be described as "used to determine the current state information of the relevant computing resources, the current state information being determined based on the execution level of the current processing instruction and the computing clock."

[0233] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium stores one or more programs, which, when used by one or more processors, execute the instruction processing method described in this application:

[0234] Obtain operation information for the command to be launched, wherein the operation information is used to indicate the relevant computing resources associated with the command to be launched;

[0235] The current state information of the relevant computing resources is determined based on the execution level of the current processing instruction and the computing clock.

[0236] If it is determined from the current status information that there is a dependency between the instruction to be launched and the currently processed instruction, then the processing of the instruction to be launched is paused.

[0237] In another aspect, this application also provides a computer program product that includes instructions that, when executed, implement the instruction processing methods described in the various embodiments above.

[0238] In summary, the instruction processing method, apparatus, circuit, transmitter, chip, medium, and product provided in this application maintain the current state information of computing resources through a detection circuit on the transmitter. This current state information is determined based on the execution level and computing clock of all currently processed instructions, and can characterize the occupancy of computing resources by all currently processed instructions. When an instruction is ready to be transmitted, the current state information of the computing resources related to the instruction is read, and then the existence of a dependency relationship between the currently processed instruction and the instruction to be transmitted is determined based on the current state information. If the detection result indicates a dependency, the processing of the instruction to be transmitted is paused, thus avoiding resource conflicts between instructions. This method maintains the state information of computing resources based on the execution level and computing clock of the current instruction. The execution level and computing clock of the instruction are different from the execution status of the instruction; they are the operational information of the instruction itself and can be obtained without relying on feedback from subsequent execution units. As can be seen, the solution provided in this application can determine the dependencies between instructions without relying on the execution status reported by the subsequent execution unit after processing the instructions. This reduces the coupling between the transmitting module and the subsequent execution unit in the transmitter, improves robustness, and ultimately improves the efficiency of transmitting instructions. In addition, since the detection circuit does not require the subsequent execution unit to report the execution status of the instructions, it also avoids the wiring overhead caused by this, reducing the chip size.

[0239] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. An instruction processing method, characterized in that, The method includes: The operation information for obtaining the instruction to be transmitted is used to indicate the relevant computing resources associated with the instruction to be transmitted; the relevant computing resources include relevant registers and relevant computing units; the operation information includes the clock of the relevant computing unit occupied by the instruction to be transmitted. The current state information of the relevant computing resources is determined based on the execution level of the current processing instruction and the computing clock. The current state information includes first state information and second state information. The computing clock is used to indicate the computing units involved after the current processing instruction enters the processing pipeline and the clock for executing each computing unit. The first status information is used to indicate whether the current processing instruction has completed writing to the relevant register; The second status information is used to characterize the current processing instruction's occupation of the relevant arithmetic unit. The second status information is the clock identifier of the bit-mapped register corresponding to the relevant arithmetic unit, determined based on the arithmetic clock of the current processing instruction. Each bit in the clock identifier corresponds to a clock cycle to indicate whether the relevant arithmetic unit is occupied by the current processing instruction in the corresponding clock cycle. The clock identifier is shifted and updated with the clock cycle. The clock flag of the bit-mapped register corresponding to the relevant operation unit in the operation information and the second status information is output to the AND gate. If there is a clock conflict corresponding to a structural hazard between the clock occupied by the current processing instruction and the clock occupied by the relevant operation unit of the instruction to be issued, it is determined that there is a dependency relationship between the instruction to be issued and the current processing instruction. If it is determined, based on the first or second status information in the current status information, that there is a dependency between the instruction to be launched and the current processing instruction, then the processing of the instruction to be launched is paused.

2. The instruction processing method according to claim 1, characterized in that, The first status information is the value of the counter corresponding to the relevant register. The initial value of the value is related to the execution level of the current processing instruction corresponding to the counter, and the value decreases as the operation clock of the current processing instruction decreases. The operation clock is used to execute an operation unit related to the current processing instruction.

3. The instruction processing method according to claim 2, characterized in that, Determining the current state information of the relevant computing resources includes: Read the current value of the counter corresponding to the relevant register.

4. The instruction processing method according to claim 2, characterized in that, When the relevant register is the source register of the instruction to be transmitted; If the value of the counter is a preset reference value, it is determined that there is no dependency between the instruction to be issued and the currently processed instruction. The difference between the reference value and the initial value is related to the remaining execution level of the currently processed instruction.

5. The instruction processing method according to claim 2, characterized in that, When the relevant register is the destination register of the instruction to be transmitted; Determining a dependency relationship between the command to be launched and the currently processed command based on the first status information includes: The first clock for the current processing instruction to perform a write operation on the relevant register is determined based on the value of the counter. The second clock for the instruction to be transmitted to perform a write operation on the relevant register is determined based on the execution level of the instruction to be transmitted. If there is a clock conflict corresponding to a data hazard between the first clock and the second clock, it is determined that the instruction to be transmitted and the currently processed instruction have a dependency relationship.

6. The instruction processing method according to claim 1, characterized in that, Determining the current state information of the relevant computing resources includes: Read the current clock flag of the bit-mapped register corresponding to the relevant arithmetic unit.

7. The instruction processing method according to claim 1, characterized in that, The method further includes: Obtain the execution level of the current processing instruction, and set the counter corresponding to the destination register related to the current processing instruction according to the execution level of the current processing instruction; The value of the counter is updated according to the update status of the operation clock of the current processing instruction, and the value of the counter is the first status information of the destination register.

8. The instruction processing method according to claim 1, characterized in that, The method further includes: Obtain the operation clock of at least one arithmetic unit related to the current processing instruction; For each of the at least one arithmetic units, a register corresponding to the arithmetic unit is set according to the clock identifier of the arithmetic clock of the arithmetic unit, and the value of the register is the second state information.

9. The instruction processing method according to claim 7 or 8, characterized in that, The method further includes: If the current state information of the relevant computing resources indicates that there is no dependency between the instruction to be launched and the current processing instruction, then the instruction to be launched is processed. Update the first status information and / or the second status information according to the occupancy of the relevant computing resources by the command to be launched.

10. An instruction processing apparatus, characterized in that, include: The query module is used to obtain the operation information of the command to be launched, and the operation information is used to indicate the relevant computing resources related to the command to be launched. The relevant computing resources include relevant registers and relevant computing units; the operation information includes the clock time occupied by the instruction to be issued in the relevant computing unit; The detection module is used to determine the current status information of the relevant computing resources. The current status information is determined based on the execution level of the current processing instruction and the computing clock. The current status information includes first status information and second status information. The computing clock is used to indicate the computing units involved after the current processing instruction enters the processing pipeline and the clock for executing each computing unit. The first status information is used to indicate whether the current processing instruction has completed writing to the relevant register; The second status information is used to characterize the current processing instruction's occupation of the relevant arithmetic unit. The second status information is the clock identifier of the bit-mapped register corresponding to the relevant arithmetic unit, determined based on the arithmetic clock of the current processing instruction. Each bit in the clock identifier corresponds to a clock cycle to indicate whether the relevant arithmetic unit is occupied by the current processing instruction in the corresponding clock cycle. The clock identifier is shifted and updated with the clock cycle. The clock flag of the bit-mapped register corresponding to the relevant operation unit in the operation information and the second status information is output to the AND logic gate. If there is a clock conflict between the clock occupied by the current processing instruction and the clock occupied by the relevant operation unit of the instruction to be issued, it is determined that there is a dependency relationship between the instruction to be issued and the current processing instruction. The processing module is configured to pause processing the instruction to be launched when it is determined, based on the first or second status information in the current status information, that there is a dependency between the instruction to be launched and the current processing instruction.

11. A detection circuit, characterized in that, It includes a processor and a computer program stored in memory and executable on the processor, the processor being used to perform the instruction processing method as described in any one of claims 1-9.

12. A transmitter, characterized in that, It includes a signal processing module and the detection circuit as described in claim 11.

13. A chip, characterized in that, Includes the transmitter as described in claim 12.

14. A computer-readable storage medium having a computer program stored thereon, the computer program being used to implement the instruction processing method as described in any one of claims 1-9.

15. A computer program product, characterized in that, The computer program product includes instructions that, when executed, implement the instruction processing method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Microprocessor with pipeline control for executing of instruction at a preset future time

    US20210326141A1