WO2007099604A1 - コンピュータの分岐予測装置 - Google Patents

コンピュータの分岐予測装置 Download PDF

Info

Publication number
WO2007099604A1
WO2007099604A1 PCT/JP2006/303769 JP2006303769W WO2007099604A1 WO 2007099604 A1 WO2007099604 A1 WO 2007099604A1 JP 2006303769 W JP2006303769 W JP 2006303769W WO 2007099604 A1 WO2007099604 A1 WO 2007099604A1
Authority
WO
WIPO (PCT)
Prior art keywords
branch
instruction
storage
way
unit
Prior art date
Application number
PCT/JP2006/303769
Other languages
English (en)
French (fr)
Inventor
Megumi Yokoi
Original Assignee
Fujitsu Limited
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Limited filed Critical Fujitsu Limited
Priority to JP2008502591A priority Critical patent/JP5136404B2/ja
Priority to EP06714898.1A priority patent/EP1990713B1/en
Priority to PCT/JP2006/303769 priority patent/WO2007099604A1/ja
Publication of WO2007099604A1 publication Critical patent/WO2007099604A1/ja
Priority to US12/196,486 priority patent/US8578140B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3842Speculative instruction execution
    • G06F9/3844Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0864Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches using pseudo-associative means, e.g. set-associative or hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/126Replacement control using replacement algorithms with special data handling, e.g. priority of data or instructions, handling errors or pinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3804Instruction prefetching for branches, e.g. hedging, branch folding
    • G06F9/3806Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer

