US20070162728A1 - Information processing apparatus, replacing method, and computer-readable recording medium on which a replacing program is recorded - Google Patents
Information processing apparatus, replacing method, and computer-readable recording medium on which a replacing program is recorded Download PDFInfo
- Publication number
- US20070162728A1 US20070162728A1 US11/703,225 US70322507A US2007162728A1 US 20070162728 A1 US20070162728 A1 US 20070162728A1 US 70322507 A US70322507 A US 70322507A US 2007162728 A1 US2007162728 A1 US 2007162728A1
- Authority
- US
- United States
- Prior art keywords
- branch
- entry
- branch history
- past
- memory section
- Prior art date
- Legal status (The legal status 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 status listed.)
- Abandoned
Links
- 238000000034 method Methods 0.000 title claims description 56
- 230000010365 information processing Effects 0.000 title abstract description 38
- 230000015654 memory Effects 0.000 claims abstract description 128
- 230000006870 function Effects 0.000 abstract description 74
- 238000007616 round robin method Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- COCAUCFPFHUGAA-MGNBDDOMSA-N n-[3-[(1s,7s)-5-amino-4-thia-6-azabicyclo[5.1.0]oct-5-en-7-yl]-4-fluorophenyl]-5-chloropyridine-2-carboxamide Chemical compound C=1C=C(F)C([C@@]23N=C(SCC[C@@H]2C3)N)=CC=1NC(=O)C1=CC=C(Cl)C=N1 COCAUCFPFHUGAA-MGNBDDOMSA-N 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 101000637342 Homo sapiens Nucleolysin TIAR Proteins 0.000 description 1
- 102100032138 Nucleolysin TIAR Human genes 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
- G06F9/3848—Speculative instruction execution using hybrid branch prediction, e.g. selection between prediction techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3802—Instruction prefetching
- G06F9/3804—Instruction prefetching for branches, e.g. hedging, branch folding
- G06F9/3806—Instruction 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 technique of replacing an entry in case that all entries are in use in a full-associative memory device, for example, a technique preferably used, in an information processing apparatus in which a global history system or a local history system is used for predicting a branch direction of a branch instruction with reference to a past branch history held by a full-associative branch history memory section (past branch history memory section), when replacing an entry of the branch history memory section with a new entry.
- an entry least recently used since it was accessed is selected as an unnecessary entry which is an object of replacement, and therefore particularly in a global history register (see patent document 1 listed above) or the like which expects a history will be repeated and provides an expectation value from its periodicity, an entry least recently used since it was accessed is not always an unnecessary entry due to its characteristic.
- the entry about such a long interval branch instruction as to appear with a low frequency but at a fixed interval is assumed to be an entry which is an object of replacement, if possible.
- the possibility of assuming the entry about an instruction appearing with a low frequency to be an entry, which is an object of replacement becomes high, so it is also difficult to say that the LRU method is an effective method.
- Patent Document 1 Japanese Patent Laid-Open (Kokai) No. 2004-38323
- Patent Document 2 Japanese Patent Laid-Open (Kokai) No. 2002-278752
- Patent Document 3 Japanese Patent Laid-Open (Kokai) No. HEI 6-67880
- the present invention has been developed in view of such problems and aims to realize effective replacement by enabling an unnecessary entry to be selected as an entry, which is an object of replacement, without using new resources in a full-associative memory device.
- the present invention aims to realize effective replacement, in an information processing apparatus, for example, in which a global history system is employed, by enabling an entry of the entries of the branch history memory section, which does not affect prediction about a branch direction of a branch instruction without its entry, to be selected as an entry, which is an object of replacement, without using new resources.
- an information processing apparatus comprises: a branch history register for holding, in order to predict a branch destination of a branch instruction, a correspondence table providing the correspondence between an address of said branch instruction and an address of the predicted branch destination of said branch instruction; a past branch history memory section for holding past branch directions of said branch instruction as a branch history; a branch direction predictor for predicting a branch direction of said branch instruction on the basis of said branch history held by said past branch history memory section; a branch history register updating section for updating said correspondence table held by said branch history register on the basis of the branch direction predicted by said branch direction predictor; a selector for selecting one entry from all entries of said past branch history memory section in case that all entries of said past branch history memory section are in use when a branch history about a new branch instruction is registered into said past branch history memory section; and a replacing section for registering the branch history about said new branch instruction into said one entry selected by said selector, wherein said selector has a first selecting function of selecting said one entry on the basis
- Said selector preferably has a second selecting function of selecting, as said one entry, an entry registered earliest of all entries of said past branch history memory section, and employs an entry selected with said first selecting function on a higher priority basis than an entry selected with said second selecting function.
- said selector preferably has a second selecting function of selecting, as said one entry, an entry used earliest for prediction by said branch direction predictor of all entries of said past branch history memory section, and employs an entry selected with said first selecting function on a higher priority basis than an entry selected with said second selecting function.
- said first selecting function of said selector preferably is a function of selecting, as said one entry, an entry in which said branch history held by said past branch history memory section includes only branches taken, and in this case said first selecting function of said selector preferably is a function of selecting an entry in which the number of branches taken included in said branch history held by said past branch history memory section is equal to or more than a predetermined number.
- said past branch history memory section preferably holds, as said branch history, the number of branches, which were successively taken, and the number of branches, which were not successively taken until a changeover is made twice of the branch taken/the branch not taken, which signifies said branch direction of said branch instruction, and said branch direction predictor preferably predicts the branch taken/the branch not taken, which is said branch direction of said branch instruction, on the basis of said number of branches successively taken and said number of branches not successively taken.
- said information processing apparatus preferably further comprises a branch history architecting state determining section for determining whether or not said branch history held by said past branch history memory section is in an initial architecting state, wherein said branch direction predictor preferably does not perform prediction of said branch direction based on said branch history when said branch history architecting state determining section determines that said branch history is in an initial architecting state.
- a replacing method for an information processing apparatus which includes a branch history register for holding, in order to predict a branch destination of a branch instruction, a correspondence table providing the correspondence between an address of said branch instruction and an address of the predicted branch destination of said branch instruction, a past branch history memory section for holding past branch directions of said branch instruction as a branch history, a branch direction predictor for predicting a branch direction of said branch instruction on the basis of said branch history held by said past branch history memory section, and a branch history register updating section for updating said correspondence table held by said branch history register on the basis of the branch direction predicted by said branch direction predictor, said replacing method, used for entries of said past branch history memory section in case that all of said entries are in use when a branch history about a new branch instruction is registered into said past branch history memory section, comprises the steps of: (a)selecting one entry from all entries of said past branch history memory section; and (b)registering a branch history about said new branch instruction into said one entry selected in said
- a computer-readable recording medium is a computer-readable recording medium on which said replacing program is recorded.
- an entry which is an object of replacement, is selected on the basis of a branch history originally provided in the past branch history memory section to be used for predicting a branch direction, so that an entry unnecessary for branch prediction can be selected on a priority basis without specially holding new information for replacing, in other words, without using new resources, whereby effective replacement can be performed.
- selecting an entry, in which said branch history held by the past branch history memory section includes only branches taken, i.e. an entry, in which branches were all taken since registration in the branch history and yet the number of branches taken is equal to or more than a predetermined number, as an entry, which is an object of replacement, on a priority basis makes it possible to select an entry of the entries of the past branch history memory section, which does not affect prediction about a branch direction of a branch instruction without its entry, as an entry, which is an object of replacement. This makes it possible to realize effective replacement, to effectively use the limited resources of the past branch history memory section, and to improve the accuracy (performance) of prediction about a branch direction performed by using the past branch history memory section.
- FIG. 1 is a block diagram showing the configuration of an information processing apparatus which is an embodiment of the present invention
- FIG. 2 shows the data structure of a correspondence table held by the branch history register of the information processing apparatus which is the embodiment of the present invention
- FIG. 3 shows the data structure of a branch history held by the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIGS. 4 ( a ) and 4 ( b ) depict the configuration of a branch history held by the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIG. 4 ( a ) is a concrete example showing branch directions of a branch instruction
- FIG. 4 ( b ) shows the data structure of a branch history in the concrete example of FIG. 4 ( a );
- FIG. 5 is a flow chart depicting the operation procedure of the branch history updating section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIG. 6 is a flow chart depicting the operation procedures of the branch history updating section, branch direction predictor, and branch history architecting stage determining section of the global history register of the information processing apparatus which is the embodiment of the present invention (the procedure of the method of retrieving the past branch history memory section);
- FIG. 7 shows a signal generating circuit for generating a CREATE_NEW_WRGHT signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 8 is a flow chart depicting the procedure of registering a new entry to the past branch history memory section by the branch history updating section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIG. 9 shows a signal generating circuit for generating a WRGHT_HIT signal in the information processing apparatus which is the embodiment of the present invention.
- FIG. 10 shows a signal generating circuit for generating a WRGHT_HIT_OR signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 11 is a flow chart depicting the procedure of selecting an entry with the first selecting function of the selector of the branch history updating section of the information processing apparatus which is the embodiment of the present invention
- FIG. 12 shows a signal generating circuit for generating a WRGHT_FULL signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 13 shows a signal generating circuit for generating a CURRENT_CRT_OVERFLOW signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 14 shows a signal generating circuit for generating an OVERWRITE_CANDIDATE_WRGHT signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 15 depicts that an OVERWRITE_CANDIDATE_WRGHT signal is generated from all entries in the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIG. 16 is a time chart depicting the process executed until a CURRENT_CTR_OVERFLOW signal is generated from the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention
- FIGS. 17 ( a ) to 17 ( f ) depict the technique of selecting one entry with the first selecting function of the selector of the branch history updating section of the information processing apparatus which is the embodiment of the present invention
- FIG. 18 shows a signal generating circuit for generating a WRGHT_NEXT_PTR ⁇ K: 0 > signal in the information processing apparatus which is the embodiment of the present invention
- FIG. 19 depicts a WRGHT_NEXT_PTR ⁇ K: 0 > signal generated in the information processing apparatus which is the embodiment of the present invention
- FIG. 20 is a flow chart depicting the procedure of a replacing method which is the embodiment of the present invention.
- FIG. 21 shows a signal generating circuit for generating a USE_OVERWRITE_CANDIDATE signal in the information processing apparatus which is the embodiment of the present invention.
- FIG. 22 depicts a signal generating circuit for generating a CREATE_WRGHT signal in the information processing apparatus which is the embodiment of the present invention.
- FIG. 1 is a block diagram showing the configuration of the information processing apparatus 1 which is an embodiment of the present invention.
- the information processing apparatus 1 which is an embodiment of the present invention comprises an instruction fetch address generator 10 , an instruction fetch section 11 , an instruction decoder 12 , a branch instruction controller 13 , a branch history register 15 , and a global history register 20 .
- the instruction fetch section 11 outputs an instruction fetch request using an instruction fetch address generated by the instruction fetch address generator 10 , and at the same time retrieves the branch history register 15 .
- the instruction fetch section 11 When a branch instruction corresponding to the instruction fetch address has been registered in the branch history register 15 , the instruction fetch section 11 reads the instruction address of a branch destination predicted by the branch history register 15 , and performs next instruction fetch on the basis of the instruction address which has been read.
- FIG. 2 shows the data construction of a correspondence table 15 a held by the branch history register 15 .
- the branch history register 15 holds the correspondence table 15 a consisting of branch instruction addresses (IARs) and predicted branch destination addresses (TIARs), and has stored a branch instruction address and a corresponding predicted branch destination address in the correspondence table 15 a , every one of branch instructions executed in the past about which the branch would be predicted taken.
- IARs branch instruction addresses
- TIARs predicted branch destination addresses
- the branch history register 15 which is used, when a branch instruction is contained in the instruction data taken out by the instruction fetch section 11 , to predict a branch destination address of the branch instruction, allows a predicted branch destination address to be retrieved from a branch instruction address on the basis of the correspondence table 15 a.
- the branch instruction address held by the correspondence table 15 a of the branch history register 15 which is an instruction address of a branch instruction, is used as an index.
- the predicted branch destination address which is a branch destination address to which the branch went when the branch instruction was executed in the past, is used as a prediction value of a branch destination address in case that said branch instruction would be executed next time.
- branch instructions fetched by the instruction fetch section 11 are decoded by the instruction decoder 12 , and the branch instructions are processed by the branch instruction controller 13 .
- branch instruction controller 13 is provided with a branch reservation station (indicated as BRANCH RS in the figure, and referred as a branch RS hereinafter) 14 , which holds information about branch instructions for which processing has been executed.
- BRANCH RS branch reservation station
- the branch RS 14 holds the address of a branch instruction, and the instruction address of a branch destination of the branch instruction, for example, every one of branch instructions processed, and holds branch information, etc. about the branch taken/branch not taken of the branch instructions, which is registered in the branch RS 14 by the branch instruction controller 13 .
- the information registered in the branch RS 14 is passed from the branch instruction controller 13 to the branch history register 15 and/or the global history register 20 described later as required.
- the global history register 20 which predicts a branch direction as to whether or not the branch is next taken with the above branch direction, based on the branch history of the branch instruction, to update the branch history register 15 on the basis of the result of the prediction, comprises a branch history updating section 21 , a past branch history memory section 24 , a branch direction predictor 25 , a branch direction architecting stage determining section (branch direction architecting state determining section) 26 , and a branch history register updating section 27 .
- the branch history updating section 21 registers a branch history into or updates a branch history in the past branch history memory section 24 described later on the basis of information about a branch instruction held by the branch RS 14 received from the branch instruction controller 13 . Further, The branch history updating section 21 comprises a selector 22 and a replacing section 23 . Details of the selector 22 and replacing section 23 will be described later.
- the past branch history memory section 24 which is a full-associative memory device, holds the past branch taken/the branch not taken (i.e., branch direction), as a branch history, about the branch instruction passed from the branch RS 14 (i.e., registered and updated by the branch history updating section 21 ), which is a conditional branch instruction by which the branch was taken when executed in the past.
- the past branch history memory section 24 has a predetermined number of entries (n entries 0 to n ⁇ 1 in this embodiment) and holds respective branch histories about a plurality of branch instructions.
- FIG. 3 shows the data structure of a branch history held in each of entries of the past branch history memory section 24 .
- the past branch history memory section 24 comprises, in each of the entries, an I-Address 24 a , a TAKEN counter (denoted as TAKEN.CTR in FIG. 3 ) 24 b , a NOT-TAKEN counter (denoted as N_TKN.CTR in FIG. 3 ) 24 c , a CURRENT counter (denoted as CURR.DIR in FIG. 3 ) 24 d , and a CURRENT direction (denoted as CURR.DIR in FIG. 3 ) 24 e respectively.
- the I-Address 24 a is an address of the branch instruction corresponding to this entry. This address is not necessary to be a whole address and may be a train of bits or the like which is part of the whole address provided that it defines the correspondence between the entry and the branch instruction.
- the TAKEN counter 24 b holds the number of branches successively taken until a changeover is made to the branch not taken after the branch was taken.
- the NOT-TAKEN counter 24 c holds the number of branches not successively taken until a changeover is again made to the branch taken after a changeover was made from the branch taken to the branch not taken.
- the CURRENT counter 24 d counts and holds the number of times by which the last branch direction occurred successively, represented by the CURRENT direction 24 e described later.
- the CURRENT direction 24 e represents whether the branch was taken or not by the last execution of the branch instruction, and consists of one-bit information (flag), for example.
- the CURRENT counter 24 d is designed to be able to count a successive number up to m (m is an integer of 0 or more), and the TAKEN counter 24 b and the NOT-TAKEN counter 24 c are designed to be able to hold a value of 0 to m.
- m is a critical value of the CURRENT counter 24 d , and when the value of the CURRENT counter 24 d is “m”, it means overflow from the CURRENT counter 24 d.
- FIGS. 4 ( a ) and 4 ( b ) The configuration of a branch history held by the past branch history memory section 24 will be described using an concrete example with reference to FIGS. 4 ( a ) and 4 ( b ).
- T means TAKEN (the branch is taken)
- N means NOT TAKEN(the branch is not taken).
- “1” of the CURRENT direction 24 e means that the branch was taken by the last execution of the branch instruction.
- the past branch history memory section 24 holds the number of branches successively taken (the TAKEN counter 24 b ) and the number of branches not successively taken (the NOT-TAKEN counter 24 c ) until a changeover is made twice of the branch taken/the branch not taken, which signifies the branch direction of the branch instruction.
- the past branch history memory section 24 of the global history register 20 does not store all of the past branch results, but stores the recent number of times by which the branches are successively taken/not taken as a branch history, thus allowing a branch history to be stored effectively, which enables the amount of required hardware (resources) to be reduced.
- the branch direction predictor 25 which predicts a branch direction of the branch instruction (branch taken/branch not taken) on the basis of the branch history held by the past branch history memory section 24 , predicts the next branch direction of the branch instruction on the basis of the number of branches successively taken in the TAKEN counter 24 b and the number of branches not successively taken in the NOT-TAKEN counter 24 c.
- the branch direction predictor 25 is designed not to predict a branch direction using the above branch history.
- the branch direction predictor 25 will be described in more details.
- a changeover was made from the branch not taken to the branch taken in executing the last branch instruction but one, and the branch was taken also at the last execution. Therefore, the value of the CURRENT counter 24 d becomes “2”, and the CURRENT direction 24 e becomes “1”.
- the value of the TAKEN counter 24 b becomes “3”, so that the branch direction predictor 25 predicts that the branch would be taken next time on the condition that the branch instruction periodically repeats the number of branches successively taken held in the TAKEN counter 24 b and the number of branches not successively taken held in the NOT-TAKEN counter 24 c.
- the branch direction architecting stage determining section 26 which determines whether or not a branch history held by the past branch history memory section 24 is in an initial architecting stage (state), determines that the branch history of the branch instruction of the entry is in an initial architecting state when either of the value of the TAKEN counter 24 a or the value of the NOT-TAKEN counter 24 c is “0”.
- the branch history register updating section 27 which updates the correspondence table 15 a held in the branch history register 15 on the basis of the branch direction predicted by the branch direction predictor 25 , updates the correspondence table 15 a of the branch history register 15 such that it holds branch instructions by which the branch is predicted taken by the branch direction predictor 25 , and updates the correspondence table 15 a of the branch history register 15 such that it does not hold branch instructions by which the branch is predicted not taken by the branch direction predictor 25 .
- step S 10 to S 14 the operation of the branch history register updating section 27 will be described with reference to the flow chart (steps S 10 to S 14 ) shown in FIG. 5 .
- the branch instruction controller 13 After the processing about a branch instruction by the branch instruction controller 13 has finished, it is determined whether or not the branch instruction is a conditional branch instruction. If the branch instruction is not a conditional branch instruction (“No” route of step S 10 ), the branch history register updating section 27 does not function, and the branch history register 15 is updated based on the prediction by the branch history register 15 (step S 11 ).
- the branch instruction is a conditional branch instruction (“Yes” route of step S 10 ), and yet if the global history register 20 has been retrieved (step S 12 ) and a prediction has been output from the global history register 20 (“Yes” route of step S 13 ), that is, if prediction has been performed by the branch direction predictor 25 (see steps S 32 , S 34 and S 35 in FIG. 6 described later), the branch history register updating section 27 updates the correspondence table 15 a (see FIG. 2 ) of the branch history register 15 on the basis of the prediction by the branch direction predictor 25 (step S 14 ). If a prediction has not been output from the global history register 20 (“No” route of step S 13 ), the branch history register updating section 27 does not function.
- step S 20 the operation of the branch history updating section 21 , the branch direction predictor 25 , and the branch direction architecting stage determining section 26 (the procedure of retrieving the past branch history memory section 24 ) will be described with reference to the flow chart (steps S 20 to S 35 ) shown in FIG. 6 .
- the branch history updating section 21 at first retrieves whether or not the branch instruction exists in an entry of the past branch history memory section 24 (step S 20 ).
- the branch history updating section 21 If the branch history of the branch instruction does not exist in an entry of the past branch history memory section 24 (“No” route of step S 21 ), the branch history updating section 21 generates a new entry for the branch instruction as required to register it into the past branch history memory section 24 (step S 22 ). In this operation, when the past branch history memory section 24 has an empty entry, the branch history updating section 21 registers the new entry for the branch instruction into the empty entry, while when the past branch history memory section 24 has no empty entry, the branch history updating section 21 selects one entry from the entries of the past branch history memory section 24 with the selector 22 , and registers the new entry with the replacing section 23 into the entry selected with the selector 22 . Details of the selector 22 and replacing section 23 will be described later with reference to FIGS. 11 to 22 .
- a signal (CREATE_NEW_WRGHT signal) to register the new entry into the past branch history memory section 24 is generated by a signal generating circuit 30 shown in FIG. 7 .
- the CREATE_NEW_WRGHT signal is generated in case that a signal (WRGHT_HIT_OR signal) for indicating that the branch instruction has been found in an entry of the past branch history memory section 24 has not been generated (in other words, the branch history of the branch instruction does not exist in the past branch history memory section 24 ).
- WRGHT_HIT_OR signal a signal for indicating that the branch instruction has been found in an entry of the past branch history memory section 24 has not been generated (in other words, the branch history of the branch instruction does not exist in the past branch history memory section 24 ).
- WRGHT denotes an entry of the past branch history memory section 24
- the numbers 0 to n ⁇ 1 attached to the end of WRGHT denote the entries 0 to n ⁇ 1 respectively.
- a conditional branch instruction which is executed by the branch instruction controller 13 and then is registered into the branch history register 15 , applies if an instruction for generating the branch instruction is provided from the branch history register 15 (in other words, if an entry for the conditional branch instruction is newly registered into the branch history register; “Yes” route of step S 22 a ), and if the branch instruction hits no entry of the past branch history memory section 24 (“Yes” route of step S 22 b ), the branch history updating section 21 generates a new entry for the branch instruction in the past branch history memory section 24 (step S 22 c ).
- step S 21 if an entry for the branch instruction does not exist in the past branch history memory section 24 (“No” route of step S 21 ), prediction by the branch direction predictor 25 (i.e., prediction by the global history register) based on a branch history of the past branch history memory section 24 is not executed (step S 23 ).
- step S 21 checks whether or not the branch direction (branch taken/branch not taken) of the branch instruction included in the information about the branch instruction sent from the branch instruction controller 13 matches the branch direction indicated by the CURRENT direction 24 e (step S 24 ).
- a signal (WRGHT_HIT) indicating that an entry for the branch instruction exists in the past branch history memory section 24 is generated by a signal generating circuit 31 shown in FIG. 9 .
- a signal (COMPLETE signal) indicating that execution of the branch instruction has been completed is generated, and a WRGHT_HIT signal is then generated when a branch instruction address (COMP_IAR) included in the COMPLETE signal matches I-Address held by the past branch history memory section 24 .
- a signal (WRGHT_HIT_OR signal) indicating that an entry for the branch instruction has been found from any entry of the past branch history memory section 24 is generated, on the basis of the signals (WRGHT 0 _HIT signal to WRGHTn ⁇ 1_HIT signal) from all entries 0 to n ⁇ 1 of the past branch history memory section 24 , by a signal generating circuit 32 shown in FIG. 10 .
- the branch direction of the branch instruction does not match the branch direction indicated by the CURRENT direction 24 e (“No” route of step S 24 ), and yet the current value of the CURRENT direction 24 e (i.e., the last value of the CURRENT direction 24 e before being updated to the direction of the branch instruction sent from the branch instruction controller 13 ) is “1” which means the branch taken (“Yes” route of step S 25 ), the TAKEN counter 24 b is caused to hold the current value of the CURRENT counter 24 d (step S 26 ), and then the CURRENT direction 24 e is updated to the branch direction sent from the branch instruction controller 13 (in this case, “0” which means the branch not taken) and further, the value of the CURRENT counter is changed to “1” (step S 28 ).
- the NOT-TAKEN counter 24 c is caused to hold the current value of the CURRENT counter 24 d (step S 27 ), and then the CURRENT direction 24 e is updated to the branch direction sent from the branch instruction controller 13 (in this case, “1” which means the branch taken) and the value of the CURRENT counter 24 d is changed to “1” (step S 28 ).
- step S 24 If the branch direction (the branch taken/branch not taken) of the branch instruction sent from the branch instruction controller 13 matches the branch direction indicated by the CURRENT direction 24 e (“Yes” route of step S 24 ), the value of the CURRENT counter 24 d is incremented by one, keeping the branch direction indicated by the CURRENT direction 24 e as it is (step S 29 ).
- the branch direction architecting stage determining section 26 determines whether or not the branch history of the branch instruction is in an initial architecting stage (step S 30 ). In other words, the branch direction architecting stage determining section 26 determines whether or not at least one of the value of the TAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c in the branch history of the branch instruction is “0”.
- step S 30 If the branch direction architecting stage determining section 26 determines that at least one of the value of the TAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c is “0” (i.e., the branch history is in an initial architecting stage) (“Yes” route of step S 30 ), prediction about the next branch direction of the branch instruction is not executed by the branch direction predictor 25 (step S 23 ).
- step S 30 prediction about the next branch direction of the branch instruction is executed by the branch direction predictor 25 (steps S 31 to S 35 ).
- the branch direction predictor 25 determines whether the value of the CURRENT direction 24 e after updating by the branch history updating section 21 is “1” (i.e., the branch taken) (step 28 or step 29 ), and yet whether or not the value of the CURRENT counter 24 d matches the value of the TAKEN counter 24 b (step S 31 ). If the both conditions are satisfied (“Yes” route of step S 31 ), the branch direction predictor 25 predicts that the branch would not be taken by the next execution of the branch instruction (step S 32 ).
- the branch direction predictor 25 determines whether the value of the CURRENT direction 24 e after updating by the branch history updating section 21 is “0” (i.e., the branch not taken), and yet whether or not the value of the CURRENT counter 24 d matches the value of the NOT-TAKEN counter 24 c (step S 33 ). If the branch direction predictor 25 determines that the both conditions are satisfied (“Yes” route of step S 33 ), the branch direction predictor 25 predicts that the branch would be taken by the next execution of the branch instruction (step S 34 ).
- step S 33 If the branch direction predictor 25 determines, also in this step (step S 33 ), that the both conditions are not satisfied (“No” route of step S 33 ), the branch direction predictor 25 predicts that the branch instruction would continue to keep the current branch direction (the branch direction after updated) next time as well (in other words, the next branch direction would be identical to the current branch direction) (step S 35 ).
- the branch direction predictor 25 predicts a branch direction of a branch instruction on the basis of a branch history (see FIG. 3 ) held in the past branch history memory section 25 (steps S 32 , S 34 , and S 35 ).
- the selector 22 which selects one entry in n entries 0 to n ⁇ 1 of the past branch history memory section 24 in case that all of the n entries 0 to n ⁇ 1 are in use when the branch history updating section 21 registers a branch history about a new branch instruction into the past branch history memory section 24 (see FIG. 8 ), has two functions, a first selecting function and a second selection function described later.
- the first selecting function of the selector 22 is a function of selecting one entry in n entries 0 to n ⁇ 1 of the past branch history memory section 24 on the basis of the branch history of the past branch history memory section 24 in case that all of the n entries 0 to n ⁇ 1 are in use when a branch history about a new branch instruction is registered into the past branch history memory section 24 .
- the selector 22 selects one entry in which the branch history held by the branch history memory section 24 includes only branches taken, and yet the number of branches successively taken included in the branch history is equal to or more than a predetermined number (m in this embodiment).
- the first selecting function of the selector 22 is a function of selecting an entry having a branch history in which any of the value of the TAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c is “0”, the CURRENT direction 24 e indicates “1”, and further, the CURRENT counter 24 d indicates “m”.
- the procedure of selecting an entry, which is an object of replacement, with the first selecting function of the selector 22 (first selecting step) will be described with reference to the flow chart (steps S 40 to S 45 ) shown in FIG. 11 .
- the first selecting function of the selector 22 is a function of checking the branch histories of all entries 0 to n ⁇ 1 of the past branch history memory section 24 in case that all the entries are in use when a branch history about a new branch instruction is registered into an entry of the past branch history memory section 24 (step S 40 ).
- the selector 22 determines whether or not all entries 0 to n ⁇ 1 of the past branch history memory section 24 are in use, by means of a signal (WRGHT_FULL signal) indicating that all the entries 0 to n ⁇ 1 of the past branch history memory section 24 are in use, which has been generated by a signal generating circuit 33 shown in FIG. 12 .
- the WRGHT_FULL signal is generated as shown in FIG.
- step S 41 it is at first determined whether or not the current branch direction indicated by the CURRENT direction 24 e signifies the branch taken (“1”) (step S 41 ).
- the branch direction signifies the branch not taken (the value of the CURRENT direction 24 e is “0” (“No” route of step S 41 )
- the entry of this branch history is not selected (step S 42 ). In other words, it is determined that the entry of this branch history is necessary to change the prediction of the branch history register 15
- step S 41 it is determined whether or not the number of branches successively taken of the CURRENT counter 24 d exceeds a predetermined number (m in this embodiment) (step S 43 ).
- step S 43 if the number of branches successively taken has not exceeded a predetermined number (“No” route of step S 43 ), the entry of this branch history is not selected, and then the process is returned to the above step S 40 .
- step S 43 If the number of branches successively taken has exceeded a predetermined number (“Yes” route of step S 43 ), it is determined whether or not the value of the NOT-TAKEN counter 24 c of this branch history is “0”, which is, whether or not the branch not taken has never occurred (step S 44 ).
- step S 44 If the NOT-TAKEN counter 24 c indicates a value other than “0” (“No” route of step S 44 ), it is determined that the branch is possible not to be taken also into the future, so the entry of this branch history is not selected (step S 42 ).
- step S 45 if the NOT-TAKEN counter 24 c indicates “0” (“Yes” route of step S 44 ), it is thought that the branch taken will continue also into the future, and it is determined that it is not necessary to change the prediction about this branch history in the branch history register 15 , so the entry of this branch history is selected as an entry, which is object of replacement (step S 45 ).
- a signal generating circuit 35 of FIG. 14 when the CURRENT direction indicates “1”, yet a new-registration signal (CREATE_WRGHT signal) for this entry is not generated, yet the TAKEN counter 24 b indicates “0”, and yet a signal (CURRENT_CTR_OVERFLOW signal; see FIG. 13 ) indicating overflow from the CURRENT counter 24 d is generated, an OVERWRITE_CANDIDATE_WRGHT signal for making the entry of this branch history an entry, which is an object of replacement (object of overwrite) is generated.
- CREATE_WRGHT signal CREATE_WRGHT signal
- the OVERWRITE_CANDIDATE_WRGHT signal can be generated for each of all entries 0 to n ⁇ 1 of the past branch history memory section 24 as shown in FIG. 15
- T 1 to Tx are units of time for the processing of the information processing apparatus 1 .
- COMPLETE signal and a signal indicating that the branch of the executed branch instruction has been taken are generated from the branch instruction controller 13 (see T 1 )
- COMPLETE signal and a signal indicating that the branch of the executed branch instruction has been taken are generated from the branch instruction controller 13 (see T 1 )
- CREATE_WRIGHT signal is generated in the global history register 20 (see T 2 ).
- the value of the CURRENT counter 24 d of the entry n ⁇ 1 is incremented to “m”, and the CURRENT_CTR_OVERFLOW signal is generated from the past branch history memory section 24 , and a replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHTn ⁇ 1 signal; denoted as OVERWRITE_CAND) is further generated in order to use the entry n ⁇ 1 when replacement is performed (see Tx- 8 ).
- the first selecting function is so designed to select one entry ranked highest in the order of the entry 0 to the entry n ⁇ 1 as an entry, which is an object of replacement, even if a plurality of entries in which the number of branches successively taken included in the branch history is equal to or more than a predetermined number exist at the same time.
- FIGS. 17 ( a ) to ( f ) depict the procedure of selecting one entry with the first selecting function of the selector 22 .
- the first selecting function of the selector 22 it is checked in the order of the entry 0 to the entry n ⁇ 1 whether the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT signal) has been output, and at the time when a replaced-candidate signal was detected, an entry from which the detected replaced-candidate signal was output is selected as an entry, which is an object of replacement.
- the replaced-candidate signal OVERWRITE_CANDIDATE_WRGHT signal
- FIG. 17 ( c ) in case that the replaced-candidate signal has been not output from the entry 0 and the entry 1 , but the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT 2 signal) has been output from the entry 2 , the entry 2 is selected as an entry, which is an object of replacement, and the signal (USE_WRGHT 2 _OVERWRITE signal) used to replace the entry 2 is generated.
- FIGS. 17 ( d ) to ( f ) a procedure similar to the procedures in FIGS. 17 ( a ) to ( c ) is used.
- the second selecting function of the selector 22 is a function of selecting one entry registered earliest in n entries 0 to n ⁇ 1 of the past branch history memory section 24 in case that all the entries 0 to n ⁇ 1 are in use when a branch history about a new branch instruction is registered.
- the second selecting function of the selector 22 is a function of selecting an entry, which is an object of replacement, in the round-robin method.
- a pointer (WRGHT_NEXT_PTR ⁇ K: 0 >) for selecting an entry, which is an object of replacement, is generated by a signal generating circuit 36 shown in FIG. 18 .
- the pointer is generated by incrementing the value of the counter 37 one by one.
- signals (WRGHT_NEXT_PTR_EQ_ 0 to WRGHT_NEXT_PTR_EQ_n ⁇ 1) for selecting the entries 0 to n ⁇ 1 can be obtained by decoding this WRGHT_NEXT_PTR ⁇ K: 0 > with the decoder 31 .
- the replacing section 23 registers a branch history about a new branch instruction into one entry selected by the selector 22 .
- step S 50 when a branch history about a new branch instruction is registered into an entry of the past branch history memory section 24 , the selector 22 at first determines whether or not all entries 0 to n ⁇ 1 of the past branch history memory section 24 are in use (step S 50 ). If all the entries are not in use (“No” route of step S 50 ), the branch history updating section 21 selects an empty entry which is not in current use in the round-robin method, and registers a branch history about a new branch instruction into the selected entry (step S 51 ).
- step S 50 the selector 22 selects an entry on the basis of the branch histories held in the past branch history memory section 24 with the first selecting function as described above with reference to FIG. 11 (first selecting step; step S 52 ).
- first selecting step; step S 52 the entry of this branch history is selected as an entry, which is an objection of replacement.
- the selector 22 selects an entry registered earliest of all the entries 0 to n ⁇ 1 as an entry, which is an objection of replacement, in the round-robin method with the second selecting function (second selecting step; step S 53 ).
- step S 52 If a branch history exists in which only the branch taken was registered until now and yet the number of branches successively taken is equal to or more than a predetermined number (m), and one entry has been selected with the first selecting function in the first selecting step (step S 52 ) (“Yes” route of step S 54 ), the selector 22 employs one entry selected on the basis of the branch histories in this first selecting step on a higher priority basis than one entry selected with the second selecting function in the second selecting step (step S 55 ), and then the replacing section 23 registers a branch history about a new branch instruction into one entry selected (employed) in the first selecting step (replacing step; step S 57 ).
- step S 52 If a branch history does not exist in which only the branch taken was registered until now and yet the number of branches successively taken is equal to or more than a predetermined number (m), and one entry has not been selected with the first selecting function in the first selecting step (step S 52 ) (“No” route of step S 54 ), the selector 22 employs an entry registered earliest selected with the second selecting function in the second selecting step (step S 56 ), and then the replacing section 23 registers a branch history about a new branch instruction into one entry selected (employed) in the second selecting step (replacing step; step S 57 ).
- steps S 51 and S 53 to S 57 in FIG. 20 function as selecting steps.
- a signal (USE_OVERWRITE_CANDIDATE signal) allowing one entry selected with the first selecting function to be employed is generated by a signal generating circuit 38 shown in FIG. 21 .
- the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT) is output from any one of the entries 0 to n ⁇ 1, the USE_OVERWRITE_CANDIDATE signal is generated.
- the selector 22 employs, using a signal generating circuit 39 shown in FIG. 22 , one entry selected with the first selecting function (first selecting step) on a priority basis.
- first selecting step the first selecting function
- the USE_WRGHT_TO_OVERWRITE signal see FIG. 17
- WRGHT_NEXT_PTR_EQ signal see FIG. 19
- the USE_OVERWRITE_CANDIDATE signal see FIG. 21
- the WRGHT_FULL signal see FIG. 12
- the selected signals and the instruction for new entry registration (CREATE_NEW_WRGHT signal; see FIG. 7 ) then allow CREATE_WRGHT 0 to CREATE_WRGHTn ⁇ 1 signals for registering a new entry (branch history) into each of the entries 0 to n ⁇ 1 to be generated.
- the information processing apparatus 1 and replacing method enables the selector 22 of the branch history updating section 21 to select an entry of the entries of the past branch history memory section 24 , which does not affect prediction about a branch direction of a branch instruction without its entry, without specially holding new information for replacement by the past branch history memory section 24 , using only information (i.e., I-Address 24 a , TAKEN counter 24 b , NOT-TAKEN counter 24 c , CURRENT counter 24 d , and CURRENT direction 24 e ) originally provided in the past branch history memory section 24 to be used for prediction, thereby allowing the limited resources to be effectively used and effective replacement to be realized.
- I-Address 24 a , TAKEN counter 24 b , NOT-TAKEN counter 24 c , CURRENT counter 24 d , and CURRENT direction 24 e originally provided in the past branch history memory section 24 to be used for prediction, thereby allowing the limited resources to be effectively used and effective replacement to be realized.
- the selector 22 selects a branch history in which only branches taken is included since newly registered in an entry of the past branch history memory section 24 and yet the number of the branches taken is more than a predetermined number (critical value), thereby making it possible to select an entry (branch history) about a branch instruction unnecessary for branch prediction, by which the branch taken is thought to continue also into the future, as an objection of replacement, on a priority basis, which enables the entries 0 to n ⁇ 1 of the past branch history memory section 24 to be effectively used, and the prediction accuracy (performance) of the global history register 20 to be improved.
- the embodiment described above is configured so that the second selecting function of the selector 22 is a function of selecting an entry, which is an object of replacement, of the plurality of entries of the past branch history memory section 24 with the round-robin method.
- the present invention is not limited to this configuration, and may be configured so that the second selecting function of the selector 22 is a function of selecting an entry, which is an object of replacement, of the plurality of entries in the past branch history memory section 24 with the LRU method.
- the present invention may be configured so that the second selecting function of the selector 22 is a function of selecting an entry used earliest for prediction by the branch direction predictor 25 , of all entries of the past branch history memory section 24 , thereby allowing an effect similar to that of the embodiment described above to be produced.
- a configuration has to be made so that histories such as times when the branch history was used (updated) are held in the branch history of the past branch history memory section 24 .
- the embodiment described above is configured so that the first selecting function of the selector 22 is a function of selecting one entry ranked highest in the order of the entry 0 to the entry n ⁇ 1 as an entry, which is an object of replacement even if a plurality of entries exist at the same time in which only branches taken is included since registered in the past branch history memory section 24 and yet the number of branches taken included in the branch history is equal to or more than a predetermined number.
- the present invention is not limited to this configuration, and may be configured so that when a plurality of entries were selected with the first selecting function of the selector 22 , one entry is selected from the selected plurality of entries with the second selecting function of the selector 22 .
- a pointer for selecting one entry selected with the second selecting function is not updated, whereby when the entry selected with the first selecting function matches the entry selected with the second selecting function, there is a possibility that the entry is replaced with the first selecting function and then is replaced again with the second selecting function. Therefore, it may be designed that in such a case a pointer generated with the second selecting function is incremented.
- the embodiment described above may be configured so that the branch instruction about the entry selected and replaced by the selector 22 is not registered again into the past branch history memory section 24 .
- the embodiment described above may be configured so that the branch RS 14 holds, every branch instruction, information (flag, etc.) indicating that the instruction was registered once but has been erased for replacement, and that the selector 22 selects an entry, which is an object of replacement, on the basis of such information.
- the replacing method of the present invention was applied to the past branch history memory section 24 of the global history register.
- application of the replacing method of the present invention is not limited to the past branch history memory section 24 of the global history register.
- the replacing method may be applied in case that an entry is replaced when all entries are in use, and may provide the same work and effect as those in the embodiment described above.
- TLB translation lookaside buffer
- a context used for identifying a process space does not represents a space currently executed, it is considered that the frequency of use of the context is low, and therefore there may be a means for replacing the context on a priority basis or the like.
- the functions of the aforementioned instruction fetch address generator 10 , instruction fetch section 11 , instruction decoder 12 , branch instruction controller 13 , branch RS 14 , branch history register 15 , branch history updating section 21 , selector 22 , replacing section 23 , past branch history memory section 24 , I-Address 24 a , TAKEN counter 24 b , NOT-TAKEN counter 24 c , CURRENT counter 24 d , CURRENT direction 24 e , branch direction predictor 25 , branch direction architecting stage determining section 26 , and branch history register updating section 27 may be realized by that a computer (including a CPU, an information processing apparatus, and various terminals) executes a predetermined application program (replacing program).
- the program is provided in the form of being recorded on a computer-readable recording medium such as a flexible disk, a CD-ROM, a CD-R, a CD-RW, a DVD, or the like.
- the computer reads a storing instruction control program from its recording medium, which is transferred to an internal memory device or an external memory device, stored and used.
- the program may be recorded in memory devices (recording medium) such as a magnetic disk, an optical disk, and a magneto-optical disk, and provided to the computer through a communication line from the memory device.
- the so-called computer which is a concept including hardware and an operating system (OS) signifies the hardware operating under the control of the OS.
- OS operating system
- the hardware itself corresponds to the computer.
- the hardware is provided with at least a microprocessor such as a CPU, and means for reading a computer program recorded on the recording medium.
- the application program which is the replacing program described above includes program codes for allowing a computer as described above to realize the functions of the instruction fetch address generator 10 , the instruction fetch section 11 , the instruction decoder 12 , the branch instruction controller 13 , the branch RS 14 , the branch history register 15 , the branch history updating section 21 , the selector 22 , the replacing section 23 , the past branch history memory section 24 , the I-Address 24 a , the TAKEN counter 24 b , the NOT-TAKEN counter 24 c , the CURRENT counter 24 d , the CURRENT direction 24 e , the branch direction predictor 25 , the branch direction architecting stage determining section 26 , and the branch history register updating section 27 . Further, part of the functions may be realized not with an application program but with an OS.
- various computer-readable mediums such as an IC card, a ROM cartridge, a magnetic tape, a punched card, an internal memory device (memories such as a RAM and a ROM) and an external memory device, etc. of a computer, and a printed matter, etc. on which a code such as a bar code is printed may be used, in addition to the flexible disk, the CD-ROM, the CD-R, the CD-RW, the DVD, the magnetic disk, the optical disk, and the magneto-optical disk described above.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Advance Control (AREA)
Abstract
The present invention relates to an information processing apparatus predicting a branch destination of a branch instruction using a branch history register to realize effective replacement by enabling an unnecessary entry to be selected as an entry, which is an object of replacement, without using new resources in a full-associative memory device. The invention includes a selector for selecting one entry from all entries of a past branch history memory section if all entries of the past branch history memory section are in use when a branch history about a new branch instruction is registered into the past branch history memory section and a replacing section for registering the branch history about the new branch instruction into one entry selected by said selector, wherein the selector has a first selecting function of selecting one entry based on the branch history held by the past branch history memory section.
Description
- This application is a divisional of U.S. patent application Ser. No. 11/062,472 filed Feb. 22, 2005, which is incorporated herein by reference in its entirety.
- 1. Field of the Invention
- The present invention relates to a technique of replacing an entry in case that all entries are in use in a full-associative memory device, for example, a technique preferably used, in an information processing apparatus in which a global history system or a local history system is used for predicting a branch direction of a branch instruction with reference to a past branch history held by a full-associative branch history memory section (past branch history memory section), when replacing an entry of the branch history memory section with a new entry.
- 2. Description of the Related Art
- Up to now, a full-associative memory device having a predetermined number of entries has been provided in various kinds of devices and has been widely used.
- For example, there is a technique of providing a global history register including a full-associative memory device for holding information about a past branch history for the purpose of improving prediction accuracy, in an information processing apparatus which predicts a branch destination of a branch instruction using a branch history register which holds pairs of an address of a branch instruction and an address of the predicted branch destination of its branch instruction (see
patent document 1 listed below). - In a full-associative memory device having only a fixed number of entries like this global history register, it is a key to an improvement in the performance how effectively the limited entries are used, and it is important, when replacing an entry, to surely replace an unnecessary entry of the plurality of entries.
- Up to now, as a method of replacing an entry in a full-associative memory device, we have had a round robin method by which an entry registered earliest is replaced and a least-recently-used (LRU) method by which en entry least recently used since it was accessed is replaced.
- Furthermore, we have other replacing methods including techniques of selecting an entry to be replaced on the basis of a success rate (number of coincidences) in branch prediction, in the technical field related to branch prediction for a branch instruction (see
patent documents - However, in the round robin method described above, it is not taken into consideration at all to use entries effectively, and an entry is erased without reservation if it was registered earliest even if it is very effective for branch prediction or it is in use, whereby it is difficult to say that the method is an effective replacing method.
- Furthermore, in the LRU method described above, an entry least recently used since it was accessed is selected as an unnecessary entry which is an object of replacement, and therefore particularly in a global history register (see
patent document 1 listed above) or the like which expects a history will be repeated and provides an expectation value from its periodicity, an entry least recently used since it was accessed is not always an unnecessary entry due to its characteristic. - In other words, it is desirable to avoid, from the viewpoint of the characteristic of the global history register, that the entry about such a long interval branch instruction as to appear with a low frequency but at a fixed interval is assumed to be an entry which is an object of replacement, if possible. However, with the LRU method, the possibility of assuming the entry about an instruction appearing with a low frequency to be an entry, which is an object of replacement, becomes high, so it is also difficult to say that the LRU method is an effective method.
- In addition, with the LRU method, it is necessary to separately hold information about an accessed history, which requires a resource cost for holding such information, and therefore the limited resources of the full-associative memory device are not used effectively.
- Furthermore, with techniques of using a success rate in branch prediction, etc. disclosed in
patent documents - [Patent Document 1] Japanese Patent Laid-Open (Kokai) No. 2004-38323
- [Patent Document 2] Japanese Patent Laid-Open (Kokai) No. 2002-278752
- [Patent Document 3] Japanese Patent Laid-Open (Kokai) No. HEI 6-67880
- Additional aspects and/or advantages of the invention will be set forth in part in the description which follows and, in part, will be apparent from the description, or may be learned by practice of the invention.
- The present invention has been developed in view of such problems and aims to realize effective replacement by enabling an unnecessary entry to be selected as an entry, which is an object of replacement, without using new resources in a full-associative memory device.
- In particular, the present invention aims to realize effective replacement, in an information processing apparatus, for example, in which a global history system is employed, by enabling an entry of the entries of the branch history memory section, which does not affect prediction about a branch direction of a branch instruction without its entry, to be selected as an entry, which is an object of replacement, without using new resources.
- In order to accomplish the above aim, an information processing apparatus according to the present invention comprises: a branch history register for holding, in order to predict a branch destination of a branch instruction, a correspondence table providing the correspondence between an address of said branch instruction and an address of the predicted branch destination of said branch instruction; a past branch history memory section for holding past branch directions of said branch instruction as a branch history; a branch direction predictor for predicting a branch direction of said branch instruction on the basis of said branch history held by said past branch history memory section; a branch history register updating section for updating said correspondence table held by said branch history register on the basis of the branch direction predicted by said branch direction predictor; a selector for selecting one entry from all entries of said past branch history memory section in case that all entries of said past branch history memory section are in use when a branch history about a new branch instruction is registered into said past branch history memory section; and a replacing section for registering the branch history about said new branch instruction into said one entry selected by said selector, wherein said selector has a first selecting function of selecting said one entry on the basis of said branch history held by said past branch history memory section.
- Said selector preferably has a second selecting function of selecting, as said one entry, an entry registered earliest of all entries of said past branch history memory section, and employs an entry selected with said first selecting function on a higher priority basis than an entry selected with said second selecting function.
- Furthermore, said selector preferably has a second selecting function of selecting, as said one entry, an entry used earliest for prediction by said branch direction predictor of all entries of said past branch history memory section, and employs an entry selected with said first selecting function on a higher priority basis than an entry selected with said second selecting function.
- In addition, said first selecting function of said selector preferably is a function of selecting, as said one entry, an entry in which said branch history held by said past branch history memory section includes only branches taken, and in this case said first selecting function of said selector preferably is a function of selecting an entry in which the number of branches taken included in said branch history held by said past branch history memory section is equal to or more than a predetermined number.
- Furthermore, said past branch history memory section preferably holds, as said branch history, the number of branches, which were successively taken, and the number of branches, which were not successively taken until a changeover is made twice of the branch taken/the branch not taken, which signifies said branch direction of said branch instruction, and said branch direction predictor preferably predicts the branch taken/the branch not taken, which is said branch direction of said branch instruction, on the basis of said number of branches successively taken and said number of branches not successively taken.
- In addition, said information processing apparatus preferably further comprises a branch history architecting state determining section for determining whether or not said branch history held by said past branch history memory section is in an initial architecting state, wherein said branch direction predictor preferably does not perform prediction of said branch direction based on said branch history when said branch history architecting state determining section determines that said branch history is in an initial architecting state.
- Furthermore, in order to accomplish the above aim, a replacing method according to the present invention for an information processing apparatus which includes a branch history register for holding, in order to predict a branch destination of a branch instruction, a correspondence table providing the correspondence between an address of said branch instruction and an address of the predicted branch destination of said branch instruction, a past branch history memory section for holding past branch directions of said branch instruction as a branch history, a branch direction predictor for predicting a branch direction of said branch instruction on the basis of said branch history held by said past branch history memory section, and a branch history register updating section for updating said correspondence table held by said branch history register on the basis of the branch direction predicted by said branch direction predictor, said replacing method, used for entries of said past branch history memory section in case that all of said entries are in use when a branch history about a new branch instruction is registered into said past branch history memory section, comprises the steps of: (a)selecting one entry from all entries of said past branch history memory section; and (b)registering a branch history about said new branch instruction into said one entry selected in said step (a) of selecting, wherein said step (a) of selecting includes a step of (a-1) selecting said one entry on the basis of said branch history held by said past branch history memory section.
- In addition, in order to accomplish the above aim, a replacing program according to the present invention for an information processing apparatus comprising: a branch history register for holding, in order to predict a branch destination of a branch instruction, a correspondence table providing the correspondence between an address of said branch instruction and an address of the predicted branch destination of said branch instruction; a past branch history memory section for holding past branch directions of said branch instruction as a branch history; a branch direction predictor for predicting a branch direction of said branch instruction on the basis of said branch history held by said past branch history memory section; and a branch history register updating section for updating said correspondence table held by said branch history register on the basis of the branch direction predicted by said branch direction predictor, allows a computer to realize a replacing function used for entries of said past branch history memory section in case that all of said entries are in use when a branch history about a new branch instruction is registered into said past branch history memory section, and allows said computer to: function as a selector for selecting one entry from all entries of said past branch history memory section and as a replacing section for registering a branch history about said new branch instruction into said one entry selected by said selector; and function such that said selector has a first selecting function of selecting said one entry on the basis of said branch history held by said past branch history memory section.
- In addition, in order to accomplish the above aim, a computer-readable recording medium according to the present invention is a computer-readable recording medium on which said replacing program is recorded.
- As described above, according to the present invention, an entry, which is an object of replacement, is selected on the basis of a branch history originally provided in the past branch history memory section to be used for predicting a branch direction, so that an entry unnecessary for branch prediction can be selected on a priority basis without specially holding new information for replacing, in other words, without using new resources, whereby effective replacement can be performed.
- In addition, selecting an entry, in which said branch history held by the past branch history memory section includes only branches taken, i.e. an entry, in which branches were all taken since registration in the branch history and yet the number of branches taken is equal to or more than a predetermined number, as an entry, which is an object of replacement, on a priority basis makes it possible to select an entry of the entries of the past branch history memory section, which does not affect prediction about a branch direction of a branch instruction without its entry, as an entry, which is an object of replacement. This makes it possible to realize effective replacement, to effectively use the limited resources of the past branch history memory section, and to improve the accuracy (performance) of prediction about a branch direction performed by using the past branch history memory section.
- These and/or other aspects and advantages of the invention will become apparent and more readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
-
FIG. 1 is a block diagram showing the configuration of an information processing apparatus which is an embodiment of the present invention; -
FIG. 2 shows the data structure of a correspondence table held by the branch history register of the information processing apparatus which is the embodiment of the present invention; -
FIG. 3 shows the data structure of a branch history held by the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention; - FIGS. 4(a) and 4(b) depict the configuration of a branch history held by the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention,
FIG. 4 (a) is a concrete example showing branch directions of a branch instruction, andFIG. 4 (b) shows the data structure of a branch history in the concrete example ofFIG. 4 (a); -
FIG. 5 is a flow chart depicting the operation procedure of the branch history updating section of the global history register of the information processing apparatus which is the embodiment of the present invention; -
FIG. 6 is a flow chart depicting the operation procedures of the branch history updating section, branch direction predictor, and branch history architecting stage determining section of the global history register of the information processing apparatus which is the embodiment of the present invention (the procedure of the method of retrieving the past branch history memory section); -
FIG. 7 shows a signal generating circuit for generating a CREATE_NEW_WRGHT signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 8 is a flow chart depicting the procedure of registering a new entry to the past branch history memory section by the branch history updating section of the global history register of the information processing apparatus which is the embodiment of the present invention; -
FIG. 9 shows a signal generating circuit for generating a WRGHT_HIT signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 10 shows a signal generating circuit for generating a WRGHT_HIT_OR signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 11 is a flow chart depicting the procedure of selecting an entry with the first selecting function of the selector of the branch history updating section of the information processing apparatus which is the embodiment of the present invention; -
FIG. 12 shows a signal generating circuit for generating a WRGHT_FULL signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 13 shows a signal generating circuit for generating a CURRENT_CRT_OVERFLOW signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 14 shows a signal generating circuit for generating an OVERWRITE_CANDIDATE_WRGHT signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 15 depicts that an OVERWRITE_CANDIDATE_WRGHT signal is generated from all entries in the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention; -
FIG. 16 is a time chart depicting the process executed until a CURRENT_CTR_OVERFLOW signal is generated from the past branch history memory section of the global history register of the information processing apparatus which is the embodiment of the present invention; - FIGS. 17(a) to 17(f) depict the technique of selecting one entry with the first selecting function of the selector of the branch history updating section of the information processing apparatus which is the embodiment of the present invention;
-
FIG. 18 shows a signal generating circuit for generating a WRGHT_NEXT_PTR<K:0> signal in the information processing apparatus which is the embodiment of the present invention; -
FIG. 19 depicts a WRGHT_NEXT_PTR<K:0> signal generated in the information processing apparatus which is the embodiment of the present invention; -
FIG. 20 is a flow chart depicting the procedure of a replacing method which is the embodiment of the present invention; -
FIG. 21 shows a signal generating circuit for generating a USE_OVERWRITE_CANDIDATE signal in the information processing apparatus which is the embodiment of the present invention; and -
FIG. 22 depicts a signal generating circuit for generating a CREATE_WRGHT signal in the information processing apparatus which is the embodiment of the present invention. - Reference will now be made in detail to the embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the like elements throughout. The embodiments are described below to explain the present invention by referring to the figures.
- At first, the configuration of an information processing apparatus which is an embodiment of the present invention will be described.
FIG. 1 is a block diagram showing the configuration of theinformation processing apparatus 1 which is an embodiment of the present invention. As shown inFIG. 1 , theinformation processing apparatus 1 which is an embodiment of the present invention comprises an instruction fetchaddress generator 10, an instruction fetchsection 11, aninstruction decoder 12, abranch instruction controller 13, abranch history register 15, and aglobal history register 20. - In the
information processing apparatus 1, the instruction fetchsection 11 outputs an instruction fetch request using an instruction fetch address generated by the instruction fetchaddress generator 10, and at the same time retrieves thebranch history register 15. - When a branch instruction corresponding to the instruction fetch address has been registered in the
branch history register 15, the instruction fetchsection 11 reads the instruction address of a branch destination predicted by thebranch history register 15, and performs next instruction fetch on the basis of the instruction address which has been read. -
FIG. 2 shows the data construction of a correspondence table 15 a held by thebranch history register 15. As shown inFIG. 2 , thebranch history register 15 holds the correspondence table 15 a consisting of branch instruction addresses (IARs) and predicted branch destination addresses (TIARs), and has stored a branch instruction address and a corresponding predicted branch destination address in the correspondence table 15 a, every one of branch instructions executed in the past about which the branch would be predicted taken. - As described above, the
branch history register 15, which is used, when a branch instruction is contained in the instruction data taken out by the instruction fetchsection 11, to predict a branch destination address of the branch instruction, allows a predicted branch destination address to be retrieved from a branch instruction address on the basis of the correspondence table 15 a. - In other words, the branch instruction address held by the correspondence table 15 a of the
branch history register 15, which is an instruction address of a branch instruction, is used as an index. Furthermore, the predicted branch destination address, which is a branch destination address to which the branch went when the branch instruction was executed in the past, is used as a prediction value of a branch destination address in case that said branch instruction would be executed next time. - On the other hand, branch instructions fetched by the instruction fetch
section 11 are decoded by theinstruction decoder 12, and the branch instructions are processed by thebranch instruction controller 13. - Furthermore, the
branch instruction controller 13 is provided with a branch reservation station (indicated as BRANCH RS in the figure, and referred as a branch RS hereinafter) 14, which holds information about branch instructions for which processing has been executed. - The
branch RS 14 holds the address of a branch instruction, and the instruction address of a branch destination of the branch instruction, for example, every one of branch instructions processed, and holds branch information, etc. about the branch taken/branch not taken of the branch instructions, which is registered in thebranch RS 14 by thebranch instruction controller 13. - The information registered in the
branch RS 14 is passed from thebranch instruction controller 13 to thebranch history register 15 and/or theglobal history register 20 described later as required. - The
global history register 20, which predicts a branch direction as to whether or not the branch is next taken with the above branch direction, based on the branch history of the branch instruction, to update thebranch history register 15 on the basis of the result of the prediction, comprises a branchhistory updating section 21, a past branchhistory memory section 24, abranch direction predictor 25, a branch direction architecting stage determining section (branch direction architecting state determining section) 26, and a branch historyregister updating section 27. - The branch
history updating section 21 registers a branch history into or updates a branch history in the past branchhistory memory section 24 described later on the basis of information about a branch instruction held by thebranch RS 14 received from thebranch instruction controller 13. Further, The branchhistory updating section 21 comprises aselector 22 and a replacingsection 23. Details of theselector 22 and replacingsection 23 will be described later. - The past branch
history memory section 24, which is a full-associative memory device, holds the past branch taken/the branch not taken (i.e., branch direction), as a branch history, about the branch instruction passed from the branch RS 14 (i.e., registered and updated by the branch history updating section 21), which is a conditional branch instruction by which the branch was taken when executed in the past. The past branchhistory memory section 24 has a predetermined number of entries (n entries 0 to n−1 in this embodiment) and holds respective branch histories about a plurality of branch instructions. -
FIG. 3 shows the data structure of a branch history held in each of entries of the past branchhistory memory section 24. As shown inFIG. 3 , the past branchhistory memory section 24 comprises, in each of the entries, an I-Address 24 a, a TAKEN counter (denoted as TAKEN.CTR inFIG. 3 ) 24 b, a NOT-TAKEN counter (denoted as N_TKN.CTR inFIG. 3 ) 24 c, a CURRENT counter (denoted as CURR.DIR inFIG. 3 ) 24 d, and a CURRENT direction (denoted as CURR.DIR inFIG. 3 ) 24 e respectively. - The I-
Address 24 a is an address of the branch instruction corresponding to this entry. This address is not necessary to be a whole address and may be a train of bits or the like which is part of the whole address provided that it defines the correspondence between the entry and the branch instruction. - The TAKEN counter 24 b holds the number of branches successively taken until a changeover is made to the branch not taken after the branch was taken.
- The NOT-
TAKEN counter 24 c holds the number of branches not successively taken until a changeover is again made to the branch taken after a changeover was made from the branch taken to the branch not taken. - The
CURRENT counter 24 d counts and holds the number of times by which the last branch direction occurred successively, represented by theCURRENT direction 24 e described later. - The
CURRENT direction 24 e represents whether the branch was taken or not by the last execution of the branch instruction, and consists of one-bit information (flag), for example. - The
CURRENT counter 24 d is designed to be able to count a successive number up to m (m is an integer of 0 or more), and theTAKEN counter 24 b and the NOT-TAKEN counter 24 c are designed to be able to hold a value of 0 to m. Thus, m is a critical value of theCURRENT counter 24 d, and when the value of theCURRENT counter 24 d is “m”, it means overflow from theCURRENT counter 24 d. - The configuration of a branch history held by the past branch
history memory section 24 will be described using an concrete example with reference to FIGS. 4(a) and 4(b). InFIG. 4 (a), “T” means TAKEN (the branch is taken), and “N” means NOT TAKEN(the branch is not taken). InFIG. 4 (b), “1” of theCURRENT direction 24 e means that the branch was taken by the last execution of the branch instruction. - In the concrete example shown in FIGS. 4(a) and 4(b), since the branch was successively taken by the last execution and the last execution but one, the value of the
CURRENT direction 24 e becomes “1” and the value of theCURRENT counter 24 d becomes “2”. Furthermore, since the branch has been taken three times successively until a changeover is made to the branch not taken after the branch was taken, the value of theTAKEN counter 24 b becomes “3”, and further, thereafter, the branch has been not taken six times successively until a changeover is again made to the branch taken after the branch was not taken, whereby the value of NOT-TAKEN counter 24 c becomes “6”. That is, the past branchhistory memory section 24 holds the number of branches successively taken (theTAKEN counter 24 b) and the number of branches not successively taken (the NOT-TAKEN counter 24 c) until a changeover is made twice of the branch taken/the branch not taken, which signifies the branch direction of the branch instruction. - As described above, the past branch
history memory section 24 of theglobal history register 20 does not store all of the past branch results, but stores the recent number of times by which the branches are successively taken/not taken as a branch history, thus allowing a branch history to be stored effectively, which enables the amount of required hardware (resources) to be reduced. - The
branch direction predictor 25, which predicts a branch direction of the branch instruction (branch taken/branch not taken) on the basis of the branch history held by the past branchhistory memory section 24, predicts the next branch direction of the branch instruction on the basis of the number of branches successively taken in theTAKEN counter 24 b and the number of branches not successively taken in the NOT-TAKEN counter 24 c. - Furthermore, when the branch direction architecting
stage determining section 26 determines that a branch history about a branch instruction, which is an object of prediction, is in an initial architecting stage (state), thebranch direction predictor 25 is designed not to predict a branch direction using the above branch history. - The
branch direction predictor 25 will be described in more details. In case of the concrete example shown in FIGS. 4(a) and 4(b), a changeover was made from the branch not taken to the branch taken in executing the last branch instruction but one, and the branch was taken also at the last execution. Therefore, the value of theCURRENT counter 24 d becomes “2”, and theCURRENT direction 24 e becomes “1”. In this example, the value of theTAKEN counter 24 b becomes “3”, so that thebranch direction predictor 25 predicts that the branch would be taken next time on the condition that the branch instruction periodically repeats the number of branches successively taken held in theTAKEN counter 24 b and the number of branches not successively taken held in the NOT-TAKEN counter 24 c. - The branch direction architecting
stage determining section 26, which determines whether or not a branch history held by the past branchhistory memory section 24 is in an initial architecting stage (state), determines that the branch history of the branch instruction of the entry is in an initial architecting state when either of the value of the TAKEN counter 24 a or the value of the NOT-TAKEN counter 24 c is “0”. - The branch history
register updating section 27, which updates the correspondence table 15 a held in thebranch history register 15 on the basis of the branch direction predicted by thebranch direction predictor 25, updates the correspondence table 15 a of thebranch history register 15 such that it holds branch instructions by which the branch is predicted taken by thebranch direction predictor 25, and updates the correspondence table 15 a of thebranch history register 15 such that it does not hold branch instructions by which the branch is predicted not taken by thebranch direction predictor 25. - Herein, the operation of the branch history
register updating section 27 will be described with reference to the flow chart (steps S10 to S14) shown inFIG. 5 . As shown inFIG. 5 , after the processing about a branch instruction by thebranch instruction controller 13 has finished, it is determined whether or not the branch instruction is a conditional branch instruction. If the branch instruction is not a conditional branch instruction (“No” route of step S10), the branch historyregister updating section 27 does not function, and thebranch history register 15 is updated based on the prediction by the branch history register 15 (step S11). If the branch instruction is a conditional branch instruction (“Yes” route of step S10), and yet if theglobal history register 20 has been retrieved (step S12) and a prediction has been output from the global history register 20 (“Yes” route of step S13), that is, if prediction has been performed by the branch direction predictor 25 (see steps S32, S34 and S35 inFIG. 6 described later), the branch historyregister updating section 27 updates the correspondence table 15 a (seeFIG. 2 ) of thebranch history register 15 on the basis of the prediction by the branch direction predictor 25 (step S14). If a prediction has not been output from the global history register 20 (“No” route of step S13), the branch historyregister updating section 27 does not function. - Next, the operation of the branch
history updating section 21, thebranch direction predictor 25, and the branch direction architecting stage determining section 26 (the procedure of retrieving the past branch history memory section 24) will be described with reference to the flow chart (steps S20 to S35) shown inFIG. 6 . As shown inFIG. 6 , after execution of a branch instruction, when information about the branch instruction is sent from thebranch instruction controller 13 to theglobal history register 20, the branchhistory updating section 21 at first retrieves whether or not the branch instruction exists in an entry of the past branch history memory section 24 (step S20). - If the branch history of the branch instruction does not exist in an entry of the past branch history memory section 24 (“No” route of step S21), the branch
history updating section 21 generates a new entry for the branch instruction as required to register it into the past branch history memory section 24 (step S22). In this operation, when the past branchhistory memory section 24 has an empty entry, the branchhistory updating section 21 registers the new entry for the branch instruction into the empty entry, while when the past branchhistory memory section 24 has no empty entry, the branchhistory updating section 21 selects one entry from the entries of the past branchhistory memory section 24 with theselector 22, and registers the new entry with the replacingsection 23 into the entry selected with theselector 22. Details of theselector 22 and replacingsection 23 will be described later with reference to FIGS. 11 to 22. - When the branch
history updating section 21 generates a new entry for the branch instruction and registers it into the past branch history memory section 24 (step S22), a signal (CREATE_NEW_WRGHT signal) to register the new entry into the past branchhistory memory section 24 is generated by asignal generating circuit 30 shown inFIG. 7 . In other words, when there is an instruction for registering a new entry into the past branchhistory memory section 24, which occurs when an entry for the branch instruction is registered into thebranch history register 15, the CREATE_NEW_WRGHT signal is generated in case that a signal (WRGHT_HIT_OR signal) for indicating that the branch instruction has been found in an entry of the past branchhistory memory section 24 has not been generated (in other words, the branch history of the branch instruction does not exist in the past branch history memory section 24). InFIG. 7 andFIGS. 9, 10 , 12 to 19, 21 and 22 described later, WRGHT denotes an entry of the past branchhistory memory section 24, and thenumbers 0 to n−1 attached to the end of WRGHT denote theentries 0 to n−1 respectively. - In other words, as shown in the flow chart (steps S22 a to S22 c) of
FIG. 8 , a conditional branch instruction, which is executed by thebranch instruction controller 13 and then is registered into thebranch history register 15, applies if an instruction for generating the branch instruction is provided from the branch history register 15 (in other words, if an entry for the conditional branch instruction is newly registered into the branch history register; “Yes” route of step S22 a), and if the branch instruction hits no entry of the past branch history memory section 24 (“Yes” route of step S22 b), the branchhistory updating section 21 generates a new entry for the branch instruction in the past branch history memory section 24 (step S22 c). - Furthermore, as shown in
FIG. 6 , if an entry for the branch instruction does not exist in the past branch history memory section 24 (“No” route of step S21), prediction by the branch direction predictor 25 (i.e., prediction by the global history register) based on a branch history of the past branchhistory memory section 24 is not executed (step S23). - On the other hand, if an entry for the branch instruction exists in the past branch history memory section 24 (“Yes” route of step S21), the branch
history updating section 21 checks whether or not the branch direction (branch taken/branch not taken) of the branch instruction included in the information about the branch instruction sent from thebranch instruction controller 13 matches the branch direction indicated by theCURRENT direction 24 e (step S24). - If an entry for the branch instruction exists in the past branch history memory section 24 (“Yes” route of step S21), a signal (WRGHT_HIT) indicating that an entry for the branch instruction exists in the past branch
history memory section 24 is generated by asignal generating circuit 31 shown inFIG. 9 . - In other words, a signal (COMPLETE signal) indicating that execution of the branch instruction has been completed is generated, and a WRGHT_HIT signal is then generated when a branch instruction address (COMP_IAR) included in the COMPLETE signal matches I-Address held by the past branch
history memory section 24. - In addition, a signal (WRGHT_HIT_OR signal) indicating that an entry for the branch instruction has been found from any entry of the past branch
history memory section 24 is generated, on the basis of the signals (WRGHT0_HIT signal to WRGHTn−1_HIT signal) from allentries 0 to n−1 of the past branchhistory memory section 24, by asignal generating circuit 32 shown inFIG. 10 . - Furthermore, as shown in
FIG. 6 , if the branch direction of the branch instruction does not match the branch direction indicated by theCURRENT direction 24 e (“No” route of step S24), and yet the current value of theCURRENT direction 24 e (i.e., the last value of theCURRENT direction 24 e before being updated to the direction of the branch instruction sent from the branch instruction controller 13) is “1” which means the branch taken (“Yes” route of step S25), theTAKEN counter 24 b is caused to hold the current value of theCURRENT counter 24 d (step S26), and then theCURRENT direction 24 e is updated to the branch direction sent from the branch instruction controller 13 (in this case, “0” which means the branch not taken) and further, the value of the CURRENT counter is changed to “1” (step S28). - Further, if the current value of the
CURRENT direction 24 e is “0” which means the branch not taken (“No” route of step S25), the NOT-TAKEN counter 24 c is caused to hold the current value of theCURRENT counter 24 d (step S27), and then theCURRENT direction 24 e is updated to the branch direction sent from the branch instruction controller 13 (in this case, “1” which means the branch taken) and the value of theCURRENT counter 24 d is changed to “1” (step S28). - If the branch direction (the branch taken/branch not taken) of the branch instruction sent from the
branch instruction controller 13 matches the branch direction indicated by theCURRENT direction 24 e (“Yes” route of step S24), the value of theCURRENT counter 24 d is incremented by one, keeping the branch direction indicated by theCURRENT direction 24 e as it is (step S29). - Next, the branch direction architecting
stage determining section 26 determines whether or not the branch history of the branch instruction is in an initial architecting stage (step S30). In other words, the branch direction architectingstage determining section 26 determines whether or not at least one of the value of theTAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c in the branch history of the branch instruction is “0”. If the branch direction architectingstage determining section 26 determines that at least one of the value of theTAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c is “0” (i.e., the branch history is in an initial architecting stage) (“Yes” route of step S30), prediction about the next branch direction of the branch instruction is not executed by the branch direction predictor 25 (step S23). - However, if the branch direction architecting
stage determining section 26 determines that any of the value of theTAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c is not “0” (i.e., the branch history is not in an initial architecting stage) (“No” route of step S30), prediction about the next branch direction of the branch instruction is executed by the branch direction predictor 25 (steps S31 to S35). - In other words, the
branch direction predictor 25 determines whether the value of theCURRENT direction 24 e after updating by the branchhistory updating section 21 is “1” (i.e., the branch taken) (step 28 or step 29), and yet whether or not the value of theCURRENT counter 24 d matches the value of theTAKEN counter 24 b (step S31). If the both conditions are satisfied (“Yes” route of step S31), thebranch direction predictor 25 predicts that the branch would not be taken by the next execution of the branch instruction (step S32). - On the other hand, if both conditions are not satisfied (“No” route of step S31), the
branch direction predictor 25 determines whether the value of theCURRENT direction 24 e after updating by the branchhistory updating section 21 is “0” (i.e., the branch not taken), and yet whether or not the value of theCURRENT counter 24 d matches the value of the NOT-TAKEN counter 24 c (step S33). If thebranch direction predictor 25 determines that the both conditions are satisfied (“Yes” route of step S33), thebranch direction predictor 25 predicts that the branch would be taken by the next execution of the branch instruction (step S34). - If the
branch direction predictor 25 determines, also in this step (step S33), that the both conditions are not satisfied (“No” route of step S33), thebranch direction predictor 25 predicts that the branch instruction would continue to keep the current branch direction (the branch direction after updated) next time as well (in other words, the next branch direction would be identical to the current branch direction) (step S35). - Like this, the
branch direction predictor 25 predicts a branch direction of a branch instruction on the basis of a branch history (seeFIG. 3 ) held in the past branch history memory section 25 (steps S32, S34, and S35). - Next, the
selector 22 and replacingsection 23 of the branchhistory updating section 21 will be described. - The
selector 22, which selects one entry inn entries 0 to n−1 of the past branchhistory memory section 24 in case that all of then entries 0 to n−1 are in use when the branchhistory updating section 21 registers a branch history about a new branch instruction into the past branch history memory section 24 (seeFIG. 8 ), has two functions, a first selecting function and a second selection function described later. - The first selecting function of the
selector 22 is a function of selecting one entry inn entries 0 to n−1 of the past branchhistory memory section 24 on the basis of the branch history of the past branchhistory memory section 24 in case that all of then entries 0 to n−1 are in use when a branch history about a new branch instruction is registered into the past branchhistory memory section 24. Specifically, theselector 22 selects one entry in which the branch history held by the branchhistory memory section 24 includes only branches taken, and yet the number of branches successively taken included in the branch history is equal to or more than a predetermined number (m in this embodiment). - Which is, the first selecting function of the
selector 22 is a function of selecting an entry having a branch history in which any of the value of theTAKEN counter 24 b and the value of the NOT-TAKEN counter 24 c is “0”, theCURRENT direction 24 e indicates “1”, and further, theCURRENT counter 24 d indicates “m”. - The procedure of selecting an entry, which is an object of replacement, with the first selecting function of the selector 22 (first selecting step) will be described with reference to the flow chart (steps S40 to S45) shown in
FIG. 11 . As shown inFIG. 11 , the first selecting function of theselector 22 is a function of checking the branch histories of allentries 0 to n−1 of the past branchhistory memory section 24 in case that all the entries are in use when a branch history about a new branch instruction is registered into an entry of the past branch history memory section 24 (step S40). - The
selector 22 determines whether or not allentries 0 to n−1 of the past branchhistory memory section 24 are in use, by means of a signal (WRGHT_FULL signal) indicating that all theentries 0 to n−1 of the past branchhistory memory section 24 are in use, which has been generated by asignal generating circuit 33 shown inFIG. 12 . The WRGHT_FULL signal is generated as shown inFIG. 12 in case that the number of an entry designated by a pointer (WRGHT_NEXT_PTR) generated to register a branch history into an entry selected in the order of theentries 0 to n−1 by the second selecting function of theselector 22 described later matches the number of the last entry (i.e., n−1), when a signal of instruction for new entry registration (CREATE_NEW_WRGHT signal) is generated. - As shown in
FIG. 11 , with the first selecting function of theselector 22, it is at first determined whether or not the current branch direction indicated by theCURRENT direction 24 e signifies the branch taken (“1”) (step S41). Herein, if the branch direction signifies the branch not taken (the value of theCURRENT direction 24 e is “0” (“No” route of step S41), it is determined that the branch is possible not to be taken also into the future, so the entry of this branch history is not selected (step S42). In other words, it is determined that the entry of this branch history is necessary to change the prediction of thebranch history register 15 - On the other hand, if the branch direction signifies the branch taken (the value of the
CURRENT direction 24 e is “1”) (“Yes” route of step S41), it is determined whether or not the number of branches successively taken of theCURRENT counter 24 d exceeds a predetermined number (m in this embodiment) (step S43). - Herein, if the number of branches successively taken has not exceeded a predetermined number (“No” route of step S43), the entry of this branch history is not selected, and then the process is returned to the above step S40.
- If the number of branches successively taken has exceeded a predetermined number (“Yes” route of step S43), it is determined whether or not the value of the NOT-
TAKEN counter 24 c of this branch history is “0”, which is, whether or not the branch not taken has never occurred (step S44). - In this connection, when the number of branches successively taken matches the predetermined value (critical value; m), a CURRENT_CTR_OVERFLOW signal indicating that the value held in the
CURRENT counter 24 d has become equal to or more than the predetermined value (m), which is, overflow from theCURRENT counter 24 d, is generated by asignal generating circuit 34 shown inFIG. 13 . - If the NOT-
TAKEN counter 24 c indicates a value other than “0” (“No” route of step S44), it is determined that the branch is possible not to be taken also into the future, so the entry of this branch history is not selected (step S42). - On the other hand, if the NOT-
TAKEN counter 24 c indicates “0” (“Yes” route of step S44), it is thought that the branch taken will continue also into the future, and it is determined that it is not necessary to change the prediction about this branch history in thebranch history register 15, so the entry of this branch history is selected as an entry, which is object of replacement (step S45). - In other words, as shown in a
signal generating circuit 35 ofFIG. 14 , when the CURRENT direction indicates “1”, yet a new-registration signal (CREATE_WRGHT signal) for this entry is not generated, yet theTAKEN counter 24 b indicates “0”, and yet a signal (CURRENT_CTR_OVERFLOW signal; seeFIG. 13 ) indicating overflow from theCURRENT counter 24 d is generated, an OVERWRITE_CANDIDATE_WRGHT signal for making the entry of this branch history an entry, which is an object of replacement (object of overwrite) is generated. - The OVERWRITE_CANDIDATE_WRGHT signal can be generated for each of all
entries 0 to n−1 of the past branchhistory memory section 24 as shown inFIG. 15 - Herein, the process executed until the CURRENT_CTR_OVERFLOW signal is generated in the
information processing apparatus 1 will be described with reference to the time chart shown in FIGS. 16(a) to (k). InFIG. 16 , T1 to Tx are units of time for the processing of theinformation processing apparatus 1. - As shown in
FIG. 16 , when the COMPLETE signal and a signal indicating that the branch of the executed branch instruction has been taken (COMP_TAKEN signal) are generated from the branch instruction controller 13 (see T1), a signal of instruction for new entry registration (CREATE_WRIGHT signal) is generated in the global history register 20 (see T2). - Herein, it is assumed that a branch history has been registered into the entry n−1, the value of the
CURRENT counter 24 d (denoted as CURRENT_CTR in the figure) in the branch history of the entry n−1 is incremented to “1”, and the value of theCURRENT direction 24 e (denoted as CURRENT_DTR in the figure) becomes “1” (the flag comes into ON state) (see T3). Additionally, at this point in this time chart, allentries 0 to n−1 of the past branchhistory memory section 24 result in having been used, whereby a WRGHT_FULL signal (seeFIG. 12 ) is also generated (see T3). This WRGHT_FULL signal continues to be generated into the future. - After that, when the same branch instruction is executed again, the COMPLETE signal is generated (see T5). However, since the branch history of the branch instruction has been already held in the entry n−1, a WRGHT_HIT_OR signal indicating that the branch history about the branch instruction has been held in the past branch
history memory section 24 is generated, and a WRGHTn−1_HIT signal indicating that the branch instruction has hit the entry n−1 is also generated (see T5). - Furthermore, when the branch of the branch instruction is taken this time too, the COMP_TAKEN signal is generated (see T5), and the value of the
CURRENT counter 24 d of the entry n−1 holding the branch history about the branch instruction is incremented to “2” (see T6). - In addition, also after that, when the branch instruction is executed and the branch is taken, an operation similar to the operation at T5 and T6 is repeated (see T7 to Tx-10).
- When the branch instruction has been successively executed m times and the branch has been taken each time (see Tx-9), the value of the
CURRENT counter 24 d of the entry n−1 is incremented to “m”, and the CURRENT_CTR_OVERFLOW signal is generated from the past branchhistory memory section 24, and a replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHTn−1 signal; denoted as OVERWRITE_CAND) is further generated in order to use the entry n−1 when replacement is performed (see Tx-8). - After that, even if the branch instruction is executed and the branch is taken (see Tx-5, Tx-3, and Tx), the
CURRENT counter 24 d is not incremented (see Tx-4 and Tx-2), and the CURRENT_CTR_OVERFLOW signal and the OVERWRITE_CANDIDATE WRGHTn−1 signal continue to be generated unless replacement is performed with this entry n−1 assumed to be an object (see Tx-7 to Tx). - In this connection, it happens that a plurality of entries which can be selected as a candidate for replacement with the first selecting function of the
selector 22 exist at the same time in theentries 0 to n−1 of the past branchhistory memory section 24. However, the first selecting function is so designed to select one entry ranked highest in the order of theentry 0 to the entry n−1 as an entry, which is an object of replacement, even if a plurality of entries in which the number of branches successively taken included in the branch history is equal to or more than a predetermined number exist at the same time. - FIGS. 17(a) to (f) depict the procedure of selecting one entry with the first selecting function of the
selector 22. As shown in FIGS. 17(a) to (f), with the first selecting function of theselector 22, it is checked in the order of theentry 0 to the entry n−1 whether the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT signal) has been output, and at the time when a replaced-candidate signal was detected, an entry from which the detected replaced-candidate signal was output is selected as an entry, which is an object of replacement. - In other words, as shown in
FIG. 17 (a), with the first selecting function of theselector 22, in case that the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT0) was output from theentry 0, thisentry 0 is selected as an entry, which an object of replacement. Furthermore, as shown inFIG. 17 (b), in case that the replaced-candidate signal was not output from theentry 0 but the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT1 signal) was output from theentry 1, theentry 1 is selected as an entry, which an object of replacement, and a signal (USE_WRGHT1_OVERWRITE signal) used to replace theentry 1 is generated. - Furthermore, as shown in
FIG. 17 (c), in case that the replaced-candidate signal has been not output from theentry 0 and theentry 1, but the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT2 signal) has been output from theentry 2, theentry 2 is selected as an entry, which is an object of replacement, and the signal (USE_WRGHT2_OVERWRITE signal) used to replace theentry 2 is generated. In FIGS. 17(d) to (f), a procedure similar to the procedures in FIGS. 17(a) to (c) is used. - The second selecting function of the
selector 22 is a function of selecting one entry registered earliest inn entries 0 to n−1 of the past branchhistory memory section 24 in case that all theentries 0 to n−1 are in use when a branch history about a new branch instruction is registered. In other words, the second selecting function of theselector 22 is a function of selecting an entry, which is an object of replacement, in the round-robin method. - With the second selecting function of the
selector 22, a pointer (WRGHT_NEXT_PTR<K:0>) for selecting an entry, which is an object of replacement, is generated by asignal generating circuit 36 shown inFIG. 18 . In other words, when an instruction for new entry registration (CREATE_NEW_WRGHT) is generated, the pointer is generated by incrementing the value of thecounter 37 one by one. - In this connection, as shown in
FIG. 19 , signals (WRGHT_NEXT_PTR_EQ_0 to WRGHT_NEXT_PTR_EQ_n−1) for selecting theentries 0 to n−1 can be obtained by decoding this WRGHT_NEXT_PTR<K:0> with thedecoder 31. - The replacing
section 23 registers a branch history about a new branch instruction into one entry selected by theselector 22. - Next, the procedure of a replacing method, which is one embodiment of the present invention, will be described with reference to the flow chart (steps S50 to S57) shown in
FIG. 20 . As shown inFIG. 20 , when a branch history about a new branch instruction is registered into an entry of the past branchhistory memory section 24, theselector 22 at first determines whether or not allentries 0 to n−1 of the past branchhistory memory section 24 are in use (step S50). If all the entries are not in use (“No” route of step S50), the branchhistory updating section 21 selects an empty entry which is not in current use in the round-robin method, and registers a branch history about a new branch instruction into the selected entry (step S51). - On the other hand, if all the entries are in use (“Yes” route of step S50), the
selector 22 selects an entry on the basis of the branch histories held in the past branchhistory memory section 24 with the first selecting function as described above with reference toFIG. 11 (first selecting step; step S52). In other words, when a branch history exists in which only the branch taken was registered until now and yet the number of branches successively taken is equal to or more than a predetermined number (m), the entry of this branch history is selected as an entry, which is an objection of replacement. - Furthermore, if all the entries are in use (“Yes” route of step S50), the
selector 22 selects an entry registered earliest of all theentries 0 to n−1 as an entry, which is an objection of replacement, in the round-robin method with the second selecting function (second selecting step; step S53). - If a branch history exists in which only the branch taken was registered until now and yet the number of branches successively taken is equal to or more than a predetermined number (m), and one entry has been selected with the first selecting function in the first selecting step (step S52) (“Yes” route of step S54), the
selector 22 employs one entry selected on the basis of the branch histories in this first selecting step on a higher priority basis than one entry selected with the second selecting function in the second selecting step (step S55), and then the replacingsection 23 registers a branch history about a new branch instruction into one entry selected (employed) in the first selecting step (replacing step; step S57). - If a branch history does not exist in which only the branch taken was registered until now and yet the number of branches successively taken is equal to or more than a predetermined number (m), and one entry has not been selected with the first selecting function in the first selecting step (step S52) (“No” route of step S54), the
selector 22 employs an entry registered earliest selected with the second selecting function in the second selecting step (step S56), and then the replacingsection 23 registers a branch history about a new branch instruction into one entry selected (employed) in the second selecting step (replacing step; step S57). - In this connection, steps S51 and S53 to S57 in
FIG. 20 function as selecting steps. - Furthermore, with the first selecting function of the
selector 22, a signal (USE_OVERWRITE_CANDIDATE signal) allowing one entry selected with the first selecting function to be employed is generated by asignal generating circuit 38 shown inFIG. 21 . In other words, when the replaced-candidate signal (OVERWRITE_CANDIDATE_WRGHT) is output from any one of theentries 0 to n−1, the USE_OVERWRITE_CANDIDATE signal is generated. - The
selector 22 employs, using asignal generating circuit 39 shown inFIG. 22 , one entry selected with the first selecting function (first selecting step) on a priority basis. In other words, even if the USE_WRGHT_TO_OVERWRITE signal (seeFIG. 17 ) and the WRGHT_NEXT_PTR_EQ signal (seeFIG. 19 ) have been generated in each of theentries 0 to n−1, when the USE_OVERWRITE_CANDIDATE signal (seeFIG. 21 ) and the WRGHT_FULL signal (seeFIG. 12 ) have been generated with the first selecting function, these signals generated with the first selecting function are employed. The selected signals and the instruction for new entry registration (CREATE_NEW_WRGHT signal; seeFIG. 7 ) then allow CREATE_WRGHT0 to CREATE_WRGHTn−1 signals for registering a new entry (branch history) into each of theentries 0 to n−1 to be generated. - As described above, the
information processing apparatus 1 and replacing method, which is one embodiment of the present invention, enables theselector 22 of the branchhistory updating section 21 to select an entry of the entries of the past branchhistory memory section 24, which does not affect prediction about a branch direction of a branch instruction without its entry, without specially holding new information for replacement by the past branchhistory memory section 24, using only information (i.e., I-Address 24 a, TAKEN counter 24 b, NOT-TAKEN counter 24 c,CURRENT counter 24 d, andCURRENT direction 24 e) originally provided in the past branchhistory memory section 24 to be used for prediction, thereby allowing the limited resources to be effectively used and effective replacement to be realized. - Specifically, the
selector 22 selects a branch history in which only branches taken is included since newly registered in an entry of the past branchhistory memory section 24 and yet the number of the branches taken is more than a predetermined number (critical value), thereby making it possible to select an entry (branch history) about a branch instruction unnecessary for branch prediction, by which the branch taken is thought to continue also into the future, as an objection of replacement, on a priority basis, which enables theentries 0 to n−1 of the past branchhistory memory section 24 to be effectively used, and the prediction accuracy (performance) of theglobal history register 20 to be improved. - The present invention is not limited to the embodiment described above, and may be embodied with various variations without departing from the spirit and scope of the invention.
- For example, the embodiment described above is configured so that the second selecting function of the
selector 22 is a function of selecting an entry, which is an object of replacement, of the plurality of entries of the past branchhistory memory section 24 with the round-robin method. However, the present invention is not limited to this configuration, and may be configured so that the second selecting function of theselector 22 is a function of selecting an entry, which is an object of replacement, of the plurality of entries in the past branchhistory memory section 24 with the LRU method. In other word, the present invention may be configured so that the second selecting function of theselector 22 is a function of selecting an entry used earliest for prediction by thebranch direction predictor 25, of all entries of the past branchhistory memory section 24, thereby allowing an effect similar to that of the embodiment described above to be produced. In this case, a configuration has to be made so that histories such as times when the branch history was used (updated) are held in the branch history of the past branchhistory memory section 24. - Furthermore, the embodiment described above is configured so that the first selecting function of the
selector 22 is a function of selecting one entry ranked highest in the order of theentry 0 to the entry n−1 as an entry, which is an object of replacement even if a plurality of entries exist at the same time in which only branches taken is included since registered in the past branchhistory memory section 24 and yet the number of branches taken included in the branch history is equal to or more than a predetermined number. However, the present invention is not limited to this configuration, and may be configured so that when a plurality of entries were selected with the first selecting function of theselector 22, one entry is selected from the selected plurality of entries with the second selecting function of theselector 22. - Furthermore, in the embodiment described above, when one entry, which is an object of replacement, is selected with the first selecting function of the
selector 22, a pointer (seeFIGS. 18 and 19 ) for selecting one entry selected with the second selecting function is not updated, whereby when the entry selected with the first selecting function matches the entry selected with the second selecting function, there is a possibility that the entry is replaced with the first selecting function and then is replaced again with the second selecting function. Therefore, it may be designed that in such a case a pointer generated with the second selecting function is incremented. - Furthermore, the embodiment described above may be configured so that the branch instruction about the entry selected and replaced by the
selector 22 is not registered again into the past branchhistory memory section 24. For example, the embodiment described above may be configured so that thebranch RS 14 holds, every branch instruction, information (flag, etc.) indicating that the instruction was registered once but has been erased for replacement, and that theselector 22 selects an entry, which is an object of replacement, on the basis of such information. - In the embodiment described above, a case was explained that the replacing method of the present invention was applied to the past branch
history memory section 24 of the global history register. However, application of the replacing method of the present invention is not limited to the past branchhistory memory section 24 of the global history register. For example, in various full-associative memory devices, the replacing method may be applied in case that an entry is replaced when all entries are in use, and may provide the same work and effect as those in the embodiment described above. - For example, in a translation lookaside buffer (TLB) or the like used for address conversion, there may be means for decreasing the order of priority when a global bit which means that an entry can be used commonly in a whole process space is on. Further, when a context used for identifying a process space does not represents a space currently executed, it is considered that the frequency of use of the context is low, and therefore there may be a means for replacing the context on a priority basis or the like.
- Furthermore, the functions of the aforementioned instruction fetch
address generator 10, instruction fetchsection 11,instruction decoder 12,branch instruction controller 13, branch RS14,branch history register 15, branchhistory updating section 21,selector 22, replacingsection 23, past branchhistory memory section 24, I-Address 24 a, TAKEN counter 24 b, NOT-TAKEN counter 24 c,CURRENT counter 24 d,CURRENT direction 24 e,branch direction predictor 25, branch direction architectingstage determining section 26, and branch historyregister updating section 27 may be realized by that a computer (including a CPU, an information processing apparatus, and various terminals) executes a predetermined application program (replacing program). - The program is provided in the form of being recorded on a computer-readable recording medium such as a flexible disk, a CD-ROM, a CD-R, a CD-RW, a DVD, or the like. In this case, the computer reads a storing instruction control program from its recording medium, which is transferred to an internal memory device or an external memory device, stored and used. Furthermore, the program may be recorded in memory devices (recording medium) such as a magnetic disk, an optical disk, and a magneto-optical disk, and provided to the computer through a communication line from the memory device.
- Herein, the so-called computer, which is a concept including hardware and an operating system (OS), signifies the hardware operating under the control of the OS. In case that an OS is not required and the hardware is caused to operate with an application program only, the hardware itself corresponds to the computer. The hardware is provided with at least a microprocessor such as a CPU, and means for reading a computer program recorded on the recording medium. The application program which is the replacing program described above includes program codes for allowing a computer as described above to realize the functions of the instruction fetch
address generator 10, the instruction fetchsection 11, theinstruction decoder 12, thebranch instruction controller 13, thebranch RS 14, thebranch history register 15, the branchhistory updating section 21, theselector 22, the replacingsection 23, the past branchhistory memory section 24, the I-Address 24 a, theTAKEN counter 24 b, the NOT-TAKEN counter 24 c, theCURRENT counter 24 d, theCURRENT direction 24 e, thebranch direction predictor 25, the branch direction architectingstage determining section 26, and the branch historyregister updating section 27. Further, part of the functions may be realized not with an application program but with an OS. - In addition, as a recording medium which is this embodiment, various computer-readable mediums such as an IC card, a ROM cartridge, a magnetic tape, a punched card, an internal memory device (memories such as a RAM and a ROM) and an external memory device, etc. of a computer, and a printed matter, etc. on which a code such as a bar code is printed may be used, in addition to the flexible disk, the CD-ROM, the CD-R, the CD-RW, the DVD, the magnetic disk, the optical disk, and the magneto-optical disk described above.
- Although a few embodiments of the present invention have been shown and described, it would be appreciated by those skilled in the art that changes may be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the claims and their equivalents.
Claims (9)
1. A replacing method for a full-associative memory device, the replacing method being used for entries of said memory device in case that all of said entries are in use when a new entry is registered into said memory device, said method comprising:
selecting one entry from all entries of said memory device on the basis of information originally provided in entries of said memory device; and
registering said new entry into said selected one entry.
2. The replacing method according to claim 1 , wherein:
said selecting further comprises selecting said one entry on the basis of a branch history held by a past branch history memory section,
said selecting further comprises selecting, as said one entry, an entry registered earliest of all entries of said past branch history memory section,
wherein, an entry selected on the basis of the branch history held by the past branch history memory section is employed on a higher priority basis than the selected entry registered earliest of all entries of said past branch history memory section.
3. The replacing method according to claim 1 , wherein:
said selecting further comprises selecting said one entry on the basis of a branch history held by a past branch history memory section,
said selecting further comprises selecting, as said one entry, an entry used earliest for prediction by a branch direction predictor of all entries of said past branch history memory section,
wherein, an entry selected on the basis of the branch history held by the past branch history memory section is employed on a higher priority basis than the selected entry used earliest for prediction by the branch direction predictor of all entries of said past branch history memory section.
4. The replacing method according to claim 1 , wherein:
said selecting further comprises selecting said one entry on the basis of a branch history held by a past branch history memory section, and
said branch history held by said past branch history memory section includes only branches taken.
5. The replacing method according to claim 2 , wherein said branch history held by said past branch history memory section includes only branches taken.
6. The replacing method according to claim 3 , wherein said branch history held by said past branch history memory section includes only branches taken.
7. The replacing method according to claim 4 , wherein the number of branches taken included in said branch history held by said past branch history memory section is equal to or greater than a predetermined number.
8. The replacing method according to claim 5 , wherein the number of branches taken included in said branch history held by said past branch history memory section is equal to or greater than a predetermined number.
9. The replacing method according to claim 6 , the number of branches taken included in said branch history held by said past branch history memory section is equal to or greater than a predetermined number
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US11/703,225 US20070162728A1 (en) | 2004-09-30 | 2007-02-07 | Information processing apparatus, replacing method, and computer-readable recording medium on which a replacing program is recorded |
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004-286129 | 2004-09-30 | ||
JP2004286129A JP4362096B2 (en) | 2004-09-30 | 2004-09-30 | Information processing apparatus, replacement method, replacement program, and computer-readable recording medium recording the replacement program |
US11/062,472 US7613910B2 (en) | 2004-09-30 | 2005-02-22 | Information processing apparatus, method, and computer-readable recording medium for replacing an entry in a memory device |
US11/703,225 US20070162728A1 (en) | 2004-09-30 | 2007-02-07 | Information processing apparatus, replacing method, and computer-readable recording medium on which a replacing program is recorded |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US11/062,472 Division US7613910B2 (en) | 2004-09-30 | 2005-02-22 | Information processing apparatus, method, and computer-readable recording medium for replacing an entry in a memory device |
Publications (1)
Publication Number | Publication Date |
---|---|
US20070162728A1 true US20070162728A1 (en) | 2007-07-12 |
Family
ID=35515639
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US11/062,472 Expired - Fee Related US7613910B2 (en) | 2004-09-30 | 2005-02-22 | Information processing apparatus, method, and computer-readable recording medium for replacing an entry in a memory device |
US11/703,225 Abandoned US20070162728A1 (en) | 2004-09-30 | 2007-02-07 | Information processing apparatus, replacing method, and computer-readable recording medium on which a replacing program is recorded |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US11/062,472 Expired - Fee Related US7613910B2 (en) | 2004-09-30 | 2005-02-22 | Information processing apparatus, method, and computer-readable recording medium for replacing an entry in a memory device |
Country Status (3)
Country | Link |
---|---|
US (2) | US7613910B2 (en) |
EP (1) | EP1643357B1 (en) |
JP (1) | JP4362096B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120030518A1 (en) * | 2010-07-28 | 2012-02-02 | Ravi Rajwar | Last branch record indicators for transactional memory |
US9594564B2 (en) | 2013-08-13 | 2017-03-14 | Fujitsu Limited | Arithmetic processing device and control method of arithmetic processing device |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8904155B2 (en) * | 2006-03-17 | 2014-12-02 | Qualcomm Incorporated | Representing loop branches in a branch history register with multiple bits |
US8171269B2 (en) * | 2009-03-06 | 2012-05-01 | Agere Systems Inc. | Branch target buffer with entry source field for use in determining replacement priority |
US20180004627A1 (en) * | 2016-06-29 | 2018-01-04 | Centipede Semi Ltd. | Sequential monitoring and management of code segments for run-time parallelization |
US20190004806A1 (en) * | 2017-06-30 | 2019-01-03 | Qualcomm Incorporated | Branch prediction for fixed direction branch instructions |
US11928474B2 (en) * | 2022-06-03 | 2024-03-12 | Microsoft Technology Licensing, Llc | Selectively updating branch predictors for loops executed from loop buffers in a processor |
Citations (31)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4731740A (en) * | 1984-06-30 | 1988-03-15 | Kabushiki Kaisha Toshiba | Translation lookaside buffer control system in computer or virtual memory control scheme |
US4980816A (en) * | 1987-12-18 | 1990-12-25 | Nec Corporation | Translation look-aside buffer control system with multiple prioritized buffers |
US5265213A (en) * | 1990-12-10 | 1993-11-23 | Intel Corporation | Pipeline system for executing predicted branch target instruction in a cycle concurrently with the execution of branch instruction |
US5434985A (en) * | 1992-08-11 | 1995-07-18 | International Business Machines Corporation | Simultaneous prediction of multiple branches for superscalar processing |
US5564052A (en) * | 1991-06-27 | 1996-10-08 | Integrated Device Technology, Inc. | Logically disconnectable virtual-to-physical address translation unit and method for such disconnection |
US5752069A (en) * | 1995-08-31 | 1998-05-12 | Advanced Micro Devices, Inc. | Superscalar microprocessor employing away prediction structure |
US5758142A (en) * | 1994-05-31 | 1998-05-26 | Digital Equipment Corporation | Trainable apparatus for predicting instruction outcomes in pipelined processors |
US5802568A (en) * | 1996-06-06 | 1998-09-01 | Sun Microsystems, Inc. | Simplified least-recently-used entry replacement in associative cache memories and translation lookaside buffers |
US5848269A (en) * | 1994-06-14 | 1998-12-08 | Mitsubishi Denki Kabushiki Kaisha | Branch predicting mechanism for enhancing accuracy in branch prediction by reference to data |
US5850632A (en) * | 1995-09-08 | 1998-12-15 | Texas Instruments Incorporated | Memory access controller utilizing cache memory to store configuration information |
US5948100A (en) * | 1997-03-18 | 1999-09-07 | Industrial Technology Research Institute | Branch prediction and fetch mechanism for variable length instruction, superscalar pipelined processor |
US6108775A (en) * | 1996-12-30 | 2000-08-22 | Texas Instruments Incorporated | Dynamically loadable pattern history tables in a multi-task microprocessor |
US6125433A (en) * | 1990-06-26 | 2000-09-26 | Lsi Logic Corporation | Method of accomplishing a least-recently-used replacement scheme using ripple counters |
US6223263B1 (en) * | 1998-09-09 | 2001-04-24 | Intel Corporation | Method and apparatus for locking and unlocking a memory region |
US20020049824A1 (en) * | 1999-02-09 | 2002-04-25 | Kenneth Mark Wilson | Computer architecture with caching of history counters for dynamic page placement |
US20020138236A1 (en) * | 2001-03-21 | 2002-09-26 | Akihiro Takamura | Processor having execution result prediction function for instruction |
US20020199091A1 (en) * | 2001-06-20 | 2002-12-26 | Fujitsu Limited | Apparatus for branch prediction based on history table |
US6532534B1 (en) * | 1998-12-10 | 2003-03-11 | Fujitsu Limited | Information processing apparatus provided with branch history with plurality of designation ways |
US6564311B2 (en) * | 1999-01-19 | 2003-05-13 | Matsushita Electric Industrial Co., Ltd. | Apparatus for translation between virtual and physical addresses using a virtual page number, a physical page number, a process identifier and a global bit |
US6598050B1 (en) * | 2000-02-11 | 2003-07-22 | Integrated Device Technology, Inc. | Apparatus and method for limited data sharing in a multi-tasking system |
US6604187B1 (en) * | 2000-06-19 | 2003-08-05 | Advanced Micro Devices, Inc. | Providing global translations with address space numbers |
US20030177317A1 (en) * | 2000-06-28 | 2003-09-18 | Intel Corporation | Snoop filter line replacement for reduction of back invalidates in multi-node architectures |
US6625695B2 (en) * | 2000-09-29 | 2003-09-23 | Intel Corporation | Cache line replacement policy enhancement to avoid memory page thrashing |
US6640286B2 (en) * | 2000-11-02 | 2003-10-28 | Hitachi, Ltd. | Cache control system |
US20040003218A1 (en) * | 2002-06-28 | 2004-01-01 | Fujitsu Limited | Branch prediction apparatus and branch prediction method |
US20040003214A1 (en) * | 2002-06-28 | 2004-01-01 | Fujitsu Limited | Instruction control method and processor |
US20040133760A1 (en) * | 2003-01-06 | 2004-07-08 | Thimmannagari Chandra M.R. | Replacement algorithm for a replicated fully associative translation look-aside buffer |
US20040165551A1 (en) * | 2003-02-26 | 2004-08-26 | Govindarajan Krishnamurthi | Method of reducing denial-of-service attacks and a system as well as an access router therefor |
US6895498B2 (en) * | 2001-05-04 | 2005-05-17 | Ip-First, Llc | Apparatus and method for target address replacement in speculative branch target address cache |
US20060026381A1 (en) * | 2004-07-29 | 2006-02-02 | Fujitsu Limited | Address translation information storing apparatus and address translation information storing method |
US7069426B1 (en) * | 2000-03-28 | 2006-06-27 | Intel Corporation | Branch predictor with saturating counter and local branch history table with algorithm for updating replacement and history fields of matching table entries |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2982506B2 (en) | 1992-08-18 | 1999-11-22 | 日本電気株式会社 | Branch history table control circuit |
JPH10105463A (en) | 1996-09-27 | 1998-04-24 | Mitsubishi Electric Corp | Cache system and replacement judgement method |
US20020013823A1 (en) | 2000-06-16 | 2002-01-31 | Eubanks Thomas Marshall | Multicast peering in multicast points of presence (MULTIPOPs) network - neutral multicast internet exchange |
JP4052887B2 (en) | 2002-06-28 | 2008-02-27 | 富士通株式会社 | Storage device, branch history storage device and control method thereof |
-
2004
- 2004-09-30 JP JP2004286129A patent/JP4362096B2/en not_active Expired - Fee Related
-
2005
- 2005-02-22 US US11/062,472 patent/US7613910B2/en not_active Expired - Fee Related
- 2005-02-28 EP EP05251180.5A patent/EP1643357B1/en not_active Expired - Fee Related
-
2007
- 2007-02-07 US US11/703,225 patent/US20070162728A1/en not_active Abandoned
Patent Citations (34)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4731740A (en) * | 1984-06-30 | 1988-03-15 | Kabushiki Kaisha Toshiba | Translation lookaside buffer control system in computer or virtual memory control scheme |
US4980816A (en) * | 1987-12-18 | 1990-12-25 | Nec Corporation | Translation look-aside buffer control system with multiple prioritized buffers |
US6125433A (en) * | 1990-06-26 | 2000-09-26 | Lsi Logic Corporation | Method of accomplishing a least-recently-used replacement scheme using ripple counters |
US5265213A (en) * | 1990-12-10 | 1993-11-23 | Intel Corporation | Pipeline system for executing predicted branch target instruction in a cycle concurrently with the execution of branch instruction |
US5564052A (en) * | 1991-06-27 | 1996-10-08 | Integrated Device Technology, Inc. | Logically disconnectable virtual-to-physical address translation unit and method for such disconnection |
US5434985A (en) * | 1992-08-11 | 1995-07-18 | International Business Machines Corporation | Simultaneous prediction of multiple branches for superscalar processing |
US5758142A (en) * | 1994-05-31 | 1998-05-26 | Digital Equipment Corporation | Trainable apparatus for predicting instruction outcomes in pipelined processors |
US5848269A (en) * | 1994-06-14 | 1998-12-08 | Mitsubishi Denki Kabushiki Kaisha | Branch predicting mechanism for enhancing accuracy in branch prediction by reference to data |
US5752069A (en) * | 1995-08-31 | 1998-05-12 | Advanced Micro Devices, Inc. | Superscalar microprocessor employing away prediction structure |
US5850632A (en) * | 1995-09-08 | 1998-12-15 | Texas Instruments Incorporated | Memory access controller utilizing cache memory to store configuration information |
US5802568A (en) * | 1996-06-06 | 1998-09-01 | Sun Microsystems, Inc. | Simplified least-recently-used entry replacement in associative cache memories and translation lookaside buffers |
US6108775A (en) * | 1996-12-30 | 2000-08-22 | Texas Instruments Incorporated | Dynamically loadable pattern history tables in a multi-task microprocessor |
US5948100A (en) * | 1997-03-18 | 1999-09-07 | Industrial Technology Research Institute | Branch prediction and fetch mechanism for variable length instruction, superscalar pipelined processor |
US6223263B1 (en) * | 1998-09-09 | 2001-04-24 | Intel Corporation | Method and apparatus for locking and unlocking a memory region |
US6532534B1 (en) * | 1998-12-10 | 2003-03-11 | Fujitsu Limited | Information processing apparatus provided with branch history with plurality of designation ways |
US6564311B2 (en) * | 1999-01-19 | 2003-05-13 | Matsushita Electric Industrial Co., Ltd. | Apparatus for translation between virtual and physical addresses using a virtual page number, a physical page number, a process identifier and a global bit |
US20020049824A1 (en) * | 1999-02-09 | 2002-04-25 | Kenneth Mark Wilson | Computer architecture with caching of history counters for dynamic page placement |
US6598050B1 (en) * | 2000-02-11 | 2003-07-22 | Integrated Device Technology, Inc. | Apparatus and method for limited data sharing in a multi-tasking system |
US7069426B1 (en) * | 2000-03-28 | 2006-06-27 | Intel Corporation | Branch predictor with saturating counter and local branch history table with algorithm for updating replacement and history fields of matching table entries |
US6604187B1 (en) * | 2000-06-19 | 2003-08-05 | Advanced Micro Devices, Inc. | Providing global translations with address space numbers |
US20030177317A1 (en) * | 2000-06-28 | 2003-09-18 | Intel Corporation | Snoop filter line replacement for reduction of back invalidates in multi-node architectures |
US6625695B2 (en) * | 2000-09-29 | 2003-09-23 | Intel Corporation | Cache line replacement policy enhancement to avoid memory page thrashing |
US6640286B2 (en) * | 2000-11-02 | 2003-10-28 | Hitachi, Ltd. | Cache control system |
US20020138236A1 (en) * | 2001-03-21 | 2002-09-26 | Akihiro Takamura | Processor having execution result prediction function for instruction |
US6678638B2 (en) * | 2001-03-21 | 2004-01-13 | Hitachi, Ltd. | Processor having execution result prediction function for instruction |
US6895498B2 (en) * | 2001-05-04 | 2005-05-17 | Ip-First, Llc | Apparatus and method for target address replacement in speculative branch target address cache |
US20020199091A1 (en) * | 2001-06-20 | 2002-12-26 | Fujitsu Limited | Apparatus for branch prediction based on history table |
US7055023B2 (en) * | 2001-06-20 | 2006-05-30 | Fujitsu Limited | Apparatus and method for branch prediction where data for predictions is selected from a count in a branch history table or a bias in a branch target buffer |
US20040003214A1 (en) * | 2002-06-28 | 2004-01-01 | Fujitsu Limited | Instruction control method and processor |
US20040003218A1 (en) * | 2002-06-28 | 2004-01-01 | Fujitsu Limited | Branch prediction apparatus and branch prediction method |
US20040133760A1 (en) * | 2003-01-06 | 2004-07-08 | Thimmannagari Chandra M.R. | Replacement algorithm for a replicated fully associative translation look-aside buffer |
US20040165551A1 (en) * | 2003-02-26 | 2004-08-26 | Govindarajan Krishnamurthi | Method of reducing denial-of-service attacks and a system as well as an access router therefor |
US7656840B2 (en) * | 2003-02-26 | 2010-02-02 | Nokia Corporation | Method of reducing denial-of-service attacks and a system as well as an access router therefor |
US20060026381A1 (en) * | 2004-07-29 | 2006-02-02 | Fujitsu Limited | Address translation information storing apparatus and address translation information storing method |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120030518A1 (en) * | 2010-07-28 | 2012-02-02 | Ravi Rajwar | Last branch record indicators for transactional memory |
CN103154908A (en) * | 2010-07-28 | 2013-06-12 | 英特尔公司 | Last branch record indicators for transactional memory |
US8479053B2 (en) * | 2010-07-28 | 2013-07-02 | Intel Corporation | Processor with last branch record register storing transaction indicator |
US8782382B2 (en) | 2010-07-28 | 2014-07-15 | Intel Corporation | Last branch record indicators for transactional memory |
TWI468937B (en) * | 2010-07-28 | 2015-01-11 | Intel Corp | Method and system of generating branch records and processor for storing branch records |
US9354878B2 (en) | 2010-07-28 | 2016-05-31 | Intel Corporation | Last branch record register for storing taken branch information and transactional memory transaction indicator to be used in transaction execution analysis |
US10073719B2 (en) | 2010-07-28 | 2018-09-11 | Intel Corporation | Last branch record indicators for transactional memory |
US9594564B2 (en) | 2013-08-13 | 2017-03-14 | Fujitsu Limited | Arithmetic processing device and control method of arithmetic processing device |
Also Published As
Publication number | Publication date |
---|---|
JP2006099528A (en) | 2006-04-13 |
EP1643357B1 (en) | 2013-11-06 |
EP1643357A3 (en) | 2008-01-23 |
EP1643357A2 (en) | 2006-04-05 |
JP4362096B2 (en) | 2009-11-11 |
US20060095748A1 (en) | 2006-05-04 |
US7613910B2 (en) | 2009-11-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7409535B2 (en) | Branch target prediction for multi-target branches by identifying a repeated pattern | |
US7055023B2 (en) | Apparatus and method for branch prediction where data for predictions is selected from a count in a branch history table or a bias in a branch target buffer | |
US6697932B1 (en) | System and method for early resolution of low confidence branches and safe data cache accesses | |
US7613910B2 (en) | Information processing apparatus, method, and computer-readable recording medium for replacing an entry in a memory device | |
US7631146B2 (en) | Processor with cache way prediction and method thereof | |
CN112543916B (en) | Multi-table branch target buffer | |
US5774710A (en) | Cache line branch prediction scheme that shares among sets of a set associative cache | |
US7320066B2 (en) | Branch predicting apparatus and branch predicting method | |
CN109643237B (en) | Branch target buffer compression | |
US20080209190A1 (en) | Parallel prediction of multiple branches | |
US7017030B2 (en) | Prediction of instructions in a data processing apparatus | |
US7454602B2 (en) | Pipeline having bifurcated global branch history buffer for indexing branch history table per instruction fetch group | |
US7769954B2 (en) | Data processing system and method for processing data | |
US6678638B2 (en) | Processor having execution result prediction function for instruction | |
US20030204705A1 (en) | Prediction of branch instructions in a data processing apparatus | |
CN111258654B (en) | Instruction branch prediction method | |
US7519798B2 (en) | Utilizing a branch predictor outcome to decide whether to fetch or not to fetch from a branch target buffer | |
US7296141B2 (en) | Method for cancelling speculative conditional delay slot instructions | |
KR20210011494A (en) | Low latency synchronization for action cache and instruction cache fetch and decode instructions | |
US20220043908A1 (en) | Mitigation of return stack buffer side channel attacks in a processor | |
CN115480826A (en) | Branch predictor, branch prediction method, branch prediction device and computing equipment | |
US20240118900A1 (en) | Arithmetic processing device and arithmetic processing method | |
JPS62224829A (en) | Instruction cache control system | |
JP2005122343A (en) | Method and device for controlling cache memory | |
JPH04239324A (en) | Branch destination estimating system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
STCB | Information on status: application discontinuation |
Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION |