Store instruction forwarding technique with increased forwarding probability

Abstract: Provided are a system and method for forwarding a first instruction in a processor. The processor comprises an execution unit and provides a plurality of instructions. The first instruction depends upon execution of a second instruction but does not otherwise require execution by the execution unit. The method first searches for the second instruction and then forwards the first instruction via the second instruction. One embodiment of the method and system forwards a store instruction in a processor. The store instruction has a source address. The processor provides a plurality of instructions. The method searches for a floating point instruction that is provided before the store instruction. The floating point instruction has a target address. The method then determines if the source address is equal to the target address. The method forwards the store instruction through the floating point instruction if the source address is equal to the target address.

Description: FIELD OF THE INVENTION The present invention relates to a method and system for forwarding instructions in a floating point execution unit and more particularly to a method and system for forwarding instructions where the probability that the instruction will be forwarded is increased and the time delays are reduced as a result of the forwarding. BACKGROUND OF THE INVENTION In the continuing development of faster and more powerful computer systems, a significant microprocessor innovation has been utilized, known as a reduced instruction set computer (RISC) processor. Increased advances in the field of RISC processors have led to the development of superscalar processors. Superscalar processors, as their name implies, perform functions not commonly found in traditional scalar microprocessors. Included in these functions is the ability to execute instructions out-of-order with respect to the program order. Although the instructions occur out-of-order, the results of the executions appear to have occurred in program order, so that proper data coherency is maintained. In a superscalar processor, certain instructions may depend on the execution of another instruction by a unit, but not require the same unit for execution. For example, a floating point store instruction often depends on a previous floating point arithmetic instruction to provide the data to be stored. Once the data from the previous floating point arithmetic instruction is obtained, the store instruction itself does not require the floating point arithmetic unit to be executed. Instead, the source register for the store instruction is the same as the target register for the floating point arithmetic instruction. Because the store instruction depends on the arithmetic instruction, the store instruction is held until the arithmetic instruction has been completed. This creates a delay, or bubble, in the floating point execution pipeline. This delay can be a multi-cycle delay. In order to address this problem and increase the speed of floating point operation, some conventional systems forward the store instruction using the arithmetic instruction. Typically, this is accomplished by identifying the store instruction with a unique tag. The tag is then appended to the arithmetic instruction on which the store instruction depends. The store instruction is thereby forwarded, or folded, into, the arithmetic instruction. Once the store has been forwarded through the arithmetic instruction, the store instruction is removed from the floating point instruction queue. When execution of the arithmetic instruction is completed, the floating point unit immediately processes the store instruction. Thus, the system writes to the floating point register and signals the data cache to access the data for the store. Consequently, a separate instruction is made unnecessary. This conventional method can forward a store instruction. However, conventional systems are only capable of forwarding a store instruction from the bottom, oldest entry in the floating point instruction queue into the floating point arithmetic instruction that is in the first stage of the execution unit's pipeline. Thus, the floating point arithmetic instruction on which the store instruction depends must also immediately precede the store instruction for forwarding to occur. where the floating point arithmetic instruction does not immediately precede the store instruction, for example because the floating point instruction is in the second stage of the pipeline, the store instruction will not be forwarded. If the store instruction is forwarded into the floating point arithmetic instruction, the store instruction is removed from the floating point instruction queue. Another instruction can then replace the store. However, this can only occur as soon as the next cycle, when the store instruction should be placed in the first stage of the pipeline. Thus, removal of the store instruction leaves the first stage of the pipeline, which is the execution stage behind the instruction to which the store instruction is forwarded, empty. This creates a delay in the floating point unit. The speed of the floating point unit is thereby reduced. Accordingly, what is needed is a system and method for instruction forwarding with an increased probability of forwarding. In addition, the method and system should reduce delays due to removal of the forwarded instruction from the execution unit's instruction queue. The present invention addresses such a need. SUMMARY OF THE INVENTION Accordingly, the present invention provides a method for forwarding a store instruction having a source address into a floating point instruction that is provided before the store instruction in a processor, the processor providing a plurality of instructions including the store instruction and the floating point instruction, the method comprising forwarding the store instruction into the floating point instruction by appending a tag to the floating point instruction, the tag identifying the store instruction; the method being further characterised by the steps of: a) searching the plurality of instructions for a floating point instruction having a target address; b) determining if the source address is equal to the target address; and c) forwarding the store instruction through the floating point instruction if the source address is equal to the target address. According to another aspect, the invention also provides a system for forwarding a store instruction having a source address into a floating point instruction that is provided before the store instruction in a processor, the processor further providing a plurality of instructions including the store instruction and the floating point instruction, the system comprising forwarding means for forwarding the store instruction into the floating point instruction by appending a tag to the floating point instruction, the tag identifying the store instruction, the system being characterised in that it further comprises: means for searching the plurality of instructions for a floating point instruction having a target address; and comparing means coupled to the searching means for determining if the source address is equal to the target address; the forwarding means being coupled to the comparing means for forwarding the store instruction through the floating point instruction if the source address is equal to the target address. According to the system and method disclosed herein, the present invention provides instruction forwarding with increased probability of forwarding and reduced delays, thereby increasing overall system performance. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a block diagram of a processor in accordance with the present invention. Figure 2 is a block diagram of an out-of-order execution, dual execution unit floating point unit. Figure 3 is a block diagram of a data flow diagram for one embodiment of the method and system. DETAILED DESCRIPTION OF PREFERRED EMBODIMENT The present invention relates to an improvement in instruction forwarding. The following description is presented to enable one of ordinary skill in the art to make and use the invention according to a preferred embodiment. Various modifications to the preferred embodiment will be readily apparent to those skilled in the art and the generic principles herein may be applied to other embodiments. Thus, the present invention is not intended to be limited to the embodiment shown. Figure 1 is a block diagram showing relevant components of a processor 1 for processing information in accordance with the present invention. In the preferred embodiment, processor 1 is a single integrated circuit superscalar microprocessor. Accordingly, as discussed further hereinbelow, processor 1 includes various units, registers, buffers, memories, and other sections, all of which are formed by integrated circuitry. As shown in Figure 1, processor 1 includes a plurality of execution components, including the floating point unit 14 and the integer unit 16. Figure 2 depicts floating point unit 14 in greater detail. Instructions to be executed are provided to the floating point unit 14 through the instruction fetch/dispatch unit 30. The instruction fetch/dispatch unit 30 places floating point instructions in the floating point instruction queue ("FPQ") 34. In a preferred embodiment, floating point instruction queue 34 is a speculative, out-of-order queue. Floating point register ("FPR") rename mechanism 32 aids in the renaming of floating point registers. As its name implies, the rename mechanism 32 allows for the renaming of memory buffers so that a location, such as a floating point register, to which execution units, such as the floating point unit 14, writes results, can be assigned rename value locations for an operand or result. Floating point register renaming is discussed more fully in U.S. Patent 5 826 070 entitled "APPARATUS AND METHOD FOR MAINTAINING STATUS FLAGS AND CONDITION CODES USING A RENAMING TECHNIQUE IN AN OUT OF ORDER FLOATING POINT EXECUTION UNIT" and assigned to the assignee of the present invention. Through register renaming, a first instruction which depends on the execution of a second instruction will have a source register physical address which is the same as the target register physical address of the second instruction. In addition, certain instructions dependent on the execution of another instruction by the unit may not require the same unit for execution. For example, a floating point store instruction often depends on a previous floating point arithmetic instruction to provide the data to be stored. This store instruction only requires floating point execution unit A 38 or floating point execution unit B 40 to execute the arithmetic instruction on which the store instruction depends. In the case of a store instruction depending upon an arithmetic instruction, the store instruction is typically held in the floating point instruction queue 34 until the floating point arithmetic instruction has been completed. This ensures that the store instruction can obtain the data required for execution. However, holding the store instruction also creates a delay, or bubble, in the floating point execution pipeline. Depending on the time taken for the arithmetic instruction to complete, the store may be held for many cycles. To address this problem, some conventional systems forward the store instruction through the arithmetic instruction. Typically, this is accomplished by identifying the store instruction with a unique tag. The tag is then appended to the arithmetic instruction. The store instruction is thereby forwarded, or folded, into, the arithmetic instruction. The store instruction is then removed from the floating point instruction queue 34. Where the store instruction is forwarded, the floating point unit 14 immediately processes the store instruction when the arithmetic instruction is finished. Thus, when the arithmetic instruction finishes, the floating point unit 14 not only writes to the floating point register but also signals the data cache to access the data for the store. Consequently, a separate store instruction is superfluous. Although the conventional processor 1 can forward a store instruction, one of ordinary skill in the art will recognize that the conventional processor 1 is only capable of forwarding a store instruction from the bottom, oldest entry in the floating point instruction queue 34 to a floating point arithmetic instruction in the first pipeline stage of floating point execution unit A 38 or floating point execution unit B 40. The floating point arithmetic instruction on which the store instruction depends must immediately precede the store instruction for forwarding to occur. Where the floating point arithmetic instruction does not immediately precede the store instruction, the store instruction will not be forwarded. One of ordinary skill in the art will also readily recognize that even if the store instruction is forwarded, some delay will still be introduced in the conventional processor 1. When a store instruction is forwarded into the floating point arithmetic instruction, the store instruction is removed from the bottom entry of the floating point instruction queue 32. Another instruction can only replace the store as soon as the next cycle, when the store should be in the first stage of the pipeline. When the store instruction is removed from the floating point instruction queue 32, the first stage of the pipeline is left empty on the next clock cycle. This creates a delay in the floating point unit 14. The present invention provides for a method and system for forwarding an instruction with increased probability of forwarding and reduced delay. The present invention will be described in terms of a floating point store instruction which is dependent upon a floating point arithmetic instruction. However, one of ordinary skill in the art will readily recognize that this method and system will operate effectively for any instruction which depends upon the execution of another instruction and does not otherwise require execution within the particular unit. The present invention will also be described in the context of a floating point unit within a superscalar processor. However, one of ordinary skill in the art will realize that this method and system will operate effectively in other environments. The method and system of the present invention provide store instruction forwarding with an increased probability of forwarding. In addition, the method and system is capable of forwarding a store instruction in any entry of the floating point instruction queue 34 into an arithmetic instruction in any other entry of the floating point instruction queue 34 or into any execution unit pipeline stage. To more particularly illustrate the method and system in accordance with the present invention, refer now to Figure 3 depicting a data flow 100 of one embodiment of such a system. The nth entry ("FPQn") 102 in floating point instruction queue 34 is a store instruction. FPQn 102 may be any entry in the floating point instruction queue 34. The store instruction in FPQn 102 depends upon a floating point arithmetic instruction for data. The store instruction in FPQn 102 is only forwarded to the arithmetic instruction on which FPQn depends. In the data flow 100 shown in Figure 3, the method and system search the floating point instruction queue 34, an execution unit's first pipeline stage ("E1") 130 and the execution unit's second pipeline stage ("E2") 140 for the arithmetic instruction on which the store instruction depends. This is in contrast to conventional systems which can only forward the store instruction to the preceding instruction. In Figure 3, the remainder of the floating point instruction queue 34, is represented by the xth entry ("FPQx") 104 of the floating point instruction queue 34. Although only two pipeline stages are depicted in Figure 3, the method and system can forward FPQn 102 to any pipeline stage. Because the method and system search the floating point instruction queue 34 and all of the execution unit pipeline stages for an arithmetic instruction to forward through, there is a higher probability of locating the instruction on which the floating point instruction depends. Therefore, there is a corresponding higher probability of instruction forwarding. In order to determine the arithmetic instruction upon which the store instruction in FPQn 102 depends, target register and source register physical addresses are used. Because of register renaming, the store instruction in FPQn 102 depends upon the floating point arithmetic instruction which has a target register physical address equal to the source register physical address of the store instruction in FPQn 102. To determine whether the store instruction in FPQn 102 depends on the arithmetic instruction in FPQx 104, E1 130 or E2 140, the target register physical address of the instructions in FPQx 104, E1 130, and E2 140 are compared to the source register physical address of FPQn 102 using compares 112, 114, and 116, respectively. The outputs of the compares 112, 114, and 116 are provided to the control logic 118. The control logic 118 controls multiplexers ("MUX") 122, 124, 126, 136, and 146. In a preferred embodiment the control logic 118 will not allow a store instruction to be forwarded to another store instruction. Similarly, in a preferred embodiment, the store instruction in FPQn 102 will not be forwarded if another store instruction has already been forwarded through the arithmetic instruction having a target register physical address which matches the source register physical address of the store instruction in FPQn 102. In a preferred embodiment, if a plurality of store instructions having the same source register physical address are provided to the floating point instruction queue 34 on the same clock cycle, only one store instruction is allowed to be forwarded. Only one store instruction is forwarded because in a preferred embodiment an arithmetic instruction can only accommodate a tag for one store instruction. In a preferred embodiment, forwarding is also allowed only if the store instruction in FPQn 102 and the arithmetic instruction through which the store instruction is to be forwarded are valid. In a preferred embodiment, the control logic 118 also precludes forwarding for certain arithmetic instructions, such as a division or square root instruction. Forwarding is not allowed for these instructions because they have intermediate results and, therefore, intermediate target registers as well as final target registers. Finally, in a preferred embodiment, the control logic 118 allows forwarding of the store instruction in FPQn 102 only if the precision of the store instruction in FPQn 102 matches the precision of the arithmetic instruction. If the target register physical address of the arithmetic instruction in FPQx 104 equals the source register physical address of the store instruction in FPQn 102, the control logic 118 causes the MUXs 122 and 124 to append the tag for FPQn 102 to the instruction in FPQx 104. The system of MUXs 122 and 124 could be used to allow the instruction in FPQx 104 to be forwarded into the instruction in FPQn 102 because MUX 126 can choose which tag, from FPQn 102 or FPQx 104, to provide to the first execution pipeline stage E1 130. If the target register physical address of the arithmetic instruction in execution pipeline stage E1 130 equals the source register physical address of the store instruction in FPQn 102, the control logic 118 causes the MUX 136 to select the tag for FPQn 102. If the target register physical address of the arithmetic instruction in execution pipeline stage E2 140 equals the source register physical address of the store instruction in FPQn 102, the control logic 118 causes the MUX 146 to select the tag for FPQn 102. Consequently, where appropriate, the tag is appended to the arithmetic instruction on which the source instruction depends. The tag then follows the arithmetic instruction through the execution pipeline. Once the tag identifying the store instruction in FPQn 102 is appended to the appropriate instruction, the store instruction is removed from the floating point instruction queue 34. Because FPQn 102 need not be the oldest entry in the floating point instruction queue 34, the bubble in the pipeline due to removal of the store instruction can be removed. Instead, another instruction can begin execution while the store instruction tag is attached to the arithmetic instruction. Other instructions are moved forward to take the place of the store instruction, and the execution of the arithmetic instruction is continued. When the arithmetic instruction finishes, the floating point unit 14 writes to the target register and signals the data cache to access the data for the store. In a preferred embodiment, the processor 1 has two floating point execution units. Referring now to Figure 2, both floating point execution unit A 38 and floating point execution unit B 40 can execute instructions. Consequently, in a preferred embodiment, two store instructions can be forwarded to two arithmetic instructions and two arithmetic instructions can be issued in place of the store instructions during each clock cycle. This can further increase the speed of the processor. A method and system has been disclosed for providing forwarding instructions where the probability that the instruction will be forwarded is significantly increased. In addition, delays in the execution unit are further reduced.

Claims: A method for forwarding a store instruction having a source address into a floating point instruction that is provided before the store instruction in a processor (1), the processor providing a plurality of instructions (34, 104, 130, 140) including the store instruction and the floating point instruction, the method comprising: forwarding the store instruction into the floating point instruction by appending a tag to the floating point instruction, the tag identifying the store instruction; the method being further characterised by the steps of: a) searching the plurality of instructions for a floating point instruction having a target address; b) determining (112, 114, 116) if the source address is equal to the target address; and c) forwarding (126, 136, 146) the store instruction through the floating point instruction if the source address is equal to the target address. The method of claim 1 wherein the source address is the source register physical address; and the target address is the target register physical address. The method of claim 1 or claim 2 wherein the store instruction further comprises a first precision and the floating point instruction further comprises a second precision; wherein step (b) further comprises the step of: b1) determining if the first precision is equal to the second precision; and wherein step (c) includes the step of: c1) forwarding the store instruction through the floating point arithmetic instruction only if the source address is equal to the target address and the first precision is equal to the second precision. The method of any preceding claim, wherein step (c) includes the step of: c2) forwarding the store instruction through the floating point instruction only if no instruction of the plurality of instructions has previously been forwarded through the floating point arithmetic instruction. The method of any preceding claim wherein the plurality of instructions further includes a plurality of additional store instructions provided to the instruction queue at the same time as said store instruction, each of the plurality of store instructions having the same source address; and wherein step (c) further includes the step of: c3) preventing the plurality of additional store instructions from being forwarded such that only one store instruction is forwarded. The method of any preceding claim, wherein the processor further comprises a clock; and step (c) further completes within a single clock cycle of the store instruction entering the instruction queue. The method of any one of the preceding claims, including the step of: searching within the plurality of instructions for the store instruction. A system for forwarding a store instruction having a source address into a floating point instruction that is provided before the store instruction in a processor (1), the processor further providing a plurality of instructions (34, 104, 130, 140) including the store instruction and the floating point instruction, the system comprising: forwarding means for forwarding the store instruction into the floating point instruction by appending a tag to the floating point instruction, the tag identifying the store instruction; the system being characterised in that it further comprises: means for searching the plurality of instructions for a floating point instruction having a target address; and comparing means (112, 114, 116) coupled to the searching means for determining if the source address is equal to the target address; the forwarding means (126, 136, 146) being coupled to the comparing means for forwarding the store instruction through the floating point instruction if the source address is equal to the target address. The system of claim 8 wherein the source address is the source register physical address; and the target address is the target register physical address. The system of claim 8 or claim 9 wherein the store instruction further comprises a first precision and the floating point instruction further comprises a second precision, the comparing means being arranged to determine if the first precision is equal to the second precision and the forwarding means being responsive to determination to forward the store instruction through the floating point arithmetic instruction only if the source address is equal to the target address and the first precision is equal to the second precision. The system of any one of claims 8 to 10, wherein the forwarding means is effective to forward the store instruction through the floating point instruction only if no instruction of the plurality of instructions has previously been forwarded through the floating point arithmetic instruction. The system of any one of claims 8 to 11 wherein the plurality of instructions further includes a plurality of additional store instructions provided to the instruction queue at the same time as said store instruction, each of the plurality of store instructions having the same source address; and wherein the forwarding means is arranged to prevent the plurality of additional store instructions from being forwarded such that only one store instruction is forwarded. The system of any one of claims 8 to 12, wherein the processor further comprises a clock; and the forwarding means completes its operation within a single clock cycle of the store instruction entering the instruction queue.

Inventors: BROOKS JEFFREY SCOTT, OLSON CHRISTOPHER HANS, BROOKS, JEFFREY SCOTT, OLSON, CHRISTOPHER HANS
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1998
Main classification: G06F9
IPC codes: G06F9