Definitions

  • the present invention relates to a computer branch prediction mechanism.
  • the branch prediction mechanism of a computer manages the execution history of a branch instruction based on a memory address (hereinafter referred to as an instruction address) in the memory of an instruction executed in the past.
  • the branch destination was predicted when the instruction was executed.
  • the branch prediction mechanism uses a set-associative storage device from a part of an instruction address (branch source address) from which a branch instruction has been acquired (fetched instruction) from the storage source in the past. Determine the set.
  • the branch prediction mechanism stores the branch destination address in one way in the set by using another part of the branch source address as a tag.
  • the branch prediction mechanism searches the storage device using the instruction address in the instruction fetch stage. If a branch instruction that has been executed in the past and the branch destination address is stored in the storage device, the branch prediction mechanism determines that the instruction address is a branch instruction and that Predict that a branch will occur.
  • the branch prediction mechanism obtains a branch destination address from a way in which the contents of the tag in the corresponding set match the part of the instruction address in the foot (the part to be stored in the tag). In this way, the branch prediction mechanism determines whether the instruction is a branch instruction in parallel with the instruction foot (the branch destination address is stored using the branch source instruction address as a tag). It is possible to determine whether or not the force is negative.
  • the computer can obtain a branch destination address predicted when the instruction is a branch instruction. Therefore, even when the computer is performing pipeline processing, an instruction fetch at the next stage can be prepared from a branch destination predicted in advance in parallel with the current instruction fetch.
  • the branch destination obtained is the predicted branch destination. In this case, each stage can be operated in parallel without stopping the knock line processing.
  • the branch destination from which the instruction power currently being fetched is obtained does not reach the predicted branch destination, the correct branch destination instruction fetch is resumed. Even if the branch destination is not stored in the storage means corresponding to the instruction address of the branch instruction currently being fetched (the branch instruction is not hit but the branch instruction is executed), the branch is also executed. The prediction cannot be used, and the instruction fetch is resumed from the branch destination address obtained by decoding the branch instruction after the fetch.
  • the branch prediction mechanism uses the management information.
  • the branch destination is stored in the way to be newly registered that has been determined in advance, and the management information is updated so that the information on the way is maintained as long as possible.
  • each way is provided with a 1-bit replacement flag and a nodding flag, and the corresponding replacement flag is updated so that the next rewriting to the way where the branch destination address is newly written will be delayed as much as possible. .
  • the current set of replacement flags (a bit pattern corresponding to the number of ways) is used to store the next way (current branch prediction of the way). The previous information will be discarded).
  • the computer has the following problems.
  • the four instructions may contain multiple branch instructions, and all of them may need to be stored in the storage device. This is typically the case, for example, when the first branch instruction that appears in four instructions is not executed and the second branch instruction appears. In such a case, generally, the branch destination where the branch actually occurred is registered in the storage device.
  • a branch prediction mechanism that performs branch prediction based on global history, in addition to a branch destination where a branch actually occurs, a branch destination address that does not cause a branch is generated. May need to be stored.
  • the branch destination that is not currently executed is stored in the storage means as the branch destination that will be executed in the future. It becomes.
  • the global history has already been proposed by the applicant (see Patent Document 2 below).
  • a plurality of branch instructions may be searched at the same stage.
  • a set generated from the instruction addresses of these multiple branch instructions may match, and there may be conflicts among ways in the set.
  • Patent Document 1 Japanese Patent Application Laid-Open No. 2004-38298
  • Patent Document 2 Japanese Patent Laid-Open No. 2004-38323
  • a plurality of branch destinations based on a plurality of branch instructions should be stored in the storage device, and the replace flag should be managed.
  • the conventional technology only one way that can store the next new branch destination has been selected, so multiple branch destinations can be stored in the storage device for the result of one instruction fetch. I helped. That is, when a plurality of branch destinations are newly stored in the storage device, a plurality of ways cannot be selected appropriately. A more difficult problem is that when you select multiple such tweets, No management technology has been proposed so that the information (branch destination address) of multiple rewritten ways can be maintained for as long as possible.
  • the present invention employs the following means in order to solve the above problems. That is, the present invention repeats an execution cycle including at least an acquisition stage for acquiring an instruction from an instruction storage source and an execution stage for processing the instruction, and acquires multiple instructions at the acquisition stage of such a computer.
  • a branch instruction prediction unit that predicts whether or not an instruction executed in the next execution stage by the computer is a branch instruction according to history information of an instruction executed in the past, and at least of the acquired instruction
  • the branch instruction prediction unit is configured to determine a branch destination address of the executed branch instruction from an instruction address for referring to a storage source of the branch instruction.
  • a plurality of storage destinations that are stored as history information, and a branch destination address of an executed branch instruction or acquired at the acquisition stage.
  • a selection unit that selects a storage destination with reference to selection information for selecting a shift of the plurality of storage destinations when the branch destination address of the branch instruction to be stored is to be stored as the history information;
  • a storage control unit that stores the branch destination address in a storage destination, and an update unit that updates the selection information in response to storage in the storage destination, and the selection unit stores in the storage destination
  • the storage destination of the second branch destination address according to the selection information after being updated by the updating means when the first branch destination address is stored in the storage destination.
  • the second branch destination address is stored in accordance with the selection information after the update by the updating means that occurs when the first branch destination address is stored in the storage destination. Since the destination is selected, even if it is necessary to register multiple branch destination addresses in one execution cycle, it can be stored in the appropriate storage location according to the selection information.
  • processing an instruction means executing a predetermined process according to the instruction. For example, in the case of a conditional branch instruction, branching to a branch destination or branching based on the determination of the condition and the determination result Including processing that does not.
  • the selection information includes 1-bit write order information for each of a plurality of storage destinations, which specifies a write order to the plurality of storage destinations determined by the instruction address.
  • the unit may select a storage destination of the branch destination address according to the write order information.
  • a storage location can be selected by 1-bit write order information for each of a plurality of storage locations.
  • the history storage unit searches the branch destination address when the instruction is a branch instruction according to the instruction address being acquired in the instruction acquisition stage, and selects the selection address.
  • the storage location may be the first storage location, and the second storage location may be selected according to the selection information.
  • the storage destination when it is necessary to store a plurality of branch destination addresses, if one of the storage destination branch addresses has already been searched, the storage destination is stored in the first storage location.
  • the second storage destination can be selected according to the selection information.
  • the selection unit is a case where there are a plurality of branch addresses to be stored in the storage destination, and the first branch destination address is not retrieved from any of the storage destinations by the history storage unit.
  • the first storage location is selected according to the selection information, the selection information is updated, and the second storage location is selected according to the updated selection information.
  • the selection information is used.
  • the first storage location can be selected and the second storage location can be selected after the selection information is updated along with the selection. Therefore, multiple branch destination addresses must be stored properly. Can be stored.
  • the selection information includes flag information indicating whether the storage content is valid or invalid for each of the plurality of storage destinations, and the selection unit indicates that the storage content is invalid by the flag information. ! /, Select the storage location with priority.
  • the storage destination can be managed efficiently by giving priority to the storage location with invalid storage contents.
  • FIG. 1 is a diagram (No. 1) for explaining a schematic configuration of a 4-way set 'associative branch predicting apparatus included in the present processing apparatus.
  • FIG. 2 is a diagram (No. 2) for explaining a schematic configuration of a 4-way “set” associative branch predicting apparatus included in the processing apparatus;
  • FIG. 3 is a diagram for explaining a configuration of each way constituting a set of branch history storage devices.
  • FIG. 4 is a diagram showing a schematic configuration of a replacement target way selection unit.
  • FIG. 5 is a diagram for explaining logic for selecting a way by a replace flag.
  • FIG. 6 is a diagram illustrating a logic for determining whether or not to replace a replacement flag when an invalid way is selected.
  • FIG. 7 is a system configuration diagram of a processing apparatus including a branch prediction apparatus.
  • FIG. 8 A diagram showing a branch prediction generation pattern when two branch instructions exist in an instruction fetched in units of 16 bytes.
  • FIG. 9 is a diagram showing a combination of the execution result of a branch instruction and the branch prediction result of the next branch instruction.
  • FIG. 10 is a diagram showing a combination of the execution result of the branch instruction and the next prediction result when there are two branch instructions and the first hit.
  • FIG. 11 is a diagram showing a combination of the execution result of the branch instruction and the next prediction result when there are two branch instructions and the second hit. [12] It is a diagram showing a turn of a combination of an execution result and the next prediction when a branch is not predicted.
  • FIG. 14 is a diagram showing details of processing for selecting two ways according to a replace flag.
  • FIG. 15 is a diagram showing details of two invalid way selection processes.
  • ⁇ 16 It is a diagram showing details of invalid way and valid way selection processing.
  • FIG. 17 is a diagram showing details of two effective way selection processes.
  • FIG. 18 is a flowchart of branch instruction storage processing.
  • ⁇ 19 A diagram showing an outline of the branch history search process executed by the branch prediction apparatus according to the modification.
  • FIG. 1 and FIG. 2 are diagrams for explaining a schematic configuration of a 4-way set 'associative branch prediction apparatus 100 included in the present processing apparatus.
  • FIG. 7 is a system configuration diagram of a processing apparatus in which the branch prediction apparatus 100 shown in FIGS. 1 and 2 is incorporated.
  • the branch prediction device 100 mainly includes a branch history storage device 130 having four ways WO to W3, an address generation unit 101, a cache memory 102, a decoder 103, and a branch.
  • a history search result determination unit 104, an equivalence determination unit 105, a hit way selection unit 106, a replacement target way selection unit 107, a branch history search result determination unit 108, and a global history 140 are provided. These are connected via a bus or the like.
  • FIG. 3 is a diagram for explaining the configuration of each way constituting the set of branch history storage devices 130.
  • the branch history storage device 130 is a storage device such as SRAM that can be accessed at a relatively high speed.
  • the 4-way branch history storage device 130 has entries corresponding to four ways in one set. As shown in FIG. 3, each entry includes a tag part TG and a data part DT.
  • the tag part TG consists of (part of) an instruction address TG1, a nodding flag V, a replacement flag scale, and other flags TG2.
  • the data part DT consists of a branch destination address DT1 as predetermined data.
  • One set is determined by a part of the instruction address A output from the address generation unit 101 (for example, 15: 5>).
  • four entries are specified by determining the set.
  • one entry is determined by a part of the instruction address A (for example, 31:16>).
  • a part of the instruction address (for example, 31: 1 16>) is stored in the instruction address TG1.
  • a set is determined using a part of instruction address A 15: 5>, and the remaining part is one of the entries in the set (the power of the four entries corresponding to the four ways)
  • the tag part (including the instruction address TG1) is stored as data.
  • the instruction address 31:16> indicates the instruction address.
  • TGI means that the 31st bit of the instruction address (eg 32 bits) is also the 16th bit.
  • the NORTH flag is a flag indicating whether the entry is valid or invalid. For example, if it is a NORMAL flag, the entry including the NORD flag is valid, and if the NORD flag is “0”, it indicates that the entry including the valid flag is invalid.
  • the entry is valid means that the branch destination address, which is data registered in the way, is deleted.
  • the NORTH flag is also used to select a replacement target way.
  • the replace flag is a flag used for selecting a replacement target way.
  • the branch destination address stores the branch destination address of the branch instruction fetched from the cache memory 102 (or main storage device).
  • the address generation unit 101 is for generating and outputting an instruction address A and the like.
  • the address generation unit 101 includes a program counter and the like.
  • the cache memory 102 is a storage device that can be accessed at a relatively high speed, such as SRAM.
  • the decoder 103 is for decoding a branch instruction or the like fetched by the cache memory 102 (or main memory).
  • the equivalence determination unit 105 compares the instruction address A (part of) output from the address generation unit 101 with the instruction address TG1 of the tag unit TG, and if there is a matching instruction address TG1, a hit signal (Bit indicating hit) is output.
  • the hit way selection unit 106 outputs a hit way selection signal for designating a hit way based on the hit signal of each way power.
  • the branch history search result judgment unit 104 determines whether the branch destination address obtained from the branch predictor is equal to the branch destination address of the fetched branch instruction, ie, S memory area (cache memory 102 or main memory). This is to determine whether the prediction is correct.
  • the replacement target way selection unit 107 is mainly for selecting a replacement target way.
  • FIG. 4 shows a schematic configuration of the replacement target way selection unit 107.
  • the replacement target way selection unit 107 replaces each way wayO (WO) force way3 (W3) with a replacement flag R (replace flag wavO, replace flag included in the entry specified by the same address A. ⁇ Wayl, replace ⁇ flag ⁇ way2, replace ⁇ flag ⁇ way3) and nod flag (wayO ⁇ valid, wayl ⁇ valid, way2 ⁇ valid, way3 ⁇ valid).
  • the replacement target way selection unit 107 finally selects a replacement target way selection signal (replace— way ⁇ 1: 0>) that specifies the replacement target way and a replacement flag (new) that is written to the way specified by the selection signal. — Replace—flag) is output.
  • the replacement target way selection unit 107 selects a replacement target way based on the replacement flags acquired from the respective ways W0 to W3.
  • the replacement flag is (1, 1, 0, 0)
  • way2 is selected as a replacement target.
  • the replacement flag is (1, 1, 1, 0).
  • the replace flag is (1, 1, 1, 0)
  • way3 is selected as a replacement target.
  • the replacement flag is (1, 1, 1, 1).
  • the replacement target way selection unit 107 selects the way selected based on the replacement flag (the way determined by the relationship in FIG. 5) if all the valid flags acquired from the ways WO to W3 are valid.
  • the replacement target way selection signal (replace — way 1: 0>) is output.
  • the replacement target way selection unit 107 selects a replacement target way based on the NORTH flag acquired from each of the ways wayO to way3. In other words, if at least one of the valid flags acquired from each way is invalid, the replacement target way selection unit 107 selects the way (the way having the invalid entry) based on the NORMAL flag. ) replace target way selection signal that specifies the (repl ace _ W ay rather 1: 0>) to output.
  • the replacement target way selection unit 107 outputs a replacement target way selection signal (replace-way 1
  • the replacement target way selection unit 107 determines that the replacement target way selection signal (repl ace—way 1: 0) is selected from the way specified by the replacement target way selection signal (repl ace — way 1: 0) if all the way flags obtained from the respective ways wayO and W3 are also valid.
  • a replacement flag (new—replace—flag) is output by inverting the acquired replacement flag, while the replacement target way selection unit 107 has at least one NORTH flag acquired from each of the ways wayO to way3. If invalid, a replace flag (new—replace—flag) is output according to the table in FIG.
  • Each row in the figure is uniquely distinguished by a set of replacement flags (wayO, wayl, way2, way3) on the left side.
  • Each line indicates the current replace flag status of each way.
  • the way set (wayO, wayl, way2, way3) force on the right side of the table corresponds to the invalid way position. In this way, in the right part of each row, the presence or absence of inversion is specified for the table entry corresponding to the invalid position.
  • the replacement flag is output as it is as a replacement flag (new_replace_flag) without being inverted.
  • FIGS. 5 and 6 can be realized by logic gates.
  • Japanese Patent Application Laid-Open No. 2004-38298 already filed by the present applicant shows a logic circuit that realizes the relationship between the repress flag and the output shown in FIGS.
  • the global history 140 has a storage unit that stores a branch direction history for each branch instruction executed in the past, and manages branch prediction from the results of a plurality of past branches. In other words, the regularity of the history of multiple branches in the past predicts the presence or absence of future branches for each branch instruction.
  • the global history 140 stores, for example, the latest continuous branch establishment count and the latest continuous branch failure establishment count for each branch instruction. Assuming that a branch is taken now, if the current number of consecutive branch establishments does not exceed the previous number of consecutive branch establishments, the next branch establishment (branch) is predicted, and the current number of consecutive branch establishments. Is the last continuous branch If it matches the number of times, it is predicted that the branch will not be taken (no branch). Also, assuming that the current branch was not taken, if the current continuous branch failure count does not exceed the previous consecutive branch failure count, the next branch failure is predicted (no branch), and the current branch success count is not reached. Is the same as the previous number of consecutive branch failures, the next branch is predicted to branch (branch).
  • the global history 140 of this embodiment sends a branch prediction based on the global history to the branch history storage device 130, and instructs whether or not a branch instruction needs to be registered in the way. After the branch destination address is determined by execution of the branch instruction, the branch history storage device 130 stores it in the force ⁇ indicated by the global history 140 and the candidate way added to each branch instruction.
  • FIG. 7 is a system configuration diagram of a processing apparatus including the branch prediction apparatus as described above.
  • This processing apparatus is, for example, a so-called computer with a built-in program that reads and executes instructions stored in the main storage device 121.
  • this processing device includes an arithmetic unit 120 that executes instructions, a main storage device 121 that stores instructions executed by the arithmetic unit 120, data processed by the arithmetic unit 120, and the like. And a program counter 122 for designating an address on the main memory 121 for an instruction to be executed by the arithmetic unit 120.
  • a program counter 122 for designating an address on the main memory 121 for an instruction to be executed by the arithmetic unit 120.
  • an instruction foot control unit 123 that controls the instruction foot based on an address generated by the program counter 122 and an instruction fetch control unit 123 that manages the instruction cache 102.
  • An instruction cache control unit 124 that fetches an instruction according to the instruction fetch request, an instruction buffer 125 that holds an instruction fetched from the instruction cache 102, a decoder 103 that decodes an instruction in the instruction buffer 125, and a decoded
  • a reservation unit that controls the execution timing of instructions (the branch reservation unit 126 that controls the execution of branch instructions and the other reservation unit 127 that controls the execution of register arithmetic instructions and address arithmetic instructions), and the completion of instruction execution Instruction completion management unit 128 that monitors the completion of processing, and arithmetic unit 120
  • the operand cache 129 supplies the O Bae lands of instructions to be executed in the calculation unit 120 at high speed, main memory instrumentation And a data cache control unit 131 for managing the exchange of data between the device 121 and the operand cache 129.
  • the instruction fetch control unit 123 corresponds to the address generation unit 101 in FIG.
  • the control procedure of this processing apparatus will be described.
  • the instruction address from the program counter 122 (the address on the main memory 121 where the instruction is stored) is sent to the instruction foot control unit 123.
  • the instruction fetch unit 123 instructs the instruction cache control unit 124 to acquire an instruction at the instruction address, and instructs the branch prediction apparatus 100 to perform branch prediction. Then, in parallel with the instruction acquisition processing in the instruction cache 102, the branch history storage device 130 is searched in the branch prediction device 100.
  • the branch prediction apparatus 100 When the branch instruction hits at the current instruction address, the branch prediction apparatus 100 sends the branch destination address to the instruction fetch control unit 123. At this time, the branch prediction apparatus 100 sends the way number and the replacement flag value (hereinafter referred to as way information) for the hit way together with the branch destination address to the instruction fetch control unit 123.
  • way information the replacement flag value
  • the instruction foot control unit 123 further instructs the instruction cache control unit 124 to acquire the next instruction according to the branch destination address of the branch instruction hit in the branch predicting device 100 (such processing is usually Forming a pipeline stage). If the branch prediction power S does not hit, the next instruction address is generated inside the instruction fetch control unit 123 without branching, and the instruction cache control unit 124 is instructed to acquire the next instruction. Do
  • the instruction fetch control unit 123 refers to the instruction group fetched from the instruction cache control unit 124 from the instruction buffer 125. Then, the instruction foot control unit 123 determines the next way according to the information shown in the tables of FIG. 5 and FIG. Information on the way to store the branch instruction is added to the branch instruction on the instruction buffer 125. Each instruction with way information is sent to the decoder 103.
  • the instruction is decoded, branch reservation station 126, and other reservations. It is sent to the base station 127 and the instruction completion unit 128. Even after the instruction is decoded, the way information is maintained in the branch reservation station 126 together with the branch instruction.
  • the decoded instruction is queued for execution by the other reservation station 127 based on operand processing. When the operands are ready, each instruction is executed by the arithmetic unit 120 or the data cache control unit 131.
  • the branch reservation station 126 waits for the instruction.
  • the branch instruction is executed, whether or not the branching power is determined, and in the case of branching, when the branch destination address is determined, a completion report is sent from the branch reservation station 126 to the instruction completion unit 128 and the branch prediction device 100. Is done.
  • the instruction address of the branch instruction, the branch destination address, and the way information (way number and replace flag) to be stored are sent to the branch prediction apparatus 100.
  • the branch history search result determination unit 108 determines whether or not the branch prediction is correct. That is, (al) the branch prediction is hit by the branch prediction device 100 at that instruction address (the branch destination address is stored in the branch history storage device 130), and (a2) the fetched branch instruction is It can be seen that the branch prediction was correct when branching to that branch destination address. Or, (bl) If the branch prediction device 100 does not hit at that instruction address, and (b2) the fetched instruction is a force that is not a branch instruction or a branch instruction, It can be seen that the branch prediction was correct.
  • the instruction fetch that has already been requested to the cache control unit 124 may be continued as it is.
  • branch prediction If the branch prediction is correct, the instruction fetch that has already been requested to the cache control unit 124 and the subsequent series of processing are interrupted. At the same time, the branch reservation station 126 instructs the instruction fetch control unit 123 to perform a re-instruction fetch from the correct branch destination.
  • the global history 140 determines whether or not to register in the branch history storage device 130 of the branch prediction device 100 according to the execution result of such a branch instruction. And Guroichi The val history 140 sends an entry update instruction to the branch history storage device 130.
  • the branch prediction apparatus 100 stores the branch instruction executed via the selector 132 in the way according to the update instruction from the global history 140.
  • the way stored at this time is the way of the way number assigned to each instruction by the branch prediction device 100 in the instruction buffer 125 at the time of branch prediction.
  • the replacement flag added to the same instruction is stored.
  • the latest registered way is selected for replacement as late as possible.
  • there may be a replacement opportunity one earlier than the latest but all combinations have the “latest replacement opportunity” or “ Also, it is not a complete LRU, but it operates in a state close to it. Control is realized in the first order (for example, in the case of 4-way, the opportunity for replacement comes in the third rewrite timing).
  • a 1-bit replacement flag is prepared for each way, the replacement flag and the valid flag flag are controlled according to the agreement, and By updating the replacement flag, it is possible to replace the entries in the branch history storage device 130 with operations close to LRU.
  • the only information needed for this is a 1-bit flag per way. When the information is sent out, it is further compressed to 1 bit. This means that the cost is much lower than that of conventional LRU-like methods.
  • the processing apparatus will be described below based on the drawings in FIGS.
  • the processing of the branch predicting apparatus 100 that controls the newly written way to be rewritten as late as possible has been described based on the tables shown in FIGS.
  • a processing device that manages ways in a processing device that fetches a plurality of instructions at the same fetch stage, as in the case of the first embodiment will be described.
  • Other configurations and operations in the present embodiment are the same as those in the first embodiment. Therefore, the same components are denoted by the same reference numerals. Therefore, the description is omitted. Refer to the drawings in Fig. 1 to Fig. 7 as necessary.
  • the processing device executes one instruction of 4 bytes.
  • the processing apparatus fetches 16 bytes, that is, 4 instructions in one instruction fetch stage (in this embodiment, such processing is fetched simultaneously).
  • the branch prediction apparatus 100 stores the branch destination address of such a branch instruction in any of the ways.
  • the branch prediction device 100 first determines one set sharing the four ways of the built-in branch history storage device 130 based on a part of the branch source address of the branch instruction. The four way forces in the set also determine the way to be rewritten.
  • the branch predicting apparatus 100 writes a tag (including a part of the branch source address that is not used for determining the set) to the entry corresponding to the way, and the branch destination address in the way. Write. Furthermore, the branch prediction apparatus 100 sets the state of the replace flag (inverts or does not invert) according to the current state of the replace flag. As in the first embodiment, this way, the way to which the currently written way will be rewritten in the future cannot be completely delayed, but it will be as late as possible (slowest order key, one time earlier than the latest order). (In order), following the prescribed rules.
  • the four instructions fetched at the same time include at most two branch instructions in normal operation. Therefore, in the present embodiment, it is assumed that the number of branch instructions sharing a set (both lines !, u) corresponding to an instruction address at which a plurality of instructions are fetched at the same fetch stage is at most two. In other words, based on branch prediction and instruction execution results, it is assumed that the number of branch instructions to be registered by the branch prediction means at the same timing (same stage) is two at the maximum. [0082] In the execution of such an instruction, the outline of the processing of the branch prediction apparatus 100 is as follows.
  • the branch prediction device 100 uses the information on the hit way for updating the replacement flag.
  • the branch prediction device 100 preferentially selects the invalid way and sets the replacement flag according to the table of FIG. Decide whether to invert. Then, according to the instruction of the global history 140, the branch predicting apparatus 100 stores the branch destination address of the branch instruction that has not been hit in the way and updates the replace flag.
  • the branch instruction force S is not hit and two instructions (this are called the first candidate and the second candidate) are branched. If the history storage device 130 should store the branch prediction device 100, first, the way to store the current rib race flag and valid flag force first candidates is determined, and the renewal flag is temporarily rewritten. Next, the way to store the second candidate is determined from the combination of the replacement flag that has been temporarily rewritten by the selection of the first candidate and the valid flag, and the replacement flag is further rewritten temporarily. Finally, the force specified by the global history 140 is determined, whether or not it is actually stored, and the replace flag is rewritten.
  • the branch prediction device 100 executes branch prediction using the branch history registered in the branch history storage device 130 at the time of instruction fetch. As described above, instruction fetch is performed in units of 16 bytes (4 instructions). Therefore, the branch predicting apparatus 100 searches for a branch instruction included in 16 bytes.
  • the branch prediction device 100 accesses the branch history storage device 130 using a part of the instruction address, and acquires data for four ways. To these data Includes the above replacement flag and valid flag.
  • the branch history storage device 130 stores a branch instruction to branch.
  • the branch predicting device 100 converts four entries (containing tags) corresponding to the four characters of the corresponding set to a part of the instruction address (the bit to be a tag). G). Then, when the entry tag matches the bit portion (when the branch instruction hits in the branch history storage device 130), the branch predicting device 100 regards it as branching to the branch destination.
  • the branch instruction to be newly registered in the branch history storage device 130 may be present in the fetched four instructions.
  • the branch prediction device 100 makes a mistake in branch prediction, the branch history storage device 130 does not hit, and a branch instruction among the four fetched instructions branches. In this case, the branch prediction device 100 unconditionally registers the branch instruction that is branched without being predicted as the next “branch instruction to branch”. That is, the branch prediction device 100 is determined in advance by the replace flag, The tag and branch destination address are stored in the entry according to the information of the way that has been loaded.
  • FIG. 8 shows a branch prediction occurrence pattern when there are two branch instructions among the instructions fetched in units of 16 bytes. Of the two branch instructions, for example, if the first branch instruction branches, the second branch instruction is naturally not executed. In the present embodiment, the branch prediction apparatus 100 processes that the second branch instruction is not predicted when the first branch instruction in 16 bytes hits.
  • FIG. 9 shows a combination of the execution result of the branch instruction and the branch prediction result of the next branch instruction.
  • “Taken” is indicated by “Tk”
  • “NotTaken” is indicated by “N—tk”.
  • the fetched two branch instructions are processed by the branch predicting device 100 when the first branch instruction is strong enough not to branch.
  • FIGS. (1-1) Assume that there are two branch instructions in the fetched 16 bytes at the current fetch stage, and the first hit.
  • Figure 10 shows the combination of the execution result of the second branch instruction and the next prediction result in this case. In this case, the first branch instruction is registered for the hit way, and the processing of the second branch instruction that did not hit becomes a problem.
  • pattern 7 is a case where the first branch instruction hits and branches.
  • the branch prediction apparatus 100 sends the information of rewriting at the time of branch history search to the instruction fetch control unit 123, and is returned from the branch reservation station 126 after the instruction is decoded and executed. Store the branch destination address in the way according to the way information. Therefore, if the first branch instruction branches, the opportunity to store the second branch instruction in the way disappears at this point.
  • the "next prediction" of the first branch instruction is "Tk", so that the execution of the first branch instruction has priority for prediction. Become. For this reason, you do not want to rewrite the way that was hit by the first branch instruction with the second branch instruction. In this case, it is necessary to suppress the registration of the second branch instruction or prepare another way (a way in the same set) to register the second branch instruction.
  • pattern 7 is a case where the first branch instruction hits a force branch without hit, and in this case, the second branch instruction is not executed.
  • the execution result is “N—Tk” because the branch prediction was wrong. Indicates.
  • patterns 4 to 7 require registration of the first branch instruction. Of these, for patterns 5 and 6, if there is only information on the way of the second branch instruction that was hit, if the first branch instruction was registered in the hit way, it could be registered. However, it is immediately overwritten by re-registration of the second branch instruction.
  • pattern 4 when the second branch instruction is hit this time (predicted to branch) but is not predicted to branch next time, an entry erasing operation occurs. In other words, in this case, if there is only information about the way of the second branch instruction hit, if the first branch instruction is registered in the hit way, the second branch instruction is erased. Depending on the operation, the first branch instruction registered will be deleted.
  • patterns 5 and 6 in Fig. 10 and patterns 4 to 6 in Fig. 11 have different branch instructions from the hit way for the first branch instruction that did not hit. It is necessary to register the branch destination address. For this, it is possible to use the way determined by the replace flag.
  • a branch instruction hit with four instructions obtained by instruction fetch is set to use the way that was hit as it is.
  • the branch predicting apparatus 100 adds information on the hit way to the hit branch instruction and sends it to the decoder 103.
  • the branch instruction that is not hit but is included in the fetched four instructions and the next branch is predicted is set to use the way selected according to the replace flag. Specifically, the branch predicting apparatus 100 adds the information on the way selected according to the repress flag and the valid flag to the branch instruction that did not hit, and sends it to the decoder 103.
  • the branch prediction device 100 updates way information (replacement flag, valid flag, etc.) and stored contents according to the results of decoding and executing the four instructions. Specifically, the branch prediction device 100 is registered in the way of the branch destination address where the next branch is predicted, changed the replacement flag, and hit according to the prediction of the global history 140 (not shown). Change the way's NORTH flag.
  • the predicted content of global history 140 is the first branch instruction that hits the next branch instruction, and the branch instruction that hit is the next branch that is not predicted, t, etc. (Pattern 4 in Fig. 11).
  • the way where the hit branch instruction is stored is turned off and the invalid flag is turned into an invalid way (unused way). Since registration is done in order, to prevent the first branch from being erased by the erase operation for the second branch instruction, for the first branch instruction where the next branch is predicted, It is necessary to prepare a way other than the hit way.
  • Figure 12 shows the combination pattern of the execution result and the next prediction in this case. Assume that two branch instructions are included in four instructions fetched at the same time. Of these, in patterns 2, 3 and 4, the registration operation occurs only in the first or second of the two branch instructions, so only one way should be registered.
  • the next branch to be predicted is the first branch instruction among the four instructions fetched at the same time.
  • global history 140 also predicts the branch of the second branch instruction.
  • the execution result was “Tk” even though the prediction for the second branch instruction was “N-Tk”, so the registration operation occurs.
  • the branch prediction device 100 acquires two ways from the invalid way having the youngest way number. In other words, in accordance with the operation logic of the replace lag when there is an invalid way (Fig. 6), two updated replacement flags are sent as a result of the way acquisition operation for two times.
  • the candidate way (first candidate) to which the first branch instruction is to be registered is, for example, wayO when selected in ascending order of the number.
  • the candidate way (second candidate) to register the second branch instruction is wayl. Whether or not the replace flag is inverted follows the operation table in Fig. 6.
  • the read replacement flag is (0, 0, 0, 1) and wayO, which is an invalid way, is used, it is necessary to invert the replacement flag from FIG. Therefore, the registration way number wayO and the replacement flag 1 (inversion of 0) are sent to the instruction fetch control unit 123 as the first candidate.
  • the instruction foot control unit 123 refers to the instruction buffer 125, and when a branch instruction exists, gives a way number and a replace flag to the branch instruction in the order of the first candidate and the second candidate.
  • the branch prediction apparatus 100 determines an invalid way as the first candidate. Next, the branch prediction apparatus 100 assumes a combination of replacement flags after the operation according to the replacement flag operation table (FIG. 6) when there is an invalid way. Then, the branch prediction apparatus 100 determines the second candidate from the assumed replacement flag combination.
  • the way (first candidate) for the first branch instruction is wayO.
  • the operation of the replacement flag (assumed) follows the operation table.
  • the branch prediction apparatus 100 When 0 is used, it is necessary to reverse the replace flag (see Fig. 6). Therefore, the branch prediction apparatus 100, as the first candidate, registers the registration way number wayO and the replacement flag 1 (
  • the branch prediction apparatus 100 determines the second candidate based on the assumed replacement flag. That is, branch prediction apparatus 100 selects wayO as the replacement target way from the table in FIG. 5 and sets it as the second candidate. At this time, the wayO replace flag is unconditionally inverted and sent. In other words, the branch prediction device 100 performs the above processing.
  • the branch prediction device 100 determines two candidate ways (first candidate and second candidate) and sends them to the instruction foot control unit 123. To do.
  • the instruction fetch control unit 123 assigns information on the first candidate and the second candidate (way number and replace flag) to the branch instruction in the fetched order. These pieces of information are held in the branch reservation unit 126 while being added to the instruction. Then, along with the execution result of the branch instruction, the branch instruction to which the first candidate information is added or the branch instruction to which the second candidate information is added is returned to the branch prediction device 100.
  • the global history 140 notifies the branch prediction device 100 of an instruction as to whether or not the next branch is a predicted branch.
  • the branch prediction device 100 has a global history of 140 According to the prediction, the branch instruction is registered in the way of the number assigned to the branch instruction.
  • FIGS. 13 to 17 show branch history search processing executed by the branch prediction apparatus 100.
  • FIG. 18 shows that the branch prediction result 100 and the way information are once sent from the branch prediction device 100 to the instruction fetch control unit 123.
  • the branch reservation unit 126 receives the branch instruction (way). This shows the processing after the branch instruction with the information is returned.
  • the branch predicting apparatus 100 determines the set of the branch history storage device 130 based on the instruction and the instruction address given as the branch predicting instruction from the instruction foot control unit 123. Then, the tag is read from the entry corresponding to the way constituting the determined set (Sl).
  • the branch prediction apparatus 100 determines whether or not the branch instruction hits in any way (S2). That is, the branch prediction apparatus 100 determines that a hit has occurred when the content of the hit tag matches a part of the instruction address that should constitute the tag, for example, the instruction address 31:16>.
  • the branch destination address is sent to the instruction fetch control unit 123. Further, the branch predicting apparatus 100 selects a way and a way set to the current NORTH flag and replace flag (S4).
  • the way is selected with priority.
  • the presence or absence of inversion of the replacement flag is determined according to the table in FIG. If there is no invalid way, the way is selected according to the table in Fig. 5 based on the current replace flag setting.
  • the process of determining the selection in FIG. 5 and the presence / absence of inversion in FIG. 6 from the replacement flag is based on the combination of logic gates. Can be realized.
  • the branch prediction apparatus 100 sends information on the way (the way that was hit and the way selected in S3 or the two ways selected in S4) to the instruction fetch control unit 123 (S5). .
  • the branch predicting apparatus 100 selects two ways according to the replace flag (S4). Then, the branch predicting apparatus 100 sends information on the selected two ways to the instruction fetch control unit 123 (S6).
  • FIG. 14 shows details of the process in which branch prediction apparatus 100 selects two ways according to the replace flag (referred to as S5 in FIG. 13, 2-way selection process).
  • the branch prediction apparatus 100 first determines whether there are two invalid ways (S51). If there are two or more invalid ways in the corresponding set, the branch prediction apparatus 100 executes two invalid way selection processes (S52).
  • the branch prediction apparatus 100 first determines whether or not there is one invalid way (S53). If there is one invalid way in the corresponding set, the branch prediction device 100 executes an invalid way and valid way selection process (S54).
  • FIG. 15 shows details of the two invalid way selection processes (S52 in FIG. 14).
  • the branch prediction device 100 refers to the valid flag of the way and selects the first invalid way (S521).
  • There is no particular restriction on which invalid way to select For example, you may select the order of the way number.
  • branch prediction apparatus 100 provisionally determines whether or not the replacement flag is inverted according to the logic of the table of FIG. 6 (S522). Further, the branch prediction apparatus 100 refers to the valid flag of the way and selects the second invalid way (S523). Then, according to the status of the rib race flag tentatively determined in S522 and the logic of the table of FIG. 6, whether or not the replace flag is inverted is further tentatively determined (S524). In addition, information of these ways (number and replacement flag) Is sent in the process of S6 in FIG. For the replace flag for which the presence or absence of inversion is tentatively determined, the inversion is confirmed in the storage of the branch history after execution of the branch instruction.
  • FIG. 16 shows details of the invalid way and valid way selection processing (S 54 in FIG. 14).
  • the branch predicting apparatus 100 selects an invalid way by referring to the NORIT flag of the way (S541).
  • branch prediction apparatus 100 provisionally determines whether or not the replacement flag is inverted according to the logic of the table of FIG. 6 (S 542).
  • branch prediction apparatus 100 selects one valid way according to the temporarily determined way state (S543).
  • the replacement flag of the selected way is temporarily inverted (S524). Note that if the replace flag is inverted, the inversion is confirmed in the storage of the branch history after execution of the branch instruction.
  • FIG. 17 shows the details of the effective two-way selection process (S55 in FIG. 14).
  • the branch prediction apparatus 100 refers to the current replace flag and selects the first way (S551).
  • the branch prediction apparatus 100 temporarily inverts the replacement flag of the selected first way (S552).
  • the branch predicting apparatus 100 selects one valid second way according to the temporarily inverted way state (S553).
  • the replacement flag of the selected second way is temporarily inverted (S554).
  • FIG. 18 shows a flowchart of the branch instruction storage process.
  • the branch predicting device 100 executes a branch instruction that has been executed or a branch instruction that has been fetched and does not branch, and information on a way that is added to the branch instruction (way number, provisionally determined). Is obtained from the branch reservation station 126 (S11).
  • the branch prediction apparatus 100 acquires information (prediction of the global history 140) as to whether or not the branch instruction is to be branched next from the global history 140 (S12). Note that the prediction itself based on the global history 140 is not directly related to the processing of the present embodiment, and thus the description thereof is omitted.
  • the branch prediction apparatus 100 determines whether or not the branch instruction is predicted to branch next (S13). The NORWAY flag of the way is cleared, and the way is invalid (S14). If it is determined in S13 that the next branch is determined, the branch prediction device 100 The history (branch destination address) is stored in the way specified by the information added to the branch instruction (S15). At this time, a part of the instruction address is stored in the entry as a tag.
  • the branch prediction apparatus 100 sets a replacement flag according to the information added to the branch instruction (S16). At this point, the contents of the temporarily set replacement flag will be confirmed.
  • V is close to the LRU and efficient.
  • the replacement flag can be managed.
  • the optimal selection cannot be made as much as LRU, but according to the tables in Fig. 5 and Fig. 6, the rewritten way is as late as possible (as in the case of the first embodiment, at the worst of the four ways). In some cases, the way that was rewritten last time may be rewritten in the third access).
  • a way number may be generated based on a hit way number and a way may be selected.
  • bit patterns For example, if a 2-bit signal indicating four way numbers is way ⁇ l: 0>, there are bit patterns "00", “01”, “10", and "11". For example, if there is a hit way, a process of inverting one bit way 1> may be configured. In this case, if the hit way is “00”, the upper bit is inverted and “10” is generated to select the way. Such bit manipulation can be easily realized by hardware (logic gate).
  • the valid flag used in the first and second embodiments may be given priority. That is, when there is a hit way and the second way is selected (S4 in FIG. 13), first, it may be determined whether or not the valid flag force also has an invalid way. .
  • the invalid way is selected as the second way, and if there is no invalid way, the above bit inversion causes a hit.
  • a way other than the way may be selected. Such control makes it possible to effectively use invalid ways and reduce overwriting of hit ways as much as possible.
  • FIG. 19 shows a flowchart of branch history search processing according to such a modification.
  • the same processing as in FIG. 13 is denoted by the same reference numerals as in FIG.
  • the branch prediction device 100 selects a way other than the hit way based on the hit way information.
  • the branch prediction apparatus 100 executes a 2-way selection process (S5A).
  • the 2-way selection process in this case may be the same process as in FIG.
  • the way determined by the nodal flag and the replace flag is set as one candidate as usual, and the hit way described above is based on the number of the way.
  • the same bit inversion processing as when there is a number may be performed as a second candidate.

Abstract

取得段階で複数命令を取得する取得部と、次の実行段階で実行される命令が分岐命令であるか否かを予測する分岐命令予測部と、命令の実行部と、を備え分岐命令予測部は、分岐命令の分岐先アドレスを履歴情報として記憶する履歴記憶部と、分岐命令の分岐先アドレスを前記履歴情報として記憶すべき場合に、複数の格納先のいずれかを選択するための選択情報を参照して格納先を選択する選択部と、格納先に分岐先アドレスを記憶する記憶制御部と、格納先への記憶に対応して選択情報を更新する更新部と、を有し、格納先に格納すべき分岐アドレスが複数ある場合に、第1の分岐先アドレスを格納先に記憶したときに更新手段によって更新された後の選択情報にしたがって第2の分岐先アドレスの格納先を選択する。

Description

明 細 書
コンピュータの分岐予測装置
技術分野
[0001] 本発明は、コンピュータの分岐予測機構に関するものである。
背景技術
[0002] コンピュータの分岐予測機構は、過去に実行された命令のメモリ上での記憶アドレ ス(以下、命令アドレスと 、う)を基に分岐命令の実行履歴を管理することによって、 次に分岐命令が実行される場合の分岐先を予測していた。
[0003] その場合、分岐予測機構は、過去に記憶元から分岐命令が取得 (命令をフェッチ するという)された命令アドレス (分岐元アドレス)の一部からセットァソァシァティブ方 式の記憶装置のセットを決定する。そして、分岐予測機構は、分岐元アドレスのさら に他の部分をタグにして、当該セット内の 1つのウェイに分岐先アドレスを記憶してお
<o
[0004] そして、分岐予測機構は、命令のフェッチ段階で命令アドレスを利用して、上記記 憶装置を検索する。そして、過去に実行済みの分岐命令で、その分岐先アドレスが 記憶装置に記憶されている場合には、分岐予測機構は、その命令アドレスが命令は 分岐命令であり、さらに、その分岐先への分岐が発生すると予測する。
[0005] そして、分岐予測機構は、該当するセット内のタグの内容がフ ツチ中の命令アドレ スの部分 (タグに格納されるべき部分)と一致するウェイから分岐先アドレスを入手す る。このようにして、分岐予測機構は、命令のフ ツチと並行して、その命令が分岐命 令であるか否力 (分岐元の命令アドレスの部分をタグにして分岐先アドレスが記憶さ れて 、る力否力 を判定することができる。
[0006] さらに、この技術では、コンピュータは、命令が分岐命令であった場合に予測される 分岐先アドレスを入手できる。したがって、コンピュータがパイプライン処理を行って いる場合であっても、現在の命令フェッチと並行して、事前に予測される分岐先から 次のステージでの命令フェッチを準備することができる。
[0007] そして、現在フ ツチ中の命令力 得られた分岐先が予測された分岐先であった場 合には、ノ ィプライン処理を止めることなく各ステージを並列動作できる。一方、現在 フェッチ中の命令力も得られた分岐先が予測された分岐先でな力つた場合には、正 しい分岐先力 命令フェッチを再開することになる。現在フェッチ中の分岐命令の命 令アドレスに対応して上記記憶手段に分岐先が記憶されていな力つた場合 (分岐予 測がヒットしな力 たが分岐命令が実行された場合)も、分岐予測を利用できず、フエ ツチ後の分岐命令をデコードして得られた分岐先アドレスから命令フェッチを再開す ることになる。
[0008] このような従来の分岐予測機構への分岐先アドレスの登録においては、例えば、分 岐元アドレスが上記記憶装置に記憶されていた場合 (アドレスがヒットしたという)、分 岐先アドレスとともにヒットしたウェイの番号を分岐命令に付加していた。そして、分岐 命令の実行結果にしたカ^、、その番号のウェイに存在するデータを更新していた。す なわち、例えば、分岐予測が正し力つた場合で、次にも同様にその分岐先に分岐す る可能性が高い場合には、分岐予測機構は、そのウェイの情報を維持するとともに、 そのウェイの情報が極力長期に保持されるように管理情報を更新して 、た。
また、アドレスがヒットしな力つたにも拘わらず (分岐予測が外れて)、実際に分岐が 発生し、分岐先を新たに記憶装置に記憶するべき場合には、分岐予測機構は、管理 情報により予め決定されていた新規登録すべきウェイにその分岐先を記憶するととも に、そのウェイの情報が極力長期に保持されるように管理情報を更新して 、た。
[0009] 本出願人は、すでに、このようなゥヱイの管理 (分岐元アドレス力 決定されるセット 内において、どのウェイを優先的に保持すべきか)を効率的に実施するための提案を 行っている(下記特許文献 1参照)。この技術では、各ウェイにリプレースフラグおよび ノリツドフラグと 、う情報をそれぞれ 1ビット設け、分岐先アドレスが新たに書き込まれ たウェイへの次の書き換えが極力遅くなるように対応するリプレースフラグが更新され る。
[0010] そして、新たに記憶すべき分岐先が発生した場合、現在の 1組のリプレースフラグ( ウェイの数に対応するビットパターン)によって、次に記憶すべきウェイ (そのウェイの 現在の分岐予測先情報は破棄されることになる)が決定されていた。
[0011] ところ力 1回のフェッチにおいて、複数命令、例えば、 4命令をフェッチする方式の コンピュータでは、以下のような問題が生じる。すなわち、その 4命令中に複数の分岐 命令が含まれている場合があり、そのいずれをも記憶装置に記憶する必要が生じる 場合がある。これは、典型的には、例えば、 4命令中で最初に現れた分岐命令が実 行されず、第 2番目に表れた分岐命令が実行された場合である。そのような場合、一 般的には、実際に分岐が発生した分岐先が記憶装置登録される。
[0012] し力しながら、他の事情、例えば、グローバルヒストリによって分岐予測を行う分岐予 測機構では、実際に分岐が発生した分岐先の他に、分岐が発生しな力つた分岐先ァ ドレスを記憶する必要が生じる場合がある。一例としては、 2つの分岐命令によって 2 重のループが形成されている場合、グロ一ノ レヒストリによれば、現在実行されなか つた分岐先が将来実行される分岐先として記憶手段に記憶される対象となる。なお、 グローバルヒストリに関しては、本出願人によってすでに提案がなされている(下記特 許文献 2参照)。
[0013] 同様に、スーパースカラマシンのように、複数本のパイプラインを備え、複数命令を 同時にデコード Z実行する場合にも、複数の分岐命令が同一のステージで検索され る可能性がある。すなわち、それら複数の分岐命令の命令アドレスから生成されるセ ットがー致し、セット内のウェイを競合する場合がある。
[0014] また、複数命令をフェッチする方式でなくても、分岐予測が外れた場合で、グローバ ルヒストリから予測された分岐先と実際の分岐先の両方を記憶すべき場合もある。 特許文献 1:特開 2004 - 38298号公報
特許文献 2:特開 2004— 38323号公報
発明の開示
発明が解決しょうとする課題
[0015] 上述のように、複数の分岐命令による複数の分岐先を記憶装置に記憶するとともに 、リプレースフラグを管理すべきである。しかし、従来の技術では、次に新たな分岐先 を格納できるウェイは 1つだけ選択されていたため、 1回の命令フェッチの結果につ いて、複数の分岐先を記憶装置に記憶することができな力つた。すなわち、複数の分 岐先を新たに記憶装置に記憶する場合に、適切に複数のウェイを選択できていなか つた。さらに困難な問題としては、そのような複数のゥヱイを選択する場合に、新たに 書き換えられた複数のウェイの情報 (分岐先アドレス)が極力長期間保持されるように 、管理する技術は提案されていな力つた。
[0016] したがって、複数の分岐先アドレスを記憶装置に登録する必要がある場合に、どち らかの情報が欠落する可能性があった。すなわち、分岐先がヒットしな力つた場合、あ るいは、分岐先の予測が外れた場合で、複数の分岐先を登録すべき場合に、情報の 欠落が発生し、分岐予測の性能を低下させる原因となっていた。また、分岐先がヒット したがグローバルヒストリによって複数の分岐先の登録が必要となる場合も同様であ る。本発明の目的は、このような従来の技術の問題を解決することにある。
課題を解決するための手段
[0017] 本発明は前記課題を解決するために、以下の手段を採用した。すなわち、本発明 は、少なくとも命令の記憶元から命令を取得する取得段階と前記命令を処理する実 行段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で 複数命令を取得する取得部と、前記コンピュータによって次の実行段階で実行され る命令が分岐命令であるか否かを過去に実行された命令の履歴情報にしたがって 予測する分岐命令予測部と、前記取得された命令の少なくとも 1つを前記実行段階 で実行する実行部と、を備え前記分岐命令予測部は、前記実行された分岐命令の 分岐先アドレスを、前記分岐命令の記憶元を参照するための命令アドレスから決定さ れる複数の格納先の 、ずれかに前記履歴情報として記憶する履歴記憶部と、実行さ れた分岐命令の分岐先アドレスまたは前記取得段階で取得された分岐命令の分岐 先アドレスを前記履歴情報として記憶すべき場合に、前記複数の格納先の 、ずれか を選択するための選択情報を参照して格納先を選択する選択部と、選択された格納 先に前記分岐先アドレスを記憶する記憶制御部と、前記格納先への記憶に対応して 前記選択情報を更新する更新部と、を有し、前記選択部は、前記格納先に格納すベ き分岐アドレスが複数ある場合に、第 1の分岐先アドレスを前記格納先に記憶したと きに前記更新手段によって更新された後の前記選択情報にしたがって第 2の分岐先 アドレスの格納先を選択するコンピュータの分岐予測装置である。
[0018] 本発明によれば、第 1の分岐先アドレスを前記格納先に記憶したときに生じる前記 更新手段による更新の後の前記選択情報にしたがって第 2の分岐先アドレスの格納 先を選択するので、 1回の実行サイクルにお 、て複数の分岐先アドレスを登録する必 要がある場合にも、選択情報にしたがった適正な格納先に格納できる。なお、ここで 命令を処理するとは、命令に従った所定の処理を実行することをいい、例えば、条件 付き分岐命令の場合には、条件の判定と判定結果に基づく分岐先への分岐または 分岐しない処理を含む。
[0019] 前記選択情報は、前記命令アドレスによって決定される前記複数の格納先への書 き込み順を指定する、複数の格納先のそれぞれに対して 1ビットの書き込み順情報を 含み、前記選択部は、前記書き込み順情報にしたがって前記分岐先アドレスの格納 先を選択するようにしてもよい。本発明によれば、複数の格納先のそれぞれに対して 1ビット書き込み順情報によって格納先を選択できる。
[0020] 前記履歴記憶部は、前記命令の取得段階において取得中の命令アドレスにしたが つて前記複数の格納先力 その命令が分岐命令であった場合の分岐先アドレスを検 索し、前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、か つ、第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先力 検 索されたものである場合に、その格納先を第 1の格納先とするとともに、前記選択情 報にしたがって第 2の格納先を選択するようにしてもよい。
[0021] 本発明によれば、複数の分岐先アドレスを格納する必要がある場合に、すでにい ずれかの格納先力 分岐アドレスが検索されていた場合には、その格納先を第 1の 格納先とし、さらに、前記選択情報にしたがって、第 2の格納先を選択できる。
[0022] 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、かつ、 第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先から検索さ れたものでない場合に、前記選択情報にしたがって第 1の格納先を選択するとともに 、前記選択情報を更新し、前記更新された選択情報にしたがって第 2の格納先を選 択するようにしてちょい。
[0023] 本発明によれば、複数の分岐先アドレスを格納する必要がある場合に、すでに!/ヽ ずれかの格納先力も分岐アドレスが検索されていない場合には、選択情報にしたが つて第 1の格納先を選択するとともに、その選択にともなって選択情報を更新した上 で、第 2の格納先を選択できる。したがって、複数の分岐先アドレスを適正な格納先 に格納できる。
[0024] 前記選択情報は、前記複数の格納先ごとにその格納内容が有効か無効かを示す フラグ情報を有し、前記選択部は、前記フラグ情報によって格納内容が無効であると 示されて!/、る格納先を優先して選択するようにしてもょ 、。格納内容が無効な格納先 を優先して選択することで、効率的に格納先を管理できる。
発明の効果
[0025] 本発明によれば、複数の分岐先アドレスを記憶装置に登録する必要がある場合に 、情報が欠落することなぐ分岐予測の性能低下を抑制できる。
図面の簡単な説明
[0026] [図 1]本処理装置が有する 4ウェイ ·セット'ァソシァティブ方式の分岐予測装置の概 略構成を説明するための図(その 1)である。
[図 2]本処理装置が有する 4ウェイ 'セット'ァソシァティブ方式の分岐予測装置の概 略構成を説明するための図(その 2)である。
[図 3]分岐履歴記憶装置のセットを構成する各ウェイの構成を説明するための図であ る。
[図 4]置換対象ウェイ選択部の概略構成を示す図である。
[図 5]リプレースフラグによってウェイを選択する論理を説明するための図である。
[図 6]無効なウェイが選択された場合に、リプレースフラグの反転の有無を決定する論 理を示す図である。
[図 7]分岐予測装置を含む処理装置のシステム構成図である。
[図 8]16バイト単位でフェッチされた命令中で 2つの分岐命令が存在する場合に、分 岐予測の発生パターンを示す図である。
[図 9]分岐命令の実行結果と、次の分岐命令の分岐予測結果との組合せを示す図で ある。
[図 10]2つの分岐命令が存在し、 1つ目がヒットした場合の分岐命令の実行結果と、 次の予測結果の組合せを示す図である。
[図 11]2つの分岐命令が存在し、 2つ目がヒットした場合の分岐命令の実行結果と、 次の予測結果の組合せを示す図である。 圆 12]分岐が予測されな力つた場合の実行結果と次の予測との組合せのノターンを 示す図である。
圆 13]分岐予測装置で実行される分岐履歴検索処理の概要を示す図である。
[図 14]リプレースフラグにしたがって 2つのウェイを選択する処理の詳細を示す図であ る。
[図 15]2つの無効ウェイ選択処理の詳細を示す図である。
圆 16]無効ウェイと有効ウェイ選択処理の詳細を示す図である。
[図 17]有効な 2つのウェイ選択処理の詳細を示す図である。
[図 18]分岐命令格納処理のフローチャートである。
圆 19]変形例に係る分岐予測装置で実行される分岐履歴検索処理の概要を示す図 である。
符号の説明
101 アドレス生成ユニット
102 命令キャッシュ
103 デコーダ
120 演算ユニット
121 主記憶装置
122 プログラムカウンタ
123 命令フ ツチ制御ユニット
124 命令キャッシュ制御ユニット
126 分岐リザべーシヨンステーション
127 その他リザべーシヨンステーション
128 命令完了管理ユニット
129 オペランドキャッシュ
130 分岐履歴記憶装置
131 データキャッシュ制御ユニット
140 グローバルヒストリ
発明を実施するための最良の形態 [0028] 以下、図面を参照して本発明の実施の形態に係る処理装置を説明する。
[0029] 《第 1実施形態》
以下、図 1から図 7の図面に基づいて本発明の第 1実施形態に係る処理装置を説 明する。
[0030] 図 1および図 2は、本処理装置が有する 4ウェイ ·セット'ァソシァティブ方式の分岐 予測装置 100の概略構成を説明するための図である。また、図 7は、図 1および図 2 に示した分岐予測装置 100を組み込んだ処理装置のシステム構成図である。
[0031] 図 1および図 2に示すように、分岐予測装置 100は、主に、 4つのウェイ WOから W3 を持つ分岐履歴記憶装置 130、アドレス生成ユニット 101、キャッシュメモリ 102、デ コーダ 103、分岐履歴検索結果判定ユニット 104、等価性判定部 105、ヒットウェイ選 択部 106、置換対象ウェイ選択部 107、分岐履歴検索結果判定部 108、および、グ ローバルヒストリ 140等を備える。これらはバス等を介して接続されて 、る。
[0032] 図 3は、分岐履歴記憶装置 130のセットを構成する各ウェイの構成を説明するため の図である。分岐履歴記憶装置 130は、 SRAM等の比較的高速にアクセス可能な 記憶装置である。 4ウェイの分岐履歴記憶装置 130は、 1つのセット内に 4つのウェイ に対応するエントリを有する。図 3に示すように、各エントリは、タグ部 TGとデータ部 D Tを含む。タグ部 TGは、命令アドレス(の一部) TG1、ノリツドフラグ V、リプレースフラ グ尺、および、その他のフラグ TG2からなる。データ部 DTは、所定データとしての分 岐先アドレス DT1からなる。
[0033] 1つのセットは、アドレス生成ユニット 101から出力される命令アドレス Aの一部(例 えばく 15 : 5 >)によって決定される。本実施形態では 4ウェイなので、セットの決定 により 4つのエントリが指定されることになる。さらに、その 4つのエントリのうち、命令ァ ドレス Aの一部(例えばく 31 : 16 >)によって一のエントリが決定される。この一のェ ントリを決定するために、命令アドレス TG1には命令アドレスの一部(例えばく 31: 1 6 >)が格納されている。例えば、登録時に、命令アドレス Aの一部く 15 : 5 >を使つ てセットが決定され、残りの部分がセット内のいずれかのエントリ(4つのウェイに対応 する 4つのエントリのいずれ力)のタグ部(命令アドレス TG1を含む)にデータとして格 納されるようになつている。なお、命令アドレスく 31 : 16 >との記載は、命令アドレス TGIが命令アドレス(例えば 32ビット)の一部 31ビット目力も 16ビット目であることを 意味する。
[0034] ノリツドフラグは、エントリの有効又は無効を示すフラグである。例えば、ノリツドフラ ダカ であればそのノリツドフラグを含むエントリが有効であること、ノリツドフラグが "0"であればそのバリッドフラグを含むエントリが無効であることを示す。エントリが有 効とは、ウェイに登録されたデータである分岐先アドレスが抹消されて 、な 、と 、う意 味である。ノリツドフラグは、置換対象のウェイを選択するためにも用いられる。
[0035] リプレースフラグは、置換対象のウェイを選択するために用いられるフラグである。
分岐先アドレスには、キャッシュメモリ 102 (または主記憶装置)からフェッチされた分 岐命令の分岐先アドレスが格納される。
[0036] アドレス生成ユニット 101は、命令アドレス A等を生成し出力するためのものである。
アドレス生成ユニット 101はプログラムカウンタ等を含む。キャッシュメモリ 102は、 SR AM等の比較的高速にアクセス可能な記憶装置である。デコーダ 103は、キャッシュ メモリ 102 (または主記憶装置)力もフェッチされた分岐命令等をデコードするための ものである。
[0037] 等価性判定部 105は、アドレス生成ユニット 101から出力される命令アドレス A (の 一部)とタグ部 TGの命令アドレス TG1とを比較し、一致する命令アドレス TG1が存在 すればヒット信号 (ヒットを示すビット)を出力する。ヒットウェイ選択部 106は、各ウェイ 力 のヒット信号に基づいてヒットしたウェイを指定するヒットウェイ選択信号を出力す る。
[0038] 分岐履歴検索結果判定ユニット 104は、分岐予測装置から得られた分岐先アドレス 力 Sメモリ領域 (キャッシュメモリ 102または主記憶装置)力 フェッチされた分岐命令の 分岐先アドレスと等しいか、つまり、予測が正し力つたかどうかを判定するためのもの である。
[0039] 置換対象ウェイ選択部 107は、主に置換対象のウェイを選択するためのものである 。図 4に置換対象ウェイ選択部 107の概略構成を示す。置換対象ウェイ選択部 107 は、各ウェイ wayO (WO)力 way3 (W3)それぞれから、同一アドレス Aによって指定 されるエントリに含まれるリプレースフラグ R (replace flag wavO, replace flag ― wayl, replace― flag― way 2, replace― flag― way3)およびノ リツドフラグ (wa yO― valid, wayl― valid, way2― valid, way 3― valid)を取得する。置換対象ゥ エイ選択部 107は最終的に、置換対象のウェイを指定する置換対象ウェイ選択信号( replace— way< 1 : 0 >)およびその選択信号によって指定されるウェイに書き込むリ プレースフラグ(new— replace— flag)を出力する。
[0040] 置換対象ウェイ選択部 107は、ウェイ W0から W3それぞれカゝら取得されたリプレー スフラグに基づいて、置換対象のウェイを選択する。図 5は、それらリプレースフラグ によってウェイが選択される論理を説明するための図である。同図は、ウェイ wayOか ら way3それぞれから左側のリプレースフラグ(例えば(wayO, wayl, way2, way3) = (0, 0, 0, 0) )が取得された場合には、置換対象のウェイとして右側の〇が位置す るウェイ (例えばウェイ 0)が選択されることを示す。
[0041] 例えば、図 5において、リプレースフラグが(0, 0, 0, 0)である場合を考える。この 場合、図 5によれば、置換対象として wayOが選択される。選択されたウェイのリプレ 一スフラグは反転されるので、この場合リプレースフラグは、(1, 0, 0, 0)となる。
[0042] そして、リプレースフラグが(1, 0, 0, 0)の場合には、図 5によれば、置換対象とし て waylが選択される。そして、リプレースフラグは、(1 , 1, 0, 0)となる。
[0043] さらに、リプレースフラグが(1, 1, 0, 0)の場合には、図 5によれば、置換対象として way2が選択される。そして、リプレースフラグは、(1, 1, 1, 0)となる。
[0044] さらに、リプレースフラグが(1, 1, 1, 0)の場合には、図 5によれば、置換対象として way3が選択される。そして、リプレースフラグは、(1, 1, 1, 1)となる。
[0045] さらに、リプレースフラグが(1, 1, 1, 1)の場合には、図 5によれば、置換対象として wayOが選択される。そして、リプレースフラグは、(0, 1, 1, 1)となる。
[0046] このように、図 5の表にしたがって、ウェイを選択するとともに、リプレースフラグを反 転した場合、選択されたウェイが次に選択される時期を可能な限り送らせて、 LRUに 近 、効率を達成することができる。
[0047] 例えば、単純に図 5の表を最上段の行 (0, 0, 0, 0)と第 8行目(0, 0, 0, 1)との間 で遷移する場合には、常に、選択されたウェイが次に選択される時期は最後 (4番目 )となる。また、第 9行目(1, 0, 1, 0)と最下段の行(1, 0, 1, 1)との間で遷移する場 合には、常に、選択されたウェイが次に選択される時期は最後 (4番目)となる。
[0048] 置換対象ウェイ選択部 107は、ウェイ WOから W3それぞれカゝら取得されたバリッドフ ラグすべてが有効であれば、リプレースフラグに基づいて選択されたウェイ(図 5の関 係で定まるウェイ)を指定する置換対象ウェイ選択信号 (replace— wayく 1: 0 > )を 出力する。
[0049] また、置換対象ウェイ選択部 107は、ウェイ wayOから way3それぞれから取得され たノリツドフラグに基づいて、置換対象のウェイを選択する。すなわち、置換対象ゥェ ィ選択部 107は、各ウェイから取得されたバリッドフラグのうち少なとも 1つが無効であ れば、ノリツドフラグに基づ 、て選択されたウェイ (その無効なエントリを有するウェイ) を指定する置換対象ウェイ選択信号 (replace_Wayく 1 : 0 >)を出力する。
[0050] また、置換対象ウェイ選択部 107は、置換対象ウェイ選択信号 (replace— wayく 1
: 0 >)によって指定されるウェイに書き込むリプレースフラグ(new— replace— flag) を出力する。すなわち、置換対象ウェイ選択部 107は、ウェイ wayOカゝら W3それぞれ 力も取得されるノリツドフラグすべてが有効であれば、置換対象ウェイ選択信号 (repl ace— wayく 1 : 0 »によって指定されるウェイから取得されたリプレースフラグを反 転したリプレースフラグ (new— replace— flag)を出力する。一方、置換対象ウェイ選 択部 107は、ウェイ wayOから way3それぞれから取得されたノリツドフラグのうち少な くとも 1つが無効であれば、図 6の表にしたがってリプレースフラグ (new— replace— flag)を出力する。
[0051] 同図の各行は、左側部分のリプレースフラグの組 (wayO, wayl, way2, way3)に よってユニークに区別される。各行は、現在のそれぞれのウェイのリプレースフラグの 状態を示している。また、表の右側部分のウェイの組 (wayO, wayl, way2, way3) 力 無効なウェイの位置に相当する。このようにして、各行の右側部分で、無効な位 置に相当する表のエントリに、反転の有無が指定される。
[0052] 今、ウェイ wayOから way3それぞれから左側のリプレースフラグの組(例えば(wayO , wayl, way2, way3) = (0, 0, 0, 0) )力 S取得され、かつ、置換対象クエイ選択信 号 (replace— wayく 1 : 0 »によって無効なエントリを有するウェイとして右側部分の いずれかのウェイ (例えば wayOのウェイ)が指定されたとする。すると、表の左側部分 で(0, 0, 0, 0)の組で指定される行において、表の右側部分において wayOの箇所 には、 "反転"が指定されている。したがって、この場合の選択信号によって指定され るウェイ 0から取得されたリプレースフラグは反転され、リプレースフラグ(new— repla ce_flag)として出力されることになる。
[0053] また、例えば、同行のウェイ 2の箇所には、 "反転"が指定されていない(空欄である )。このような場合には、リプレースフラグは反転されることなぐそのままリプレースフラ グ(new_replace_flag)として出力される。
[0054] 例えば、(0, 0, 0, 0)の状態で、ノリツドフラグにしたがって wayOが選択された場 合には、図 6より反転が指定されているので、リプレースフラグは、(1, 0, 0, 0)となる 。この場合、図 5の表にしたがうと、次に WayOが選択されるのは、最も遅く(4番目に) なる。
[0055] また、 例えば、(0, 0, 0, 0)の状態で、バリッドフラグにしたがって waylが選択さ れた場合には、図 6より反転が指定されているので、リプレースフラグは、(0, 1, 0, 0 )となる。この場合、図 5の表にしたがうと、次に Waylが選択されるのは、第 12行 (0, 1, 0, 0) = >第13行(0, 1, 0, 1) = >第14行(1, 1, 0, 1)と遷移した後である。こ の場合、最も遅い 4番目の遷移より 1つ前の 3番目の遷移で waylが選択されることに なる。
[0056] このような図 5および図 6の状態遷移は、論理ゲートによって実現できる。例えば、 本出願人がすでに出願済みの特開 2004— 38298において図 5および図 6のリプレ 一スフラグと出力との関係を実現する論理回路が示されている。
[0057] グローバルヒストリ 140は、過去に実行された分岐命令ごとに分岐方向の履歴を記 憶した記憶部を有し、過去の複数回の分岐の結果から分岐予測を管理する。すなわ ち、過去の複数回の分岐の履歴の規則性力 それぞれ分岐命令の将来の分岐の有 無を予測する。
[0058] また、グローバルヒストリ 140は、例えば、分岐命令ごとに最近の連続分岐成立回数 および最近の連続分岐不成立回数を記憶する。そして、現在は分岐が成立したとす ると、現在の連続分岐成立回数が前回の連続分岐成立回数を越えない場合には次 も分岐成立 (分岐する)と予測し、現在の分岐連続成立回数が前回の連続分岐成立 回数と一致した場合には、次には分岐不成立 (分岐しない)と予測する。また現在は 分岐が成立しなかったとすると、現在の連続分岐不成立回数が前回の連続分岐不 成立回数を超えない場合には、次も分岐不成立 (分岐しない)と予測し、現在の分岐 連続不成立回数が前回の連続分岐不成立回数と一致した場合には、次には分岐成 立 (分岐する)と予測する。
[0059] 本実施形態のグローバルヒストリ 140は、グローバルヒストリに基づく分岐予測を分 岐履歴記憶装置 130に送出し、分岐命令のウェイへの登録の要否を指示する。分岐 履歴記憶装置 130は、分岐命令の実行によって分岐先アドレスが確定した後、グロ 一バルヒストリ 140からの指示にした力 ^、、各分岐命令に付加された候補のウェイに 格納する。
[0060] 図 7は、以上のような分岐予測装置を含む処理装置のシステム構成図である。本処 理装置は、例えば、主記憶装置 121に格納された命令を読み出して実行する、いわ ゆるプログラム内蔵方式のコンピュータである。
[0061] 図 7のように、この処理装置は、命令を実行する演算ユニット 120と、演算ユニット 1 20で実行される命令および演算ユニット 120が処理するデータ等を格納する主記憶 装置 121と、演算ユニット 120が実行すべき命令の主記憶装置 121上のアドレスを指 定するプログラムカウンタ 122とを有している。このようなプログラムカウンタ 122の制 御に基づく処理装置の制御は周知である。
[0062] 図 7では、さらに具体的に、プログラムカウンタ 122の生成するアドレスに基づいて 命令のフ ツチを制御する命令フ ツチ制御ユニット 123と、命令キャッシュ 102を管 理し命令フェッチ制御ユニット 123からの命令フェッチ要求にしたがって命令をフェツ チする命令キャッシュ制御ユニット 124と、命令キャッシュ 102からフェッチされた命令 を保持する命令バッファ 125と、命令バッファ 125の命令をデコードするデコーダ 10 3と、デコードされた命令の実行タイミングを制御するリザべーシヨンユニット (分岐命 令の実行を制御する分岐リザべーシヨンユニット 126およびレジスタ演算命令、ァドレ ス演算命令の実行を制御するその他リザべーシヨンユニット 127)と、命令の実行完 了を監視する命令完了管理ユニット 128と、演算ユニット 120で実行される命令のォ ぺランドを高速に演算ユニット 120に供給するオペランドキャッシュ 129と、主記憶装 置 121とオペランドキャッシュ 129との間でデータの授受を管理するデータキャッシュ 制御ユニット 131とを有して 、る。
[0063] このうち、命令フェッチ制御ユニット 123が図 1のアドレス生成ユニット 101に該当す る。以下、本処理装置の制御手順を説明する。まず、プログラムカウンタ 122からの命 令アドレス (命令が格納された主記憶装置 121上のアドレス)が命令フ ツチ制御ュ ニット 123に送出される。
[0064] 命令フェッチユニット 123は、命令キャッシュ制御ユニット 124にその命令アドレスの 命令取得を指示するとともに、分岐予測装置 100に対して、分岐予測を指示する。す ると命令キャッシュ 102での命令取得処理と並行して、分岐予測装置 100での分岐 履歴記憶装置 130の検索がなされる。
[0065] そして、分岐予測装置 100は、現在の命令アドレスで分岐命令がヒットした場合に は、その分岐先アドレスを命令フェッチ制御ユニット 123に送出する。このとき、分岐 予測装置 100は、分岐先アドレスとともに、ヒットしたウェイについてのウェイの番号とリ プレースフラグの値 (以下、ウェイの情報という)を命令フェッチ制御ユニット 123に送 出する。
[0066] 命令フ ツチ制御ユニット 123は、分岐予測装置 100でヒットした分岐命令の分岐 先アドレスによって、さらに、次の命令取得を命令キャッシュ制御ユニット 124に指示 する(このような処理は、通常、パイプラインのステージを形成する)。なお、分岐予測 力 Sヒットしな力つた場合には、分岐しな 、次の命令アドレスを命令フェッチ制御ュ-ッ ト 123の内部で生成し、次の命令取得を命令キャッシュ制御ユニット 124に指示する
[0067] そして、命令フェッチ制御ユニット 123は、命令キャッシュ制御ユニット 124からフエ ツチされた命令群を命令バッファ 125から参照する。そして、命令フ ツチ制御ュ-ッ ト 123は、ヒットした場合にはヒットしたウェイの情報、またヒットしな力つた場合には、 図 5および図 6の表に示した論理にしたがって、次に分岐命令を格納すべきウェイの 情報を命令バッファ 125上の分岐命令に付与する。ウェイの情報が付与された命令 は、それぞれデコーダ 103に送出される。
[0068] その結果、命令はデコードされ、分岐リザべーシヨンステーション 126、その他リザ ベーシヨンステーション 127、および命令完了ユニット 128に送出される。なお、命令 がデコードされた後も、ウェイの情報は分岐命令とともに分岐リザべーシヨンステーシ ヨン 126で維持されている。デコードされた命令は、その他リザべーシヨンステーショ ン 127によってオペランドの処理等に基づいて、実行の待ち合わせを受ける。そして 、オペランドが揃った時点で、各命令が演算ユニット 120またはデータキャッシュ制御 ユニット 131で実行される。
[0069] 一方、分岐命令については、分岐リザべーシヨンステーション 126によって命令の 待ち合わせがなされる。そして、分岐命令の実行によって分岐する力否か、また分岐 する場合には分岐先アドレスが確定したときに、完了報告が分岐リザべーシヨンステ ーシヨン 126から、命令完了ユニット 128および分岐予測装置 100に送出される。こ のとき、分岐命令の命令アドレス、分岐先アドレス、および格納すべきウェイの情報( ウェイの番号とリプレースフラグ)が分岐予測装置 100に送出される。
[0070] このとき、分岐リザべーシヨンステーション 126内の分岐履歴検索結果判定部 108 ( 図 1参照)は分岐予測が正し力つた力否かを判定する。すなわち、(al)その命令アド レスにて分岐予測装置 100によって分岐予測がヒットし (分岐履歴記憶装置 130に分 岐先アドレスが格納されて 、た)、 (a2)フ ツチされた分岐命令がその分岐先ァドレ スに分岐した場合に、分岐予測が正し力つたことが分かる。あるいは、(bl)その命令 アドレスにて分岐予測装置 100がヒットせず、(b2)フェッチされた命令が分岐命令で はな力つた力もしくは分岐命令であっても分岐しな力つた場合に、分岐予測が正しか つたことがわかる。
[0071] この場合、すでにキャッシュ制御ユニット 124に依頼済みの命令フェッチは、そのま ま続行されること〖こなる。
[0072] また、分岐予測が正しくな力つた場合には、すでに、キャッシュ制御ユニット 124に 依頼済みの命令フェッチおよびその後に続く一連の処理は中断されることになる。同 時に分岐リザべーシヨンステーション 126からは、正しい分岐先からの再命令フェッチ を行うよう、命令フェッチ制御ユニット 123に指示が出される。
[0073] グローバルヒストリ 140は、このような分岐命令の実行結果にしたがって、分岐予測 装置 100の分岐履歴記憶装置 130に登録すべきか否かを判定する。そして、グロ一 バルヒストリ 140は、エントリの更新指示を分岐履歴記憶装置 130に送出する。
[0074] 分岐予測装置 100は、グローバルヒストリ 140からの更新指示にしたがい、セレクタ 132を介して実行された分岐命令をウェイに格納する。このとき格納されるウェイは、 分岐予測の時点で、命令バッファ 125にお 、て分岐予測装置 100によって各命令に 付与されたウェイ番号のウェイである。さらに、分岐命令のウェイへの格納とともに、同 じく命令に付与されたリプレースフラグを格納する。
[0075] 以上述べたように、本実施形態の処理装置によれば、図 5および図 6のルールにし たがって、置換対象となる機会が順番に巡ってくることになる。つまり、最新の登録さ れたウェイができるだけ遅く置換対象として選択されるようになる。ただし、組合せによ つては、最も遅い場合よりも 1つだけ早く置換の機会が来る場合もあるが、すべての 組合せで、「最も遅く置換の機会が来る」か、あるいは、「最も遅い順番よりも 1つだけ 早い順番で (例えば、 4ウェイの場合に、 3回目の書き換えタイミングで)置換の機会 が来る」制御が実現され、完全な LRUではないが、それに近い状態で動作する。
[0076] すなわち、本実施形態の分岐予測装置 100によれば、各ウェイに 1ビットのリプレー スフラグを用意し、取り決めにしたがってリプレースフラグ、およびバリッドフラグカもェ ントリの置換の制御を行い、またリプレースフラグを更新することで、 LRUに近い動作 での分岐履歴記憶装置 130のエントリの入れ替えが実現される。このために必要な 情報は、ウェイにつき 1ビットのフラグのみである。また、その情報を外部に出すときは 、さらに 1ビットに圧縮される。これは、従来の LRUのような方法と比べて、格段に低コ ストとなることを意味する。
[0077] 《第 2実施形態》
以下、図 8から図 14の図面に基づいて、本発明の第 2実施形態に係る処理装置を説 明する。上記第 1実施形態では、図 5および図 6に示したテーブルに基づいて、新規 に書き込まれたウェイが極力遅く書き換えられるように制御する分岐予測装置 100の 処理について説明した。本実施形態では、同一のフェッチステージで複数の命令が フェッチされる処理装置において、第 1実施形態の場合と同様に、ウェイの管理を行 う処理装置について説明する。本実施形態に置ける他の構成および作用は、第 1実 施形態の場合と同様である。そこで、同一の構成要素については、同一の符号を付 してその説明を省略する。また、必要に応じて、図 1から図 7の図面を参照する。
[0078] 本実施形態では、処理装置は、 1命令 4バイトの命令を実行する。また、処理装置 は、 16バイト、すなわち、 1つの命令フェッチステージにおいて 4命令をフェッチする( 本実施形態では、このような処理を同時にフェッチするという)。
[0079] 上記 4命令は同一の命令アドレスで命令フェッチされるので、同一のセット(ラインと もいう)内の 4つのウェイを共有する。そして、取得した分岐命令が次回の命令フェツ チにおいて取得され実行されると予測される場合、分岐予測装置 100は、そのような 分岐命令の分岐先アドレスをいずれかのウェイに格納する。この場合、分岐予測装 置 100は、まず、その分岐命令の分岐元アドレスの一部によって、内蔵する分岐履歴 記憶装置 130の 4つのウェイを共有する 1つのセットを決定する。そして、そのセット内 の 4つのウェイ力も書き換えられるべきウェイを決定する。
[0080] すなわち、セット内の各ウェイにそれぞれ 1ビットのリプレースフラグとバリッドフラグ が付与されており、リプレースフラグとバリッドフラグの現在の状態にしたがって、次に 書き換えられるべきウェイが決定される。そして、分岐予測装置 100は、そのウェイに 対応するエントリに、タグ (分岐元アドレスの一部で、セットの決定に使用されな力つた 部分のビットを含む)を書き込むとともに、ウェイに分岐先アドレスを書き込む。さらに、 分岐予測装置 100は、現在のリプレースフラグの状態にしたがって、リプレースフラグ の状態を設定する (反転する、または、反転しない)。この設定は、第 1実施形態と同 様、現在書き込まれたウェイが今後書き換えるタイミングが完全には最も遅くすること はできないが、極力遅くなる(最も遅い順番カゝ、最も遅い順番より 1回早い順番)、所 定の規則にしたがつている。
[0081] 本実施形態で想定する命令セットアーキテクチャの仕様では、同時にフェッチされ る 4命令中には、通常動作においては高々 2個の分岐命令しか含まれないと仮定で きる。したがって、本実施形態では、同一のフェッチステージで複数命令がフェッチさ れる命令アドレスに対応して、セット (ラインとも!、う)を共有する分岐命令の数は高々 2個と仮定する。すなわち、分岐予測と命令の実行結果に基づいて、同一タイミング( 同一のステージ)で、分岐予測手段が登録すべき分岐命令の数は、最大 2個と仮定 する。 [0082] このような命令の実行において、分岐予測装置 100の処理の概要は、以下の通り である。
(1)現在フ ツチ中の命令アドレスによる分岐履歴記憶装置 130の検索により、分岐 命令がヒットした場合には、分岐予測装置 100は、ヒットしたウェイの情報をリプレース フラグの更新に使用する。
[0083] さらに、フェッチされた 4命令中のヒットしなかった分岐命令で、グローバルヒストリ 14 0の予測カゝら今後分岐すると予測される分岐命令が存在する場合、現在のリプレース フラグの状態から図 5にしたがって新たなウェイを選択する。
[0084] このとき、ノリツドフラグにより無効なウェイが存在することが分力つた場合には、分 岐予測装置 100は、無効なウェイを優先して選択し、図 6の表にしたがって、リプレー スフラグの反転の有無を決定する。そして、グローバルヒストリ 140の指示にしたがい 、分岐予測装置 100は、そのヒットしな力つた分岐命令の分岐先アドレスをそのウェイ に格納するとともに、リプレースフラグを更新する。
(2)現在フ ツチ中のアドレスによる分岐履歴記憶装置 130の検索により、分岐命令 力 Sヒットせず、かつ、 2つの命令 (これを第 1の候補、および第 2の候補と呼ぶ)を分岐 履歴記憶装置 130に記憶すべき場合には、分岐予測装置 100は、まず、現在のリブ レースフラグおよびバリッドフラグ力 第 1の候補を格納すべきウェイを決定し、リプレ 一スフラグを仮に書き換える。次に、第 1の候補の選択によって仮に書き換えられた 状態のリプレースフラグの組合せとバリッドフラグから、第 2の候補を格納すべきウェイ を決定し、リプレースフラグをさらに仮に書き換える。そして、最終的には、グローバル ヒストリ 140の指示にした力^、、実際に格納するか否かが決定され、リプレースフラグ が書き換えられる。
[0085] <分岐予測装置 100の処理概要 >
分岐予測装置 100は、命令フェッチに際して分岐履歴記憶装置 130に登録された分 岐履歴を利用して分岐予測を実行する。上述のように、命令フェッチは、 16バイト (4 命令)単位で行われる。したがって、分岐予測装置 100は、 16バイト内に含まれる分 岐命令を検索することになる。分岐予測装置 100は、命令アドレスの一部を用いて分 岐履歴記憶装置 130にアクセスし、 4ウェイ分のデータを取得する。これらのデータに は、上記リプレースフラグおよびバリッドフラグも含まれて 、る。
[0086] この分岐履歴記憶装置 130には、分岐する分岐命令が格納されている。分岐予測 装置 100は、分岐履歴記憶装置 130の検索時、該当するセットの 4つのゥヱイに対応 する 4つのエントリ(タグが格納されている)を、命令アドレスの一部(タグとなるべきビ ット部分)と比較する。そして、エントリのタグがそのビット部分と一致した時点(分岐命 令が分岐履歴記憶装置 130でヒットした時点)で、分岐予測装置 100は、分岐先に 分岐するとみなす。
[0087] したがって、分岐を予測しな力つた場合も、新たに分岐履歴記憶装置 130に登録 すべき分岐命令がフェッチされた 4命令中に存在する場合がある。
[0088] 第 1に、 4つの命令中に分岐しない分岐命令が存在する場合である。この場合、た とえ現在の処理 (ステージ)でその分岐命令が分岐しなくても、次回分岐することがグ ローバルヒストリ 140により予測され、登録指示が出される場合がある。 第 2に、分岐 予測が誤った場合である。これは、分岐予測装置 100が分岐予測を誤った結果、分 岐履歴記憶装置 130がヒットせず、かつ、フェッチされた 4命令中の分岐命令が分岐 した場合である。この場合、分岐予測装置 100は、分岐が予測されず分岐した分岐 命令を次に「分岐する分岐命令」として無条件で登録するすなわち、分岐予測装置 1 00は、リプレースフラグにより予め決定され、命令に負荷されていたウェイの情報に 従ってエントリにタグおよび分岐先アドレスを格納する。
[0089] 図 8に、 16バイト単位でフェッチされた命令中で 2つの分岐命令が存在する場合に 、分岐予測の発生パターンを示す。 2つの分岐命令のうち、例えば 1つ目の分岐命令 が分岐すれば、当然 2つ目の分岐命令は実行されない。本実施形態では、分岐予 測装置 100は、 16バイト中の最初の分岐命令がヒットした時点で、 2つ目の分岐命令 の予測は必要ないものとして処理する。
[0090] 図 9に、分岐命令の実行結果と、次の分岐命令の分岐予測結果との組合せを示す 。図 9では、 "分岐する(Taken) "を" Tk"で示し、 "分岐しない(NotTaken) "を" N— tk"で示している。図のように、フェッチされた 2つの分岐命令が分岐予測装置 100の 処理対象となるのは、 1つ目の分岐命令が分岐しな力つた場合である。以下、図 8の( 1— 1)、 (1 - 2) ,および(2)のそれぞれについて、図 9から図 12とともに説明する。 (1— 1)現在のフェッチステージで、フェッチされた 16バイト中に 2つの分岐命令が存 在し、 1つ目がヒットしたとする。図 10に、この場合の 2つ目の分岐命令の実行結果と 、次の予測結果の組合せを示す。この場合、ヒットしたウェイには、 1つ目の分岐命令 が登録されており、ヒットしなかった 2つ目の分岐命令の処理が問題となる。
[0091] 図 10において、パターン 7は、 1つ目の分岐命令がヒットし、かつ、分岐した場合で ある。本実施形態の分岐予測装置 100は、分岐履歴検索時に書き換えるゥ イの情 報をー且命令フェッチ制御ユニット 123に送出し、命令のデコードおよび実行後に分 岐リザべーシヨンステーション 126から戻されたウェイの情報にしたがって分岐先アド レスをウェイに格納する。このため、 1つ目の分岐命令で分岐すると、 2つ目の分岐命 令をウェイに格納する機会はこの時点では消滅する。
[0092] また、図 10において、 "ヒットした"にも拘わらず、実行結果が" N— Tk"というのは、 分岐予測を誤ったことを示す。
[0093] 図 10の場合に、 2つ目の分岐命令の登録動作が生じるのは、パターン 2、 3、 5、お よび 6である。このうち、パターン 2、 3については、 1つ目の分岐命令が"次の予測"に おいて,, N— Tk"の場合であり、 1つ目の分岐命令のヒットしたウェイが書き換えられて も構わない場合である。
[0094] 一方、パターン 5、 6については、 1つ目の分岐命令の"次の予測"が" Tk"であるの で、予測上は、 1つ目の分岐命令の実行が優先することとなる。このため、 1つ目の分 岐命令のヒットしたウェイを 2つ目の分岐命令によって書き換えたくない場合である。 この場合に、 2つ目の分岐命令の登録を抑止するか、 2つ目の分岐命令を登録する ための別のウェイ(同一セット内ウェイ)を準備する必要がある。
(1— 2)次に、フェッチされた 16バイト中に 2つの分岐命令が存在し、 2つ目がヒットし たとする。図 11に、この場合の 2つ目の分岐命令の実行結果と、次の予測結果の組 合せを示す。この場合、ヒットしたウェイには、 2つ目の分岐命令が登録されており、ヒ ットしなかった 1つ目の分岐命令の処理が問題となる。
[0095] 図 11において、パターン 7は、 1つ目の分岐命令がヒットしな力つた力 分岐した場 合であり、この場合には、 2つ目の分岐命令は実行されない。また、図 11においても 、 "ヒットした"にも拘わらず、実行結果が" N— Tk"というのは、分岐予測を誤ったこと を示す。
[0096] 図 11で、 1つ目の分岐命令の登録が必要になるのは、パターン 4から 7である。この うち、パターン 5、 6については、ヒットした二つ目の分岐命令のウェイの情報しかなか つた場合、ヒットしたウェイに 1つ目の分岐命令を登録してしまうと、ー且登録できたと しても、直ちに、 2つ目の分岐命令の再登録によって上書きされることになる。
[0097] また、パターン 4については、 2つ目の分岐命令が今回はヒットした (分岐すると予測 された)けれども次には分岐しないと予測された結果、エントリの消去動作が発生する 。つまりこの場合には、ヒットした二つ目の分岐命令のウェイの情報しかな力つた場合 、ヒットしたウェイに 1つ目の分岐命令を登録してしまうと、 2つ目の分岐命令の消去動 作によって、せっかく登録した一つ目の分岐命令が消去されてしまうことになる。
[0098] これらの問題を回避するために、図 10のパターン 5、 6および図 11のパターン 4— 6 については、一つ目のヒットしなかった分岐命令について、ヒットしたウェイとは異なる 場所に分岐先アドレスを登録する必要がある。これには、リプレースフラグで決定され るウェイを使用することが考えられる。
[0099] すなわち、命令フェッチによって得られた 4つの命令でヒットした分岐命令は、その ままヒットしたウェイを使用するように設定される。具体的には、分岐予測装置 100は、 ヒットした分岐命令にヒットしたウェイの情報を付加してデコーダ 103に送出する。
[0100] また、ヒットしなかったがフェッチされた 4つの命令に含まれており、次に分岐が予測 される分岐命令は、リプレースフラグにしたがって選択されるウェイを使用するように 設定される。具体的には、分岐予測装置 100は、ヒットしな力つた分岐命令にリプレ 一スフラグとバリッドフラグにしたがって選択されたウェイの情報を付加してデコーダ 1 03に送出する。
[0101] さらに、 4つの命令がデコードされ、実行された結果にしたがって、分岐予測装置 1 00は、ウェイの情報(リプレースフラグ、バリッドフラグ等)と格納内容とを更新する。具 体的には、分岐予測装置 100は、不図示のグローバルヒストリ 140の予測にしたがつ て、次に分岐が予測される分岐先アドレスのウェイへの登録、リプレースフラグの変更 、およびヒットしたウェイのノリツドフラグを変更する。
[0102] 例えば、デコードされた 4つの命令中に 2つ分岐命令が含まれ、このうち、後の分岐 命令がヒットした場合を考える。この場合に、グローバルヒストリ 140の予測内容力 ヒ ットしな力つた最初の分岐命令が次に分岐する分岐命令であり、ヒットした分岐命令 は次に分岐が予測されな 、、 t 、うものであったとする(図 11のパターン 4の場合)。 このような場合、ヒットした分岐命令が格納されていたウェイは、ノリツドフラグがオフさ れ、無効なウェイ (未使用のウェイ)にされる。登録は順番に行われるので二つ目の分 岐命令のための消去動作によって一つ目が消去されるのを防ぐため、次に分岐が予 測される一つ目の分岐命令のために、ヒットしたウェイ以外のウェイを用意する必要が ある。
[0103] また、図 11のパターン 7のように、ヒットしなかった最初の分岐命令を実行した結果 それが分岐し、分岐予測が外れた場合には、その分岐命令を登録するウェイを用意 する必要がある。また、図 11のパターン 5、 6のように、ヒットしたウェイの分岐先ァドレ スへの次回の分岐が予測されるとともに、ヒットしな力つた最初の分岐命令が次に分 岐されると予測された場合も、ヒットしたウェイの他、さらになるウェイを用意する必要 がある。
(2)次に、図 8の最後のパターン (分岐が予測されな力つた場合である。図 8において (2)で示されている)について説明する。この場合の実行結果と次の予測との組合せ のパターンを図 12に示す。今、同時フェッチされた 4命令中に 2つの分岐命令が含ま れている場合を想定する。このうち、パターン 2、 3および 4においては、登録動作が 生じるのは 2つの分岐命令のうち、 1つ目あるいは 2つ目だけであるので、登録すべき ウェイは 1つでよい。
[0104] 一方、パターン 5、 6のとき、次に分岐が予測されるのは、同時にフェッチされた 4命 令中の 1つ目の分岐命令である。し力し、パターン 5では、グローバルヒストリ 140が 2 つ目の分岐命令の分岐をも予測している。またパターン 6では、二つ目の分岐命令 について予測が" N—Tk"であったにも関わらず実行結果が" Tk "であったため、登 録動作が生じる。
[0105] このような場合が生じるのは、実行されるプログラム中に 2重のループがあって、 1つ 目の分岐命令が内側の小さなループを形成し、 2つ目の分岐命令が外側の大きなル ープを形成する場合が考えられる。この場合、 2つ目の分岐命令は、 1つ目の分岐命 令(内側の小さなループを形成する分岐命令)が N—Tkとなったときに実行されるこ とになる。したがって、このような場合には、グロ一ノ レヒストリ 140力 、分岐するとの 予測 (登録する旨の指示)が送出される。このような場合、それぞれの分岐命令を登 録するウェイを用意する必要がある。以下、バリッドフラグの状態を場合分けして説明 する。
(a)無効なウェイが 2つ以上存在する場合
無効なウェイが存在する場合には、無効なウェイを優先して使用する。分岐予測装 置 100は、無効なウェイのうち、ウェイ番号の若い方から 2つウェイを取得する。すな わち、無効なウェイが存在する場合のリプレースラグの操作論理(図 6)にしたがって、 2回分のウェイの取得操作を行った結果、更新されたリプレースフラグを 2つ送出する
[0106] 例えば、読み出したリプレースフラグが(wayO、 wayl、 way2、 way3) = (0, 0, 0, 1)だったとする。また、無効なウェイが wayO, wayl, way3であったとする。
[0107] このとき、 1つ目の分岐命令を登録すべき候補のウェイ (第一候補)は、例えば、番 号の若い順に選択すると、 wayOとなる。また、 2つ目の分岐命令を登録すべき候補 のウェイ (第二候補)は、 waylとなる。リプレースフラグの反転の有無は、図 6の操作 表にしたがう。
[0108] 例えば、読み出したリプレースフラグが(0, 0, 0, 1)であって、無効なウェイである w ayOを使用した場合には、図 6より、リプレースフラグの反転が必要となる。このため、 第一候補として,登録用ウェイ番号 wayOおよび、リプレースフラグ 1 (0の反転)を命 令フェッチ制御ユニット 123に送出する。
[0109] このとき、分岐予測装置 100は、ー且、 wayoのリプレースフラグは 1になったと仮定 し、さらに次のウェイの選択を続行する。すなわち、リプレースフラグは、(wayO, way 1, way2, way3) = (1, 0, 0, 1)と仮定される。分岐予測装置 100は、この仮定に基 づいて第二候補の反転の有無を決定する。すなわち、リプレースフラグが(1, 0, 0, 1 )であって、無効なウェイである waylを使用した場合、図 6より、リプレースフラグの 反転は必要ない。
[0110] そこで、分岐予測装置 100は、第二候補として、登録用ウェイ番号 waylおよび、リ プレースフラグ 0を送出する。すなわち、以上の処理によって分岐予測装置 100は、 第一候補: wayO, リプレースフラグ = 1 ;
第二候補: way 1, リプレースフラグ =0 :
を決定し、命令フェッチ制御ユニット 123に送出する。
[0111] すると、命令フ ツチ制御ユニット 123は、命令バッファ 125を参照し、分岐命令が 存在する場合に、第一候補、第二候補の順に、ウェイ番号およびリプレースフラグを 分岐命令に付与する。
(b)無効なウェイが 1つだけ存在する場合
この場合、分岐予測装置 100は、無効なウェイを第一候補として決定する。次に、 分岐予測装置 100は、無効なウェイが存在する場合のリプレースフラグ操作表(図 6) にしたがって、操作を行った後のリプレースフラグの組合せを仮定する。そして、分岐 予測装置 100は、仮定されたリプレースフラグの組合せから、第二候補を決定する。
[0112] 例えば、読み出したリプレースフラグが(wayO, wayl, way2、 way3) = (0, 0, 0,
1)だったとする。また、無効なゥ イが wayOであったとする。
[0113] このとき、 1つ目の分岐命令用のウェイ (第一候補)は wayOとなる。リプレースフラグ の操作 (仮定)は、操作表にしたがう。リプレースフラグが(0, 0, 0, 1)のときは、 way
0を使用した場合、リプレースフラグの反転が必要となる(図 6参照)。そこで、分岐予 測装置 100は、第一候補として、登録用ウェイ番号 wayOおよび,リプレースフラグ 1 (
0の反転)を送出する。
[0114] このとき、分岐予測装置 100は、ー且、 wayOのリプレースフラグは 1になったと仮定 し、リプレースフラグは(wayO, wayl, way2, way3) = (1, 0, 0, 1)となる。
[0115] 分岐予測装置 100は、この仮定に基づいて第二候補を決定する。本例では、 1つ の無効なウェイを使用すれば、残りのウェイはすべて有効なウェイである。この場合に は、分岐予測装置 100は、リプレースフラグによるウェイの決定表(図 5参照)から、置 換対象のウェイとして way2を選択し、これを第二候補とする。この場合には、分岐予 測装置 100は、選択した way2のリプレースフラグを反転して送出する(バリッドフラグ は有効であるので、図 6の論理にしたがうことなぐリプレースフラグが無条件に反転さ れる)。すなわち、以上の処理によって分岐予測装置 100は、 第一候補: wayO, リプレースフラグ = 1 ;
第二候補: way2, リプレースフラグ = 1 ;
を決定し、命令フェッチ制御ユニット 123に送出する。
(c)無効なウェイがない場合
この場合、分岐予測装置 100は、リプレースフラグによるウェイの決定表(図 5)から 、候補を選択する。例えば、読み出したリプレースフラグが (wayO, wayl, way2, w ay3) = (0, 0, 0, 1)だったとする。
[0116] 分岐予測装置 100は、リプレースフラグによるウェイの決定表(図 5)から、置換対象 のウェイとして way3を選択し、これを第一候補とする。 way3のリプレースフラグは、 無条件に反転して送出されるので、その後のリプレースフラグの状態は、(wayO, wa yl, way2, way3) = (0、 0、 0、 0)となると仮定される。
[0117] 分岐予測装置 100は、この仮定されたリプレースフラグに基づいて第二候補を決定 する。すなわち、分岐予測装置 100は、図 5の表カゝら置換対象のウェイとして wayOを 選択し、第二候補とする。このとき、 wayOのリプレースフラグは無条件に反転して送 出される。すなわち、以上の処理によって分岐予測装置 100は、
第一候補: way3、リプレースフラグ =0
第二候補: wayO、リプレースフラグ = 1
を決定し、命令フェッチ制御ユニット 123に送出する。
[0118] 以上のように、分岐履歴記憶装置 130の読み出し時点で、分岐予測装置 100は、 2 つの候補ウェイ (第一候補、第二候補)を決定し、命令フ ツチ制御ユニット 123に送 出する。
[0119] 命令フェッチ制御ユニット 123は、フェッチされた順に分岐命令に第一候補、およ び第二候補の情報 (ウェイ番号およびリプレースフラグ)を付与する。これらの情報は 、命令に付加された状態で、分岐リザべーシヨンユニット 126に保持される。そして、 分岐命令の実行結果とともに、第一候補の情報が付加された分岐命令または第二 候補の情報が付加された分岐命令が分岐予測装置 100に戻される。
[0120] このとき、グローバルヒストリ 140からは、次に分岐が予測された分岐か否かの指示 が分岐予測装置 100に通知される。分岐予測装置 100は、グローバルヒストリ 140の 予測にしたがって、分岐命令に付与された番号のウェイに分岐命令を登録する。
[0121] <処理フロー >
図 13から図 18の図面により、分岐予測装置 100の処理を説明する。図 13から図 1 7は、分岐予測装置 100で実行される分岐履歴検索処理を示している。一方、図 18 は、一旦分岐予測装置 100から、分岐予測結果と、ウェイの情報が命令フェッチ制御 ユニット 123に送出され、分岐命令のデコードおよび実行後に分岐リザべーシヨンュ ニット 126から、分岐命令(ウェイの情報が付加された分岐命令)が戻された後の処理 を示している。
[0122] これらの処理は、基本的には、図 5および図 6に示された論理にしたがって、高々 2 個のウェイを選択する処理である。したがって、図 5および図 6の論理を実現する論理 回路を 2回駆動させる制御回路 (論理ゲートの組合せ)により、以下の処理が実現さ れる。
[0123] 図 13のように、分岐予測装置 100は、命令フ ツチ制御ユニット 123からの分岐予 測指示にしたカ^、、命令アドレスを基に、分岐履歴記憶装置 130のセットを決定する 。そして、決定されたセットを構成するウェイに対応するエントリからタグを読み出す( Sl)。
[0124] 次に、分岐予測装置 100は、分岐命令がいずれかのウェイでヒットした力否かを判 定する(S2)。すなわち、分岐予測装置 100は、ヒットタグの内容が、タグを構成すベ き命令アドレスの一部、例えば、命令アドレスく 31 : 16 >と一致した場合には、ヒット したと判定する。
[0125] ヒットした場合には、分岐先アドレスを命令フェッチ制御ユニット 123に送出する。さ らに、分岐予測装置 100は、現在のノリツドフラグおよびリプレースフラグの設定にし たカ^、ウェイを選択する(S4)。
[0126] すなわち、無効なウェイがあった場合には、そのウェイを優先して選択する。その際 に、図 6の表にしたがって、リプレースフラグの反転の有無を決定する。また、無効な ウェイがない場合には、現在のリプレースフラグの設定を元に、図 5の表にしたがって 、ウェイを選択する。すでに、第 1実施形態で説明したにょうに、リプレースフラグから 図 5の選択および図 6の反転の有無を決定する処理は、論理ゲートの組合せによつ て実現できる。
[0127] そして、分岐予測装置 100は、ウェイ (ヒットしたウェイと S3で選択されたウェイ、また は、 S4で選択された 2つのウェイ)の情報を命令フェッチ制御ユニット 123に送出する (S5)。
[0128] 一方、 S2の判定で、分岐命令がいずれのウェイにおいても、ヒットしなかった場合、 分岐予測装置 100は、リプレースフラグにしたがって 2つのウェイを選択する(S4)。 そして、分岐予測装置 100は、選択された 2つのウェイの情報を命令フェッチ制御ュ ニット 123に送出する(S6)。
[0129] 図 14に、分岐予測装置 100がリプレースフラグにしたがって 2つのウェイを選択す る処理(図 13の S5、 2ウェイ選択処理という)の詳細を示す。この処理では、分岐予 測装置 100は、まず、無効なウェイが 2つ存在するか否かを判定する(S51)。該当す るセットに 2つ以上の無効なウェイが存在する場合には、分岐予測装置 100は、 2つ の無効ウェイ選択処理を実行する(S52)。
[0130] また、無効なウェイが 2つ存在しない場合、分岐予測装置 100は、まず、無効なゥェ ィが 1つ存在するか否かを判定する(S53)。該当するセットに 1つの無効なウェイが 存在する場合には、分岐予測装置 100は、無効ウェイと有効ウェイ選択処理を実行 する(S54)。
[0131] また、該当するセットに無効なウェイが存在しない場合には、分岐予測装置 100は 、有効な 2つのウェイ選択処理を実行する(S55)。
[0132] 図 15に、 2つの無効ウェイ選択処理(図 14の S52)の詳細を示す。この処理では、 分岐予測装置 100は、ウェイのバリッドフラグを参照し、第 1の無効ウェイを選択する( S521)。どの無効なウェイを選択するかについて特に制限はない。例えば、ウェイの 番号の若 、順に選択してもよ 、。
[0133] 次に、分岐予測装置 100は、図 6の表の論理にしたがって、リプレースフラグの反転 の有無を仮決定する(S522)。さらに、分岐予測装置 100は、ウェイのバリッドフラグ を参照し、第二の無効ウェイを選択する(S523)。そして、 S522で仮決定されたリブ レースフラグの状態と、図 6の表の論理にしたがって、さらに、リプレースフラグの反転 の有無を仮決定する(S524)。なお、これらのウェイの情報 (番号とリプレースフラグ) は、図 6の S6の処理で送出される。反転の有無が仮決定されたリプレースフラグは、 分岐命令の実行後、分岐履歴の格納において、反転が確定する。
[0134] 図 16に、無効ウェイと有効ウェイ選択処理(図 14の S54)の詳細を示す。この処理 では、分岐予測装置 100は、ウェイのノリツドフラグを参照し、無効ウェイを選択する( S541)。
[0135] 次に、分岐予測装置 100は、図 6の表の論理にしたがって、リプレースフラグの反転 の有無を仮決定する(S 542)。次に、分岐予測装置 100は、仮決定されたウェイの状 態にしたがって、有効なウェイを 1つ選択する(S543)。そして、選択されたウェイのリ プレースフラグを仮に反転する(S524)。なお、仮に反転されたリプレースフラグは、 分岐命令の実行後、分岐履歴の格納において、反転が確定する。
[0136] 図 17に、有効な 2つウェイ選択処理(図 14の S55)の詳細を示す。この処理では、 分岐予測装置 100は、現在のリプレースフラグを参照し、第一のウェイを選択する(S 551)。
[0137] 次に、分岐予測装置 100は、選択された第一のウェイのリプレースフラグを仮に反 転する(S552)。次に、分岐予測装置 100は、仮反転されたウェイの状態にしたがつ て、有効な第二のウェイを 1つ選択する(S553)。そして、選択された第二のウェイの リプレースフラグを仮に反転する(S554)。
[0138] 図 18に、分岐命令格納処理のフローチャートを示す。この処理では、分岐予測装 置 100は、実行が完了した分岐命令またはフェッチされて分岐しなカゝつた分岐命令と 、その分岐命令に付加されているウェイの情報(ウェイの番号、仮決定された反転の 有無)を分岐リザべーシヨンステーション 126から取得する(S 11)。
[0139] 次に、分岐予測装置 100は、グローバルヒストリ 140から、その分岐命令が次に分 岐するか否かの情報(グローバルヒストリ 140の予測)を取得する(S 12)。なお、グロ 一バルヒストリ 140による予測そのものは、本実施形態の処理と直接関係がないので 、その説明を省略する。
[0140] そして、分岐予測装置 100は、その分岐命令が次に分岐すると予測されているか 否かを判定する(S 13)。そのウェイのノリツドフラグをクリアし、無効なウェイとする(S 14)。 S13の判定で、次に分岐すると判定された場合、分岐予測装置 100は、分岐 履歴 (分岐先アドレス)をその分岐命令に付加されている情報で指定されたウェイに 格納する(S15)。このとき、その命令アドレスの一部がタグとしてエントリに格納される
[0141] 次に、分岐予測装置 100は、分岐命令に付加されている情報にしたがってリプレー スフラグを設定する(S 16)。この時点で、仮設定されたリプレースフラグの内容が確 定すること〖こなる。
[0142] 以上述べたように、本実施形態の分岐処理装置 100によれば、 1回のフェッチにお V、て複数命令をフェッチするような装置にぉ 、ても、 LRUに近 、効率でリプレースフ ラグを管理することができる。すなわち、 LRUほど最適の選択はできないが、図 5およ び図 6の表にしたがって、書き換えたウェイを可能な限り後の時点 (第 1実施形態の 場合と同様、最悪でも 4つのウェイに対して最後に書き換えられたウェイが 3回目のァ クセスで書き換えられる場合がある)で書き換えるにょうにウェイの書き換えを制御で きる。
[0143] 《変形例》
上記第 2実施形態では、 1回のフェッチで 2つ以上の分岐命令が存在することがあり 得る処理装置において、図 5および図 6のテーブルにしたがって、書き換えるべきゥェ ィを選択する処理を示した。この処理では、 2つ分岐命令の分岐先アドレスを格納す るウェイとして、まず、 1つのウェイを選択し、その後、仮にリプレースフラグを設定した 上で、第 2番目のウェイを決定した。
[0144] しかし、このような複雑な処理を実行する代わりに、以下のような処理を行ってもよ!ヽ
[0145] 例えば、ヒットしたウェイの番号を元にウェイ番号を生成してウェイを選択するように してちよい。
[0146] 例えば、 4つのウェイ番号を示す 2ビットの信号を way<l: 0>とすれば、 "00"、 "01 "、 "10"、 "11"のビットパターンが存在する。例えば、ヒットしたウェイが存在する場合 には、一方のビット wayく 1>を反転するという処理を構成すればよい。この場合、ヒッ トしたウェイが" 00"であれば、上位ビットを反転し" 10"を生成してウェイを選択すれ ばよい。このようなビットの操作は、ハードウェア (論理ゲート)で簡易に実現できる。 [0147] また、これは例えば、上記第 1実施形態および第 2実施形態で用いたバリッドフラグ を優先してもよい。すなわち、ヒットしたウェイが存在する場合で、 2つ目のウェイを選 択する場合(図 13の S4)、まず、バリッドフラグ力も無効なウェイが存在する力否かを 判定するようにしてもよい。そして、無効なウェイが存在する場合には、その無効なゥ エイを 2つ目のウェイとして、選択するようにし、無効なウェイが存在しない場合には、 上記のようなビットの反転によってヒットしたウェイ以外のウェイを選択するようにしても よい。このような制御にすることで、無効なウェイを有効に利用するとともに、ヒットした ウェイの上書きを極力低減することができる。
[0148] また、ヒットしな力つた場合には、リプレースフラグで決定されるウェイを通常通り一 つの候補とし、そのウェイの番号を元にして、前述のヒットしたウェイ番号がある場合と 同様の処理を行ってもよい。つまり、リプレーフラグで決定された 4つのウェイ番号を 示す 2ビットの信号を wayく 1: 0>とすれば、 "00"、 "01"、 "10"、 "11"のビットパタ ーンが存在する。ここから、一方のビット wayく 1>を反転するという処理などでもう一 つのウェイ番号を構成すればよい。例えば、元のリプレースフラグによる一つ目の分 岐命令のためのウェイが" 00"であれば、上位ビットを反転し" 10"を生成して二つ目 の分岐命令のためのウェイとすればょ 、。
[0149] 図 19に、このような変形例に係る分岐履歴検索処理のフローチャートを示す。図 19 の処理で、図 13と同様の処理については、図 13と同一の符号を付している。
[0150] すなわち、図 19のように、分岐予測がヒットした場合には、分岐予測装置 100は、ヒ ットしたウェイの情報を基に、ヒットしたウェイ以外のウェイを
つ選択する(S4A)。
[0151] 一方、ヒットしな力つた場合には、分岐予測装置 100は、 2ウェイ選択処理を実行す る(S5A)。この場合の 2ウェイ選択処理は、図 14と同様の処理でもよい。また、 2ゥェ ィ選択処理として、上述のように、ノ リツドフラグとリプレースフラグとで決定されるゥェ ィを通常通り一つの候補とし、そのウェイの番号を元にして、前述のヒットしたウェイ番 号がある場合と同様のビット反転処理を行って 2つ目の候補としてもよい。

Claims

請求の範囲
[1] 少なくとも命令の記憶元から命令を取得する取得段階と前記命令を実行する実行 段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で複 数命令を取得する取得部と、
前記コンピュータによって次の実行段階で実行される命令が分岐命令である力否 かを過去に実行された命令の履歴情報にしたがって予測する分岐命令予測部と、 前記取得された命令の少なくとも 1つを前記実行段階で実行する実行部と、を備え 前記分岐命令予測部は、
前記実行された命令または前記取得された命令に含まれる分岐命令の分岐先ァ ドレスを、前記命令の記憶元を参照するための命令アドレス力 決定される複数の格 納先のいずれかに前記履歴情報として記憶する履歴記憶部と、
実行された分岐命令の分岐先アドレスまたは前記取得段階で取得された分岐命 令の分岐先アドレスを前記履歴情報として記憶すべき場合に、前記複数の格納先の いずれかを選択するための選択情報を参照して格納先を選択する選択部と、
選択された格納先に前記分岐先アドレスを記憶する記憶制御部と、 前記格納先への記憶に対応して前記選択情報を更新する更新部と、を有し、 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合に、第 1の 分岐先アドレスを前記格納先に記憶したときに前記更新手段によって更新された後 の前記選択情報にしたがって第 2の分岐先アドレスの格納先を選択するコンピュータ の分岐予測装置。
[2] 前記選択情報は、前記命令アドレスよって決定される前記複数の格納先への書き 込み順を指定する、複数の格納先のそれぞれに対して 1ビットの書き込み順情報を 含み、
前記選択部は、前記書き込み順情報にしたがって前記分岐先アドレスの格納先を 選択する請求項 1に記載のコンピュータの分岐予測装置。
[3] 前記履歴記憶部は、前記命令の取得段階において取得中の命令アドレスにしたが つて前記複数の格納先力 その命令が分岐命令であった場合の分岐先アドレスを検 索し、 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、かつ、 第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先から検索さ れたものである場合に、その格納先を第 1の格納先とするとともに、前記選択情報に したがって第 2の格納先を選択する請求項 1または 2に記載のコンピュータの分岐予 測装置。
[4] 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、かつ、 第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先から検索さ れたものでない場合に、前記選択情報にしたがって第 1の格納先を選択するとともに 、前記選択情報を更新し、前記更新された選択情報にしたがって第 2の格納先を選 択する請求項 1または 2に記載のコンピュータの分岐予測装置。
[5] 前記選択情報は、前記複数の格納先ごとにその格納内容が有効か無効かを示す フラグ情報を有し、
前記選択部は、前記フラグ情報によって格納内容が無効であると示されて 、る格納 先を優先して選択する請求項 1から 4のいずれかに記載のコンピュータの分岐予測 装置。
[6] 少なくとも命令の記憶元から命令を取得する取得段階と前記命令を実行する実行 段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で複 数命令を取得する取得部と、
前記コンピュータによって次の実行段階で実行される命令が分岐命令である力否 かを過去に実行された命令の履歴情報にしたがって予測する分岐命令予測部と、 前記取得された命令の少なくとも 1つを前記実行段階で実行する実行部と、を備え 前記分岐命令予測部は、
前記実行された命令または前記取得された命令に含まれる分岐命令の分岐先ァ ドレスを、前記命令の記憶元を参照するための命令アドレス力 決定される複数の格 納先のいずれかに前記履歴情報として記憶する履歴記憶部と、
実行された分岐命令の分岐先アドレスまたは前記取得段階で取得された分岐命 令の分岐先アドレスを前記履歴情報として記憶すべき場合に、前記複数の格納先の いずれかを選択するための選択情報を参照して格納先を選択する選択部と、 選択された格納先に前記分岐先アドレスを記憶する記憶制御部と、 前記格納先への記憶に対応して前記選択情報を更新する更新部と、を有し、 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、 かつ、第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先から 検索されたものである場合に、その格納先を第 1の格納先とするとともに、前記第 1の 格納先を元に生成した前記第 1の格納先以外の第 2の格納先を選択するコンビユー タの分岐予測装置。
[7] 前記選択情報は、前記複数の格納先ごとにその格納内容が有効か無効かを示す フラグ情報を有し、
前記選択部は、前記フラグ情報によって格納内容が無効であると示されて 、る格納 先を優先して選択する請求項 6に記載のコンピュータの分岐予測装置。
[8] 少なくとも命令の記憶元から命令を取得する取得段階と前記命令を実行する実行 段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で複 数命令を取得する取得部と、
前記コンピュータによって次の実行段階で実行される命令が分岐命令である力否 かを過去に実行された命令の履歴情報にしたがって予測する分岐命令予測部と、 前記取得された命令の少なくとも 1つを前記実行段階で実行する実行部と、を備え 前記分岐命令予測部は、
前記実行された命令または前記取得された命令に含まれる分岐命令の分岐先ァ ドレスを、前記命令の記憶元を参照するための命令アドレス力 決定される複数の格 納先のいずれかに前記履歴情報として記憶する履歴記憶部と、
実行された分岐命令の分岐先アドレスまたは前記取得段階で取得された分岐命 令の分岐先アドレスを前記履歴情報として記憶すべき場合に、前記複数の格納先の いずれかを選択するための選択情報を参照して格納先を選択する選択部と、
選択された格納先に前記分岐先アドレスを記憶する記憶制御部と、 前記格納先への記憶に対応して前記選択情報を更新する更新部と、を有し、 前記選択部は、前記格納先に格納すべき分岐アドレスが複数ある場合で、 かつ、第 1の分岐先アドレスが前記履歴記憶部によって前記いずれかの格納先から 検索されたものでない場合に、前記選択情報にしたがって第 1の格納先を選択する とともに、前記第 1の格納先を元に生成した前記第 1の格納先以外の第 2の格納先を 選択するコンピュータの分岐予測装置。
PCT/JP2006/303769 2006-02-28 2006-02-28 コンピュータの分岐予測装置 WO2007099604A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2008502591A JP5136404B2 (ja) 2006-02-28 2006-02-28 演算処理装置、演算処理装置の制御方法
EP06714898.1A EP1990713B1 (en) 2006-02-28 2006-02-28 Branch predicting device for computer
PCT/JP2006/303769 WO2007099604A1 (ja) 2006-02-28 2006-02-28 コンピュータの分岐予測装置
US12/196,486 US8578140B2 (en) 2006-02-28 2008-08-22 Branch prediction apparatus of computer storing plural branch destination addresses

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2006/303769 WO2007099604A1 (ja) 2006-02-28 2006-02-28 コンピュータの分岐予測装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US12/196,486 Continuation US8578140B2 (en) 2006-02-28 2008-08-22 Branch prediction apparatus of computer storing plural branch destination addresses

Publications (1)

Publication Number Publication Date
WO2007099604A1 true WO2007099604A1 (ja) 2007-09-07

Family

ID=38458728

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2006/303769 WO2007099604A1 (ja) 2006-02-28 2006-02-28 コンピュータの分岐予測装置

Country Status (4)

Country Link
US (1) US8578140B2 (ja)
EP (1) EP1990713B1 (ja)
JP (1) JP5136404B2 (ja)
WO (1) WO2007099604A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015036888A (ja) * 2013-08-13 2015-02-23 富士通株式会社 演算処理装置及び演算処理装置の制御方法

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012023185A1 (ja) * 2010-08-18 2012-02-23 富士通株式会社 試験方法、演算処理装置、試験プログラム、試験プログラム生成方法、試験プログラム生成装置、及び試験プログラム生成プログラム
GB2526943B (en) 2011-12-20 2016-04-27 Imagination Tech Ltd Method and apparatus for compressing and decompressing data
JP6205966B2 (ja) * 2013-08-15 2017-10-04 富士通株式会社 演算処理装置及び演算処理装置の制御方法
US9672043B2 (en) 2014-05-12 2017-06-06 International Business Machines Corporation Processing of multiple instruction streams in a parallel slice processor
US9720696B2 (en) 2014-09-30 2017-08-01 International Business Machines Corporation Independent mapping of threads
CN105590178A (zh) * 2014-10-21 2016-05-18 阿里巴巴集团控股有限公司 一种资源处理方法与设备
US9977678B2 (en) 2015-01-12 2018-05-22 International Business Machines Corporation Reconfigurable parallel execution and load-store slice processor
US10133581B2 (en) * 2015-01-13 2018-11-20 International Business Machines Corporation Linkable issue queue parallel execution slice for a processor
US10133576B2 (en) 2015-01-13 2018-11-20 International Business Machines Corporation Parallel slice processor having a recirculating load-store queue for fast deallocation of issue queue entries
US10037211B2 (en) 2016-03-22 2018-07-31 International Business Machines Corporation Operation of a multi-slice processor with an expanded merge fetching queue
US10346174B2 (en) 2016-03-24 2019-07-09 International Business Machines Corporation Operation of a multi-slice processor with dynamic canceling of partial loads
US10761854B2 (en) 2016-04-19 2020-09-01 International Business Machines Corporation Preventing hazard flushes in an instruction sequencing unit of a multi-slice processor
US10037229B2 (en) 2016-05-11 2018-07-31 International Business Machines Corporation Operation of a multi-slice processor implementing a load/store unit maintaining rejected instructions
US10318419B2 (en) 2016-08-08 2019-06-11 International Business Machines Corporation Flush avoidance in a load store unit
US20190369999A1 (en) * 2018-06-04 2019-12-05 Advanced Micro Devices, Inc. Storing incidental branch predictions to reduce latency of misprediction recovery
US20230214222A1 (en) * 2021-12-30 2023-07-06 Arm Limited Methods and apparatus for storing instruction information

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0689173A (ja) * 1992-09-09 1994-03-29 Fujitsu Ltd ブランチ・ヒストリーを持つ命令実行処理装置
JPH10133874A (ja) * 1996-11-01 1998-05-22 Mitsubishi Electric Corp スーパスカラプロセッサ用分岐予測機構
JPH10171652A (ja) * 1996-10-07 1998-06-26 Internatl Business Mach Corp <Ibm> ブランチ・ヒストリ・テーブルを更新するための方法および装置
JP2000172503A (ja) * 1998-12-10 2000-06-23 Fujitsu Ltd 複数のウェイを持つブランチヒストリを備える情報処理装置
US20020188834A1 (en) 2001-05-04 2002-12-12 Ip First Llc Apparatus and method for target address replacement in speculative branch target address cache
JP2004038298A (ja) 2002-06-28 2004-02-05 Fujitsu Ltd セットアソシアティブ方式の記憶装置及びキャッシュメモリ装置
EP1624369A2 (en) 2004-08-04 2006-02-08 VIA Technologies, Inc. Apparatus for predicting multiple branch target addresses

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE4211222B4 (de) * 1991-04-05 2009-05-28 Kabushiki Kaisha Toshiba, Kawasaki Abzweigungs-Vorhersage-Vorrichtung und Abzweigungs-Vorhersage-Verfahren für einen Super-Skalar-Prozessor
US5434985A (en) * 1992-08-11 1995-07-18 International Business Machines Corporation Simultaneous prediction of multiple branches for superscalar processing
US5574871A (en) * 1994-01-04 1996-11-12 Intel Corporation Method and apparatus for implementing a set-associative branch target buffer
US6088793A (en) * 1996-12-30 2000-07-11 Intel Corporation Method and apparatus for branch execution on a multiple-instruction-set-architecture microprocessor
US5802602A (en) * 1997-01-17 1998-09-01 Intel Corporation Method and apparatus for performing reads of related data from a set-associative cache memory
JP3798998B2 (ja) 2002-06-28 2006-07-19 富士通株式会社 分岐予測装置および分岐予測方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0689173A (ja) * 1992-09-09 1994-03-29 Fujitsu Ltd ブランチ・ヒストリーを持つ命令実行処理装置
JPH10171652A (ja) * 1996-10-07 1998-06-26 Internatl Business Mach Corp <Ibm> ブランチ・ヒストリ・テーブルを更新するための方法および装置
JPH10133874A (ja) * 1996-11-01 1998-05-22 Mitsubishi Electric Corp スーパスカラプロセッサ用分岐予測機構
JP2000172503A (ja) * 1998-12-10 2000-06-23 Fujitsu Ltd 複数のウェイを持つブランチヒストリを備える情報処理装置
US20020188834A1 (en) 2001-05-04 2002-12-12 Ip First Llc Apparatus and method for target address replacement in speculative branch target address cache
JP2004038298A (ja) 2002-06-28 2004-02-05 Fujitsu Ltd セットアソシアティブ方式の記憶装置及びキャッシュメモリ装置
EP1624369A2 (en) 2004-08-04 2006-02-08 VIA Technologies, Inc. Apparatus for predicting multiple branch target addresses

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP1990713A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015036888A (ja) * 2013-08-13 2015-02-23 富士通株式会社 演算処理装置及び演算処理装置の制御方法

Also Published As

Publication number Publication date
JP5136404B2 (ja) 2013-02-06
EP1990713A1 (en) 2008-11-12
US20080320288A1 (en) 2008-12-25
JPWO2007099604A1 (ja) 2009-07-16
US8578140B2 (en) 2013-11-05
EP1990713A4 (en) 2009-06-17
EP1990713B1 (en) 2013-04-10

Similar Documents

Publication Publication Date Title
JP5136404B2 (ja) 演算処理装置、演算処理装置の制御方法
US6073213A (en) Method and apparatus for caching trace segments with multiple entry points
KR100880686B1 (ko) 2개 레벨의 분기 예측 캐시를 갖는 분기 예측
US6076144A (en) Method and apparatus for identifying potential entry points into trace segments
US6216206B1 (en) Trace victim cache
KR100783828B1 (ko) 단일 스레드 프로그램의 암시적 멀티스레디드 실행을 행할수 있는 멀티스레디드 프로세서
CN100478872C (zh) 最小化未调度d缓存缺失流水线停顿的方法和装置
US5933860A (en) Multiprobe instruction cache with instruction-based probe hint generation and training whereby the cache bank or way to be accessed next is predicted
US6289442B1 (en) Circuit and method for tagging and invalidating speculatively executed instructions
JP3502592B2 (ja) 分岐予測装置
JP3760041B2 (ja) 分岐予測する情報処理装置
US20040128448A1 (en) Apparatus for memory communication during runahead execution
JPS5991546A (ja) 中央処理装置
JP2001236266A (ja) 高レベルキャッシュの効率改善方法
CN101449238A (zh) 本地和全局分支预测信息存储
JP2007207240A (ja) データ・ラインのための自己プリフェッチl2キャッシュ機構
US7743238B2 (en) Accessing items of architectural state from a register cache in a data processing apparatus when performing branch prediction operations for an indirect branch instruction
CN101017430A (zh) D缓存缺失预测和调度的方法和装置
JP2003005956A (ja) 分岐予測装置、プロセッサ、及び分岐予測方法
US20080098174A1 (en) Cache memory having pipeline structure and method for controlling the same
US10747540B2 (en) Hybrid lookahead branch target cache
JP2007272280A (ja) データ処理装置
JP2001100995A (ja) 分岐履歴情報の書き込み制御装置及びその方法
US7036003B1 (en) Instruction processing device and method for controlling branch instruction accompanied by mode change
US6532534B1 (en) Information processing apparatus provided with branch history with plurality of designation ways

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application
ENP Entry into the national phase

Ref document number: 2008502591

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2006714898

Country of ref document: EP