WO2004031944A1 - Processor and instruction control method - Google Patents

Processor and instruction control method Download PDF

Info

Publication number
WO2004031944A1
WO2004031944A1 PCT/JP2002/010370 JP0210370W WO2004031944A1 WO 2004031944 A1 WO2004031944 A1 WO 2004031944A1 JP 0210370 W JP0210370 W JP 0210370W WO 2004031944 A1 WO2004031944 A1 WO 2004031944A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
exception
branch
issued
correct direction
Prior art date
Application number
PCT/JP2002/010370
Other languages
French (fr)
Japanese (ja)
Inventor
Takaharu Ishizuka
Original Assignee
Fujitsu Limited
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Limited filed Critical Fujitsu Limited
Priority to JP2004541191A priority Critical patent/JP3807740B2/en
Priority to PCT/JP2002/010370 priority patent/WO2004031944A1/en
Publication of WO2004031944A1 publication Critical patent/WO2004031944A1/en
Priority to US11/028,338 priority patent/US20050125634A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3804Instruction prefetching for branches, e.g. hedging, branch folding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3842Speculative instruction execution
    • G06F9/3844Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3861Recovery, e.g. branch miss-prediction, exception handling

Definitions

  • the present invention relates to a processor and an instruction control method for executing an instruction at speculation by branch prediction, and more particularly to a processor and an instruction control method for efficiently canceling a subsequent instruction when branch prediction fails.
  • an in-order instruction issuing unit that depends on the program order
  • an out-of-order instruction execution unit that does not depend on the program order
  • a program order It has an instruction decision section (commit) of the dependent inorder, and executes instructions speculatively based on branch prediction. That is, the instruction issuing unit fetches and decodes a plurality of instructions in order, and causes the instruction storage queue of the instruction storage unit to hold instruction operations (opcodes) and operands.
  • the instruction execution unit speculatively executes instructions in out-of-order order and obtains a result as soon as all operands are prepared in the instruction storage unit and the arithmetic unit becomes available.
  • the instruction determinator holds the incomplete instruction in the reorder buffer, and if the branch prediction is correct, the result of the instruction following the branch is valid, and is written from the reorder buffer to the register or memory. . If the branch prediction is missed and a branch miss occurs, all instructions following the branch are invalidated and removed from the instruction storage unit and the reorder buffer.
  • the reorder buffer is managed by a reorder map assigned by the instruction issuing unit as a substitute for the actual register used in the instruction, and the result of the instruction executed in the order of the order is written to the actual register. It is held only while the instruction determination unit waits for the insertion. Therefore, when the branch prediction is incorrect, the valid bit on the map of the reorder buffer assigned to the instruction following the branch is turned off.
  • Figure 1 shows the processing when a branch error occurs in a conventional processor.
  • the branch prediction for the branch instruction B4 is If a branch miss 200 is detected due to a failure, as shown in Fig. 1 (B), if all instructions before branch instruction B4 are completed, after the resources including the reorder buffer have been updated, Cancel processing 202 is performed to cancel instructions 5 to 8 that have been executed by mistake, and then, as shown in Fig. 1 (C), the issuance of instructions that become instructions 50 and 51 in the correct direction is started, and the instruction sequence is changed. I want to run.
  • FIG. 3 is an explanatory diagram of a rename map used in a conventional processor.
  • Renameable registers REG0, REG1, REG2, REG3, and reorder buffers ROB0, ROB1, ROB2 used for the rename are shown.
  • ROB 3 will be described as an example.
  • the rename map 210 is a table for indexing the register number REG—AD212 as entry numbers 0 to 3. If the effective bit field AV field 216 is “1”, the register is reordered buffer.
  • Dress HOB Renamed in the reorder buffer HOB indicated by field 218 of AD.
  • register REG1 when register REG1 is renamed using reorder buffer ROB3 when an instruction is issued, write “1" in the valid flag AV field 2 16 of the rename map entry "1", and also write the reorder buffer address ROB_AD field. Write “3” in 2 1 4.
  • the valid flag AV field 216 is rewritten to “0” to release the Rio buffer ROB3.
  • it is desired to rename the same register REG 1 with another Rioder buffer ROB 0 before releasing the reorder buffer ROB 3 only the fields 2 14 of the rename buffer address HOB—AD in the rename map 210 are read, for example.
  • a third instruction control unit for starting a line As described above, the processor of the present invention updates the identifier (ID) assigned to an instruction after the occurrence of a branch error, and thus corrects the instruction without waiting for completion of all instructions before the branch instruction in which the branch error occurred.
  • a third instruction control unit that waits for all instructions before the old branch instruction to complete, cancels all subsequent instructions, and then starts issuing instructions in the correct direction. I do.
  • ID 0
  • the third instruction control unit that determines that the instruction is in the correct direction by detecting the first branch error, cancels the issued instruction, and then starts issuing instructions in the correct direction determined by detecting the second branch error.
  • the second branch miss is detected and the correct direction instruction is issued.
  • all instructions before the old branch instruction A fourth instruction control unit that waits, cancels the instruction on the second branch miss side, and then resumes issuing instructions in the correct direction. After starting instruction issuance in the correct direction for the first branch miss in this way, if a branch miss occurs for the old branch instruction before that, wait for completion of all instructions before the old branch instruction.
  • All the uncompleted instructions that were erroneously issued in the first branch prediction can be canceled to issue an instruction in the correct direction, then wait for the completion of the instruction before the old branch instruction, and then erroneously issued uncompleted After canceling this instruction, the processing performance can be improved by issuing an instruction in the correct direction, and the amount of hardware can be reduced because at least two identifiers need to be attached to the instruction.
  • the point that the second instruction control unit that issues an instruction in the correct direction following the instruction issued in error and attaches the second identifier (ID 1) to the instruction Same as the first mode, except that after the first branch miss is detected and the instruction is issued in the correct direction, the second branch is executed with a new branch instruction in the instruction issued as the correct direction.
  • a third instruction control unit is provided that waits for all instructions before the new branch instruction to complete, cancels all subsequent instructions, and then starts issuing instructions in the correct direction.
  • the third instruction control unit that cancels the instruction that was issued by mistake due to the old branch instruction, cancels the suppression, and starts issuing the instruction in the correct direction, and the correct direction by detecting the second branch error Wait for all instructions before the new branch instruction to complete after the instruction issuance of the first branch instruction has been completed, cancel the instruction on the second branch miss side, and then move in the correct direction due to the second branch miss.
  • a fourth instruction control unit for resuming instruction issuance After starting instruction issuance in the correct direction for the first branch error in this way, if a branch error occurs for a new branch instruction in the instruction sequence in the correct direction, all instructions before the new branch instruction are completed.
  • the processor further includes, in an entry referred to by a register number used by an instruction, an address storage area of a reorder buffer used for renaming, and instruction control.
  • a rename map having a plurality of valid flag areas corresponding to a plurality of attached identifiers, and a rename map referred to by a register number when a register used by an instruction is renamed using a reorder buffer.
  • the instruction that stores the address of the reorder buffer used for renaming in the entry turns on the valid flag corresponding to the identifier attached to the instruction, and is issued erroneously when a branch error is detected.
  • a renaming processing unit for turning on the valid flag of the rename map is provided so that an instruction in the correct direction issued upon detection of a branch error uses the rename information of an instruction issued erroneously. It is characterized by preventing.
  • a first form of the instruction control method of the processor according to the present invention is as follows.
  • a second form of the instruction control method for a processor according to the present invention is as follows.
  • a third mode of the processor instruction control method according to the present invention is as follows.
  • a third step of starting to issue an instruction in the correct direction determined by detecting the second branch error after canceling the issued instruction.
  • a fourth mode of the instruction control method for a processor according to the present invention is as follows.
  • the instruction before the new branch instruction is A third step of waiting for all to complete, canceling all subsequent instructions, and then starting to issue instructions in the correct direction;
  • a fourth step of resuming instruction issuing in the correct direction due to the second branch error
  • the instruction A rename map that has an address storage area for the Rioda buffer used for renaming and multiple valid flag areas corresponding to multiple identifiers attached by instruction control in the entry referenced by the register number used. If you set
  • the valid flag of the rename map corresponding to the identifier attached to the instruction issued erroneously is turned off, and the identifier corresponding to another identifier attached to the instruction issued in the correct direction is turned off.
  • the processor of the present invention can be applied similarly to the case of a branch miss, in addition to the speculative execution of an instruction by branch prediction, and also in the case of canceling an instruction speculatively executed without an exception by the occurrence of an exception.
  • the following first to fifth modes are also taken for the occurrence of an exception in response to the detection of
  • a first mode of a processor for processing an exception occurrence includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence; A second instruction control unit that issues an exception handling routine instruction with a second identifier attached after an instruction that is erroneously issued as no exception when an exception is detected, and an exception generating instruction And a third instruction control unit for canceling an instruction in which an exception has occurred and an instruction which has been issued as having no exception and starting to issue an instruction in an exception generation routine after all the previous instructions have been completed. I do.
  • a second mode of processing the exception occurrence of the processor includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of the exception; When the first exception is detected, the instruction of the exception handling routine is added with the second identifier following the instruction that was erroneously issued as no exception.
  • the second instruction control unit which issues a second exception, detects the occurrence of the first exception, and issues an exception processing routine instruction that is in the correct direction after the first exception has been issued In this case, the instruction that caused the exception and all subsequent instructions are canceled after all instructions before the old branch instruction are completed, and then the instruction issuance of the exception handling routine due to the second exception is started. And three instruction control units.
  • a third mode for processing an exception occurrence of the processor of the present invention includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception; A second instruction control unit for issuing an instruction of an exception handling routine with a second identifier added immediately after the instruction which is erroneously issued as no exception when the first exception is detected; After the first exception is detected and the instruction in the correct direction is issued and the second exception is detected in an earlier instruction, the first exception is detected.
  • a third instruction control unit that starts issuing the instruction of the exception handling routine that is oriented in the right direction by detecting the occurrence of the second exception, and that the second exception is detected Exception handling rules After the instruction of the previous instruction has been issued, wait for all instructions before the old branch instruction to complete, and then the instruction that caused the first exception and the instruction that was erroneously issued as having no exception due to this instruction And a fourth instruction control unit that resumes issuing an instruction of an exception handling routine upon occurrence of the second exception after canceling the second exception.
  • a fourth mode for processing an exception occurrence of the processor includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence; A second instruction control unit for issuing an instruction of an exception handling routine with a second identifier added immediately after the instruction which is erroneously issued as no exception when the first exception is detected; After the first exception has been detected and the instruction of the exception handling routine in the correct direction has started, the second exception occurrence is detected with a new instruction in the instruction issued by the exception handling routine. In this case, wait for all instructions before the new exception generation instruction to complete, cancel the exception generation instruction and all subsequent instructions, and then start issuing the exception handling routine for the first exception.
  • a third command control unit is provided.
  • a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence;
  • a second instruction control unit that issues an exception handling routine instruction with a second identifier attached after an instruction that is erroneously issued as having no exception when the first exception is detected; If the first exception occurrence is detected and the direction is correct, after the issuance of an instruction in the exception handling routine is started, if the second exception occurrence is detected in a new instruction in the instruction issued by the exception handling routine, the exception handling routine In the state where the issue of the first exception has been detected, wait until all instructions before the one that caused the first exception have been completed, and then erroneously determine that the old exception occurred and that no exception occurred due to this instruction.
  • the third instruction control unit, and the exception occurs when the second exception occurs After the instruction in the processing routine is issued, wait for all instructions before the new exception generation instruction to complete, and then cancel the second exception occurrence instruction and the instruction issued in the first exception generation exception handling routine.
  • a fourth instruction control unit that resumes issuing an instruction of an exception handling routine upon occurrence of a second exception.
  • the first mode of handling the exception occurrence of the instruction control method of the processor according to the present invention can be applied similarly to the case of a branch miss when canceling an instruction speculatively executed due to an exception.
  • the following first to fifth modes are also applied to the occurrence of an exception in response to the detection.
  • a first mode of an instruction control method for a processor according to the present invention for processing an exception occurrence includes issuing an instruction including an exception occurrence instruction with a first identifier attached thereto, and speculatively executing the instruction as no exception occurrence.
  • the second mode of the instruction control method for processing an exception occurrence of a processor according to the present invention is to issue an instruction including an exception occurrence instruction with a first identifier attached thereto, and to execute the instruction speculatively without exception occurrence.
  • a third form of the instruction control method for processing an exception occurrence in a processor according to the present invention includes the first step of issuing an instruction including an exception occurrence instruction with a first identifier attached thereto and executing the instruction speculatively without exception occurrence.
  • a fourth mode of an instruction control method for processing an exception occurrence of a processor includes the steps of: issuing an instruction including an exception occurrence instruction with a first identifier attached thereto; and speculatively executing the instruction with no exception occurrence.
  • the first exception When the first exception is detected, the first exception that issues the instruction of the exception handling routine with the second identifier attached after the instruction that was erroneously issued as no exception After the issuance of an instruction in the exception handling routine that has been detected and the direction is correct, if the second exception occurrence is detected in a new instruction among the instructions issued by the exception handling routine, all instructions before the new exception occurrence instruction A third step of waiting for completion, canceling the exception generating instruction and all subsequent instructions, and then starting issuing an instruction in an exception handling routine due to the first exception;
  • an instruction control method for processing an exception occurrence of a processor comprising the steps of: issuing an instruction including an exception occurrence instruction with a first identifier attached thereto; and speculatively executing the instruction without exception.
  • the exception handling routine is executed. Waiting for all instructions before the old exception generating instruction in which the first exception has been detected to be completed in the state where the instruction issue of A third step of canceling the issued instruction, releasing the suppression, and starting to issue an instruction of an exception handling routine that is oriented in a correct direction due to the occurrence of the second exception;
  • FIG. 1 is an explanatory diagram of an instruction control operation for a branch miss in a conventional processor
  • FIG. 2 is an explanatory diagram of an instruction control operation for a branch miss in a conventional processor in which a different ID is assigned to each branch instruction
  • Figure 3 is an illustration of the rename map used in the conventional processor
  • FIG. 4 is a block diagram of a functional configuration of a processor to which the present invention is applied;
  • FIG. 5 is an explanatory diagram of a rename map used in the processor of the present invention.
  • FIG. 6 is a circuit diagram comparing the hardware scale according to the number of IDs attached to an instruction with the present invention and the conventional example;
  • FIG. 7 is a block diagram of the first mode branch prediction instruction control unit according to the present invention.
  • FIG. 8 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 7;
  • FIG. 9 is a timing chart of the instruction control operation according to the embodiment of FIG. 7;
  • FIG. 10 is a flowchart of instruction control according to the embodiment of FIG. 7;
  • FIG. 11 is a block diagram of the second mode branch prediction instruction control unit according to the present invention
  • FIG. 12 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 11;
  • FIG. 13 is a timing chart of the instruction control operation according to the embodiment of FIG. 11;
  • FIG. 14 is a flowchart of instruction control according to the embodiment of FIG. 11;
  • FIG. 15 is a block diagram of a third mode branch prediction instruction control unit according to the present invention
  • FIG. 16 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 15;
  • FIG. 17 is a timing chart of the instruction control operation according to the embodiment of FIG. 15;
  • FIG. 18 is a flowchart of the instruction control according to the embodiment of FIG. 15;
  • FIG. 19 is a block diagram of a fourth mode branch prediction instruction control unit according to the present invention
  • FIG. 20 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 19;
  • FIG. 21 is a timing chart of the instruction control operation according to the embodiment of Fig. 19;
  • Fig. 22 is a flowchart of instruction control according to the embodiment of Fig. 19;
  • FIG. 23 is a block diagram of a fourth mode branch prediction instruction control unit according to the present invention;
  • FIG. 24 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 23;
  • FIG. 25 is a timing chart of the instruction control operation according to the embodiment of FIG. 23;
  • FIG. 26 is a flowchart of instruction control according to the embodiment of FIG. 24;
  • FIG. 27 is a flowchart of instruction control integrating the branch prediction instruction control of the first to fifth modes according to the present invention.
  • FIG. 28 is a block diagram of the first mode exception occurrence instruction control unit according to the present invention
  • FIG. 29 is an explanatory diagram of the instruction control operation according to the embodiment of FIG. 27;
  • FIG. 30 is a flowchart of instruction control according to the embodiment of FIG. 27;
  • FIG. 31 is a block diagram of a second mode exception occurrence instruction control unit according to the present invention
  • FIG. 32 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 31;
  • FIG. 33 is a flowchart of instruction control according to the embodiment of FIG. 31;
  • FIG. 34 is a block diagram of a third mode exception occurrence instruction control unit according to the present invention
  • FIG. 35 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 34;
  • FIG. 36 is a flowchart of instruction control according to the embodiment of FIG. 34;
  • FIG. 37 is a block diagram of a fourth mode exception occurrence instruction control unit according to the present invention
  • FIG. 38 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 37;
  • FIG. 39 is a flowchart of instruction control according to the embodiment of FIG. 37;
  • FIG. 40 is a block diagram of a fifth mode exception generating instruction control unit according to the present invention.
  • FIG. 41 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 40;
  • FIG. 42 is a flowchart of instruction control according to the embodiment of FIG. 41;
  • FIG. 43 is a flowchart of an instruction control in which the exception occurrence instruction control of the first to fifth modes according to the present invention is integrated;
  • FIG. 4 is a block diagram of a functional configuration of a processor to which the instruction control of the present invention is applied.
  • a processor 10 includes a branch prediction unit 12, an instruction issuing unit 14, an instruction storage unit 16, an instruction execution unit 18, an instruction determination unit 20, a register 22, and a renaming processing unit 24.
  • the instruction storage 16 contains a reservation station.
  • the instruction execution unit 18 includes a function processing unit such as a branch processing unit 28, an integer arithmetic unit 30, a floating point arithmetic unit 32, and a load Z store processing unit 34.
  • the renaming processing section 24 is provided with a reorder buffer 36 and a rename map 38.
  • Each processing unit of the processor 10 operates under the control of the instruction control unit 40.
  • the instruction control unit 40 includes a branch prediction instruction control unit 42 and an exception generation instruction control unit 44 which are unique to the present invention, in addition to the normal instruction control.
  • the processor 10 in the embodiment of FIG. 4 performs speculative execution of instructions by using so-called dynamic scheduling and branch prediction together.
  • the instruction issuing unit 14 fetches and decodes, for example, four instructions from the instruction cache.
  • the branch prediction unit 12 includes a branch history table for branch prediction, and performs speculative execution in the predicted branch direction.
  • the instruction issued from the instruction issuing unit 14 in order sends each instruction and its operand to the instruction storage unit 16 corresponding to the function processing unit in the instruction execution unit 18.
  • the instruction issuing unit 14 registers the instruction in the reorder buffer 36.
  • the instructions sent to the instruction storage unit 16 are executed out-of-order as soon as the corresponding processing unit provided in the instruction execution unit 18 becomes available, and the Rio buffer assigned to the instruction is executed.
  • the result is stored in
  • the instruction deciding unit 20 holds all uncompleted instructions in the reorder buffer 36, and upon receiving the result of the determination as to whether or not the branch is taken by the branch processing unit 28 of the instruction executing unit 18, it receives the result.
  • the instruction determination unit 20 determines the processing of the incomplete instruction based on the instruction.
  • the branch prediction instruction control unit 42 when a branch error is detected for an instruction speculatively executed by branch prediction, the branch prediction instruction control unit 42 according to the present invention provided in the instruction control unit 40 is erroneous due to the branch error. It efficiently processes instructions in the correct direction based on cancellation of instructions issued in the direction and detection of branch mistakes.
  • FIG. 5 is a diagram showing a rename machine provided in the renaming processing section 24 of the processor 10 of FIG. FIG.
  • the rename map 38 contains the reorder buffer address field (ROB—AD) 46 for each of the entries 0, 1, 2, and 3 shown on the right side specified by the register number 50 of the instruction.
  • the address of the Rio buffer to be renamed for example, "00" is written in the entry specified by the register number 50, for example, in the reorder buffer address field 46 of the entry "0" for the register number RG1. .
  • the flag of the corresponding field of the valid flag field 48-0 is set to “1”.
  • set the valid flag field 48-0 of ID 0, which is set to "1", to "0". Good.
  • FIG. 6 is a circuit diagram as hardware that generates a cancel signal for canceling the valid flag field to “0” according to the ID attached to the instruction for the rename map 38 in FIG.
  • the output line from the latch 60 is a 3-bit line, and the latch 60
  • a decoder 62 is provided to divide the 3-bit information in the ID field of the instruction stored in the decoder into eight types of IDs, and the output from the decoder 62 becomes eight signal lines.
  • FIG. 7 is a block diagram of a functional configuration of a first mode branch prediction instruction control unit 42-1 which is a first embodiment of the branch prediction instruction control unit 42 provided in the processor 10 of FIG.
  • the first mode branch prediction instruction control unit 42-1 includes a first instruction control unit 68, a second instruction control unit 70, and a third instruction control unit 72-1.
  • FIG. 8 shows an instruction control operation by the first mode branch prediction instruction control unit 421-1 of FIG. 7.
  • the control operation of FIG. 7 will be described below with reference to this.
  • the branch instruction sequence B4 instructions 5 to 11 are issued in the direction determined by the branch prediction and executed speculatively.
  • the second instruction control unit 70 in FIG. 7 detects the branch miss 80. At that point, as shown in Fig.
  • FIG. 9 is a timing chart corresponding to the instruction control operation of FIG. 8, in which instructions issued in the vertical direction are arranged, and the elapsed time is indicated in the horizontal direction.
  • ID 1 is assigned and instructions 50 and 51 in the correct direction are started to be issued. Thereafter, at time t3, after all instructions up to branch instruction B4 are completed at time t3, the erroneously issued instructions 5 to 11 are canceled.
  • FIG. 10 is a flow chart of the instruction control by the first mode branch prediction instruction control unit 421-1 in FIG.
  • an instruction is issued with the same ID in step s1, and if a branch error occurs in the branch instruction that has been issued and executed in step S2, another ID is issued in step S3. And issue an instruction in the correct direction.
  • step S4 it is monitored whether all instructions before the branch error have been completed. If all instructions have been completed, in step S5, a speculative failure instruction and a reorder buffer that are erroneously issued due to a branch error are included. After canceling the resource, instruction issuance in the correct direction is resumed in step S6.
  • FIG. 10 is a flow chart of the instruction control by the first mode branch prediction instruction control unit 421-1 in FIG.
  • FIG. 11 is a block diagram of a second mode branch prediction instruction control unit 42-2 as a second embodiment of the branch prediction instruction control unit provided in the processor 10 of FIG. 4, and a first instruction control unit. 68, a second command control unit 70 and a third command control unit 72-2.
  • the first instruction control unit 68 and the second instruction control unit 70 are the same as the first mode branch prediction instruction control unit 42--1 in FIG. In such a case, while an instruction in the correct direction is issued due to a branch miss, instruction control is performed when an older branch instruction causes a branch miss.
  • FIG. 12 is an explanatory diagram of the control operation by the second mode branch prediction instruction control unit 42-2 in FIG.
  • a branch miss 80 is detected along with the execution of the branch instruction B4 by the auto-order.
  • the control operations by the first command control unit 68 and the second command control unit 70 are the same as those already described in FIGS. 8 (A) and 8 (B).
  • FIG. 13 is a timing chart of the instruction control corresponding to FIG.
  • a branch miss 80 is detected at time t 1 along with execution of the branch instruction B 4
  • the timing after the completion of the branch instruction B2 at the time t4 becomes incorrect.
  • All of the issued instructions 3 to 51 have been cancelled, and at time t5, the issuance of instructions 60, 61,...
  • FIG. 14 is a flowchart of instruction control by the second mode branch prediction instruction control unit 42-2 in FIG.
  • step S1 an instruction is issued with the same ID, and in step S2, if a branch error occurs along with the execution of the branch instruction for which branch prediction is performed, another ID is assigned in step S3. And issue an instruction in the correct direction.
  • step S5 it is checked in step S5 whether all of the branch instructions before the old branch miss have been completed.
  • FIG. 15 is a block diagram of the third mode branch prediction instruction control unit 42-3 in the branch prediction instruction control unit 42 of FIG. 4.
  • the first instruction control unit 68 and the second instruction control unit 70 are the same as the first mode branch prediction instruction control unit 42-1 in FIG.
  • the third instruction control unit 723 and the fourth instruction control unit 744-3 are the same as the third instruction control unit 722 of the second mode branch prediction instruction control unit 422 of FIG. It is characterized by performing instruction control when a branch miss is detected for an old branch instruction after the first branch miss is detected.
  • FIGS. 16 (A), (B) and (C) are the same as those of the second mode branch prediction instruction control unit 42-2 in FIG. That is, as shown in Figure 16 (A), When a branch error 80 is detected, as shown in Figure 16 (B), instructions 50 and 51 in the correct direction follow instructions 5 to 11 issued incorrectly. Issue with a different ID-1. Then, as shown in Fig.
  • ID 0 and assets are canceled at the same time as the cancellation of the instruction.
  • the control operation of the third mode branch prediction instruction control unit 42-3 in FIG. 16 is compared with the control operation of the second mode branch prediction instruction control unit 42-2 in FIG.
  • the first branch miss 80 is detected following the old branch instruction's branch miss 82, but in the case of Fig. 16, the second branch miss as shown in Fig. 16 (D).
  • cancel processing 8 8 of instructions 50 and 51 issued in the correct direction due to the first detected branch error 80 is performed, and then, as shown in Figure 16 (E).
  • the instructions 60 and 61 in the correct direction are issued for the branch error 82, and the timing of issuing the instruction in the correct direction due to the second branch error 82 is faster than in Figure 12.
  • the performance of instruction processing can be improved by a corresponding amount.
  • FIG. 17 is a timing chart corresponding to the instruction control of FIG.
  • FIG. 18 is a flowchart of the instruction control of the third mode branch prediction instruction control unit 42-3 in FIG.
  • an instruction is issued with the same ID in step S1. If it is determined in step S2 that a branch error has occurred along with execution of a branch instruction among the instructions issued in step S2, step S3 is executed. Issue a command in the correct direction with a different ID. Subsequently, in step S4, it is checked whether a branch miss occurs by executing a branch instruction that is older than the branch instruction that caused the first branch miss, and if an old branch miss occurs, the first step in step S5 is performed. The resource including the speculative failure instruction and reorder buffer issued in the correct direction for the branch error of the above is canceled.
  • step S6 an instruction in the correct direction for the branch miss that occurred for the old branch instruction is issued with the same ID as in step S3.
  • step S7 it is determined whether or not all the instructions before the old branch miss have been completed.When all the instructions have been completed, in step S8, the speculatively failed instruction issued erroneously due to the branch miss and its You have to cancel resources.
  • FIG. 19 is a block diagram of a fourth mode branch prediction instruction control unit 42-4 which is the fourth embodiment of the branch prediction instruction control unit 42 provided in the processor 10 of FIG.
  • a first command control unit 68, a second command control unit 70, and a third command control unit 72-4 are provided, and a first command control unit 68 and a second command control unit 72 are provided.
  • the control unit 70 is the same as in the first embodiment in FIG.
  • the third instruction control unit 72-4 performs a new instruction in the instruction sequence issued in the correct direction for the branch error after the branch error is first detected in the speculative instruction execution by the branch prediction. It is characterized by performing instruction control when a second branch error is detected for a branch instruction.
  • FIG. 20 is an explanatory diagram of the control operation of the fourth mode branch prediction instruction control unit 42-4 in FIG.
  • the first instruction control unit 68 issues an instruction including a branch instruction B2, B4, and B8, and the branch instruction is executed speculatively by branch prediction.
  • Out-of-order execution of branch instruction B4 detects branch miss 80
  • the third instruction control unit 72-4 waits until all the instructions before the branch instruction B52 where the branch miss 92 has been detected are completed, and then proceeds.
  • Cancel processing 94 is performed to cancel all instructions 5 2 and 5 3, and then instructions 60 0, 61 1 and 62 2 in the correct direction due to branch mistake 90 as shown in Figure 20 (E). Start issuing.
  • FIG. 21 is a timing chart corresponding to the instruction control of FIG.
  • a branch miss 80 is detected along with the execution of the branch instruction B4 at time t1
  • instructions 50 to 53 in the correct direction are added.
  • Start issuing.
  • the branch instruction 92 where the branch miss 92 is detected at the time t4.
  • start issuing instructions 60, 61, and 62 in the correct direction due to branch miss 92.
  • FIG. 22 is a flowchart of the instruction control of the fourth mode branch prediction instruction control unit 42-4 in FIG.
  • step S 1 an instruction is issued with the same ID in step S 1, and if a branch error is detected in step S 2 along with execution of a branch instruction among the issued instructions, step S 3 A different ID is assigned to the instruction in the right direction, and the instruction in the correct direction is issued after the instruction issued incorrectly.
  • step S4 in response to the execution of a branch instruction in the instruction issued in the correct direction with respect to the branch error detected in step S2, if the occurrence of a branch error is determined, a new branch is determined in step S5. It is checked whether all instructions before the branch instruction for the miss have been completed. When it is determined that the instruction has been completed, all speculative failure instructions and resources that were erroneously issued due to the second branch error in step S6 are cancelled, and then instruction issuance in the correct direction is started in step S7.
  • FIG. 23 is a block diagram of a fifth mode branch prediction instruction control unit 42-5 serving as the fifth embodiment of the branch instruction prediction control unit 42 provided in the processor 10 of FIG. This W
  • a first instruction control unit 68, a second instruction control unit 70, a third instruction control unit 72-5, and a fourth instruction control unit 74-5 are provided.
  • the second command control unit 70 is the same as that of the first embodiment shown in FIG.
  • the third instruction control unit 72-5 and the fourth instruction control unit 74-5 detect the correct branch after first detecting the branch prediction as in the case of the third mode branch prediction instruction control unit 42-3 in FIG. It is characterized by performing instruction control when the second branch error is detected in the instruction issued in the direction.
  • FIG. 24 shows the control operation of the fifth mode branch prediction instruction control unit 42-5 in FIG. FIG.
  • 24 (A) shows a case where an instruction including the branch instructions B2, B4, and B8 issued by the first instruction control unit 68 detects a branch miss 80 along with the execution of the branch instruction B4.
  • FIG. 24 (C) if a branch miss 92 is detected upon execution of the branch instruction B52 in the instructions 50 to 53 issued in the correct direction, the third instruction control unit in FIG.
  • FIG. 24 Issuance timing is Figure 20 Therefore, the fifth embodiment of FIG. 24 can improve the instruction processing performance.
  • FIG. 25 is a timing chart corresponding to the instruction control of FIG.
  • the instructions 50 to 53 in the correct direction are issued at the time t2.
  • the branch instruction B4 before the first branch miss 80 is detected.
  • time t4 after all of these instructions have been completed instructions 5 to 11 that were issued by mistake in the branch prediction of branch instruction B4 are cancelled.
  • FIG. 26 is a flowchart of instruction control of the fifth branch prediction instruction control unit 42-5 in FIG.
  • step S1 an instruction is issued with the same ID, and in step S2, if it is determined that a branch error has occurred due to execution of a branch instruction, another ID is assigned in step S3.
  • the instruction in the right direction is issued after the instruction that was issued by mistake.
  • the processing of steps S1 to S3 is the processing of the first command control unit 68 and the second command control unit 70 in FIG.
  • step S5 it is determined in step S5 that all instructions before the old branch instruction are completed in a state where the issuance of instructions in the correct direction is suppressed. Proceeding to step S6, cancel the instruction erroneously issued by the old branch instruction, release the inhibition, and start issuing the instruction in the correct direction for the new branch miss. Subsequently, the fourth instruction control section 7 4-5 determines in step S7 whether or not the previous instruction of the new branch miss has been completed. In step S8, the instruction issued by mistake in step S8 is canceled, and then in step S9, the instruction is issued in the correct direction.
  • FIG. 27 is a flowchart of the branch prediction instruction control unit 42 of the processor 10 of FIG. 4, and the first to fifth mode branch prediction instruction controls described in FIGS. 7 to 25 are all integrated. It is a flowchart of branch prediction instruction control.
  • steps S1 to S3 are the processing of the first instruction control unit 68 and the second instruction control unit 70, and are executed while issuing the instruction with the same ID in step S1. If it is determined in step S2 that a branch error has occurred during execution of the branch instruction, an instruction in the correct direction is issued by attaching another ID to the instruction issued in error in step S3. Subsequently, it is checked in step S4 whether all instructions before the branch miss have been completed.
  • step S7 executes the first mode branch prediction instruction control.
  • the processing contents of the first mode branch prediction instruction control in step S7 are the processing in steps S5 and S6 in FIG. If all instructions before the branch miss have not been completed in step S4, the occurrence of the second branch miss is checked in step S5. In step 6, it is determined whether the second branch miss is older than the first branch miss. If there is an old branch miss, the flow advances to step S8 to perform the second mode or third mode branch prediction instruction control.
  • the second mode branch predictive instruction control performed in step S8 is the processing of steps S5 to S7 in FIG.
  • the branch prediction instruction control in the third mode in step S8 is the processing in steps S5 to S8 in FIG.
  • step S9 the control of the fourth or fifth mode branch prediction instruction is performed.
  • the branch prediction instruction control of the fourth mode in step S9 is the processing of steps S5 to S7 in FIG.
  • the control of the branch prediction instruction in the fifth mode in step S9 in FIG. 27 is the processing in steps S5 to S9 in FIG.
  • the present invention may perform the branch prediction instruction control in any one of the first to fifth modes, and may perform either the second mode or the third mode with respect to the first mode.
  • the control may be a combination of any one of the fourth mode and the fifth mode.
  • the exception occurrence instruction control unit 44 provided in the processor 10 of FIG. 4 will be described.
  • Each of the first mode, second mode, third mode, fourth mode, and fifth mode exception occurrence instruction control unit 441-1 to 44-4-5 is a specific example of the branch prediction instruction control unit 42 already described.
  • the first mode exception occurrence instruction control unit 4411 in FIG. 28 includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102-1.
  • the exception 105 occurs in the instruction 4
  • the cancellation processing 1 08 for canceling the speculation failure instruction 5 to the instruction 11 is executed. After that, issue of the exception handling routine is resumed.
  • FIG. 30 is a flowchart of the first mode exception occurrence instruction control.
  • the instruction is issued with the same ID in step S1, and if the execution of the instruction in step S2 determines that an exception has occurred, another instruction follows the speculative failure instruction in step S3. Issue an exception handling routine instruction with the ID of Next, if it is determined in step S4 that all the instructions before the occurrence of the exception have been completed, the speculative failure instruction and the resources issued in step S5 that have been issued as having no exception have been canceled. The instruction issuance of the exception handling routine is restarted.
  • FIG. 31 is a block diagram of the second mode exception occurrence instruction control unit 44, and includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102. — Equipped with 2.
  • FIG. 33 is a flowchart of the second mode exception generation instruction control.
  • step S1 an instruction is issued with the same ID, and if an exception occurs during execution of the instruction in step S2, it is erroneously issued as no exception in step S3. Issue an exception handling routine instruction with a different ID after the instruction that has been executed.
  • step S4 it is checked whether an exception has occurred for an instruction older than the first exception occurrence. If an exception occurs for the old instruction, step S5 has completed all instructions before the old exception occurrence instruction. Then, if completed, cancel all speculative failure instructions including the old instruction that caused an exception and its resources in step S6, and then execute the exception handling routine in step S7. Start issuing I do.
  • FIG. 34 is a block diagram of the third mode exception occurrence instruction control unit 44-13.
  • FIG. 35 is an explanatory diagram of the instruction control of the third mode exception occurrence instruction control unit 44-13 in FIG.
  • FIG. 36 is a flowchart of the third mode exception generation instruction control.
  • an instruction is issued with the same ID in step S1, and if an exception occurs in step S2 'in this instruction, an exception follows the instruction in step S3 in step S3.
  • step S4 it is determined whether an exception has occurred in an instruction older than the first exception occurrence, and if an old exception has occurred, in step S5, the speculation issued in the exception handling routine for the first exception occurrence is performed.
  • the instruction of the exception handling routine for the occurrence of the old exception is issued in step S6 with the same ID as in step S3.
  • FIG. 37 is a block diagram of the fourth mode exception occurrence instruction control unit 44 14, and includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102 4. Is provided.
  • FIG. 38 is an explanatory diagram of instruction control of the fourth mode exception occurrence instruction control unit 44-4. In Fig. 38, first, after issuing instructions 1 to 11 as shown in Fig.
  • FIG. 39 is a flowchart of the fourth mode exception generation instruction control.
  • an instruction is issued with the same ID in step S_1, and if it is determined that an exception occurs due to execution of the instruction in step S2, an exception occurs in step S3.
  • An instruction for the exception handling routine is issued with a different ID after the speculatively failed instruction that was erroneously issued as no exception occurred.
  • step S4 if it is determined that the second instruction is to be generated in accordance with the execution of one of the instructions issued by the exception handling routine, the process proceeds to step S5.
  • step S6 If it is determined that all the instructions have been completed, the process proceeds to step S6, and all subsequent speculative failure instructions including the instruction that caused the new exception and its resources are canceled, and then a new exception is generated in step S7. Resumes the issuance of an instruction in the exception handling routine when the error occurs.
  • FIG. 40 is a block diagram of the fifth mode exception occurrence instruction control unit 44-5.
  • a first instruction control unit 98, a second instruction control unit 100, a third instruction control unit 102-5, and a fourth instruction control unit 104-5 are provided.
  • FIG. 42 is a flowchart of the fifth mode exception generation instruction control.
  • step S1 an instruction is issued with the same ID, and in step S2, if an exception occurs due to execution of an instruction in the instruction, a speculative operation following the exception instruction is performed in step S3.
  • An exception handling routine instruction is issued with a different ID after the failed instruction.
  • step S4 if an exception occurs due to the execution of an instruction in the instruction issued by the exception handling routine, in step S5 an old exception is generated with instruction issuance suppressed by the exception handling routine. Judge whether all instructions before the completed instruction have been completed. When the completion of this instruction is determined, the exception generating instruction and the speculative failure instruction and its resources are canceled in step S6, and the exception handling accompanying the occurrence of the new exception is performed. Of the logical routine is started. Subsequently, it is checked in step S7 whether all instructions preceding the instruction that caused the new exception have been completed.If it is determined that the instruction has been completed, the instruction including the instruction that caused the new exception in step S8 follows. After canceling the speculative failure instruction and its resources, in step S9, the instruction issuing of the exception handling routine accompanying the occurrence of a new exception is restarted.
  • FIG. 43 shows the first mode, second mode, third mode, fourth mode, and fifth mode of the exception occurrence instruction control section 44 provided in the processor 10 of FIG.
  • This is a flowchart of the exception generation instruction control in which all the exception generation instruction controls are integrated.
  • step S1 an instruction is issued with the same ID, and when the occurrence of an exception is determined by executing the instruction in step S2, another ID is determined in step S3.
  • the instruction of the exception handling routine is issued following the speculative failure instruction.
  • step S4 it is checked whether or not all the instructions before the occurrence of the exception have been completed.
  • control of the first mode exception occurrence instruction is executed.
  • the exception generating instruction control in the first mode is the processing of steps S5 and S6 in FIG. If all instructions before the occurrence of the exception are not completed in step S4, the occurrence of the second exception is checked in step S5. If the second exception has occurred, the process proceeds to step S6, and it is checked whether the exception is older than the first exception. If an old exception has occurred, the process proceeds to step S8, and the second or third mode exception occurrence instruction control is performed.
  • the exception generation instruction control in the second mode is the processing of steps S5 to S7 in FIG.
  • the exception generation instruction control in the third mode is the processing of steps S5 to S8 in FIG.
  • step S6 determines whether an exception is newer than the first exception.
  • step S9 determines whether an exception is newer than the first exception.
  • the exception generation instruction control in the fourth mode is the processing of steps S5 to S7 in FIG.
  • the exception generation instruction control in the fifth mode is the processing of steps S5 to S9 in FIG.
  • the branch instruction is executed as a speculatively executed instruction, and the exception occurrence accompanying the instruction execution is taken as an example.
  • the present invention can be applied to other appropriate speculative instructions. it can.
  • the present invention is not limited to the above embodiment, and does not impair its object and advantages. Including any appropriate modifications. Further, the present invention is not limited by the numerical values shown in the above embodiments. Industrial applicability
  • the present invention at the time of speculative instruction execution based on branch prediction, if a branch miss is detected, the speculatively failed instruction that has been erroneously issued is canceled and correct.
  • the process of resuming instruction issue in the direction can be realized at high speed and with a small amount of hardware resources, and can greatly contribute to performance improvement particularly when the operating frequency of the processor is increased.
  • the speculatively failed instruction that was issued as having no exception can be canceled, and the instruction can be issued by the exception handling routine with a high speed and a small amount of hardware. In this case as well, it can greatly contribute to performance improvement in a processor whose operating frequency is increased.

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

A processor issues an instruction including a branching instruction having a first identifier (ID=0), and executes speculation by the branching estimation. When a branching mistake is detected, an instruction in the correct direction is issued with a second identifier (ID=1) after the mistakenly issued instruction. After all the instructions issued prior to the branching are completed the instruction which has been mistakenly issued by the branching estimation is canceled, and issuing of the instruction in the correct direction is resumed. Since the processor updates the identifier (ID) attached to the instruction after the branching mistake has occurred, it is possible to issue the instruction in the correct direction without waiting for completion of all the instructions issued before the branching instruction which has caused a mistake, there by improving the processing performance. At least two identifiers are sufficient to be attached to the instruction, which reduces the quantity of the hardware.

Description

明 細 書 プロセッサ及び命令制御方法 技術分野  Description Processor and instruction control method
本発明は、 分岐予測により命令を投機時に実行するプロセッサ及び命令制御方 法に関し、 特に、 分岐予測に失敗した場合の後続命令のキャンセルを効率良く行 うプロセッサ及び命令制御方法に関する。 背景技術  The present invention relates to a processor and an instruction control method for executing an instruction at speculation by branch prediction, and more particularly to a processor and an instruction control method for efficiently canceling a subsequent instruction when branch prediction fails. Background art
従来、 分岐予測と動的パイプライン処理を併 したプロセッサにあっては、 プ ログラム順序に依存したィンオーダーの命令発行部、 プログラムの順番に依存し ないアウトォブオーダ一の命令実行部、 更に、 プログラム順序に依存したインォ ーダ一の命令確定部 (コミット) を備え、 分岐予測に基づき命令を投機的に実行 している。 即ち、 命令発行部は、 インオーダーにより複数命令をフェッチしてデ コードし、 命令格納部の命令格納キューに命令操作 (オペコード) とオペランド を保持させる。 命令実行部は、 命令格納部に全てのオペランドが準備され、 演算 器が利用可能となり次第、 アウトォブオーダーで投機的に命令を実行し、 結果を 得る。 命令確定部は、 未完了命令をリオーダ一バッファに保持しており、 分岐予 測が正しかった場合には、 分岐の後続命令の結果は有効とされ、 リオーダーバッ ファからレジスタやメモリに書き込まれる。 分岐予測が外れて分岐ミスとなった 場合には、 分岐の後続命令は全て無効とされ、 命令格納部およびリオーダーバッ ファから除去される。 ここでリオーダーバッファは、 命令発行部が命令で使用す る実際のレジスタの代替用として割当てたリオーダーマップで管理しており、 ァ ゥトォブオーダ一で実行された命令の結果を実際のレジスタに書込むのを命令確 定部が待つ間だけ保持する。 このため分岐予測が外れた場合には、 分岐の後続命 令に割当てたリオーダーバッファのマツプ上の有効ビットをオフする。  Conventionally, in processors with both branch prediction and dynamic pipeline processing, an in-order instruction issuing unit that depends on the program order, an out-of-order instruction execution unit that does not depend on the program order, and a program order It has an instruction decision section (commit) of the dependent inorder, and executes instructions speculatively based on branch prediction. That is, the instruction issuing unit fetches and decodes a plurality of instructions in order, and causes the instruction storage queue of the instruction storage unit to hold instruction operations (opcodes) and operands. The instruction execution unit speculatively executes instructions in out-of-order order and obtains a result as soon as all operands are prepared in the instruction storage unit and the arithmetic unit becomes available. The instruction determinator holds the incomplete instruction in the reorder buffer, and if the branch prediction is correct, the result of the instruction following the branch is valid, and is written from the reorder buffer to the register or memory. . If the branch prediction is missed and a branch miss occurs, all instructions following the branch are invalidated and removed from the instruction storage unit and the reorder buffer. Here, the reorder buffer is managed by a reorder map assigned by the instruction issuing unit as a substitute for the actual register used in the instruction, and the result of the instruction executed in the order of the order is written to the actual register. It is held only while the instruction determination unit waits for the insertion. Therefore, when the branch prediction is incorrect, the valid bit on the map of the reorder buffer assigned to the instruction following the branch is turned off.
図 1は従来のプロセッ,サにおける分岐ミス発生時の処理である。 図 1 (A) の 分岐予測による命令の投機的実行において、 分岐命令 B 4についての分岐予測が 失敗して分岐ミス 200が検出されると、 図 1 (B) のように、 分岐命令 B 4以 前の命令が全て完了した場合、 リオーダーバッファを含む資源の更新が完了して から後に、 誤って実行してしまった命令 5〜命令 8をキャンセルするキャンセル 処理 202を行い、 その後に図 1 (C) のように、 正しい方向の命令 50, 51 となる命令の発行開始し、 命令列を実行するようにしている。 Figure 1 shows the processing when a branch error occurs in a conventional processor. In the speculative execution of the instruction by the branch prediction in FIG. 1A, the branch prediction for the branch instruction B4 is If a branch miss 200 is detected due to a failure, as shown in Fig. 1 (B), if all instructions before branch instruction B4 are completed, after the resources including the reorder buffer have been updated, Cancel processing 202 is performed to cancel instructions 5 to 8 that have been executed by mistake, and then, as shown in Fig. 1 (C), the issuance of instructions that become instructions 50 and 51 in the correct direction is started, and the instruction sequence is changed. I want to run.
しかしながら、 このような命令制御にあっては、 分岐ミスとなった分岐命令 B 4以前の命令が完了しないと、 正しい命令列の発行を再開できず、 命令実行の処 理性能が低いという問題がある。そこで、プロセッサの処理性能を向上するため、 図 2のような分岐ミス発生に対する命令制御を行っている。 この命令制御にあつ ては、 図 2 (A) のように、 分岐命令 B4, B 8を境に命令列に識別子としての IDを ID=0, I D= 1, I D= 2のように持たせ、 図 2 (B) で分岐命令 B 4 の分岐ミス 204を検出した場合には、 分岐命令 B 4の I D=0より新しい ID =1, I D= 2を持つ命令 5〜命令 11をキャンセルするキャンセル処理 206 を行い、 その後、 図 2 (C) のように、 正しい方向の命令 50, 51の発行を開 始して命令列を実行するようにしている。 このため分岐ミス 204が検出された 分岐命令 B 4以前の命令が全て完了していなくても、 正しい命令列の実行を再開 でき、 命令の処理性能を高めることができる。 しかし、 図 2の命令制御にあって は、 多数の分岐命令を同時に動作させようとすると、 分岐命令の数分の IDを持 つ必要があり、 ハードウェア量の増加と複雑化を招き、 プロセッサの高速化には 向かないという問題がある。 またリネームを行っているプロセッサの場合、 分岐 命令毎にリネーム情報のスナップショットをとる必要があつたため、 同様に、 ハ 一ドウエア量の増加と複雑化を招き、 プロセッサの高速化には向かないという問 題がある。 この問題を詳細に説明すると次のようになる。  However, such an instruction control has a problem in that, unless the instruction before the branch instruction B4, which resulted in a branch error, is not completed, the issue of a correct instruction sequence cannot be resumed, and the processing performance of instruction execution is low. is there. Therefore, in order to improve the processing performance of the processor, instruction control for occurrence of a branch error as shown in Fig. 2 is performed. In this instruction control, as shown in Fig. 2 (A), the instruction sequence is provided with IDs as identifiers, such as ID = 0, ID = 1, and ID = 2, at the boundary of the branch instructions B4 and B8. If the branch error 204 of the branch instruction B 4 is detected in FIG. 2B, the instructions 5 to 11 having ID = 1 and ID = 2 newer than ID = 0 of the branch instruction B 4 are canceled. The process 206 is performed, and then, as shown in FIG. 2 (C), the issuance of the instructions 50 and 51 in the correct direction is started, and the instruction sequence is executed. Therefore, even if all instructions before the branch instruction B4 in which the branch miss 204 is detected are not completed, execution of a correct instruction sequence can be resumed, and the processing performance of the instruction can be improved. However, in the instruction control of Fig. 2, if a large number of branch instructions are to be operated simultaneously, it is necessary to have IDs corresponding to the number of the branch instructions, resulting in an increase in hardware amount and complexity, resulting in a processor. There is a problem that it is not suitable for speeding up. Also, in the case of a processor that is renaming, it is necessary to take a snapshot of the rename information for each branch instruction, which similarly increases the amount of hardware and makes it more unsuitable for accelerating the processor. There's a problem. This problem is described in detail as follows.
図 3は、 従来のプロセッサで使用するリネームマップの説明図であり、 リネー ム可能なレジスタ REG0、 REG 1, REG2, REG3と、 そのリネームに使 用するリオーダーバッファ ROB 0, ROB 1, ROB 2, ROB 3が存在する場 合を例として説明する。 リネームマップ 210はレジスタ番号 REG— AD 21 2をエントリ番号 0〜 3として索引するテーブルであり、 有効ビットフィールド AVのフィールド 216が 「1」 であると、 そのレジスタがリオーダバッファァ ドレス HOB— ADのフィールド 2 1 4の示すリオーダバッファ HOBでリネーム中 であることを示す。 命令発行に伴い例えばレジスタ REG1 をリオーダバッファ ROB3を用いてリネームする場合には、 リネームマップのエントリ 「1」 の有効 クラグ AVのフィールド 2 1 6に 「1」 を書くと共に、 リオーダバッファアドレス ROB_ADのフィールド 2 1 4に 「3」 を書く。 また命令の完了によりリネームが 終了すると、 有効フラグ AVのフィールド 2 1 6を 「0」 に書き換えてリオ一ダバ ッファ R O B 3を開放する。更にリオーダバッファ ROB 3を開放する前に同一の レジスタ REG 1を別のリオ一ダバッファ R O B 0でリネームしたい場合には、リ ネームマツプ 2 1 0におけるリネームバッファアドレス HOB— ADのフィールド 2 1 4のみを例えば 「0」 に書き換え、 有効クラグ AVのフィールド 2 1 6はそ .のレジスタ REG 1を最後にリネームした命令が完了した時に 「0」 とする。 この ため図 2の命令制御のように、 分岐命令を境に命令列毎に識別子である IDを持 たせた場合には、 図 3のようなリネームマップ 2 1 0では、 分岐命令毎にリオ一 ダバッファアドレス: OB— ADのフィールド 2 1 4を持たなくてはならない上に、 中間状態の有効フラグ AVのフィールドも生成しなくてはならないという問題が あり、 このためハ一ドウエア量の増加と複雑化を招き、 プロセッサの高速化には 向かないという問題が生じている。 このような命令の投機的実行は、 命令実行で 例外が発生した場合にも、 例外なしとして発行してしまつた投機的に実行された 命令が無効となり、 分岐ミスの塲合と同様な問題がある。 FIG. 3 is an explanatory diagram of a rename map used in a conventional processor. Renameable registers REG0, REG1, REG2, REG3, and reorder buffers ROB0, ROB1, ROB2 used for the rename are shown. , ROB 3 will be described as an example. The rename map 210 is a table for indexing the register number REG—AD212 as entry numbers 0 to 3. If the effective bit field AV field 216 is “1”, the register is reordered buffer. Dress HOB—Renamed in the reorder buffer HOB indicated by field 218 of AD. For example, when register REG1 is renamed using reorder buffer ROB3 when an instruction is issued, write "1" in the valid flag AV field 2 16 of the rename map entry "1", and also write the reorder buffer address ROB_AD field. Write “3” in 2 1 4. When the instruction is completed and the rename is completed, the valid flag AV field 216 is rewritten to “0” to release the Rio buffer ROB3. Further, if it is desired to rename the same register REG 1 with another Rioder buffer ROB 0 before releasing the reorder buffer ROB 3, only the fields 2 14 of the rename buffer address HOB—AD in the rename map 210 are read, for example. Rewrite to “0” and set the valid flag AV field 2 16 to “0” when the instruction that last renamed the register REG 1 is completed. For this reason, as shown in the instruction control of Fig. 2, when an ID, which is an identifier, is assigned to each instruction sequence at the boundary of a branch instruction, the rename map 210 shown in Fig. Buffer address: OB—there is a need to have an AD field 211 and an intermediate state valid flag AV field, which increases the amount of hardware. The problem is that it is complicated and is not suitable for high-speed processors. In the speculative execution of such an instruction, even if an exception occurs during the execution of the instruction, the speculatively executed instruction that has been issued without exception becomes invalid, and the same problem as that of a branch error occurs. is there.
本発明は、 少ないハードウェア量で投機的実行を誤った時の命令発行再開を速 やかに可能とするプロセッサ及び命令制御方法を提供することを目的とする。 発明の開示  SUMMARY OF THE INVENTION It is an object of the present invention to provide a processor and an instruction control method capable of promptly resuming instruction issuance when a speculative execution is erroneous with a small amount of hardware. Disclosure of the invention
(分岐予測を制御するプロセッサ)  (Processor controlling branch prediction)
本発明のプロセッサの第 1形態にあっては、 第 1識別子 (I D = 0 ) を添付し て分岐命令を含む命令を発行し、分岐予測により投機実行する第 1命令制御部と、 分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて正しい方 向の命令を発行する第 2命令制御部と、 分岐以前の命令が全て完了した後に、 分 岐予測により誤って発行してしまった命令をキャンセルして正しい方向の命令発 行を開始する第 3命令制御部とを備えたことを特徴とする。 このように本発明の プロセッサは、 分岐ミスが発生してから命令に付ける識別子 (I D) を更新して いるため、 分岐ミスが発生した分岐命令以前の命令の全ての完了を待たずに正し い方向の命令が発行できることで、 命令の処理性能が向上し、 また命令に付ける 識別子は少なくとも 2つあれば良く、 処理性能の向上とハードウェア量の低減が 両立できる。 In the first embodiment of the processor according to the present invention, a first instruction control unit for issuing an instruction including a branch instruction with a first identifier (ID = 0) attached thereto and performing speculative execution by branch prediction, and When detected, the second instruction control unit issues an instruction in the correct direction following the instruction issued incorrectly, and incorrectly issues a branch prediction after all instructions before the branch are completed. Cancel the command that has been done and issue the command in the correct direction A third instruction control unit for starting a line. As described above, the processor of the present invention updates the identifier (ID) assigned to an instruction after the occurrence of a branch error, and thus corrects the instruction without waiting for completion of all instructions before the branch instruction in which the branch error occurred. By being able to issue instructions in different directions, the processing performance of the instructions is improved, and at least two identifiers need to be attached to the instructions, so that both the improvement in processing performance and the reduction in the amount of hardware can be achieved.
本発明のプロセッサの第 2形態にあっては、 第 1識別子 (I D = 0 ) を添付し て分岐命令を含む命令を発行し、分岐予測により投機実行する第 1命令制御部と、 第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて正 しい方向の命令に第 2識別子 (I D = 1 ) を添付して発行する第 2命令制御部と を備えた点は第 1形態と同じであるが、 更に、 第 1の分岐ミスが検出されて正し い方向の命令が発行された後に、 それ以前の古い分岐命令について第 2の分岐ミ スを検出した場合、 古い分岐命令以前の命令が全て完了するのを待って、 後続す る全ての命令をキャンセルしてから、 正しい方向の命令発行を開始する第 3命令 制御部とを備えたことを特徴とする。 このように最初の分岐ミスに対し正しい方 向に命令発行を開始した後に、 それ以前の古い分岐命令について分岐ミスが発生 した場合に、 古い分岐命令以前の命令の全ての完了を待って未完了の命令を全て キャンセルしてから正しい方向の命令を発行でき、 この場合も、 命令に付ける識 別子は少なくとも 2つあれば良く、 ハードウェア量を低減できる。  In a second embodiment of the processor of the present invention, a first instruction control unit for issuing an instruction including a branch instruction with a first identifier (ID = 0) attached thereto and performing speculative execution by branch prediction, A second instruction control unit is provided that, when a branch error is detected, attaches a second identifier (ID = 1) to the instruction in the correct direction following the instruction issued in error and issues it. Same as the first mode, except that after the first branch miss is detected and the instruction in the correct direction is issued, the second branch miss is detected for the old branch instruction before that. A third instruction control unit that waits for all instructions before the old branch instruction to complete, cancels all subsequent instructions, and then starts issuing instructions in the correct direction. I do. After starting instruction issuance in the right direction for the first branch error in this way, if a branch error occurs for the old branch instruction before that, it waits for completion of all instructions before the old branch instruction and is not completed Can be issued after canceling all instructions, and in this case also, at least two identifiers need to be attached to the instructions, and the amount of hardware can be reduced.
本発明のプロセッサの第 3形態にあっては、 第 1識別子 (I D = 0 ) を添付し て分岐命令を含む命令を発行し、分岐予測により投機実行する第 1命令制御部と、 第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて正 しい方向の命令を第 2識別子 (I D = 1 ) を添付して発行する第 2命令制御部と を備える点は、 第 1形態と同じであるが、 これに加え、 第 1の分岐ミスが検出さ れて正しい方向の命令が発行された後に、 それ以前の古い分岐命令において第 2 の分岐ミスを検出した場合、 第 1の分岐ミスの検出により正しい方向と判断して 発行した命令をキャンセルした後に、 第 2の分岐ミスの検出により判断した正し い方向の命令発行を開始する第 3命令制御部と、 第 2の分岐ミスが検出されて正 しい方向の命令が発行された後に、 古い分岐命令以前の命令が全て完了するのを 待って、 第 2の分岐ミス側の命令をキャンセルしてから、 正しい方向の命令発行 を再開する第 4命令制御部とを備えたことを特徴とする。 このように最初の分岐 ミスに対し正しい方向に命令発行を開始した後に、 それ以前の古い分岐命令につ いて分岐ミスが発生した場合に、 古い分岐命令以前の命令の全ての完了を待つこ となく、 最初の分岐予測で誤って発行した未完了の命令を全てキャンセルして正 しい方向の命令を発行でき、その後に、古い分岐命令以前の命令の完了を待って、 誤って発行した未完了の命令をキャンセルしてから、 正しい方向の命令を発行し て処理性能を向上でき、 また命令に付ける識別子は少なくとも 2つあれば良いか らハードウエア量も低減できる。 According to a third embodiment of the processor of the present invention, a first instruction control unit for issuing an instruction including a branch instruction with a first identifier (ID = 0) attached thereto and performing speculative execution by branch prediction, A second instruction control unit that issues an instruction in the correct direction with a second identifier (ID = 1) attached after an instruction that has been issued incorrectly when a branch miss is detected. Is the same as the first form, except that after the first branch miss is detected and an instruction in the correct direction is issued, a second branch miss is detected in an older branch instruction before that. In this case, the third instruction control unit that determines that the instruction is in the correct direction by detecting the first branch error, cancels the issued instruction, and then starts issuing instructions in the correct direction determined by detecting the second branch error. The second branch miss is detected and the correct direction instruction is issued. After completion, all instructions before the old branch instruction A fourth instruction control unit that waits, cancels the instruction on the second branch miss side, and then resumes issuing instructions in the correct direction. After starting instruction issuance in the correct direction for the first branch miss in this way, if a branch miss occurs for the old branch instruction before that, wait for completion of all instructions before the old branch instruction. All the uncompleted instructions that were erroneously issued in the first branch prediction can be canceled to issue an instruction in the correct direction, then wait for the completion of the instruction before the old branch instruction, and then erroneously issued uncompleted After canceling this instruction, the processing performance can be improved by issuing an instruction in the correct direction, and the amount of hardware can be reduced because at least two identifiers need to be attached to the instruction.
本発明によるプロセッサの第 4形態は、 第 1識別子 (I D = 0 ) を添付して分 岐命令を含む命令を発行し、 分岐予測により投機実行する第 1命令制御部と、 第 1の分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて正し い方向の命令を第 2識別子 (I D = 1 ) を添付して発行する第 2命令制御部とを 備える点は第 1形態と同じであるが、 これに加えて、 第 1の分岐ミスが検出され て正しい方向の命令発行を開始した後に、 正しい方向として発行した命令内の新 しい分岐命令で第 2の分岐ミスを検出した場合、 新しい分岐命令以前の命令が全 て完了するのを待って、 後続する全ての命令をキャンセルしてから、 正しい方向 の命令発行を開始する第 3命令制御部を備えたことを特徴とする。 このように最 初の分岐ミスに対し正しい方向に命令発行を開始した後に、 正しい命令列内の新 たな分岐命令について分岐ミスが発生した場合に、 新しい分岐命令以前の命令の 全ての完了を待って未完了の命令を全てキャンセルして正しい方向の命令を発行 でき、 この場合も、 命令に付ける識別子は少なくとも 2つあれば良く、 ハードウ エア量を低減できる。  A fourth embodiment of the processor according to the present invention includes a first instruction control unit that issues an instruction including a branch instruction with a first identifier (ID = 0) attached thereto and performs speculative execution by branch prediction, and a first branch error. The point that the second instruction control unit that issues an instruction in the correct direction following the instruction issued in error and attaches the second identifier (ID = 1) to the instruction Same as the first mode, except that after the first branch miss is detected and the instruction is issued in the correct direction, the second branch is executed with a new branch instruction in the instruction issued as the correct direction. When a miss is detected, a third instruction control unit is provided that waits for all instructions before the new branch instruction to complete, cancels all subsequent instructions, and then starts issuing instructions in the correct direction. It is characterized by. In this way, after the instruction is issued in the correct direction for the first branch error, if a branch error occurs for a new branch instruction in the correct instruction sequence, the completion of all instructions before the new branch instruction is completed. It is possible to wait and cancel all unfinished instructions and issue instructions in the correct direction. In this case as well, only two identifiers need to be attached to the instructions, and the amount of hardware can be reduced.
本発明によるプロセッサの第 5形態は、 第 1識別子 (I D = 0 ) を添付して分 岐命令を含む命令を発行し、 分岐予測により投機実行する第 1命令制御部と、 第 1の分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて正し い方向の命令を第 2識別子 '( I D = 1 ) を添付して発行する第 2命令制御部とを 備えた点は第 1形態と同じであるが、 これに加えて、 第 1の分岐ミスが検出され て正しい方向の命令発行を開始した後に、 正しい方向として発行した命令内の新 しい分岐命令で第 2の分岐ミスを検出した場合、 正しい方向の命令発行を抑止し た状態で、 第 1の分岐ミスが検出された古い方の分岐命令以前の命令が全て完了 するのを待つて、 古い分岐命令により誤つて発行してしまつた命令をキヤンセル してから、 抑止を解除して正しい方向の命令発行を開始する第 3命令制御部と、 第 2の分岐ミスの検出による正しい方向の命令発行が開始された後に、 新しい分 岐命令以前の命令が全て完了するのを待って、 第 2の分岐ミス側の命令をキヤン セルしてから、 第 2の分岐ミスのよる正しい方向の命令発行を再開する第 4命令 制御部とを備えたことを特徴とする。 このように最初の分岐ミスに対し正しい方 向に命令発行を開始した後に、 正しい方向の命令列内の新しい分岐命令につき分 岐ミスが発生した場合に、 新しい分岐命令以前の命令の全ての完了を待つことな く、 最初の分岐ミスで誤って発行した未完了の命令を全てキャンセルして正しい 方向の命令を発行でき、 その後に、 新しい分岐命令以前の命令の完了を待って誤 つて発行した未完了の命令をキャンセルして正しい方向の命令を発行することで 処理性能を向上でき、 また命令に付ける識別子は少なくとも 2つあれば良いから ハードウェア量も低減できる。 A fifth embodiment of the processor according to the present invention includes a first instruction control unit that issues an instruction including a branch instruction with a first identifier (ID = 0) attached thereto and performs speculative execution by branch prediction, and a first branch error. And a second instruction control unit that issues an instruction in the correct direction following the instruction issued erroneously with the second identifier '(ID = 1) attached when detecting This is the same as in the first mode, but in addition to this, after the first branch error is detected and the instruction in the correct direction is started, the new If the second branch miss is detected with a new branch instruction, wait for all instructions before the old branch instruction where the first branch miss is detected to complete, while the instruction issue in the correct direction is suppressed. The third instruction control unit that cancels the instruction that was issued by mistake due to the old branch instruction, cancels the suppression, and starts issuing the instruction in the correct direction, and the correct direction by detecting the second branch error Wait for all instructions before the new branch instruction to complete after the instruction issuance of the first branch instruction has been completed, cancel the instruction on the second branch miss side, and then move in the correct direction due to the second branch miss. A fourth instruction control unit for resuming instruction issuance. After starting instruction issuance in the correct direction for the first branch error in this way, if a branch error occurs for a new branch instruction in the instruction sequence in the correct direction, all instructions before the new branch instruction are completed. Without waiting for the first branch, all uncompleted instructions that were erroneously issued due to the first branch error can be canceled and the instruction in the correct direction can be issued. By canceling unfinished instructions and issuing instructions in the correct direction, processing performance can be improved, and the amount of hardware can be reduced because at least two identifiers are required for instructions.
このような第 1形態乃至第 5形態のプロセッサは、 更に、 命令が使用するレジ ス夕の番号で参照されるェントリに、 リネームに使用するリォ一ダ一バッファの ァドレス格納領域と、 命令制御で添付する複数の識別子に対応して複数の有効フ ラグ領域を備えたリネームマツプと、 命令が使用するレジスタをリオーダーパッ ファを用いてリネームする際に、 レジスタの番号で参照されるリネームマップの エントリに、 リネームに使用するリオーダーバッファのアドレスを格納すると共 に、 命令に添付される識別子に対応した有効フラグをオンし、 分岐ミスを検出し た際に、 誤って発行されてしまった命令に添付した識別子に対応したリネームマ ップの有効フラグをオフし、 正しい方向に発行した命令に添付される別の識別子 に対応したリネームマップの有効フラグをオンするリネーミング処理部とを設け、 これによつて分岐ミスの検出により発行される正しい方向の命令が、 誤って発行 されてしまった命令によるリネーム情報を使用することを防ぐことを特徴とする。  The processor according to the first to fifth embodiments further includes, in an entry referred to by a register number used by an instruction, an address storage area of a reorder buffer used for renaming, and instruction control. A rename map having a plurality of valid flag areas corresponding to a plurality of attached identifiers, and a rename map referred to by a register number when a register used by an instruction is renamed using a reorder buffer. The instruction that stores the address of the reorder buffer used for renaming in the entry, turns on the valid flag corresponding to the identifier attached to the instruction, and is issued erroneously when a branch error is detected. Turn off the valid flag of the rename map corresponding to the identifier attached to the instruction, and correspond to another identifier attached to the instruction issued in the correct direction. A renaming processing unit for turning on the valid flag of the rename map is provided so that an instruction in the correct direction issued upon detection of a branch error uses the rename information of an instruction issued erroneously. It is characterized by preventing.
(分岐予測の命令制御方法)  (Instruction control method of branch prediction)
本発明によるプロセッサの命令制御方法の第 1形態は、 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実行 する第 1ステップと、 A first form of the instruction control method of the processor according to the present invention is as follows. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて正しい 方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, when a branch miss is detected, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
分岐以前の命令が全て完了した後に、 分岐予測により誤って発行してしまった 命令をキャンセルして正しい方向の命令発行を開始する第 3ステツプと、 を備えたことを特徴とする。  After all instructions before the branch are completed, a third step of canceling an instruction issued erroneously by branch prediction and starting instruction issuance in the correct direction is provided.
本発明によるプロセッサの命令制御方法の第 2形態は、  A second form of the instruction control method for a processor according to the present invention is as follows.
第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実行 する第 1ステップと、  A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch miss, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以前の 古い分岐命令で第 2の分岐ミスを検出した場合、 古い分岐命令以前の命令が全て 完了するのを待って、 後続する全ての命令をキャンセルしてから、 正しい方向の 命令発行を開始する第 3ステップと、  After the first branch miss is detected and an instruction in the correct direction is issued, if the old branch instruction detects a second branch miss, wait until all instructions before the old branch instruction have completed. , A third step of canceling all subsequent instructions and then starting to issue instructions in the correct direction;
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッサの命令制御方法の第 3形態は、  A third mode of the processor instruction control method according to the present invention is as follows.
第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実行 する第 1ステップと、  A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch miss, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以前の 古い分岐命令で第 2の分岐ミスを検出した場合、 第 1の分岐ミスの検出により正 しい方向と判断して発行した命令をキャンセルした後に、 第 2の分岐ミスの検出 により判断した正しい方向の命令発行を開始する第 3ステップと、  After the first branch miss is detected and an instruction in the correct direction is issued, if a second branch miss is detected in an older branch instruction before that, the correct direction is determined by detecting the first branch miss. A third step of starting to issue an instruction in the correct direction determined by detecting the second branch error after canceling the issued instruction.
第 2の分岐ミスが検出されて正しい方向の命令が発行された後に、 古い分岐命 令以前の命令が全て完了するのを待って、 第 2の分岐予測により誤って発行して しまった命令をキャンセルしてから、 正しい方向の命令発行を再開する第 4ステ ップと、 After the second branch miss is detected and the instruction in the correct direction is issued, wait for all instructions before the old branch instruction to complete, and then execute the instruction that was erroneously issued by the second branch prediction. Cancels and then resumes issuing instructions in the correct direction. And
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッサの命令制御方法の第 4形態は、  A fourth mode of the instruction control method for a processor according to the present invention is as follows.
第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実行 する第 1ステップと、  A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに翁けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch error, issuing an instruction in the correct direction attached to the second identifier after the erroneously issued instruction;
第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正しい方 向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 新 しい分岐命令以前の命令が全て完了するのを待って後続する全ての命令をキャン セルしてから、 正しい方向の命令発行を開始する第 3ステップと、  After the first branch miss is detected and the instruction in the correct direction is started, if the second branch miss is detected in a new branch instruction in the instruction issued as the correct direction, the instruction before the new branch instruction is A third step of waiting for all to complete, canceling all subsequent instructions, and then starting to issue instructions in the correct direction;
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッサの命令制御方法の 4形態は、  Four modes of the instruction control method of the processor according to the present invention are as follows.
第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実行 する第 1ステップと、  A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch miss, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正しい方 向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 正 しい方向の命令発行を抑止した状態で、 第 1分岐ミスが検出された古い方の分岐 命令以前の命令が全て完了するのを待つて、 古い分岐命令により誤つて発行して しまった命令をキャンセルしてから、 抑止を解除して正しい方向の命令発行を開 始する第 3ステップと、  After the first branch miss is detected and instruction is issued in the correct direction, if the second branch miss is detected in a new branch instruction in the instruction issued as the correct direction, instruction issuance in the correct direction is suppressed. Waits for all instructions before the old branch instruction where the first branch miss is detected to be completed, cancels the instruction that was issued incorrectly by the old branch instruction, and releases the suppression. 3rd step to start issuing instructions in the correct direction
第 2の分岐ミスの検出による正しい方向の命令発行が開始された後に、 新しい 分岐命令以前の命令が全て完了するのを待って、 第 1の分岐予測の検出により発 行された命令をキャンセルしてから、 前記第 2の分岐ミスによる正しい方向の命 令発行を再開する第 4ステップと、  After the issuance of instructions in the correct direction due to the detection of the second branch error, wait for all instructions before the new branch instruction to complete, and then cancel the instruction issued by the detection of the first branch prediction. A fourth step of resuming instruction issuing in the correct direction due to the second branch error;
を備えたことを特徴とする。 It is characterized by having.
更に第 1乃至第 5形態におけるプロセッサの命令制御方法にあっては、 命令が 使用するレジス夕の番号で参照されるェントリに、 リネームに使用するリオ一ダ バッファのアドレス格納領域と、 命令制御で添付する複数の識別子に対応して複 数の有効フラグ領域を備えたリネームマップを設けた場合、 Further, in the instruction control method of the processor according to the first to fifth embodiments, the instruction A rename map that has an address storage area for the Rioda buffer used for renaming and multiple valid flag areas corresponding to multiple identifiers attached by instruction control in the entry referenced by the register number used. If you set
命令が使用するレジスタをリオーダバッファを用いてリネームする際に、 レジ ス夕の番号で参照される前記リネームマップのエントリに、 リネームに使用する 前記リォ一ダバッファのアドレスを格納すると共に、 命令に添付される識別子に 対応した有効フラグをオンし、  When renaming a register used by an instruction using a reorder buffer, store the address of the reorder buffer used for renaming in the entry of the rename map referenced by the register number and attach it to the instruction. Turn on the valid flag corresponding to the identifier
分岐ミスを検出した際に、 誤って発行されてしまった命令に添付した識別子に 対応した前記リネームマップの有効フラグをオフし、 正しい方向に発行した命令 に添付される別の識別子に対応した前記リネームマップの有効フラグをオンする ことにより、  When a branch mistake is detected, the valid flag of the rename map corresponding to the identifier attached to the instruction issued erroneously is turned off, and the identifier corresponding to another identifier attached to the instruction issued in the correct direction is turned off. By turning on the valid flag of the rename map,
分岐ミスの検出により発行される正しい方向の命令が誤って発行されてしまつ た命令によるリネーム情報を使用することを防ぐことを特徴とする。  It is characterized in that an instruction in the correct direction issued by detection of a branch miss is prevented from using rename information by an instruction issued incorrectly.
(例外発生を処理するプロセッサ)  (Processor that handles exceptions)
本発明のプロセッサは、 分岐予測による命令の投機的実行以外に、 例外発生な しとして投機的に実行した命令を例外発生でキャンセルする場合にも、 分岐ミス の場合と同様に適用でき、 分岐ミスの検出に対応して例外発生についても次の第 1形態〜第 5形態をとる。  The processor of the present invention can be applied similarly to the case of a branch miss, in addition to the speculative execution of an instruction by branch prediction, and also in the case of canceling an instruction speculatively executed without an exception by the occurrence of an exception. The following first to fifth modes are also taken for the occurrence of an exception in response to the detection of
本発明の例外発生を処理するプロセッサの第 1形態は、 第 1識別子を添付して 例外発生命令を含む命令を発行し、 例外発生なしとして投機的に命令を実行する 第 1命令制御部と、 例外発生を検出した際に、 例外発生なしとして誤って発行し てしまった命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して 発行する第 2命令制御部と、 例外発生命令以前の命令が全て完了した後に、 例外 発生命令及び例外発生なしとして発行してしまった命令をキャンセルして例外発 生ルーチンの命令発行を開始する第 3命令制御部とを備えたことを特徴とする。 本発明のプロセッサの例外発生を処理する第 2形態は、 第 1識別子を添付して 例外発生命令を含む命令を発行し、 例外発生なしとして投機的に命令を実行する 第 1命令制御部と、 第 1の例外発生を検出した際に、 例外発生なしとして誤って 発行してしまつた命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添 付して発行する第 2命令制御部と、 第 1の例外発生が検出されて正しい方向とな る例外処理ルーチンの命令が発行された後に、 それ以前の古い命令で第 2の例外 発生を検出した場合、 古い分岐命令以前の命令が全て完了するのを待って例外発 生命令及び後続する全ての命令をキャンセルしてから、 第 2の例外発生による例 外処理ルーチンの命令発行を開始する第 3命令制御部とを備えたことを特徴とす る。 A first mode of a processor for processing an exception occurrence according to the present invention includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence; A second instruction control unit that issues an exception handling routine instruction with a second identifier attached after an instruction that is erroneously issued as no exception when an exception is detected, and an exception generating instruction And a third instruction control unit for canceling an instruction in which an exception has occurred and an instruction which has been issued as having no exception and starting to issue an instruction in an exception generation routine after all the previous instructions have been completed. I do. A second mode of processing the exception occurrence of the processor according to the present invention includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of the exception; When the first exception is detected, the instruction of the exception handling routine is added with the second identifier following the instruction that was erroneously issued as no exception. The second instruction control unit, which issues a second exception, detects the occurrence of the first exception, and issues an exception processing routine instruction that is in the correct direction after the first exception has been issued In this case, the instruction that caused the exception and all subsequent instructions are canceled after all instructions before the old branch instruction are completed, and then the instruction issuance of the exception handling routine due to the second exception is started. And three instruction control units.
本発明のプロセッサの例外発生を処理する第 3形態は、 第 1識別子を添付して 例外発生命令を含む命令を発行し、 例外発生なしとして投機的に命令を実行する 第 1命令制御部と、 第 1の例外発生を検出した際に、 例外発生なしとして誤って 発行してしまつた命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添 付して発行する第 2命令制御部と、 第 1の例外発生が検出されて正しい方向とな る例外処理ルーチンの命令が発行された後に、 それ以前の古い命令で第 2の例外 発生を検出した場合、 第 1の例外発生の検出により発行した例外処理ルーチンの 命令をキヤンセルした後に、 第 2の例外発生の検出により正しい方向となる例外 処理ルーチンの命令発行を開始する第 3命令制御部と、 第 2の例外発生が検出さ れて例外処理ルーチンの命令が発行された後に、 古い分岐命令以前の命令が全て 完了するのを待って、 第 1の例外発生を起こした命令及びこの命令により例外発 生なしとして誤って発行してしまった命令をキャンセルしてから、 第 2の例外発 生による例外処理ルーチンの命令発行を再開する第 4命令制御部とを備えたこと を特徴とする。  A third mode for processing an exception occurrence of the processor of the present invention includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception; A second instruction control unit for issuing an instruction of an exception handling routine with a second identifier added immediately after the instruction which is erroneously issued as no exception when the first exception is detected; After the first exception is detected and the instruction in the correct direction is issued and the second exception is detected in an earlier instruction, the first exception is detected. After canceling the issued instruction of the exception handling routine, a third instruction control unit that starts issuing the instruction of the exception handling routine that is oriented in the right direction by detecting the occurrence of the second exception, and that the second exception is detected Exception handling rules After the instruction of the previous instruction has been issued, wait for all instructions before the old branch instruction to complete, and then the instruction that caused the first exception and the instruction that was erroneously issued as having no exception due to this instruction And a fourth instruction control unit that resumes issuing an instruction of an exception handling routine upon occurrence of the second exception after canceling the second exception.
本発明のプロセッサの例外発生を処理する第 4形態は、 第 1識別子を添付して 例外発生命令を含む命令を発行し、 例外発生なしとして投機的に命令を実行する 第 1命令制御部と、 第 1の例外発生を検出した際に、 例外発生なしとして誤って 発行してしまつた命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添 付して発行する第 2命令制御部と、 第 1の例外発生が検出されて正しい方向とな る例外処理ル一チンの命令発行を開始した後に、 例外処理ル一チンにより発行し た命令内の新しい命令で第 2の例外発生を検出した場合、 新しい例外発生命令以 前の命令が全て完了するのを待って例外発生命令及び後続する全ての命令をキヤ ンセルしてから、 第 1の例外発生による例外処理ルーチンの命令発行を開始する 第 3命令制御部とを備えたことを特徴とする。 A fourth mode for processing an exception occurrence of the processor according to the present invention includes: a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence; A second instruction control unit for issuing an instruction of an exception handling routine with a second identifier added immediately after the instruction which is erroneously issued as no exception when the first exception is detected; After the first exception has been detected and the instruction of the exception handling routine in the correct direction has started, the second exception occurrence is detected with a new instruction in the instruction issued by the exception handling routine. In this case, wait for all instructions before the new exception generation instruction to complete, cancel the exception generation instruction and all subsequent instructions, and then start issuing the exception handling routine for the first exception. A third command control unit.
本発明のプロセッサ例外発生を処理する第 5形態は、 第 1識別子を添付して例 外発生命令を含む命令を発行し、 例外発生なしとして投機的に命令を実行する第 1命令制御部と、 第 1の例外発生を検出した際に、 例外発生なしとして誤って発 行してしまった命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付 して発行する第 2命令制御部と、 第 1の例外発生が検出されて正しい方向となる 例外処理ルーチンの命令発行を開始した後に、 例外処理ルーチンにより発行した 命令内の新しい命令で第 2の例外発生を検出した場合、 例外処理ルーチンの命令 発行を抑止した状態で、 第 1例外発生が検出されたせい方の例外発生命令以前の 命令が全て完了するのを待って、 古い例外発生命令及びこの命令により例外発生 なしとして誤って発行してしまった命令をキャンセルしてから、 抑止を解除して 第 2の例外発生により正しい方向となる例外処理ルーチンの命令発行を開始する 第 3命令制御部と、 第 2の例外発生により例外処理ルーチンの命令が発行された 後に、 新しい例外発生命令以前の命令が全て完了するのを待って第 2の例外発生 の命令及び第 1の例外発生による例外処理ルーチンで発行された命令をキャンセ ルしてから、 第 2の例外発生による例外処理ルーチンの命令発行を再開する第 4 命令制御部とを備えたことを特徴とする。  According to a fifth aspect of the present invention for processing a processor exception occurrence, a first instruction control unit that issues an instruction including an exception occurrence instruction with a first identifier attached thereto and executes the instruction speculatively without exception occurrence; A second instruction control unit that issues an exception handling routine instruction with a second identifier attached after an instruction that is erroneously issued as having no exception when the first exception is detected; If the first exception occurrence is detected and the direction is correct, after the issuance of an instruction in the exception handling routine is started, if the second exception occurrence is detected in a new instruction in the instruction issued by the exception handling routine, the exception handling routine In the state where the issue of the first exception has been detected, wait until all instructions before the one that caused the first exception have been completed, and then erroneously determine that the old exception occurred and that no exception occurred due to this instruction. Cancels the issued instruction, cancels the suppression, and starts issuing an exception handling routine instruction in the correct direction when the second exception occurs.The third instruction control unit, and the exception occurs when the second exception occurs After the instruction in the processing routine is issued, wait for all instructions before the new exception generation instruction to complete, and then cancel the second exception occurrence instruction and the instruction issued in the first exception generation exception handling routine. And a fourth instruction control unit that resumes issuing an instruction of an exception handling routine upon occurrence of a second exception.
(例外発生を処理する命令制御方法)  (Instruction control method for handling exceptions)
本発明によるプロセッサの命令制御方法の例外発生を処理する第 1形態は、 例 外発生により投機的に実行した命令をキャンセルする場合にも、 分岐ミスの場合. と同様に適用でき、 分岐ミスの検出に対応して例外発生についても次の第 1形態 〜第 5形態をとる。  The first mode of handling the exception occurrence of the instruction control method of the processor according to the present invention can be applied similarly to the case of a branch miss when canceling an instruction speculatively executed due to an exception. The following first to fifth modes are also applied to the occurrence of an exception in response to the detection.
例外発生を処理する本発明によるプロセッサの命令制御方法の第 1形態は、 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしとして 投機的に命令を実行する第 1ステップと、  A first mode of an instruction control method for a processor according to the present invention for processing an exception occurrence includes issuing an instruction including an exception occurrence instruction with a first identifier attached thereto, and speculatively executing the instruction as no exception occurrence. When,
例外発生を検出した際に、 例外発生なしとして誤つて発行してしまつた命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステ ップと、  A second step in which, when an exception is detected, an instruction of an exception handling routine is attached with a second identifier, followed by an instruction that has been erroneously issued as no exception has occurred, and
例外発生命令以前の命令が全て完了した後に、 例外発生命令及び例外発生なし として発行してしまった命令をキャンセルして例外発生ルーチンの命令発行を開 始する第 3ステップとを備えたことを特徴とする。 ' 本発明によるプロセッサの例外発生を処理する命令制御方法の第 2形態は、 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしとして 投機的に命令を実行する第 1ステップと、 After all instructions before the exception generation instruction have completed, no exception generation instruction and no exception generation And a third step of canceling the issued instruction and starting instruction issuing of the exception generating routine. '' The second mode of the instruction control method for processing an exception occurrence of a processor according to the present invention is to issue an instruction including an exception occurrence instruction with a first identifier attached thereto, and to execute the instruction speculatively without exception occurrence. Steps and
例外発生を検出した際に、 例外発生なしとして誤つて発行してしまつた命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステ ップと、  A second step in which, when an exception is detected, an instruction of an exception handling routine is attached with a second identifier, followed by an instruction that has been erroneously issued as no exception has occurred, and
第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が発行 された後に、 それ以前の古い命令で第 2の例外発生を検出した場合、 古い分岐命 令以前の命令が全て完了するのを待って例外発生命令及び後続する全ての命令を キャンセルしてから、 第 2の例外発生による例外処理ル一チンの命令発行を開始 する第 3ステップと、  After the first exception occurrence is detected and the instruction of the exception handling routine in the correct direction is issued, if an older instruction before that detects the second exception occurrence, all instructions before the old branch instruction are completed. A third step of canceling the exception generating instruction and all subsequent instructions after waiting for the execution of the second instruction, and then starting to issue the instruction of the exception handling routine due to the second exception generation; and
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッサの例外発生を処理する命令制御方法の第 3形態は、 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしとして 投機的に命令を実行する第 1ステツプと、  A third form of the instruction control method for processing an exception occurrence in a processor according to the present invention includes the first step of issuing an instruction including an exception occurrence instruction with a first identifier attached thereto and executing the instruction speculatively without exception occurrence. When,
例外発生を検出した際に、 例外発生なしとして誤って発行してしまった命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステ ップと、  A second step of, when an exception is detected, issuing an instruction of an exception handling routine with a second identifier attached after an instruction which is erroneously issued as no exception is generated,
第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が発行 された後に、 それ以前の古い命令で第 2の例外発生を検出した場合、 第 1の例外 発生の検出により発行した例外処理ルーチンの命令をキャンセルした後に、 第 2 の例外発生の検出により正しい方向となる例外処理ルーチンの命令発行を開始す る第 3ステップと、  After the first exception has been detected and the instruction of the exception handling routine in the correct direction has been issued, if an earlier instruction detects a second exception occurrence, it is issued by detecting the first exception occurrence. A third step of, after canceling the exception processing routine instruction, starting to issue an exception processing routine instruction that is oriented in a correct direction by detecting the occurrence of the second exception;
第 2の例外発生が検出されて例外処理ルーチンの命令が発行された後に、 前記 古い分岐命令以前の命令が全て完了するのを待って、 第 1の例外発生を起こした 命令及びこの命令により例外発生なしとして誤つて発行してしまった命令をキヤ ンセルしてから、 第 2の例外発生による例外処理ルーチンの命令発行を再開する 第 4ステップと、 After the second exception has been detected and the instruction of the exception handling routine has been issued, after waiting for all instructions before the old branch instruction to complete, the instruction that caused the first exception and the exception caused by this instruction Cancels the instruction that was erroneously issued as no occurrence, and then resumes issuing instructions in the exception handling routine due to the second exception The fourth step,
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッザの例外発生を処理する命令制御方法の第 4形態は、 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしとして 投機的に命令を実行する第 1ステップと、 '  A fourth mode of an instruction control method for processing an exception occurrence of a processor according to the present invention includes the steps of: issuing an instruction including an exception occurrence instruction with a first identifier attached thereto; and speculatively executing the instruction with no exception occurrence. When, '
第 1の例外発生を検出した際に、 例外発生なしとして誤って発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発行を 開始した後に、 例外処理ルーチンにより発行した命令内の新しい命令で第 2の例 外発生を検出した場合、 新しい例外発生命令以前の命令が全て完了するのを待つ て例外発生命令及び後続する全ての命令をキャンセルしてから、 第 1の例外発生 による例外処理ルーチンの命令発行を開始する第 3ステップと、  When the first exception is detected, the first exception that issues the instruction of the exception handling routine with the second identifier attached after the instruction that was erroneously issued as no exception After the issuance of an instruction in the exception handling routine that has been detected and the direction is correct, if the second exception occurrence is detected in a new instruction among the instructions issued by the exception handling routine, all instructions before the new exception occurrence instruction A third step of waiting for completion, canceling the exception generating instruction and all subsequent instructions, and then starting issuing an instruction in an exception handling routine due to the first exception;
を備えたことを特徴とする。 It is characterized by having.
本発明によるプロセッサの例外発生を処理する命令制御方法の第 5形態は、 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしとして 投機的に命令を実行する第 1ステツプと、  According to a fifth aspect of the present invention, there is provided an instruction control method for processing an exception occurrence of a processor, comprising the steps of: issuing an instruction including an exception occurrence instruction with a first identifier attached thereto; and speculatively executing the instruction without exception. When,
例外発生を検出した際に、 例外発生なしとして誤って発行してしまった命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステ ップと、  A second step of, when an exception is detected, issuing an instruction of an exception handling routine with a second identifier attached after an instruction which is erroneously issued as no exception is generated,
第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発行を 開始した後に、 例外処理ルーチンにより発行した命令内の新しい命令で第 2の例 外発生を検出した場合、 例外処理ルーチンの命令発行を抑止した状態で、 第 1例 外発生が検出された古い方の例外発生命令以前の命令が全て完了するのを待って、 古い例外発生命令及びこの命令により例外発生なしとして誤って発行してしまつ た命令をキャンセルしてから、 抑止を解除して第 2の例外発生により正しい方向 となる例外処理ルーチンの命令発行を開始する第 3ステップと、  If the first exception occurrence is detected and the instruction of the exception handling routine in the correct direction is started, and if the second exception occurrence is detected in a new instruction among the instructions issued by the exception handling routine, the exception handling routine is executed. Waiting for all instructions before the old exception generating instruction in which the first exception has been detected to be completed in the state where the instruction issue of A third step of canceling the issued instruction, releasing the suppression, and starting to issue an instruction of an exception handling routine that is oriented in a correct direction due to the occurrence of the second exception;
第 2の例外発生により例外処理ルーチンの命令が発行された後に、 新しい例外 発生命令以前の命令が全て完了するのを待って第 2の例外発生の命令及び第 1の 例外発生による例外発生ルーチンで発行された命令をキャンセルしてから、 第 2 の例外発生による例外処理ルーチンの命令発行を再開する第 4ステップと、 を備えたことを特徴とする。 図面の簡単な説明 After the instruction of the exception handling routine has been issued due to the second exception, the instruction of the second exception and the first And a fourth step of canceling the instruction issued in the exception generating routine due to the exception and then restarting the instruction issuing of the second exception handling routine due to the occurrence of the exception. BRIEF DESCRIPTION OF THE FIGURES
図 1は従来のプロセッサにおける分岐ミスに対する命令制御動作の説明図; 図 2は分岐命令毎に異なる I Dを付ける従来のプロセッサにおける分岐ミスに対 する命令制御動作の説明図; FIG. 1 is an explanatory diagram of an instruction control operation for a branch miss in a conventional processor; FIG. 2 is an explanatory diagram of an instruction control operation for a branch miss in a conventional processor in which a different ID is assigned to each branch instruction;
図 3は従来のプロセッサで使用するリネームマツプの説明図; Figure 3 is an illustration of the rename map used in the conventional processor;
図 4は本発明が適用されるプロセッサの機能構成のブロック図; FIG. 4 is a block diagram of a functional configuration of a processor to which the present invention is applied;
図 5は本発明のプロセッサで使用するリネームマップの説明図; FIG. 5 is an explanatory diagram of a rename map used in the processor of the present invention;
図 6は命令に付ける I Dの数によるハードウェア規模を本発明と従来例につき対 比した回路図; FIG. 6 is a circuit diagram comparing the hardware scale according to the number of IDs attached to an instruction with the present invention and the conventional example;
図 7は本発明による第 1モード分岐予測命令制御部のプロック図; FIG. 7 is a block diagram of the first mode branch prediction instruction control unit according to the present invention;
図 8は図 7の実施形態による命令制御動作の説明図; FIG. 8 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 7;
図 9は図 7の実施形態による命令制御動作のタイミングチヤ一ト; FIG. 9 is a timing chart of the instruction control operation according to the embodiment of FIG. 7;
図 1 0は図 7の実施形態による命令制御のフローチャート; FIG. 10 is a flowchart of instruction control according to the embodiment of FIG. 7;
図 1 1は本発明による第 2モード分岐予測命令制御部のプロック図; 図 1 2は図 1 1の実施形態による命令制御動作の説明図; FIG. 11 is a block diagram of the second mode branch prediction instruction control unit according to the present invention; FIG. 12 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 11;
図 1 3は図 1 1の実施形態による命令制御動作のタイミングチャート; 図 1 4は図 1 1の実施形態による命令制御のフローチャート; FIG. 13 is a timing chart of the instruction control operation according to the embodiment of FIG. 11; FIG. 14 is a flowchart of instruction control according to the embodiment of FIG. 11;
図 1 5は本発明による第 3モード分岐予測命令制御部のブロック図; 図 1 6は図 1 5の実施形態による命令制御動作の説明図; FIG. 15 is a block diagram of a third mode branch prediction instruction control unit according to the present invention; FIG. 16 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 15;
図 1 7は図 1 5の実施形態による命令制御動作のタイミングチャート; 図 1 8は図 1 5の実施形態による命令制御のフロ一チヤ一卜; FIG. 17 is a timing chart of the instruction control operation according to the embodiment of FIG. 15; FIG. 18 is a flowchart of the instruction control according to the embodiment of FIG. 15;
図 1 9は本発明による第 4モード分岐予測命令制御部のブロック図; 図 2 0は図 1 9の実施形態による命令制御動作の説明図; FIG. 19 is a block diagram of a fourth mode branch prediction instruction control unit according to the present invention; FIG. 20 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 19;
図 2 1は図 1 9の実施形態による命令制御動作のタイミングチャート; 図 2 2は図 1 9の実施形態によるる命令制御のフローチャート; 図 2 3は本発明による第 4モード分岐予測命令制御部のプロック図; 図 2 4は図 2 3の実施形態による命令制御動作の説明図; Fig. 21 is a timing chart of the instruction control operation according to the embodiment of Fig. 19; Fig. 22 is a flowchart of instruction control according to the embodiment of Fig. 19; FIG. 23 is a block diagram of a fourth mode branch prediction instruction control unit according to the present invention; FIG. 24 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 23;
図 2 5は図 2 3の実施形態による命令制御動作のタイミングチャート; 図 2 6は図 2 4の実施形態によるる命令制御のフローチャート; FIG. 25 is a timing chart of the instruction control operation according to the embodiment of FIG. 23; FIG. 26 is a flowchart of instruction control according to the embodiment of FIG. 24;
図 2 7は本発明による第 1モードから第 5モードの分岐予測命令制御を一体化し た命令制御のフローチャート; FIG. 27 is a flowchart of instruction control integrating the branch prediction instruction control of the first to fifth modes according to the present invention;
図 2 8は本発明による第 1モード例外発生命令制御部のプロック図; 図 2 9は図 2 7の実施形態による命令制御動作の説明図; FIG. 28 is a block diagram of the first mode exception occurrence instruction control unit according to the present invention; FIG. 29 is an explanatory diagram of the instruction control operation according to the embodiment of FIG. 27;
図 3 0は図 2 7の実施形態による命令制御のフローチャート; FIG. 30 is a flowchart of instruction control according to the embodiment of FIG. 27;
図 3 1は本発明による第 2モード例外発生命令制御部のブロック図; 図 3 2は図 3 1の実施形態による命令制御動作の説明図; FIG. 31 is a block diagram of a second mode exception occurrence instruction control unit according to the present invention; FIG. 32 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 31;
図 3 3は図 3 1の実施形態による命令制御のフローチャート; FIG. 33 is a flowchart of instruction control according to the embodiment of FIG. 31;
図 3 4は本発明による第 3モード例外発生命令制御部のブロック図; 図 3 5は図 3 4の実施形態による命令制御動作の説明図; FIG. 34 is a block diagram of a third mode exception occurrence instruction control unit according to the present invention; FIG. 35 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 34;
図 3 6は図 3 4の実施形態による命令制御のフローチャート; FIG. 36 is a flowchart of instruction control according to the embodiment of FIG. 34;
図 3 7は本発明による第 4モード例外発生命令制御部のブロック図; 図 3 8は図 3 7の実施形態による命令制御動作の説明図; FIG. 37 is a block diagram of a fourth mode exception occurrence instruction control unit according to the present invention; FIG. 38 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 37;
図 3 9は図 3 7の実施形態による命令制御のフローチャート; FIG. 39 is a flowchart of instruction control according to the embodiment of FIG. 37;
図 4 0は本発明による第 5モード例外発生命令制御部のブロック図; FIG. 40 is a block diagram of a fifth mode exception generating instruction control unit according to the present invention;
図 4 1は図 4 0の実施形態による命令制御動作の説明図; FIG. 41 is an explanatory diagram of an instruction control operation according to the embodiment of FIG. 40;
図 4 2は図 4 1の実施形態による命令制御のフローチャート; FIG. 42 is a flowchart of instruction control according to the embodiment of FIG. 41;
図 4 3は本発明による第 1モードから第 5モードの例外発生命令制御を一体化し た命令制御のフローチャート; 発明を実施するための最良の形態 FIG. 43 is a flowchart of an instruction control in which the exception occurrence instruction control of the first to fifth modes according to the present invention is integrated;
図 4は、 本発明の命令制御が適用されるプロセッサの機能構成のプロック図で ある。 図 4において、 プロセッサ 1 0には、 分岐予測部 1 2、 命令発行部 1 4、 命令格納部 1 6、 命令実行部 1 8、 命令確定部 2 0、 レジスタ 2 2、 リネーミン グ処理部 2 4が設けられる。 命令格納部 1 6には、 リザべーシヨンステーション と呼ばれる命令格納キュー 2 '6— 1〜 2 6— 4が設けられている。 また命令実行 部 1 8には、 分岐処理部 2 8、 整数演算器 3 0、 浮動小数点演算器 3 2、 ロード Zストア処理部 3 4などの機能処理部が設けられている。 更にリネーミング処理 部 2 4には、 リオーダバッファ 3 6とリネームマップ 3 8が設けられている。 このようなプロセッサ 1 0の各処理部は命令制御部 4 0の制御のもとに動作す る。 本発明にあっては、 命令制御部 4 0には通常の命令制御に加え、 本発明に固 有な分岐予測命令制御部 4 2と例外発生命令制御部 4 4を備えている。 この図 4 の実施形態におけるプロセッサ 1 0は、 いわゆる動的スケジューリング及び分岐 予測を併用することにより命令の投機的実行を行う。 まず命令発行部 1 4は、 命 令キャッシュから例えば 4命令をフェッチしてデコードする。 分岐予測部 1 2は 分岐予測用の分岐履歴テーブルを備え、予測された分岐方向に投機的実行を行う。 命令発行部 1 4からインオーダーで発行された命令は、 命令格納部 1 6に各命 令とそのオペランドを、 命令実行部 1 8における機能処理部に対応して送る。 同 時に命令発行部 1 4は、 リオーダバッファ 3 6に命令を登録する。 命令格納部 1 6に送られた命令は、 命令実行部 1 8に設けている対応する処理部が利用可能に なり次第、 アウトォブオーダーで命令が実行され、 命令に割り当てられたリオ一 ダバッファに結果が格納される。 命令確定部 2 0は、 未完了命令を全てリオーダ バッファ 3 6に保持しており、 命令実行部 1 8の分岐処理部 2 8で分岐が成立す るか否かの判定結果を受けると、 それに基づいて命令確定部 2 0は未完了命令の 処理を決定する。 即ち、 分岐予測が正しかった場合には分岐命令に対する後続命 令の結果は有効とされ、 プログラムの順番に従ったインオーダでレジスタ 2 2や 図示しないメモリに書き込まれる。分岐予測が外れて分岐ミスとなった場合には、 分岐命令に対する後続命令の結果は全て無効とされ、 命令格納部 1 6及びリオ一 ダバッファ 3 6からキャンセルされる。 このように、 分岐予測により投機的に実 行された命令について分岐ミスを検知した際に、 命令制御部 4 0に設けている本 発明による分岐予測命令制御部 4 2は、 分岐ミスによって誤った方向に発行して しまった命令のキャンセルと分岐ミスの検出に基づいて正しい方向への命令発行 の処理を効率的に行う。 FIG. 4 is a block diagram of a functional configuration of a processor to which the instruction control of the present invention is applied. In FIG. 4, a processor 10 includes a branch prediction unit 12, an instruction issuing unit 14, an instruction storage unit 16, an instruction execution unit 18, an instruction determination unit 20, a register 22, and a renaming processing unit 24. Is provided. The instruction storage 16 contains a reservation station. There are provided instruction storage queues 2'6-1 to 26-4. The instruction execution unit 18 includes a function processing unit such as a branch processing unit 28, an integer arithmetic unit 30, a floating point arithmetic unit 32, and a load Z store processing unit 34. Further, the renaming processing section 24 is provided with a reorder buffer 36 and a rename map 38. Each processing unit of the processor 10 operates under the control of the instruction control unit 40. In the present invention, the instruction control unit 40 includes a branch prediction instruction control unit 42 and an exception generation instruction control unit 44 which are unique to the present invention, in addition to the normal instruction control. The processor 10 in the embodiment of FIG. 4 performs speculative execution of instructions by using so-called dynamic scheduling and branch prediction together. First, the instruction issuing unit 14 fetches and decodes, for example, four instructions from the instruction cache. The branch prediction unit 12 includes a branch history table for branch prediction, and performs speculative execution in the predicted branch direction. The instruction issued from the instruction issuing unit 14 in order sends each instruction and its operand to the instruction storage unit 16 corresponding to the function processing unit in the instruction execution unit 18. At the same time, the instruction issuing unit 14 registers the instruction in the reorder buffer 36. The instructions sent to the instruction storage unit 16 are executed out-of-order as soon as the corresponding processing unit provided in the instruction execution unit 18 becomes available, and the Rio buffer assigned to the instruction is executed. The result is stored in The instruction deciding unit 20 holds all uncompleted instructions in the reorder buffer 36, and upon receiving the result of the determination as to whether or not the branch is taken by the branch processing unit 28 of the instruction executing unit 18, it receives the result. The instruction determination unit 20 determines the processing of the incomplete instruction based on the instruction. That is, if the branch prediction is correct, the result of the instruction following the branch instruction is valid, and is written to the register 22 or a memory (not shown) in in-order according to the order of the program. If the branch prediction is missed and a branch miss occurs, the results of all subsequent instructions to the branch instruction are invalidated, and are canceled from the instruction storage unit 16 and the Rioder buffer 36. As described above, when a branch error is detected for an instruction speculatively executed by branch prediction, the branch prediction instruction control unit 42 according to the present invention provided in the instruction control unit 40 is erroneous due to the branch error. It efficiently processes instructions in the correct direction based on cancellation of instructions issued in the direction and detection of branch mistakes.
図 5は、 図 4のプロセッサ 1 0のリネーミング処理部 2 4に設けたリネームマ ップ 38の説明図である。 本発明の分岐予測命令制御にあっては、 命令に付ける 識別子である I Dとして、 少なくとも ID=0, 1の 2つを使用すればよい。 この命令に付ける 2つの I Dに対応し、 リネームマップ 38は命令のレジス夕 番号 50で指定される右側に示すエントリ 0, 1, 2, 3のそれぞれについて、 リオーダバッファアドレスフィールド (ROB— AD) 46に加え、 ID=0に 対応した有効フラグ A V0を格納する有効フラグフィールド (AV0) 48-0 と、 ID=1に対応した有効フラグ AV1を格納する有効フラグフィールド (A VI) 48— 1を設けている。 このリネームマップ 38は、 レジスタ番号 50で 指定されるエントリ、 例えばレジス夕番号 RG1の場合にはエントリ 「0」 のリ オーダバッファアドレスフィールド 46に、 リネームしたいリオ一ダバッファの アドレス例えば 「00」 を書き込む。 このとき命令に付けられた I Dが I D==0 であれば、 有効フラグフィ一ルド 48— 0の該当フィールドのフラグを 「1」 に する。 命令の完了によりリオーダバッファを開放する場合や分岐ミスの検出によ り命令を無効にする場合には、 例えば 「1」 としている I D=0の有効フラグフ ィールド 48— 0を 「0」 とすればよい。 FIG. 5 is a diagram showing a rename machine provided in the renaming processing section 24 of the processor 10 of FIG. FIG. In the branch prediction instruction control of the present invention, at least two IDs, ID = 0 and 1, may be used as IDs which are identifiers attached to instructions. Corresponding to the two IDs assigned to this instruction, the rename map 38 contains the reorder buffer address field (ROB—AD) 46 for each of the entries 0, 1, 2, and 3 shown on the right side specified by the register number 50 of the instruction. In addition, the valid flag field (AV0) 48-0 for storing the valid flag A V0 corresponding to ID = 0 and the valid flag field (A VI) 48-1 for storing the valid flag AV1 corresponding to ID = 1 Provided. In the rename map 38, the address of the Rio buffer to be renamed, for example, "00" is written in the entry specified by the register number 50, for example, in the reorder buffer address field 46 of the entry "0" for the register number RG1. . At this time, if the ID assigned to the instruction is ID == 0, the flag of the corresponding field of the valid flag field 48-0 is set to “1”. To release the reorder buffer upon completion of an instruction or to invalidate an instruction by detecting a branch error, for example, set the valid flag field 48-0 of ID = 0, which is set to "1", to "0". Good.
図 6は、 図 5のリネームマップ 38を対象とした命令に付された I Dに応じて 有効フラグフィールドを 「0」 にキャンセルするためのキャンセル信号を発生す るハードウェアとしての回路図である。 図 6 (A) は、 図 5の本発明のリネーム マップ 38における 2つの I D=0, 1に対応した回路である。 これに対し図 6 (B) は、 図 2に示した従来の命令制御において I D=0〜 7の 8つを使用する 場合のハードウェアの回路を表わしている。 図 6 (A) の本発明で使用される回 路にあっては、 キャンセル信号を発生する際にはラッチ 52に命令の I Dフィ一 ルドに設けた 1ビットの I Dデ一夕がセットされ、 I D = 0であればィンバ一夕 54の出力が 1となり、 アンドゲート 56— 0に対する I D=0を付した命令の 完了あるいは無効による入力のタイミングで出力 1を生じ、 これがオアゲート 5 8からキャンセル信号として出力される。 またラッチ 52に命令の I Dフィール ドの I D= 1が保持された場合には、 バッファ 55の出力が 1となり、 アンドゲ ート 56— 1に対する I D= 1を付した命令の完了あるいは無効化に伴う信号入 力を受けたタイミングで、 オアゲート 58を介してキャンセル信号を出力する。 これに対し図 6 (B) の従来の命令制御で使用する回路にあっては、 8つの I D = 0〜7に対応し、 ラッチ 6 0からの出力ラインは 3ビットラインとなり、 また ラッチ 6 0に保持された命令の I Dフィールドの 3ビットの情報から 8種類の I Dに分けるためのデコーダ 6 2が設けられ、 デコーダ 6 2からの出力は 8本の信 号線となる。 更にデコーダ 6 2に続いて、 I D == 0〜7に 8つに対応してアンド ゲート 6 4— 0〜6 4— 7が設けられ、 これらの出力をオアゲート 6 6でまとめ てキャンセル信号を取り出している。 この図 6 (A) における本発明の 2つの I Dを用いた場合と図 6 (B) の従来の 8つの I Dを用いた場合と対比して明らか なように、 命令に付ける I Dの数が増加するほどキャンセル信号を出力するため の回路規模が大きくなることが分かる。 これに対し本発明にあっては、 図 6 (A) のように、 基本的には 2つの I Dを使用するだけでよいことから、 命令の完了あ るいは分岐ミスに伴う命令の無効で必要とするキャンセル信号のハードウェア量 を十分に小さくできることが分かる。 FIG. 6 is a circuit diagram as hardware that generates a cancel signal for canceling the valid flag field to “0” according to the ID attached to the instruction for the rename map 38 in FIG. FIG. 6A is a circuit corresponding to two IDs = 0 and 1 in the rename map 38 of the present invention in FIG. On the other hand, FIG. 6 (B) shows a hardware circuit in the case where eight ID = 0 to 7 are used in the conventional instruction control shown in FIG. In the circuit used in the present invention in FIG. 6A, when a cancel signal is generated, the 1-bit ID data provided in the ID field of the instruction is set in the latch 52, If ID = 0, the output of the receiver 54 becomes 1 and the output 1 is generated at the timing of the completion or invalid input of the instruction with ID = 0 for AND gate 56-0, which is the cancel signal from OR gate 58. Is output as When ID = 1 of the ID field of the instruction is held in the latch 52, the output of the buffer 55 becomes 1, which is accompanied by the completion or invalidation of the instruction with ID = 1 for AND gate 56-1. A cancel signal is output via the OR gate 58 when the signal is received. On the other hand, in the circuit used in the conventional instruction control shown in FIG. 6 (B), corresponding to eight IDs 0 to 7, the output line from the latch 60 is a 3-bit line, and the latch 60 A decoder 62 is provided to divide the 3-bit information in the ID field of the instruction stored in the decoder into eight types of IDs, and the output from the decoder 62 becomes eight signal lines. Further, following the decoder 62, AND gates 64-0 to 64-7 are provided corresponding to the eight ID == 0 to 7, and these outputs are combined by the OR gate 66 to extract the cancel signal. ing. As is clear from the comparison between the case of using two IDs of the present invention in FIG. 6 (A) and the conventional case of using eight IDs of FIG. 6 (B), the number of IDs added to the instruction increases. It can be seen that the circuit size for outputting the cancel signal becomes larger as the number of signals increases. On the other hand, in the present invention, as shown in Fig. 6 (A), basically, only two IDs need to be used, so it is necessary to complete the instruction or invalidate the instruction due to a branch mistake. It can be seen that the hardware amount of the cancel signal can be sufficiently reduced.
図 7は、 図 4のプロセッサ 1 0に設けている分岐予測命令制御部 4 2の第 1実 施形態となる第 1モード分岐予測命令制御部 4 2 - 1の機能構成のプロック図で ある。 この第 1モード分岐予測命令制御部 4 2— 1は、 第 1命令制御部 6 8、 第 2命令制御部 7 0及び第 3命令制御部 7 2— 1を備える。  FIG. 7 is a block diagram of a functional configuration of a first mode branch prediction instruction control unit 42-1 which is a first embodiment of the branch prediction instruction control unit 42 provided in the processor 10 of FIG. The first mode branch prediction instruction control unit 42-1 includes a first instruction control unit 68, a second instruction control unit 70, and a third instruction control unit 72-1.
図 8は、 図 7の第 1モード分岐予測命令制御部 4 2一 1による命令制御動作を 表わしており、 これを参照して図 7の制御動作を説明すると次のようになる。 ま ず第 1命令制御部 6 8は、 図 8 (A) のように、 第 1識別子としての I D = 0を 付けて分岐命令 B 4, B 8を含む命令 1〜命令 1 1の発行しており、 分岐命令列 B 4については分岐予測によって判断された方向に命令 5〜命令 1 1を発行して 投機的に実行している。このような分岐予測に基づく命令の投機的な実行により、 分岐命令 B 4についてて分岐ミス 8 0が検出されると、 図 7の第 2命令制御部 7 0は、 この分岐ミス 8 0を検出した時点で、 図 8 (B ) のように、 誤って発行し てしまった命令 5〜命令 1 1の後ろに続けて、 正しい方向の命令 5 0 , 5 1を第 2識別子となる別の I D = 1を付けて発行する。 続いて図 7の第 3命令制御部 7 2— 1力 図 8 ( C) のように、 分岐以前の命令 1〜命令 B 4が全て完了したこ とを認識した後に、 分岐命令 B 4の分岐予測によって誤って発行してしまった命 令 5〜命令 1 1に対しキャンセル処理 8 4を実行し、 その後に正しい方向の命令 5 0, 5 1に続く命令発行を開始する。 この誤って発行してしまった命令 5〜命 令 1 1のキャンセル処理 8 4の際には、 キャンセル対象となった命令に付けてい る I D = 0及び命令の資源をキャンセルする。 具体的には、 図 6 (A) の回路に よりキャンセルした命令の I Dフィールドをラッチ 5 2にセットしてキャンセル 信号を発生させ、 このキャンセル信号により図 4のプロセッサ 1 0の命令格納部 1 6に保持している誤って発行してしまった命令 5〜命令 1 1をキャンセルする と共に、 図 5のリネームマップ 3 8における I D = 0に対応した有効フラグフィ —ルド 4 8— 0の全てのエントリを 「0」 とすることで、 命令資源として使用し ていたリオ一ダバッファ 3 6を開放する。 このように本発明の第 1モード分岐予 測命令制御部による制御動作にあっては、 分岐ミスが検出された後に発行する正 しい方向の命令に新たな I Dを付していることから、 分岐ミスに対する命令キヤ ンセルと正しい方向の命令発行について使用する I Dの種類を 2つとするだけで よく、 I Dの使用に伴うハ一ドウエアの量を必要最小限にすることができる。 図 9は、 図 8の命令制御動作に対応するタイミングチャートであり、 縦方向に 発行された命令を並べ、 横方向に経過時間を表わしている。 図 9にあっては、 分 岐命令 B 4について時刻 t 1で分岐ミス 8 0が検出されると、 分岐命令 B 4の発 行済みで実行が終わった後の時刻 t 2の夕イミングで、 図 8 (B) のように I D = 1を付して、 正しい方向の命令 5 0 , 5 1の発行を開始している。 その後、 時 刻 t 3で分岐命令 B 4までの命令が全て完了した後の時刻 t 3の夕イミングで、 誤って発行した命令 5〜命令 1 1のキャンセルを行っている。 FIG. 8 shows an instruction control operation by the first mode branch prediction instruction control unit 421-1 of FIG. 7. The control operation of FIG. 7 will be described below with reference to this. First, the first instruction control unit 68 issues instructions 1 to 11 including branch instructions B4 and B8 with ID = 0 as the first identifier as shown in FIG. 8 (A). As for the branch instruction sequence B4, instructions 5 to 11 are issued in the direction determined by the branch prediction and executed speculatively. When a branch miss 80 is detected for the branch instruction B4 by speculative execution of an instruction based on such a branch prediction, the second instruction control unit 70 in FIG. 7 detects the branch miss 80. At that point, as shown in Fig. 8 (B), following instructions 5 to 11 issued by mistake, instructions 5 0 and 51 in the correct direction are another ID that serves as the second identifier. Issued with = 1. Next, as shown in FIG. 8 (C), the third instruction control unit 72-1 in FIG. 7 recognizes that all the instructions 1 to B4 before the branch are completed, and then branches the branch instruction B4. Life issued accidentally by prediction Execute cancel processing 84 for instructions 5 to 11 and then start issuing instructions following instructions 50 and 51 in the correct direction. At the time of cancel processing of the instruction 5 to instruction 11 issued by mistake 84 to instruction 11, ID = 0 and the resource of the instruction attached to the instruction to be canceled are canceled. Specifically, the ID field of the instruction canceled by the circuit of FIG. 6A is set in the latch 52 to generate a cancel signal, and the cancel signal is used by the instruction storage unit 16 of the processor 10 of FIG. In addition to canceling the instruction 5 to instruction 11 that was issued by mistake and stored in the valid flag field corresponding to ID = 0 in the rename map 38 in Fig. 5, all entries in the field 4 8-0 are deleted. By setting this bit to "0", the Rioda buffer 36 used as an instruction resource is released. As described above, in the control operation of the first mode branch prediction instruction control unit of the present invention, since a new ID is added to the instruction in the correct direction issued after the detection of a branch mistake, the branch is performed. It is only necessary to use two types of IDs for the instruction cancel for mistakes and for issuing instructions in the correct direction, and the amount of hardware involved in using IDs can be minimized. FIG. 9 is a timing chart corresponding to the instruction control operation of FIG. 8, in which instructions issued in the vertical direction are arranged, and the elapsed time is indicated in the horizontal direction. In FIG. 9, if a branch miss 80 is detected at time t1 for branch instruction B4, the branch instruction B4 has been issued and execution ends at time t2 after execution has ended. As shown in FIG. 8 (B), ID = 1 is assigned and instructions 50 and 51 in the correct direction are started to be issued. Thereafter, at time t3, after all instructions up to branch instruction B4 are completed at time t3, the erroneously issued instructions 5 to 11 are canceled.
図 1 0は、 図 7の第 1モード分岐予測命令制御部 4 2一 1による命令制御のフ ローチャートである。 まずステップ s 1で同一の I Dを付して命令を発行してお り、 ステップ S 2で発行が済んで実行が終わった分岐命令について分岐ミスが発 生すると、 ステップ S 3で別の I Dを付して正しい方向の命令を発行する。 続い てステップ S 4で分岐ミス以前の命令が全て完了したか否か監視しており、 全て 完了すると、 ステップ S 5で分岐ミスにより誤って発行してしまった投機失敗命 令及びリオーダバッファを含むその資源をキャンセルした後、 ステップ S 6で正 しい方向の命令発行を再開する。 図 1 1は、 図 4のプロセッサ 1 0に設けた分岐予測命令制御部の第 2実施形態 となる第 2モード分岐予測命令制御部 4 2— 2のブロック図であり、 第 1命令制 御部 6 8、 第 2命令制御部 7 0及び第 3命令制御部 7 2— 2を備える。 このうち 第 1命令制御部 6 8及び第 2命令制御部 7 0は図 7の第 1モード分岐予測命令制 御部 4 2— 1と同じになるが、 第 3命令制御部 7 2— 2にあっては、 分岐ミスに より正しい方向の命令を発行している間に、 それより古い分岐命令で分岐ミスが 発生した場合の命令制御を処理することを特徴とする。 FIG. 10 is a flow chart of the instruction control by the first mode branch prediction instruction control unit 421-1 in FIG. First, an instruction is issued with the same ID in step s1, and if a branch error occurs in the branch instruction that has been issued and executed in step S2, another ID is issued in step S3. And issue an instruction in the correct direction. Then, in step S4, it is monitored whether all instructions before the branch error have been completed.If all instructions have been completed, in step S5, a speculative failure instruction and a reorder buffer that are erroneously issued due to a branch error are included. After canceling the resource, instruction issuance in the correct direction is resumed in step S6. FIG. 11 is a block diagram of a second mode branch prediction instruction control unit 42-2 as a second embodiment of the branch prediction instruction control unit provided in the processor 10 of FIG. 4, and a first instruction control unit. 68, a second command control unit 70 and a third command control unit 72-2. Among them, the first instruction control unit 68 and the second instruction control unit 70 are the same as the first mode branch prediction instruction control unit 42--1 in FIG. In such a case, while an instruction in the correct direction is issued due to a branch miss, instruction control is performed when an older branch instruction causes a branch miss.
図 1 2は、 図 1 1の第 2モード分岐予測命令制御部 4 2— 2による制御動作の 説明図である。 まず第 1命令制御部 6 8は、 図 1 2 (A) のように、 分岐命令 B 2 , B 4 , B 8を含む命令に I D = 0を付して発行しており、 分岐命令 B 2, B 4, B 8については、 それぞれ分岐予測により投機的に命令を実行させている。 この状態でァゥトォブオーダ一による分岐命令 B 4の実行に伴って分岐ミス 8 0 が検出されたとする。 この分岐ミス 8 0の検出に対し第 2命令制御部 7 0は、 図 1 2 (B ) のように、 誤って発行してしまった命令 5〜命令 1 1の後ろに続けて 正しい方向の命令 5 0, 5 1を、 別の I D = 1を付けて発行する。 この第 1命令 制御部 6 8及び第 2命令制御部 7 0による制御動作は、 図 8 (A) (B) に既に説 明した場合と同じである。 次に図 1 2 ( C) のように、 分岐ミス 8 0が検出され た分岐命令 B 4より古い分岐命令 B 2のァゥトォブオーダーによる実行に伴って 分岐ミス 8 2が検知されたとすると、 第 3命令制御部 7 2— 2は分岐ミス 8 2が 検出された後に、 図 1 2 (D) のように古い分岐命令 B 2以前の命令 1及び B 2 が全て完了するのを待って、 後続する全ての命令 3〜命令 5 1をキャンセルする キャンセル処理 8 6を行う。 このキャンセル処理 8 6にあっては、 I D = 0及び 資源もキャンセルする。 そして図 1 2 ( E) のように、 誤って発行してしまった 命令のキャンセル処理 8 6が済んでから、 分岐ミス 8 2に対し正しい方向となる 命令 6 0, 6 1, 6 2 , …の発行を再開する。 このような第 2モード分岐予測命 令制御部 4 2— 2の制御動作にあっては、 図 2の従来例のように分岐命令ごとに I Dを付ける必要がなく、 分岐ミスを検出したときに、 正しい方向に発生する命 令について別の I Dを付けるだけでよいことから、 I Dは 2つで済み、 図 6 (A) のようにキヤンセル信号を発生するハ一ドウエア量を必要最小限にすることがで さる。 FIG. 12 is an explanatory diagram of the control operation by the second mode branch prediction instruction control unit 42-2 in FIG. First, as shown in FIG. 12A, the first instruction control unit 68 issues instructions including branch instructions B 2, B 4, and B 8 with ID = 0, and issues the branch instruction B 2 , B4, and B8 execute instructions speculatively by branch prediction. In this state, it is assumed that a branch miss 80 is detected along with the execution of the branch instruction B4 by the auto-order. In response to the detection of the branch miss 80, the second instruction control unit 70, following the instructions 5 to 11 issued in error, continues the instruction in the correct direction as shown in FIG. Issue 50, 51 with another ID = 1. The control operations by the first command control unit 68 and the second command control unit 70 are the same as those already described in FIGS. 8 (A) and 8 (B). Next, as shown in FIG. 12 (C), if a branch miss 82 is detected along with the execution of the branch instruction B2 older than the branch instruction B4 in which the branch miss 80 is detected in the art order, After the branch miss 8 2 is detected, the third instruction control unit 7 2-2 waits until all instructions 1 and B 2 before the old branch instruction B 2 are completed as shown in FIG. Cancel all subsequent instructions 3 to 51. Perform cancel processing 86. In this cancellation process 86, ID = 0 and resources are also canceled. Then, as shown in Fig. 12 (E), after the cancellation process 86 of the instruction issued erroneously, the instruction 60 0, 61, 62,. Resumes issuing. In the control operation of the second mode branch prediction instruction control unit 42-2, there is no need to assign an ID to each branch instruction as in the conventional example of FIG. However, since it is only necessary to attach another ID to the instruction generated in the correct direction, only two IDs are required, and the amount of hardware that generates the cancel signal is minimized as shown in Fig. 6 (A). With Monkey
図 1 3は、 図 1 2に対応した命令制御のタイミングチャートである。 図 1 3に おいて、 時刻 t 1で分岐命令 B 4の実行に伴って分岐ミス 8 0が検出されると、 時刻 t 2から正しい方向の命令 5 0, 5 1を別の I D = 1を付けて発行する。 そ の後、 時刻 t 3で分岐命令 B 4より古い分岐命令 B 2の実行に伴う分岐ミス 8 2 が検出されると、 その後の時刻 t 4における分岐命令 B 2の完了後のタイミング で、 誤って発行した命令 3〜命令 5 1の全てをキャンセルし、 その後の時刻 t 5 で正しい方向の命令 6 0 , 6 1, …の発行を開始している。  FIG. 13 is a timing chart of the instruction control corresponding to FIG. In FIG. 13, when a branch miss 80 is detected at time t 1 along with execution of the branch instruction B 4, instructions 50 and 51 in the correct direction are assigned another ID = 1 from time t 2. Issue with After that, at time t3, if a branch miss 82 caused by the execution of the branch instruction B2 older than the branch instruction B4 is detected, the timing after the completion of the branch instruction B2 at the time t4 becomes incorrect. , All of the issued instructions 3 to 51 have been cancelled, and at time t5, the issuance of instructions 60, 61,...
図 1 4は、 図 1 1の第 2モード分岐予測命令制御部 4 2 - 2による命令制御の フローチャートである。 まずステップ S 1で同一 I Dを付して命令を発行し、、ス テツプ S 2で分岐予測を行っている分岐命令の実行に伴って分岐ミスが発生する と、 ステップ S 3で別の I Dを付して正しい方向の命令を発行する。 その後、 ス テツプ S 4で最初の分岐ミスを起こした分岐命令より古い分岐命令について分岐 ミスが発生すると、 ステップ S 5で古い分岐ミスの分岐命令以前が全て完了した か否かチェックする。 古い分岐ミスの分岐命令以前の命令が全て完了すると、 ス テツプ S 6で分岐ミスによって誤つて発行してしまつた全ての投機失敗命令及び リオ一ダバッファを含むその資源をキャンセルした後、 ステップ S 7で正しい方 向の命令発行を開始する。  FIG. 14 is a flowchart of instruction control by the second mode branch prediction instruction control unit 42-2 in FIG. First, in step S1, an instruction is issued with the same ID, and in step S2, if a branch error occurs along with the execution of the branch instruction for which branch prediction is performed, another ID is assigned in step S3. And issue an instruction in the correct direction. Thereafter, if a branch miss occurs in the branch instruction that is older than the branch instruction that caused the first branch miss in step S4, it is checked in step S5 whether all of the branch instructions before the old branch miss have been completed. When all instructions before the old branch instruction of the branch error have been completed, in step S6, after canceling all speculative failure instructions issued by mistake due to the branch error and their resources including the Rioder buffer, step S7 Press to start issuing instructions in the correct direction.
図 1 5は、 図 4の分岐予測命令制御部 4 2における第 3モード分岐予測命令制 御部 4 2— 3のブロック図であり、 この実施形態にあっては、 第 1命令制御部 6 8、 第 2命令制御部 7 0、 第 3命令制御部 7 2— 3及び第 4命令制御部 7 4— 3 を備えている。 このうち第 1命令制御部 6 8及び第 2命令制御部 7 0は、 図 7の 第 1モード分岐予測命令制御部 4 2— 1と同じである。 また第 3命令制御部 7 2 一 3及び第 4命令制御部 7 4— 3は、 図 1 1の第 2モード分岐予測命令制御部 4 2— 2の第 3命令制御部 7 2— 2と同様、 最初の分岐ミスを検出した後に古い分 岐命令について分岐ミスが検出された場合の命令制御を行うことを特徴とする。 図 1' 6は、 図 1 5の第 3モード分岐予測命令制御部 4 2— 3の制御動作の説明 図である。 図 1 6 (A) (B) 及び(C) は、 図 1 2の第 2モード分岐予測命令制 御部 4 2— 2の場合と同じになる。 即ち図 1 6 (A) で分岐命令 B 4の実行に伴 い分岐ミス 8 0が検出されると、 図 1 6 (B ) のように、 誤って発行してしまつ た命令 5〜命令 1 1の後ろに続いて正しい方向の命令 5 0, 5 1を別の I D - 1 を付けて発行する。 その後、 図 1 6 (C) のように、 分岐ミス 8 0を検知した分 岐命令 B 4より古い分岐命令 B 2の実行に伴って分岐ミス 8 2が検出されたとす ると、 図 1 5の第 3命令制御部 7 2— 3により、 図 1 6 (D) のように最初の分 岐ミス 8 0の検出により正しい方向と判断して発行した命令 5 0 , 5 1をキャン セルするキャンセル処理 8 8を行った後に、 図 1 6 (E) のように分岐ミス 8 2 の検出により判断した正しい方向の命令 6 0, 6 1の発行を開始する。 続いて、 図 1 5の第 4命令制御部 7 4— 3によって図 1 6 (E ) のように古い分岐命令列 B 2以前の命令列 1 , B 2が全て完了するのを待って、 分岐命令 B 2の分岐予測 により誤って発行してしまった命令 3〜命令 1 1をキャンセルするキャンセル処 理 9 0を行ってから、 正しい方向に発行した命令 6 0 , 6 1に続く命令発行を再 開する。 もちろんキャンセル処理 9 0にあっては、 命令のキャンセルと同時に I D = 0及び資産をキャンセルする。 この図 1 6に ける第 3モード分岐予測命令 制御部 4 2 - 3による制御動作を図 1 2の第 2モ一ド分岐予測命令制御部 4 2 - 2による制御動作と対比してみると、 最初の分岐ミス 8 0に続いて古い分岐命令 の分岐ミス 8 2が検出されるという同じ状況であるが、 図 1 6の場合には、 図 1 6 (D) のように 2回目の分岐ミス 8 2が検出された際に、 最初に検知された分 岐ミス 8 0により正しい方向に発行した命令 5 0, 5 1のキャンセル処理 8 8を 行って、 その後に図 1 6 (E) のように分岐ミス 8 2に対し正しい方向の命令 6 0, 6 1を発行しており、 図 1 2に比べると 2回目の分岐ミス 8 2による正しい 方向の命令発行のタイミングが速くなつており、 その分、 命令処理の性能を高め ることができる。 FIG. 15 is a block diagram of the third mode branch prediction instruction control unit 42-3 in the branch prediction instruction control unit 42 of FIG. 4. In this embodiment, the first instruction control unit 68 , A second command control unit 70, a third command control unit 72-3, and a fourth command control unit 74-3. Among them, the first instruction control unit 68 and the second instruction control unit 70 are the same as the first mode branch prediction instruction control unit 42-1 in FIG. Also, the third instruction control unit 723 and the fourth instruction control unit 744-3 are the same as the third instruction control unit 722 of the second mode branch prediction instruction control unit 422 of FIG. It is characterized by performing instruction control when a branch miss is detected for an old branch instruction after the first branch miss is detected. FIG. 1'6 is an explanatory diagram of the control operation of the third mode branch prediction instruction control unit 42-3 of FIG. FIGS. 16 (A), (B) and (C) are the same as those of the second mode branch prediction instruction control unit 42-2 in FIG. That is, as shown in Figure 16 (A), When a branch error 80 is detected, as shown in Figure 16 (B), instructions 50 and 51 in the correct direction follow instructions 5 to 11 issued incorrectly. Issue with a different ID-1. Then, as shown in Fig. 16 (C), if a branch miss 82 is detected along with the execution of a branch instruction B2 older than the branch instruction B4 that detected the branch miss 80, The third instruction control unit 7 2-3 cancels the instructions 50 and 51 issued by judging that the direction is correct by detecting the first branching error 80 as shown in Fig. 16 (D). After the processing 88, as shown in FIG. 16 (E), the issuance of instructions 60 and 61 in the correct direction determined by detecting the branch miss 82 is started. Subsequently, the fourth instruction control unit 74-3 in FIG. 15 waits until all the instruction sequences 1 and B2 before the old branch instruction sequence B2 are completed as shown in FIG. Cancel processing 90 for canceling instructions 3 to 11 issued erroneously due to branch prediction of instruction B 2, and then reissue instructions issued following instructions 60 and 61 issued in the correct direction. Open. Of course, in the cancellation process 90, ID = 0 and assets are canceled at the same time as the cancellation of the instruction. The control operation of the third mode branch prediction instruction control unit 42-3 in FIG. 16 is compared with the control operation of the second mode branch prediction instruction control unit 42-2 in FIG. In the same situation, the first branch miss 80 is detected following the old branch instruction's branch miss 82, but in the case of Fig. 16, the second branch miss as shown in Fig. 16 (D). When 8 2 is detected, cancel processing 8 8 of instructions 50 and 51 issued in the correct direction due to the first detected branch error 80 is performed, and then, as shown in Figure 16 (E). The instructions 60 and 61 in the correct direction are issued for the branch error 82, and the timing of issuing the instruction in the correct direction due to the second branch error 82 is faster than in Figure 12. The performance of instruction processing can be improved by a corresponding amount.
図 1 7は図 1 6の命令制御に対応したタイミングチヤ一トである。 図 1 7にあ つては、 時刻 t 1で分岐命令 B 4の実行に伴って分岐ミス 8 0が検出されると、 その後の時刻 t 2で正しい方向の命令 5 0 , 5 1を別の I D = 1を付して発行す る。 続いて時刻 t 3で分岐命令 B 4より古い分岐命令 B 2の実行に伴い分岐ミス 8 2が検出されると、 その後の時刻 t 4で分岐ミス 8 0により正しい方向に発行 した命令 5 0, 5 1をキャンセルした後に、 時刻 t 5で分岐ミス 8 2に対する正 しい方向の命令 6 0, 6 1の発行を開始する。 この図 1 7のタイミングチャート を図 1 3の同じく 2つの分岐ミス 8 0, 8 2が検知された場合について対比して 見ると、 最終的に発行する正しい方向の命令 6 0 , 6 1の発行タイミングが図 1 7の方が速くなつており、 その分、 命令の処理性能が高くなつている。 FIG. 17 is a timing chart corresponding to the instruction control of FIG. In FIG. 17, at time t1, if a branch miss 80 is detected along with execution of branch instruction B4, then at time t2, instructions 50, 51 in the correct direction are assigned different IDs. Issued with = 1. Subsequently, at time t3, when a branch miss 82 is detected along with the execution of the branch instruction B2 older than the branch instruction B4, at the subsequent time t4, the instructions 50, 5 After canceling 1, 1 Start issuing instructions 60 and 61 in the new direction. Comparing the timing chart in Figure 17 with the same two branch misses 80 and 82 in Figure 13 detected, the issuance of instructions 60 and 61 in the correct direction to be finally issued The timing is faster in Figure 17 and the instruction processing performance is correspondingly higher.
図 1 8は、 図 1 5の第 3モ一ド分岐予測命令制御部 4 2— 3の命令制御のフ口 —チャートである。 図 1 8において、 まずステップ S 1で同一 I Dを付して命令 を発行し、 ステップ S 2で発行した命令の中の分岐命令の実行に伴い分岐ミスの 発生が判別されると、 ステップ S 3で別の I Dを付して正しい方向の命令を発行 する。 続いてステップ S 4で最初の分岐ミスを起こした分岐命令より古い分岐命 令の実行で分岐ミスが発生するか否かチェックしており、 古い分岐ミスが発生す ると、 ステップ S 5で最初の分岐ミスに対し正しい方向に発行した投機的失敗命 令及びリオーダバッファを含む資源をキャンセルする。 続いてステップ S 6で、 古い分岐命令について発生した分岐ミスに対する正しい方向の命令をステップ S 3と同じ I Dを付して発行する。 続いてステップ S 7で古い分岐ミス以前の命令 が全て完了したか否か判別しており、 全て完了すると、 ステップ S 8で分岐ミス によつて誤つて発行してしまつた投機的失敗命令及びその資源をキヤンセルする ことになる。  FIG. 18 is a flowchart of the instruction control of the third mode branch prediction instruction control unit 42-3 in FIG. In FIG. 18, first, an instruction is issued with the same ID in step S1. If it is determined in step S2 that a branch error has occurred along with execution of a branch instruction among the instructions issued in step S2, step S3 is executed. Issue a command in the correct direction with a different ID. Subsequently, in step S4, it is checked whether a branch miss occurs by executing a branch instruction that is older than the branch instruction that caused the first branch miss, and if an old branch miss occurs, the first step in step S5 is performed. The resource including the speculative failure instruction and reorder buffer issued in the correct direction for the branch error of the above is canceled. Subsequently, in step S6, an instruction in the correct direction for the branch miss that occurred for the old branch instruction is issued with the same ID as in step S3. Subsequently, in step S7, it is determined whether or not all the instructions before the old branch miss have been completed.When all the instructions have been completed, in step S8, the speculatively failed instruction issued erroneously due to the branch miss and its You have to cancel resources.
図 1 9は、 図 4のプロセッサ 1 0に設けている分岐予測命令制御部 4 2の第 4 実施形態となる第 4モード分岐予測命令制御部 4 2— 4のブロック図である。 こ の実施形態にあっては、 第 1命令制御部 6 8、 第 2命令制御部 7 0及び第 3命令 制御部 7 2— 4を備えており、 第 1命令制御部 6 8及び第 2命令制御部 7 0は図 7の第 1実施形態と同じになる。 これに対し第 3命令制御部 7 2— 4は、 分岐予 測による投機的命令実行で最初に分岐ミスが検出された後、 分岐ミスに対し正し い方向に発行した命令列の中の新しい分岐命令について、 2回目の分岐ミスが検 出された場合の命令制御を行うことを特徴とする。  FIG. 19 is a block diagram of a fourth mode branch prediction instruction control unit 42-4 which is the fourth embodiment of the branch prediction instruction control unit 42 provided in the processor 10 of FIG. In this embodiment, a first command control unit 68, a second command control unit 70, and a third command control unit 72-4 are provided, and a first command control unit 68 and a second command control unit 72 are provided. The control unit 70 is the same as in the first embodiment in FIG. On the other hand, the third instruction control unit 72-4 performs a new instruction in the instruction sequence issued in the correct direction for the branch error after the branch error is first detected in the speculative instruction execution by the branch prediction. It is characterized by performing instruction control when a second branch error is detected for a branch instruction.
図 2 0は、 図 1 9の第 4モード分岐予測命令制御部 4 2— 4の制御動作の説明 図である。 図 2 0 (A) は第 1命令制御部 6 8による分岐命令 B 2, B 4 , B 8 を含む命令を発行して、 分岐命令については分岐予測により投機的に命令を実行 しており、 分岐命令 B 4のアウトオーダーによる実行に伴い分岐ミス 8 0が検出 されると、 図 2 0 (B ) のように第 2命令制御部 7 0によって誤って発行してし まった命令 5〜命令 1 1の後ろに続いて、 正しい方向の命令 5 0, 5 1を別の I D = lを付けて発行する。 次に図 2 0 (C) のように、 I D = 1をつけて正しい 方向に発行した命令 5 0〜5 3に含まれる分岐命令 B 5 2の実行に伴って分岐ミ ス 9 2が検出されると、 第 3命令制御部 7 2— 4は図 2 0 (D) のように分岐ミ ス 9 2が検出された分岐命令 B 5 2以前の命令が全て完了するのを待って、 後続 する全ての命令 5 2 , 5 3をキャンセルするキャンセル処理 9 4を行い、 その後 に図 2 0 (E)のように分岐ミス 9 0による正しい方向の命令 6 0 , 6 1 , 6 2 · · · の発行を開始する。 FIG. 20 is an explanatory diagram of the control operation of the fourth mode branch prediction instruction control unit 42-4 in FIG. In FIG. 20 (A), the first instruction control unit 68 issues an instruction including a branch instruction B2, B4, and B8, and the branch instruction is executed speculatively by branch prediction. Out-of-order execution of branch instruction B4 detects branch miss 80 Then, as shown in FIG. 20 (B), instructions 5 to 5 which are erroneously issued by the second instruction control unit 70 are followed by instructions 5 to 5 after instructions 11 to 11. With another ID = l. Next, as shown in Fig. 20 (C), the branch miss 92 is detected along with the execution of the branch instruction B52 included in the instructions 50 to 53 issued in the correct direction with ID = 1. Then, as shown in FIG. 20 (D), the third instruction control unit 72-4 waits until all the instructions before the branch instruction B52 where the branch miss 92 has been detected are completed, and then proceeds. Cancel processing 94 is performed to cancel all instructions 5 2 and 5 3, and then instructions 60 0, 61 1 and 62 2 in the correct direction due to branch mistake 90 as shown in Figure 20 (E). Start issuing.
図 2 1は、 図 2 0の命令制御に対応したタイミングチヤ一トである。 図 2 1に おいて、 時刻 t 1で分岐命令 B 4の実行に伴い、 分岐ミス 8 0が検出されると、 時刻 t 2で I D = 1をつけて正しい方向の命令 5 0〜5 3の発行を開始する。 そ の後、 時刻 t 3で正しい方向に発行した命令の中の分岐命令 5 2 Bの発行に伴い 分岐ミス 9 0が検出されると、 時刻 t 4で分岐ミス 9 2が検出された分岐命令 B 5 2以前の命令が全て完了するのを待ち、 完了後の時刻 t 5で分岐ミス 9 2によ り正しい方向となる命令 6 0, 6 1, 6 2の発行を開始する。  FIG. 21 is a timing chart corresponding to the instruction control of FIG. In FIG. 21, when a branch miss 80 is detected along with the execution of the branch instruction B4 at time t1, an ID = 1 is added at time t2, and instructions 50 to 53 in the correct direction are added. Start issuing. After that, when a branch miss 90 is detected along with the issuance of the branch instruction 52B in the instruction issued in the correct direction at the time t3, the branch instruction 92 where the branch miss 92 is detected at the time t4. Wait for all instructions before B52 to complete, and at time t5 after completion, start issuing instructions 60, 61, and 62 in the correct direction due to branch miss 92.
図 2 2は、 図 1 9の第 4モード分岐予測命令制御部 4 2— 4の命令制御のフ口 一チヤ一卜である。 図 2 2において、 まずステップ S 1で同一 I Dを付して命令 を発行し、 発行した命令の中の分岐命令の実行に伴い、 ステップ S 2で分岐ミス 発生が検知されると、 ステップ S 3で別の I Dを付して正しい方向の命令を誤つ て発行した命令の後ろに続いて発行する。 続いてステップ S 4でステップ S 2で 検出した分岐ミスに対し、 正しい方向に発行している命令内の分岐命令の実行に 伴い、 分岐ミスの発生が判別されると、 ステップ S 5で新しい分岐ミスの分岐命 令以前の命令が全て完了したか否かチェックしておいる。 命令完了を判別すると ステップ S 6で 2回目の分岐ミスにより誤って発行してしまったことになる全て の投機失敗命令及び資源をキャンセルした後、 ステップ S 7で正しい方向の命令 発行を開始する。  FIG. 22 is a flowchart of the instruction control of the fourth mode branch prediction instruction control unit 42-4 in FIG. In FIG. 22, first, an instruction is issued with the same ID in step S 1, and if a branch error is detected in step S 2 along with execution of a branch instruction among the issued instructions, step S 3 A different ID is assigned to the instruction in the right direction, and the instruction in the correct direction is issued after the instruction issued incorrectly. Subsequently, in step S4, in response to the execution of a branch instruction in the instruction issued in the correct direction with respect to the branch error detected in step S2, if the occurrence of a branch error is determined, a new branch is determined in step S5. It is checked whether all instructions before the branch instruction for the miss have been completed. When it is determined that the instruction has been completed, all speculative failure instructions and resources that were erroneously issued due to the second branch error in step S6 are cancelled, and then instruction issuance in the correct direction is started in step S7.
図 2 3は、 図 4のプロセッサ 1 0に設けている分岐命令予測制御部 4 2の第 5 実施形態となる第 5モード分岐予測命令制御部 4 2 - 5のプロック図である。 こ W FIG. 23 is a block diagram of a fifth mode branch prediction instruction control unit 42-5 serving as the fifth embodiment of the branch instruction prediction control unit 42 provided in the processor 10 of FIG. This W
25 の実施形態にあっては第 1命令制御部 68、 第 2命令制御部 70、 第 3命令制御 部 72— 5及び第 4命令制御部 74— 5を備えており、 第 1命令制御部 68及び 第 2命令制御部 70は図 7の第 1実施形態と同じである。 一方、 第 3命令制御部 72-5及び第 4命令制御部 74— 5は、 図 15の第 3モード分岐予測命令制御 部 42— 3の場合と同様、 最初に分岐予測を検出した後、 正しい方向に発行した 命令内で 2回目の分岐ミスが検出された場合の命令制御を行うことを特徴とする。 図 24は、図 23の第 5モード分岐予測命令制御部 42-5の制御動作である。 図 24 (A) は第 1命令制御部 68で発行した分岐命令 B 2, B4, B 8を含む 命令において、分岐命令 B 4の実行に伴い分岐ミス 80が検出された場合であり、 分岐ミス 80が検出されると図 24 (B) のように誤って発行してしまった命令 5〜命令 11に続いて、 正しい方向の命令 50, 51を別の I D= 1をつけて発 行する。 次に図 24 (C) のよ に正しい方向に発行した命令 50〜 53の中の 分岐命令 B 52の実行に伴い分岐ミス 92が検出されたすると、 図 2 '3の第 3命 令制御部 72一 5が分岐ミス 92の検出に基づき、 分岐ミス 92に対する正しい 方向の命令 (命令 60, 61, 62 · · · ) の発行を抑止した状態で、 分岐ミス 80が検出された古い方の分岐命令 B 4以前の命令 1〜B 4が全て完了するのを 待ってをキャンセルするキャンセル処理 96を行ってから、 図 24 (E) のよう に分岐ミス 92による正しい方向の命令 60, 61, 62 · · 'の発行を開始す る。 続いて、 図 23の第 4命令制御部 74— 5が図 24 (F) のように新しい分 岐命令 B 52以前の命令が全て完了するのを待って、 分岐ミス 92の検出により 発行された命令 52, 53をキャンセルするキャンセル処理 97を行ってから、 分岐ミス 92による正しい方向の命令 60, 61, 62に続く命令発行を再開す る。 この図 24の第 5実施形態における命令制御と図 20の第 4実施形態におけ る同じ分岐ミス 80, 92が検出された際の命令制御を対比してみると、 図 24 の第 5実施形態にあっては、 図 24 (D) で古い分岐ミス 80が検出された分岐 命令 B 4以前の命令を全て完了した時点で分岐命令 B 4にっき分岐予測で誤って 発行してしまった命令 5〜命令 11を削除するキャンセル処理 96を行った後に、 図 24 (E) のように分岐ミス 92に対する正しい方向の命令 60, 61, 62 を発行しており、 正しい方向の命令 60, 61, 62の発行タイミングが図 20 に比べ早まっており、 従って、 図 2 4の第 5実施形態の方が命令の処理性能を向 上することができる。 尚、 図 2 4の命令制御にあっては、 2つの I Dを使用する 場合を例にとっているが、 3つの I Dを使用可能とした場合には、 I Dが枯渴す るまで待ち合わせをせずに命令発行を行い、 I Dが枯渴した段階で I D開放を待 つようにしても良い。 即ち、 図 2 4 (D) で分岐ミス 9 2による正しい方向の命 令発行を抑止せず、 段階で I D == 2を付けて正しい方向の命令 6 0 , 6 1の発行 を開始する。 In the twenty-fifth embodiment, a first instruction control unit 68, a second instruction control unit 70, a third instruction control unit 72-5, and a fourth instruction control unit 74-5 are provided. The second command control unit 70 is the same as that of the first embodiment shown in FIG. On the other hand, the third instruction control unit 72-5 and the fourth instruction control unit 74-5 detect the correct branch after first detecting the branch prediction as in the case of the third mode branch prediction instruction control unit 42-3 in FIG. It is characterized by performing instruction control when the second branch error is detected in the instruction issued in the direction. FIG. 24 shows the control operation of the fifth mode branch prediction instruction control unit 42-5 in FIG. FIG. 24 (A) shows a case where an instruction including the branch instructions B2, B4, and B8 issued by the first instruction control unit 68 detects a branch miss 80 along with the execution of the branch instruction B4. When 80 is detected, instructions 50 and 51 in the correct direction are issued with another ID = 1, following instructions 5 to 11 that were issued incorrectly as shown in FIG. 24 (B). Next, as shown in FIG. 24 (C), if a branch miss 92 is detected upon execution of the branch instruction B52 in the instructions 50 to 53 issued in the correct direction, the third instruction control unit in FIG. 72-5 is based on detection of branch miss 92, and in the state where the issuance of instructions (instructions 60, 61, 62, ...) in the correct direction for branch miss 92 is suppressed, and the older branch where branch miss 80 is detected After canceling all the instructions 1 to B4 before the instruction 1 to B4 are completed, cancel processing 96 is performed, and then instructions 60, 61, and 62 in the correct direction due to a branch error 92 as shown in FIG. · · Start issuing '. Subsequently, the fourth instruction control unit 74-5 in FIG. 23 waits until all instructions before the new branch instruction B 52 have completed as shown in FIG. 24 (F), and is issued upon detection of a branch miss 92. After cancel processing 97 for canceling instructions 52 and 53 is performed, instruction issuance following instructions 60, 61 and 62 in the correct direction due to branch mistake 92 is resumed. A comparison between the instruction control in the fifth embodiment shown in FIG. 24 and the instruction control performed when the same branch mistakes 80 and 92 are detected in the fourth embodiment shown in FIG. 20 shows that the fifth embodiment shown in FIG. In Figure 24 (D), when the old branch miss 80 is detected in the branch instruction B4, all the instructions before the branch instruction B4 have been completed. After executing the cancel process 96 to delete the instruction 11, the instructions 60, 61, and 62 in the correct direction for the branch mistake 92 are issued as shown in FIG. 24 (E), and the instructions 60, 61, and 62 in the correct direction are issued. Issuance timing is Figure 20 Therefore, the fifth embodiment of FIG. 24 can improve the instruction processing performance. In the instruction control of Fig. 24, the case where two IDs are used is taken as an example, but if three IDs are made available, there is no need to wait until the IDs expire. It is also possible to issue an instruction and wait for ID release when the ID expires. That is, in FIG. 24 (D), the issuing of instructions in the correct direction due to the branch mistake 92 is not suppressed, and the issuing of instructions 60 and 61 in the correct direction is started at the stage with ID == 2.
図 2 5は、 図 2 4の命令制御に対応したタイミングチャートである。 図 2 5に おいて、 時刻 t 1で分岐命令 B 4のァゥトォブオーダーによる実行に伴い分岐ミ ス 8 0が検出されると、 時刻 t 2で正しい方向の命令 5 0〜 5 3の発行を別の I D == 1をつけて開始する。 その後、 正しい方向に発行した命令 5 0〜 5 3の中の 分岐命令 B 5 2の実行に伴い分岐ミス 9 2が検出されると、 最初の分岐ミス 8 0 が検出された分岐命令 B 4以前の命令が全てが完了した後の時刻 t 4で、 分岐命 令 B 4の分岐予測で誤って発行してしまった命令 5〜命令 1 1をキャンセルする。 次に時刻 t 5で分岐ミス 9 2に対する正しい方向の命令 6 0 , 6 1 , 6 2の発行 を既に解放された I D = 0を付けて開始する。 その後、 時刻 t 6で分岐ミス 9 2 に対応した分岐命令 B 5 2以前の命令が全て完了すると、 分岐命令 B 5 2の分岐 予測で誤って発行してしまった命令 5 2, 5 3をキャンセルする。 この図 2 5の 第 5実施形態のタイミングチヤ一トを図 2 1の第 4実施形態のタイミングチヤ一 卜と参照してみると、 分岐ミス 9 2に対する正しい方向の命令 6 0, 6 1, 6 2 の発行タイミングが図 2 5の第 5実施形態の方が早くなつており、 その分、 命令 の処理性能を向上することができる。  FIG. 25 is a timing chart corresponding to the instruction control of FIG. In FIG. 25, when a branch miss 80 is detected at the time t1 due to the execution of the branch instruction B4 according to the fault order, the instructions 50 to 53 in the correct direction are issued at the time t2. Start with another ID == 1. After that, when a branch miss 92 is detected along with the execution of the branch instruction B52 in the instructions 50 to 53 issued in the correct direction, the branch instruction B4 before the first branch miss 80 is detected. At time t4 after all of these instructions have been completed, instructions 5 to 11 that were issued by mistake in the branch prediction of branch instruction B4 are cancelled. Next, at time t5, the issuance of instructions 60, 61, and 62 in the correct direction for the branch miss 92 is started with the already released ID = 0. After that, at time t6, when all the instructions before the branch instruction B52 corresponding to the branch miss 92 are completed, the instructions 52, 53 that were erroneously issued in the branch prediction of the branch instruction B52 are canceled. I do. Referring to the timing chart of the fifth embodiment in FIG. 25 as the timing chart of the fourth embodiment in FIG. 21, instructions 60, 61, and The issue timing of 62 is earlier in the fifth embodiment of FIG. 25, and the processing performance of the instruction can be improved accordingly.
図 2 6は、 図 2 3の第 5分岐予測命令制御部 4 2— 5の命令制御のフローチヤ ートである。 図 2 6において、 ステップ S 1で同一 I Dを付して命令を発行し、 ステップ S 2で分岐命令の実行に伴い分岐ミスの発生が判別されると、 ステップ S 3で別の I Dを付して正しい方向の命令を誤って発行してしまった命令の後ろ に続いて発行する。 このステップ S 1〜S 3の処理が図 2 3の第 1命令制御部 6 8及び第 2命令制御部 7 0の処理である。 次に第 3命令制御部 7 2— 5によりス テツプ S 4で正しい方向に発行している命令内の分岐命令の実行に伴い、 2回目 の分岐ミスの発生が判別されると、 ステップ S 5に進み、 正しい方向の命令の発 行を抑止した状態で、 古い方の分岐命令以前の命令が全て完了するのをステップ S 5で判別すると、 ステップ S 6に進んで古い分岐命令によって誤って発行して しまった命令をキャンセルした後に抑止を解除して新しい分岐ミスに対する正し い方向の命令発行を開始する。 続いて第 4命令制御部 7 4— 5により新しい分岐 ミスの以前の命令が完了したか否かステップ S 7で判別し、 命令の完了を判別す るとステップ S 8で新しい分岐ミスの検出前に誤って発行されてしまった命令を ステップ S 8でキャンセルしてから、 ステップ S 9で正しい方向の命令発行を開 始する。 FIG. 26 is a flowchart of instruction control of the fifth branch prediction instruction control unit 42-5 in FIG. In FIG. 26, in step S1, an instruction is issued with the same ID, and in step S2, if it is determined that a branch error has occurred due to execution of a branch instruction, another ID is assigned in step S3. The instruction in the right direction is issued after the instruction that was issued by mistake. The processing of steps S1 to S3 is the processing of the first command control unit 68 and the second command control unit 70 in FIG. Next, with the execution of the branch instruction in the instruction issued in the correct direction in step S4 by the third instruction control unit 72-5, the second instruction When it is determined that a branch error has occurred, the process proceeds to step S5, where it is determined in step S5 that all instructions before the old branch instruction are completed in a state where the issuance of instructions in the correct direction is suppressed. Proceeding to step S6, cancel the instruction erroneously issued by the old branch instruction, release the inhibition, and start issuing the instruction in the correct direction for the new branch miss. Subsequently, the fourth instruction control section 7 4-5 determines in step S7 whether or not the previous instruction of the new branch miss has been completed. In step S8, the instruction issued by mistake in step S8 is canceled, and then in step S9, the instruction is issued in the correct direction.
図 2 7は、 図 4のプロセッサ 1 0の分岐予測命令制御部 4 2のフローチャート であり、 図 7〜図 2 5で説明した第 1モード〜第 5モード分岐予測命令制御を全 て一体化した分岐予測命令制御のフローチャートである。 図 2 7において、 ステ ップ S 1〜 S 3は第 1命令制御部 6 8及び第 2命令制御部 7 0の処理であり、 ス テツプ S 1で同一 I Dを付した命令を発行中にステップ S 2で分岐命令の実行に 伴い分岐ミスの発生が判別されると、 ステップ S 3で誤って発行してしまった命 令の後ろに別の I Dを付して正しい方向の命令を発行する。 続いてステップ S 4 で分岐ミス以前の命令全て完了したか否かをチェックしており、 分岐ミス以前の 命令が全て完了するとステツプ S 7に進み第 1モードの分岐予測命令制御を実行 する。 このステツプ S 7の第 1モード分岐予測命令制御の処理内容は図 3 0のス テツプ S 5, S 6の処理となる。 ステップ S 4で分岐ミス以前の命令が全て完了 していない場合には、 ステップ S 5で 2回目の分岐ミスの発生をチェックしてお り、 2回目の分岐ミスの発生を判別すると、 ステップ S 6で 2回目の分岐ミスが 最初の分岐ミスより古い分岐ミスか否か判別する。 古い分岐ミスであった場合に はステツプ S 8に進み第 2モードあるいは第 3モードの分岐予測命令制御を行う。 ステップ S 8で行う第 2モードの分岐予測命令制御は図 3 3のステップ S 5〜S 7の処理である。 またステップ S 8の第 3モードの分岐予測命令制御は図 3 6の ステップ S 5〜S 8の処理である。 一方、 ステップ S 6で最初の分岐ミスより古 い分岐ミスで無かった場合には、 ステップ S 2の分岐ミスにより正しい方向に発 行している命令の中の分岐命令の実行に伴う新しい分岐ミスであることから、 ス テツプ S 9に進み第 4モードあるいは第 5モードの分岐予測命令制御を行う。 こ のステップ S 9の第 4モードの分岐予測命令制御は図 3 9のステップ S 5〜S 7 の処理となる。 また図 2 7のステツプ S 9の第 5モードの分岐予測命令制御は図 2 6のステップ S 5〜S 9の処理となる。 FIG. 27 is a flowchart of the branch prediction instruction control unit 42 of the processor 10 of FIG. 4, and the first to fifth mode branch prediction instruction controls described in FIGS. 7 to 25 are all integrated. It is a flowchart of branch prediction instruction control. In FIG. 27, steps S1 to S3 are the processing of the first instruction control unit 68 and the second instruction control unit 70, and are executed while issuing the instruction with the same ID in step S1. If it is determined in step S2 that a branch error has occurred during execution of the branch instruction, an instruction in the correct direction is issued by attaching another ID to the instruction issued in error in step S3. Subsequently, it is checked in step S4 whether all instructions before the branch miss have been completed. When all the instructions before the branch miss have been completed, the process proceeds to step S7 to execute the first mode branch prediction instruction control. The processing contents of the first mode branch prediction instruction control in step S7 are the processing in steps S5 and S6 in FIG. If all instructions before the branch miss have not been completed in step S4, the occurrence of the second branch miss is checked in step S5. In step 6, it is determined whether the second branch miss is older than the first branch miss. If there is an old branch miss, the flow advances to step S8 to perform the second mode or third mode branch prediction instruction control. The second mode branch predictive instruction control performed in step S8 is the processing of steps S5 to S7 in FIG. The branch prediction instruction control in the third mode in step S8 is the processing in steps S5 to S8 in FIG. On the other hand, if there is no branch miss older than the first branch miss in step S6, a new branch miss due to execution of a branch instruction among instructions issued in the correct direction due to a branch miss in step S2. Because Proceeding to step S9, the control of the fourth or fifth mode branch prediction instruction is performed. The branch prediction instruction control of the fourth mode in step S9 is the processing of steps S5 to S7 in FIG. The control of the branch prediction instruction in the fifth mode in step S9 in FIG. 27 is the processing in steps S5 to S9 in FIG.
_ このように本発明は第 1モード〜第 5モードのいずれかのモードの分岐予測命 令制御を行っても良いし、 第 1モ一ドに対し、 第 2モードまたは第 3モードのい ずれか一方と、 第 4モードまたは第 5モードのいずれか一方を加えた組み合わせ の制御としても良い。  As described above, the present invention may perform the branch prediction instruction control in any one of the first to fifth modes, and may perform either the second mode or the third mode with respect to the first mode. The control may be a combination of any one of the fourth mode and the fifth mode.
次に図 4のプロセッサ 1 0に設けている例外発生命令制御部 4 4について説明 する。 例外発生命令制御部 4 4の実施形態としては、 図 2 8の第 1モ一ド例外発 生命令制御部 4 4 _ 1、 図 3 1の第 2モード例外発生制御部 4 4— 2、 図 3 4の 第 3モード例外発生命令制御部 4 4一 3、 図 3 7の第 4モ一ド例外発生命令制御 部 4 4一 4及び図 4 0の第 5モード例外発生命令制御部 4 4— 5がある。 これら 第 1モード、 第 2モード、 第 3モード、 第 4モード及び第 5モードの各例外発生 命令制御部 4 4一 1〜4 4— 5は、 既に説明した分岐予測命令制御部 4 2の具体 的な実施形態である第 1モード、 第 2モード、 第 3モード、 第 4モード及び第 5 モ一ド分岐予測命令制御部 4 2 _ 1〜4 2— 5のそれぞれの処理における分岐ミ スの検出を例外発生に置き換えたものに相当し、 分岐ミスの場合には分岐ミスが 検出された分岐命令に続く投機失敗命令をキャンセルしているが、 例外発生の場 合には例外発生命令自身を含めて投機失敗命令をキヤンセルする点が相違する。 そこで例外発生について簡単に説明すると次のようになる。 図 2 8の第 1モ一 ド例外発生命令制御部 4 4一 1は、 第 1命令制御部 9 8、 第 2命令制御部 1 0 0 及び第 3命令制御部 1 0 2— 1を持つ。  Next, the exception occurrence instruction control unit 44 provided in the processor 10 of FIG. 4 will be described. As an embodiment of the exception generation instruction control unit 44, the first mode exception generation instruction control unit 44_1 in FIG. 28, the second mode exception generation control unit 44-2 in FIG. 31, and FIG. 3 4 3rd mode exception generation instruction control unit 4 4 3 13, 4 th mode exception generation instruction control unit 4 4 in FIG. 7 4 and 5th mode exception generation instruction control unit 4 4 in FIG. There are five. Each of the first mode, second mode, third mode, fourth mode, and fifth mode exception occurrence instruction control unit 441-1 to 44-4-5 is a specific example of the branch prediction instruction control unit 42 already described. Of the branch miss in the processing of each of the first mode, the second mode, the third mode, the fourth mode, and the fifth mode branch prediction instruction control unit 42_1 to 42-5 which are typical embodiments. This is equivalent to replacing the detection with the occurrence of an exception.In the case of a branch miss, the speculative failure instruction following the branch instruction in which the branch miss was detected is cancelled. The difference is that the speculation failure instruction is canceled. The following briefly describes the occurrence of an exception. The first mode exception occurrence instruction control unit 4411 in FIG. 28 includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102-1.
図 2 9は、図 2 8の第 1モード例外発生制御部 4 4 - 1の命令制御動作であり、 図 2 9 (A) の I D = 0を付して発行していた命令 1〜1 0について、 命令 4で 例外 1 0 5が発生すると、 例外発生なしとして発行してしまった命令 5〜命令 1 1の後ろに続けて別の I D = 1を付して例外処理ルーチンの命令 5 0, 5 1を発 行する。 次に図 2 9 ( C) のように、 例外発生命令 4より前の 1〜3の全てが完 了すると、 投機失敗命令 5〜命令 1 1をキヤンセルするキヤンセル処理 1 0 8を 行った後、 例外処理ルーチンの命令発行を再開する。 FIG. 29 shows the instruction control operation of the first mode exception occurrence control unit 44-1 of FIG. 28, and the instructions 1 to 10 issued with ID = 0 in FIG. 29 (A). When the exception 105 occurs in the instruction 4, if the instruction 5 to the instruction 11 issued as no exception occurs and another ID = 1 is added after the instruction 50, the instruction 50, 5 Issue 1. Next, as shown in Fig. 29 (C), when all of the steps 1 to 3 before the exception generation instruction 4 are completed, the cancellation processing 1 08 for canceling the speculation failure instruction 5 to the instruction 11 is executed. After that, issue of the exception handling routine is resumed.
図 3 0は、 第 1モード例外発生命令制御のフローチャートである。 ステップ S 1で同一の I Dを付して命令を発行しており、 ステップ S 2である命令の実行に より例外発生が判別されると、 ステップ S 3で投機的失敗命令の後ろに続いて別 の I Dを付して例外処理ルーチンの命令を発行する。 次にステップ S 4で例外発 生より前の命令が全て完了したことを判別すると、 ステップ S 5で例外発生無し として発行してしまった投機失敗命令及びその資源をキャンセルした後、 ステツ プ S 6で例外処理ルーチンの命令発行を再開する。  FIG. 30 is a flowchart of the first mode exception occurrence instruction control. The instruction is issued with the same ID in step S1, and if the execution of the instruction in step S2 determines that an exception has occurred, another instruction follows the speculative failure instruction in step S3. Issue an exception handling routine instruction with the ID of Next, if it is determined in step S4 that all the instructions before the occurrence of the exception have been completed, the speculative failure instruction and the resources issued in step S5 that have been issued as having no exception have been canceled. The instruction issuance of the exception handling routine is restarted.
図 3 1は、 第 2モ一ド例外発生命令制御部 4 4一 2のブロック図であり、 第 1 命令制御部 9 8、第 2命令制御部 1 0 0及び第 3命令制御部 1 0 2— 2を備える。 図 3 2は、 第 2モード例外発生命令制御部 4 4 - 2の制御動作である。 まず図 3 2 (A) で I D = 0を付して発行した命令 1〜命令 1 1の中の命令 4の実行に より、 例外 1 0 6が発生したとすると、 図 3 2 (B ) のように例外発生なしとし て発行していた投機的失敗命令 5〜命令 1 1の後ろに続いて別の I D = 1を付し て例外処理ルーチンの命令 5 0 , 5 1を発行する。 次に図 3 2 ( C) で例外 1 0 6が発生した命令 4より古い命令 2の実行に伴い例外 1 1 0が発生したとすると、 図 3 2 (D)のように古い命令 2の例外 1 1 0より前の命令 1が完了した時点で、 例外 1 1 0が発生した命令 2を含む後続する命令 2〜命令 5 1を全てキャンセル するキャンセル処理 1 1 2を行った後、 図 3 2 (E) のように例外処理ルーチン の命令 6 0 , 6 1 , 6 2 · · ·の発行を開始する。  FIG. 31 is a block diagram of the second mode exception occurrence instruction control unit 44, and includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102. — Equipped with 2. FIG. 32 shows the control operation of the second mode exception generating instruction control unit 44-2. First, assuming that exception 1 106 is generated by execution of instruction 4 of instructions 1 to 11 issued with ID = 0 in Fig. 32 (A), Speculatively failed instructions 5 to 11 issued without exception as described above are followed by another ID = 1, followed by instructions 50 and 51 of the exception handling routine. Next, assuming that the execution of instruction 2 that is older than instruction 4 that caused exception 106 in Figure 32 (C) causes exception 110 to occur with the execution of instruction 2, and the exception for instruction 2 that is older than instruction 4 as shown in Figure 32 (D) When instruction 1 before 1 1 0 is completed, cancel processing 1 1 2 is performed to cancel all subsequent instructions 2 to 51 including instruction 2 where exception 1 1 0 occurred. As shown in (E), issuance of instructions 60, 61, 62,... Of the exception handling routine is started.
図 3 3は、 第 2モード例外発生命令制御のフローチャートである。 図 3 3にお いて、 ステップ S 1で同一の I Dを付して命令を発行し、 ステップ S 2である命 令の実行に伴い例外が発生がすると、 ステップ S 3で例外なしとして誤って発行 してしまった命令の後ろに続いて、 例外処理ルーチンの命令を別の I Dを付して 発行する。 次にステップ S 4で最初の例外発生より古い命令について例外が発生 したか否かチェックしており、 古い命令について例外が発生すると、 ステップ S 5古い例外発生の命令より前の命令が全て完了したか否かを判別し、 完了したな らばステツプ S 6で例外発生となつた古い命令を含む全ての投機失敗命令及びそ の資源をキャンセルした後、 ステップ S 7で例外処理ル一チンの命令発行を開始 する。 FIG. 33 is a flowchart of the second mode exception generation instruction control. In Fig. 33, in step S1, an instruction is issued with the same ID, and if an exception occurs during execution of the instruction in step S2, it is erroneously issued as no exception in step S3. Issue an exception handling routine instruction with a different ID after the instruction that has been executed. Next, in step S4, it is checked whether an exception has occurred for an instruction older than the first exception occurrence.If an exception occurs for the old instruction, step S5 has completed all instructions before the old exception occurrence instruction. Then, if completed, cancel all speculative failure instructions including the old instruction that caused an exception and its resources in step S6, and then execute the exception handling routine in step S7. Start issuing I do.
図 3 4は、 第 3モード例外発生命令制御部 4 4一 3のブロック図であり、 第 1 命令制御部 9 8、 第 2命令制御部 1 0 0、 第 3命令制御部 1 0 2— 3及び第 4命 令制御部 1 0 4— 3備える。  FIG. 34 is a block diagram of the third mode exception occurrence instruction control unit 44-13. The first instruction control unit 98, the second instruction control unit 100, and the third instruction control unit 102-3 And the fourth instruction control unit 104-3.
図 3 5は、 図 3 4の第 3モード例外発生命令制御部 4 4一 3の命令制御の説明 図である。 図 3 5 (A) のように I D = 0を付して発行した命令 1〜命令 1 1の 中の命令 4の実行に伴い例外 1 0 6が発生すると、 図 3 5 (B ) のように命令 4 に対し例外発生なしとして発行した投機的失敗命令 5〜命令 1 1の後ろに続いて 例外処理ルーチンの命令 5 0 , 5 1を別の I D = 1を付して発行する。 続いて図 3 5 ( C) のように例外 1 0 6が発生した命令 4より古い命令 2の実行に伴い、 例外 1 1 0が発生したとすると、 図 3 5 (D) のように例外 1 0 6の発生に対す る命令処理ルーチンで発行した命令 5 0 , 5 1をキヤンセルするキャンセル処理 1 1 4を行った後、 図 3 5 (E) で例外 1 1 0の例外処理ル一チンの命令 6 0, 6 1を発行する。 そして図 3 5 ( F ) で古い例外 1 1 0の命令 2より前の命令 1 が完了した後に、 例外 1 1 0を発生した命令 2を含む投機的失敗命令 3〜命令 1 1をキャンセルするキャンセル処理 1 1 6を行った後、 例外 1 1 0の例外処理ル 一チンによる命令 6 0 , 6 1に続く命令発行を再開する。  FIG. 35 is an explanatory diagram of the instruction control of the third mode exception occurrence instruction control unit 44-13 in FIG. As shown in Fig. 35 (B), when exception 1 06 occurs with execution of instruction 4 among instructions 1 to 11 issued with ID = 0 as shown in Fig. 35 (A), Speculatively failed instructions 5 to 11 issued as no exception to instruction 4 are followed by instructions 50 and 51 of the exception handling routine with another ID = 1. Then, as shown in Figure 35 (C), if exception 1 110 occurs with the execution of instruction 2 that is older than instruction 4 where exception 106 occurs, as shown in Figure 35 (D), exception 1 After performing cancel processing 1 1 4 to cancel instructions 50 and 51 issued in the instruction processing routine for the occurrence of 06, the exception processing routine of exception 1 1 0 is shown in Figure 35 (E). Issue instructions 60 and 61. And in Figure 35 (F), after the instruction 1 before the instruction 1 of the old exception 1 1 0 is completed, the speculative failure instruction 3 to the instruction 11 including the instruction 2 that generated the exception 1 1 0 are canceled. After the processing 1 16 has been performed, the issuance of the instruction following the instructions 60 and 61 by the exception handling routine of the exception 110 is restarted.
図 3 6は、 第 3モード例外発生命令制御のフローチャートである。 図 3 6にお いて、 ステップ S 1で同一の I Dを付して命令を発行し、 この命令の中でステツ プ S 2'で例外が発生がすると、 ステップ S 3で例外発生命令に続く例外発生なし として誤って発行してしまった投機的失敗命令の後ろに I Dを付して例外処理ル 一チンの命令を発行する。 次にステップ S 4で最初の例外発生より古い命令で例 外が発生したか否か判別しており、 古い例外が発生あると、 ステップ S 5で最初 の例外発生に対する例外処理ルーチンで発行した投機失敗命令及びその資源をキ ヤンセルした後、 ステップ S 6で古い例外発生に対する例外処理ルーチンの命令 をステップ S 3と同じ I Dを付して発行する。 続いてステップ S 7で古い例外発 生より前の命令全てが完了したことを判別すると、 ステップ S 8で古い例外発生 の命令を含め、 例外無しとして発行してしまつた投機的失敗命令及び資源をキヤ ンセルした後、 例外処理ルーチンの命令発行を再開する。 図 3 7は第 4モード例外発生命令制御部 4 4一 4のブロック図であり、 第 1命 令制御部 9 8、 第 2命令制御部 1 0 0及び第 3命令制御部 1 0 2— 4を備える。 図 3 8は、第 4モード例外発生命令制御部 4 4 - 4の命令制御の説明図である。 図 3 8において、 まず図 3 8 (A) のように命令 1〜命令 1 1を発行した後に、 命令 4の実行に伴い例外 1 0 6が発生すると、 図 3 8 (B ) のように例外発生な しとして発行してしまった投機的失敗命令 5〜命令 1 1の後ろに例外 1 0 6の例 外処理ルーチンの命令 5 0, 5 1を別の I D = 1を付して発行する。 続いて図 3 8 (C) のように例外 1 0 6に対する例外処理ルーチンで発行した命令 5 0, 5 1, 5 2 , 5 3の内、 命令 5 1の実行に伴い、 2回目の例外 1 1 6が発生したと すると、 図 3 8 (D) のように例外 1 1 6が発生した命令 5 0及び命令 5 1を例 外発生無しとして発行してしまった投機的失敗命令 5 2 , 5 3をキャンセルする キャンセル処理 1 1 8を行った後、 図 3 8 (E) のように例外 1 1 6による例外 処理ルーチンの命令 6 0 , 6 1, 6 2 · · ·の発行を再開する。 FIG. 36 is a flowchart of the third mode exception generation instruction control. In FIG. 36, an instruction is issued with the same ID in step S1, and if an exception occurs in step S2 'in this instruction, an exception follows the instruction in step S3 in step S3. Issue an exception handling routine with an ID attached after the speculatively failed instruction erroneously issued as no occurrence. Next, in step S4, it is determined whether an exception has occurred in an instruction older than the first exception occurrence, and if an old exception has occurred, in step S5, the speculation issued in the exception handling routine for the first exception occurrence is performed. After canceling the failed instruction and its resources, the instruction of the exception handling routine for the occurrence of the old exception is issued in step S6 with the same ID as in step S3. Subsequently, when it is determined in step S7 that all instructions before the old exception have occurred are completed, in step S8, the speculatively failed instructions and resources issued as no exceptions, including the instruction with the old exception, are deleted. After canceling, issue of the exception handling routine is resumed. FIG. 37 is a block diagram of the fourth mode exception occurrence instruction control unit 44 14, and includes a first instruction control unit 98, a second instruction control unit 100, and a third instruction control unit 102 4. Is provided. FIG. 38 is an explanatory diagram of instruction control of the fourth mode exception occurrence instruction control unit 44-4. In Fig. 38, first, after issuing instructions 1 to 11 as shown in Fig. 38 (A), if an exception 106 occurs with execution of instruction 4, the exception as shown in Fig. 38 (B) Issue the speculatively failed instructions 5 to 11 issued without occurrence, and issue instructions 50 and 51 of the exception handling routine of exception exception 106 with a different ID = 1. Next, as shown in Figure 38 (C), of instructions 50, 51, 52, and 53 issued in the exception handling routine for exception 106, the second exception 1 Assuming that 16 has occurred, as shown in Fig. 38 (D), the speculatively failed instructions 52, 5 that issued the instruction 50 and instruction 51 in which exception 1 16 occurred without exceptions Cancel 3 Cancel processing 1 18 is performed, and then the issuance of instructions 60, 61, 62, ... of the exception handling routine due to exception 1 16 as shown in Fig. 38 (E) is resumed.
図 3 9は、 第 4モード例外発生命令制御のフローチヤ一トである。 図 3 9にお いて、 ステップ S_ 1で同一の I Dを付して命令を発行し、 ステップ S 2である命 令の実行に伴い例外が発生が判別されると、 ステップ S 3で例外が発生した命令 について例外発生なしとして誤つて発行してしまつた投機的失敗命令の後ろに別 の I Dを付して例外処理ルーチンの命令を発行する。 続いてステップ S 4で例外 処理ルーチンにより発行している命令の中のある命令の実行に伴い、 2回目の命 令が発生することが判別されると、 ステップ S 5で新しい例外発生より前の命令 が全て完了したことを判別した場合、 ステップ S 6に進み新しい例外発生となつ た命令を含むこれに後続する全ての投機的失敗命令及びその資源をキャンセルし た後、 ステップ S 7で新しい例外発生に伴う例外処理ルーチンの命令発行を再開 する。  FIG. 39 is a flowchart of the fourth mode exception generation instruction control. In FIG. 39, an instruction is issued with the same ID in step S_1, and if it is determined that an exception occurs due to execution of the instruction in step S2, an exception occurs in step S3. An instruction for the exception handling routine is issued with a different ID after the speculatively failed instruction that was erroneously issued as no exception occurred. Subsequently, in step S4, if it is determined that the second instruction is to be generated in accordance with the execution of one of the instructions issued by the exception handling routine, the process proceeds to step S5. If it is determined that all the instructions have been completed, the process proceeds to step S6, and all subsequent speculative failure instructions including the instruction that caused the new exception and its resources are canceled, and then a new exception is generated in step S7. Resumes the issuance of an instruction in the exception handling routine when the error occurs.
図 4 0は、 第 5モード例外発生命令制御部 4 4 - 5のプロック図である。 第 1 命令制御部 9 8、 第 2命令制御部 1 0 0、 第 3命令制御部 1 0 2— 5及び第 4命 令制御部 1 0 4— 5を備える。  FIG. 40 is a block diagram of the fifth mode exception occurrence instruction control unit 44-5. A first instruction control unit 98, a second instruction control unit 100, a third instruction control unit 102-5, and a fourth instruction control unit 104-5 are provided.
図 4 1は、第 5モ一ド例外発生命令制御部 4 4 - 5の命令制御の説明図である。 図 4 1 (A) のように I D == 0を付して発行した命令 1〜命令 1 1の中の命令 4 の実行に伴い例外 106が発生すると、 図 41 (B) のように、 例外 106の発 生により命令 4に続いて例外発生なとして発行してしまつた投機的失敗命令 5〜 命令 11の後ろに続いて別の I D=1を付して例外処理ルーチンの命令 50, 5 1を発行する。 続いて図 41 (C) のように例外処理ルーチンで発行している命 令 50〜 54の中の命令 52の実行に伴い、 2回目の例外 116が発生したとす ると、 図 41 (D) のように古い方の例外 106が発生した命令 4より前の命令 1〜 3の全ての実行完了を待って例外発生命令 4に続く投機的失敗命令 5〜 11 をキャンセルするキャンセル処理 120を行う。 続いて図 41 (E) のように 2 回目の新しい例外 116によって投機的失敗命令となった命令 53, 54の後ろ に続いて、 キャンセル処理 120で解放された I D=0を付して例外 116の例 外処理ルーチンの命令 60, 61, 62 · · ·の発行を開始する。 最終的に図 4 1 (F)のように新しい例外 1 16が発生した命令 52より前の全ての命令 50, 51の完了を待って、 例外 116が発生した命令 52及びこれに続く投機的失敗 命令 53, 54をキャンセルするキャンセル処理 122を行った後、 例外処理ル —チンとなる命令 60, 61, 62 · · ·に続く命令発行を再開する。 尚、 図 4 1の命令制御にあっては、 2つの I Dを使用する場合を例にとっているが、 3つ の I Dを使用可能とした場合には、 I Dが枯渴するまで待ち合わせをせずに命令 発行を行い、 I Dが枯渴した段階で I D開放を待つようにしても良い。 即ち、 図 41 (D) で例外 1 16の発生による正しい方向の命令発行を抑止せず、 この段 階で I D= 2を付けて正しい方向の命令 60, 61, 62の発行を開始する。 図 42は、 第 5モード例外発生命令制御のフローチャートである。 図 42にお いて、 ステップ S 1で同一の I Dを付して命令を発行し、 ステップ S 2でその中 である命令の実行に伴い例外が発生すると、 ステップ S 3で例外命令に続く投機 的失敗命令の後ろに続いて別の I Dを付して例外処理ル一チンの命令を発行する。 次にステップ S 4で例外処理ル一チンにより発行している命令内である命令の実 行に伴い例外が発生すると、 ステップ S 5で例外処理ルーチンによる命令発行を 抑止した状態で古い例外発生となった命令より前の命令が全て完了したか否か判 別する。 この命令完了を判別すると、 ステップ S 6で例外発生命令及びこれに続 く投機的失敗命令及びその資源をキャンセルし、 新しい例外に発生に伴う例外処 理ルーチンの命令発行を開始する。 続いてステップ S 7で新しい例外発生となつ た命令より前の命令が全て完了したかをチヱックしており、 命令完了を判別する とステップ S 8で新しい例外発生を起こした命令を含むこれに続く投機失敗命令 及びその資源をキャンセルした後、 ステップ S 9で新しい例外発生に伴う例外処 理ルーチンの命令発行を再開する。 FIG. 41 is an explanatory diagram of the instruction control of the fifth mode exception occurrence instruction control unit 44-5. Instructions 1 to 11 issued with ID == 0 as shown in Figure 41 (A) As shown in Figure 41 (B), when an exception 106 occurs due to the execution of the instruction, the speculative failure instructions 5 to 11 issued after the occurrence of the exception 106 following the instruction 4 as having no exception have occurred. Subsequently, instructions 50 and 51 of the exception handling routine are issued with another ID = 1. Next, as shown in FIG. 41 (C), if the second exception 116 occurs with the execution of the instruction 52 in the instructions 50 to 54 issued in the exception handling routine, as shown in FIG. 41 (D) ), And waits for the completion of all executions of instructions 1 to 3 before instruction 4 in which the older exception 106 occurred, and then cancels the speculative failure instructions 5 to 11 following the exception generation instruction 4. . Next, as shown in Fig. 41 (E), following the instructions 53 and 54 that became speculative failure instructions due to the second new exception 116, the exception 116 with ID = 0 released in the cancel processing 120 is added. Start issuing the instructions 60, 61, 62 · · · of the exception handling routine. Eventually, as shown in Figure 41 (F), after waiting for the completion of all instructions 50 and 51 before the instruction 52 where the new exception 1 16 has occurred, the instruction 52 where the exception 116 has occurred and the speculative failure following it After executing the cancel process 122 for canceling the instructions 53 and 54, the instruction issuance is resumed following the instructions 60, 61, 62 · · · which become the exception routine. In the instruction control shown in Fig. 41, the case where two IDs are used is taken as an example, but if three IDs are made available, there is no need to wait until the IDs expire. It is also possible to issue an instruction and wait for ID release when the ID expires. That is, in FIG. 41 (D), the issuance of instructions in the correct direction due to the occurrence of the exception 116 is not suppressed, and the issuance of instructions 60, 61, and 62 in the correct direction is started at this stage with ID = 2. FIG. 42 is a flowchart of the fifth mode exception generation instruction control. In FIG. 42, in step S1, an instruction is issued with the same ID, and in step S2, if an exception occurs due to execution of an instruction in the instruction, a speculative operation following the exception instruction is performed in step S3. An exception handling routine instruction is issued with a different ID after the failed instruction. Next, in step S4, if an exception occurs due to the execution of an instruction in the instruction issued by the exception handling routine, in step S5 an old exception is generated with instruction issuance suppressed by the exception handling routine. Judge whether all instructions before the completed instruction have been completed. When the completion of this instruction is determined, the exception generating instruction and the speculative failure instruction and its resources are canceled in step S6, and the exception handling accompanying the occurrence of the new exception is performed. Of the logical routine is started. Subsequently, it is checked in step S7 whether all instructions preceding the instruction that caused the new exception have been completed.If it is determined that the instruction has been completed, the instruction including the instruction that caused the new exception in step S8 follows. After canceling the speculative failure instruction and its resources, in step S9, the instruction issuing of the exception handling routine accompanying the occurrence of a new exception is restarted.
図 4 3は、 図 4のプロセッサ 1 0に設けている例外発生命令制御部 4 4につい . て、 すでに説明した第 1モード、 第 2モード、 第 3モード、 第 4モード及び第 5 モ一ドの例外発生命令制御を全て一体化した例外発生命令制御のフローチヤ一ト である。 この図 4 3のフローチャートにあっては、 ステップ S 1で同一の I Dを 付して命令を発行し、 ステップ S 2である命令の実行により例外発生を判別する と、 ステップ S 3で別の I Dを付して例外処理ルーチンの命令を投機的失敗命令 の後ろに続いて発行する。 続いてステップ S 4で例外発生より前の命令が全て完 了したか否かチェックし、 完了を判別するとステップ S 7で第 1モードの例外発 生命令制御を実行する。 この第 1モードの例外発生命令制御は図 3 0のステツプ S 5, S 6の処理となる。 ステップ S 4で例外発生より前の命令が全て完了して いない場合には、 ステップ S 5で 2回目の例外発生をチェックしている。 2回目 の例外発生があるとステップ S 6に進み、 最初の例外発生より古い例外発生か否 かチェックする。 古い例外発生であればステップ S 8に進み、 第 2または第 3モ ―ドの例外発生命令制御を行う。 この場合の第 2モードの例外発生命令制御は図 3 3のステップ S 5〜S 7の処理となる。 また第 3モードの例外発生命令制御は 図 3 6のステップ S 5〜S 8の処理となる。 更にステップ S 6で最初の例外発生 より新しい例外発生であった場合にはステップ S 9に進み、 第 4または第 5モー ドの例外発生命令制御を行う。 この第 4モードの例外発生命令制御は図 3 9のス テツプ S 5〜S 7の処理となる。 また第 5モードの例外発生命令制御は図 4 2に おけるステップ S 5〜S 9の処理となる。  FIG. 43 shows the first mode, second mode, third mode, fourth mode, and fifth mode of the exception occurrence instruction control section 44 provided in the processor 10 of FIG. This is a flowchart of the exception generation instruction control in which all the exception generation instruction controls are integrated. In the flowchart of FIG. 43, in step S1, an instruction is issued with the same ID, and when the occurrence of an exception is determined by executing the instruction in step S2, another ID is determined in step S3. The instruction of the exception handling routine is issued following the speculative failure instruction. Subsequently, in step S4, it is checked whether or not all the instructions before the occurrence of the exception have been completed. When it is determined that the instruction has been completed, in step S7, control of the first mode exception occurrence instruction is executed. The exception generating instruction control in the first mode is the processing of steps S5 and S6 in FIG. If all instructions before the occurrence of the exception are not completed in step S4, the occurrence of the second exception is checked in step S5. If the second exception has occurred, the process proceeds to step S6, and it is checked whether the exception is older than the first exception. If an old exception has occurred, the process proceeds to step S8, and the second or third mode exception occurrence instruction control is performed. In this case, the exception generation instruction control in the second mode is the processing of steps S5 to S7 in FIG. The exception generation instruction control in the third mode is the processing of steps S5 to S8 in FIG. Further, if it is determined in step S6 that an exception is newer than the first exception, the flow advances to step S9 to control the fourth or fifth mode of the exception occurrence instruction. The exception generation instruction control in the fourth mode is the processing of steps S5 to S7 in FIG. The exception generation instruction control in the fifth mode is the processing of steps S5 to S9 in FIG.
尚、 上記の実施形態は投機的に実行される命令として分岐命令及び命令実行に 伴う例外発生を例にとるものであつたが、 これ以外の適宜の投機的命令について 本発明を適用することができる。  In the above embodiment, the branch instruction is executed as a speculatively executed instruction, and the exception occurrence accompanying the instruction execution is taken as an example. However, the present invention can be applied to other appropriate speculative instructions. it can.
また本発明は上記の実施形態に限定されず、 その目的と利点を損なうことのな い適宜の変形を含む。 更に本発明は上記の実施形態に示した数値による限定は受 けない。 産業上の利用可能性 Further, the present invention is not limited to the above embodiment, and does not impair its object and advantages. Including any appropriate modifications. Further, the present invention is not limited by the numerical values shown in the above embodiments. Industrial applicability
以上説明してきたように本発明によれば分岐予測に基づく投機的な命令実行の 際に、 分岐ミスが検出された場合に誤って発行してしまった投機的失敗命令のキ ャンセルを行って正しい方向の命令発行を再開する処理を高速且つ少ないハード ウェア資源上で実現することができ、 特にプロセッサの動作周波数が高周波化し た場合の性能向上に大きく寄与することができる。  As described above, according to the present invention, at the time of speculative instruction execution based on branch prediction, if a branch miss is detected, the speculatively failed instruction that has been erroneously issued is canceled and correct. The process of resuming instruction issue in the direction can be realized at high speed and with a small amount of hardware resources, and can greatly contribute to performance improvement particularly when the operating frequency of the processor is increased.
同様に命令の例外発生の際にも、 例外発生なしとして発行してしまった投機的 失敗命令のキャンセルと、 例外処理ルーチンによる命令発行を同様に高速且つ少 ないハードウェア量で実現することができ、 この場合にも動作周波数が高周波化 されたプロセッサにおける性能向上に大きく寄与することができる。  Similarly, when an instruction exception occurs, the speculatively failed instruction that was issued as having no exception can be canceled, and the instruction can be issued by the exception handling routine with a high speed and a small amount of hardware. In this case as well, it can greatly contribute to performance improvement in a processor whose operating frequency is increased.

Claims

請求の範囲 The scope of the claims
1 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1命令制御部と、 1. A first instruction control unit that issues an instruction including a branch instruction with a first identifier attached thereto and executes speculation by branch prediction,
分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて正しい 方向の命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that, when a branch miss is detected, issues an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記分岐以前の命令が全て完了した後に、 分岐予測により誤って発行してしま つた命令をキャンセルして正しい方向の命令発行を開始する第 3命令制御部と、 を備えたことを特徴とするプロセッサ。  And a third instruction control unit configured to cancel instructions erroneously issued by branch prediction and start issuing instructions in a correct direction after all instructions before the branch are completed. .
2 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1命令制御部と、 2. A first instruction control unit that issues an instruction including a branch instruction with a first identifier attached thereto and executes speculation by branch prediction,
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that, when the first branch error is detected, issues an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以 前の古い分岐命令で第 2の分岐ミスを検出した場合、 前記古い分岐命令以前の命 令が全て完了するのを待って、 後続する全ての命令をキャンセルしてから、 正し い方向の命令発行を開始する第 3命令制御部と、  After the first branch miss is detected and an instruction in the correct direction is issued, if a second branch miss is detected in an earlier old branch instruction, all instructions before the old branch instruction are completed. A third instruction control unit that cancels all subsequent instructions, and then starts issuing instructions in the correct direction;
を備えたことを特徴とするプロセッサ。 A processor comprising:
3 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1命令制御部と、 3. A first instruction control unit that issues an instruction including a branch instruction with a first identifier attached thereto and executes speculation by branch prediction,
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that, when the first branch error is detected, issues an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以 前の古い分岐命令で第 2の分岐ミスを検出した場合、 前記第 1の分岐ミスの検出 により正しい方向と判断して発行した命令をキャンセルした後に、 前記第 2の分 岐ミスの検出により判断した正しい方向の命令発行を開始する第 3命令制御部と、 前記第 2の分岐ミスが検出されて正しい方向の命令が発行された後に、 前記古 い分岐命令以前の命令が全て完了するのを待って、 前記第 2の分岐予測により誤 つて発行してしまつた命令をキヤンセルしてから、 正しい方向の命令発行を再開 する第 4命令制御部と、 After the first branch miss is detected and an instruction in the correct direction is issued, if a second branch miss is detected in an earlier older branch instruction, the correct direction is determined by the detection of the first branch miss. A third instruction control unit that starts issuing instructions in the correct direction determined by the detection of the second branch error after canceling the issued instruction that has been determined; and a correct instruction direction that is detected when the second branch error is detected. After the order was issued, the old A fourth instruction control unit that waits until all instructions before the next branch instruction are completed, cancels an instruction that has been erroneously issued by the second branch prediction, and then resumes issuing instructions in the correct direction. ,
を備えたことを特徴とするプロセッサ。 A processor comprising:
4. 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1命令制御部と、 4. a first instruction control unit that issues an instruction including a branch instruction with a first identifier attached thereto and executes speculation by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that, when the first branch error is detected, issues an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正し い方向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 前記新しい分岐命令以前の命令が全て完了するのを待って後続する全ての命令を キャンセルしてから、 正しい方向の命令発行を開始する第 3命令制御部と、 を備えたことを特徴とするプロセッサ。  After the first branch miss is detected and the instruction in the correct direction is started, if a second branch miss is detected in a new branch instruction in the instruction issued as the correct direction, A processor comprising: a third instruction control unit that waits until all instructions are completed, cancels all subsequent instructions, and then starts issuing instructions in a correct direction.
5 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1命令制御部と、 5. A first instruction control unit that issues an instruction including a branch instruction with a first identifier attached thereto and executes speculation by branch prediction,
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that, when the first branch error is detected, issues an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正し い方向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 正しい方向の命令発行を抑止した状態で、 前記第 1分岐ミスが検出された古い方 の分岐命令以前の命令が全て完了するのを待って、 前記古い分岐命令により誤つ て発行してしまつた命令をキヤンセルしてから、 前記抑止を解除して正しい方向 の命令発行を開始する第 3命令制御部と、  After the first branch miss is detected and the instruction is issued in the correct direction, if the second branch miss is detected in a new branch instruction in the instruction issued as the correct direction, the instruction is issued in the correct direction. In the suppressed state, after waiting for all instructions before the old branch instruction in which the first branch miss is detected to complete, cancel the instruction erroneously issued by the old branch instruction, and then cancel the instruction. A third instruction control unit that releases the inhibition and starts issuing instructions in the correct direction;
前記第 2の分岐ミスの検出による正しい方向の命令発行が開始された後に、 新 しい分岐命令以前の命令が全て完了するのを待って、 前記第 1の分岐予測の検出 により発行された命令をキャンセルしてから、 前記第 2の分岐ミスによる正しい 方向の命令発行を再開する第 4命令制御部と、 を備えたことを特徴とするプロセッサ。 After the issuance of the instruction in the correct direction due to the detection of the second branch miss, the instruction issued by the detection of the first branch prediction is waited until all instructions before the new branch instruction are completed. A fourth instruction control unit that cancels and then resumes issuing instructions in the correct direction due to the second branch error; A processor comprising:
6 . 請求の範囲 1乃至 5のプロセッサに於いて、 更に、 6. The processor of claims 1 to 5, further comprising:
命令が使用するレジス夕の番号で参照されるェントリに、 リネームに使用する リオーダバッファのアドレス格納領域と、 命令制御で添付する複数の識別子に対 応して複数の有効フラグ領域を備えたリネームマツプと、  A rename map that has an address storage area for the reorder buffer used for renaming, and a plurality of valid flag areas corresponding to a plurality of identifiers attached by instruction control, in the entry referenced by the register number used by the instruction. When,
命令が使用するレジスタをリオーダバッファを用いてリネームする際に、 レジ ス夕の番号で参照されるリネームマップのェントリに、 リネームに使用するリォ —ダバッファのァドレスを格納すると共に、 命令に添付される識別子に対応した 有効フラグをオンし、 分岐ミスを検出した際に、 誤って発行されてしまった命令 に添付した識別子に対応したリネームマップの有効フラグをオフし、 正しい方向 に発行した命令に添付される別の識別子に対応したリネームマップの有効フラグ をオンするリネーミング処理部と、  When a register used by an instruction is renamed using the reorder buffer, the address of the reorder buffer used for renaming is stored in the entry of the rename map referenced by the register number, and attached to the instruction. Turns on the valid flag corresponding to the identifier, and when a branch error is detected, turns off the valid flag of the rename map corresponding to the identifier attached to the instruction issued incorrectly, and attaches it to the instruction issued in the correct direction. A renaming processing unit for turning on a valid flag of a rename map corresponding to another identifier to be
を設け、 分岐ミスの検出により発行される正しい方向の命令が誤って発行されて しまった命令によるリネーム情報を使用することを防ぐことを特徴とするプロセ ッサ。 A processor for preventing an instruction in a correct direction issued by detection of a branch error from using rename information by an instruction issued by mistake.
7 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1ステップと、 7. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and executing speculation by branch prediction,
分岐ミスを検出した際に、 誤って発行してしまった命令の後ろに続けて正しい 方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, when a branch miss is detected, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記分岐以前の命令が全て完了した後に、 分岐予測により誤つて発行してしま つた命令をキャンセルして正しい方向の命令発行を開始する第 3ステップと、 を備えたことを特徴とするプロセッサの命令制御方法。  A third step of canceling an erroneously issued instruction by branch prediction and starting instruction issue in a correct direction after all instructions before the branch are completed. Control method.
8 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1ステップと、 8. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and executing speculation by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 前記第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以 前の古い分岐命令で第 2の分岐ミスを検出した場合、 前記古い分岐命令以前の命 令が全て完了するのを待って、 後続する全ての命令をキャンセルしてから、 正し い方向の命令発行を開始する第 3ステツプと、 When the first branch error is detected, the instruction in the correct direction follows the instruction issued in error and attaches the second identifier. After the first branch miss is detected and an instruction in the correct direction is issued, if a second branch miss is detected in an earlier old branch instruction, all instructions before the old branch instruction are completed. A third step to cancel all subsequent instructions, and then start issuing instructions in the correct direction;
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
9 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機実 行する第 1ステップと、 9. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and executing speculation by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch miss, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令が発行された後に、 それ以 前の古い分岐命令で第 2の分岐ミスを検出した場合、 前記第 1の分岐ミスの検出 により正しい方向と判断して発行した命令をキャンセルした後に、 前記第 2の分 岐ミスの検出により判断した正しい方向の命令発行を開始する第 3ステップと、 前記第 2の分岐ミスが検出されて正しい方向の命令が発行された後に、 前記古 ぃ分歧命令以前の命令が全て完了するのを待って、 前記第 2の分岐予測により誤 つて発行してしまつた命令をキヤンセルしてから、 正しい方向の命令発行を再開 する第 4ステップと、  After the first branch miss is detected and an instruction in the correct direction is issued, if a second branch miss is detected in an earlier older branch instruction, the correct direction is determined by the detection of the first branch miss. A third step of starting the issuance of the instruction in the correct direction determined by the detection of the second branch error after canceling the instruction issued and determined, and an instruction in the correct direction when the second branch error is detected. After the instruction is issued, the instruction before the old instruction is completed, and the instruction issued in error by the second branch prediction is canceled, and then the instruction is issued in the correct direction. The fourth step to resume,
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
1 0 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機 実行する第 1ステップと、 10. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステツプと、  A second step in which, when the first branch error is detected, an instruction in the correct direction is issued after the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正し い方向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 前記新しい分岐命令以前の命令が全て完了するのを待って後続する全ての命令を キャンセルしてから、 正しい方向の命令発行を開始する第 3ステップと、 を備えたことを特徴とするプロセッサの命令制御方法。 After the first branch miss is detected and the instruction in the correct direction is started, if a second branch miss is detected in a new branch instruction in the instruction issued as the correct direction, A third step of: waiting for all instructions to be completed, canceling all subsequent instructions, and then starting issuing instructions in the correct direction.
1 1 . 第 1識別子を添付して分岐命令を含む命令を発行し、 分岐予測により投機 実行する第 1ステップと、 1 1. A first step of issuing an instruction including a branch instruction with a first identifier attached thereto and performing speculative execution by branch prediction;
第 1の分岐ミスを検出した際に、 誤つて発行してしまつた命令の後ろに続けて 正しい方向の命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first branch miss, issuing an instruction in the correct direction following the instruction issued in error with a second identifier attached thereto;
前記第 1の分岐ミスが検出されて正しい方向の命令発行を開始した後に、 正し い方向として発行した命令内の新しい分岐命令で第 2の分岐ミスを検出した場合、 正しい方向の命令発行を抑止した状態で、 前記第 1分岐ミスが検出された古い方 の分岐命令以前の命令が全て完了するのを待つて、 前記古い分岐命令により誤つ て発行してしまった命令をキャンセルしてから、 前記抑止を解除して正しい方向 の命令発行を開始する第 3ステップと、  After the first branch miss is detected and the instruction is issued in the correct direction, if the second branch miss is detected with a new branch instruction in the instruction issued as the correct direction, the instruction is issued in the correct direction. In the suppressed state, wait until all instructions before the old branch instruction in which the first branch miss is detected are completed, and then cancel the instruction erroneously issued by the old branch instruction. A third step of releasing the suppression and starting instruction issue in the correct direction;
前記第 2の分岐ミスの検出による正しい方向の命令発行が開始された後に、 新 しい分岐命令以前の命令が全て完了するのを待って、 前記第 1の分岐予測の検出 により発行された命令をキャンセルしてから、 前記第 2の分岐ミスによる正しい 方向の命令発行を再開する第 4ステップと、  After the issuance of the instruction in the correct direction due to the detection of the second branch miss, the instruction issued by the detection of the first branch prediction is waited until all instructions before the new branch instruction are completed. A fourth step of resuming instruction issue in the correct direction due to the second branch error after canceling;
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
1 2 . 請求の範囲 7乃至 1 1のプロセッサの命令制御方法に於いて、 1 2. In the instruction control method for a processor according to any one of claims 7 to 11,
命令が使用するレジスタの番号で参照されるェントリに、 リネームに使用する リォ一ダバッファのアドレス格納領域と、 命令制御で添付する複数の識別子に対 応して複数の有効フラグ領域を備えたリネ一ムマツプを備えた場合、  A line which has an address storage area of a leader buffer used for renaming and a plurality of valid flag areas corresponding to a plurality of identifiers attached by instruction control in the entry referenced by the register number used by the instruction If you have a mumap,
命令が使用するレジスタをリオーダバッファを用いてリネームする際に、 レジ ス夕の番号で参照される前記リネームマップのエントリに、 リネームに使用する 前記リオーダバッファのアドレスを格納すると共に、 命令に添付される識別子に 対応した有効フラグをオンし、  When a register used by an instruction is renamed using a reorder buffer, an address of the reorder buffer used for renaming is stored in an entry of the rename map referred to by a register number, and is attached to the instruction. Turn on the valid flag corresponding to the identifier
分岐ミスを検出した際に、 誤って発行されてしまった命令に添付した識別子に 対応した前記リネームマップの有効フラグをオフし、 正しい方向に発行した命令 に添付される別の識別子に対応した前記リネームマップの有効フラグをオンする ことにより、 分岐ミスの検出により発行される正しい方向の命令が誤って発行されてしまつ た命令によるリネーム情報を使用することを防ぐことを特徴とするプロセッサの 命令制御方法。 When a branch mistake is detected, the valid flag of the rename map corresponding to the identifier attached to the instruction issued erroneously is turned off, and the identifier corresponding to another identifier attached to the instruction issued in the correct direction is turned off. By turning on the valid flag of the rename map, An instruction control method for a processor, comprising: preventing an instruction in a correct direction issued by detection of a branch miss from using rename information of an instruction issued by mistake.
1 3 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1命令制御部と、 1 3. A first instruction control unit that issues an instruction including an exception generating instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception;
例外発生を検出した際に、 例外発生なしとして誤つて発行してしまつた命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2命令 制御部と、  A second instruction control unit that, when an exception is detected, issues an instruction of an exception handling routine with a second identifier attached after an instruction that is erroneously issued as no exception is generated,
前記例外発生命令以前の命令が全て完了した後に、 例外発生命令及び例外発生 なしとして発生した命令をキャンセルして前記例外発生ルーチンの命令発行を開 始する第 3命令制御部とを備えたことを特徴とするプロセッサ。  And a third instruction control unit for canceling the exception generation instruction and the instruction generated as no exception generation and starting the instruction generation of the exception generation routine after all instructions before the exception generation instruction are completed. Features processor.
1 4. 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1命令制御部と、 1 4. A first instruction control unit which issues an instruction including an exception generating instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception;
第 1の例外発生を検出した際に、 例外発生なしとして誤つて発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that issues an instruction of an exception handling routine with a second identifier attached after an instruction that is erroneously issued as having no exception when the first exception is detected, and
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が 発行された後に、 それ以前の古い命令で第 2の例外発生を検出した場合、 前記古 い例外発生命令以前の命令が全て完了するのを待って例外発生命令及び後続する 全ての命令をキャンセルしてから、 前記第 2の例外発生による例外処理ルーチン の命令発行を開始する第 3命令制御部と、  After the first exception occurrence is detected and the instruction of the exception handling routine in the correct direction is issued, if an earlier old instruction detects the second exception occurrence, the instruction before the old exception occurrence instruction is returned. A third instruction control unit that waits until all of the above are completed, cancels the exception generation instruction and all subsequent instructions, and then starts issuing an instruction in an exception handling routine due to the second exception generation.
を備えたことを特徴とするプロセッサ。 A processor comprising:
1 5 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1命令制御部と、 15. A first instruction control unit that issues an instruction including an exception generating instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception.
第 1の例外発生を検出した際に、 例外発生なしとして誤つて発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2命令制御部と、 When the first exception is detected, the instruction of the exception handling routine is issued with the second identifier attached following the instruction that was erroneously issued as no exception occurred. 2 Command control unit,
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が 発行された後に、 それ以前の古い命令で第 2の例外発生を検出した場合、 前記第 1の例外発生の検出により発行した例外処理ルーチンの命令をキャンセルした後 に、 前記第 2の例外発生の検出により正しい方向となる例外処理ルーチンの命令 発行を開始する第 3命令制御部と、  After the first exception occurrence is detected and the instruction of the exception handling routine in the correct direction is issued, if the second exception occurrence is detected by an earlier instruction before that, the first exception occurrence is detected. After canceling the issued instruction of the exception handling routine, a third instruction control unit that starts issuing the instruction of the exception handling routine that is oriented in a correct direction by detecting the occurrence of the second exception,
前記第 2の例外発生が検出されて例外処理ルーチンの命令が発行された後に、 前記古い分岐命令以前の命令が全て完了するのを待って、 前記第 1の例外発生を 起こした命令及び該命令により例外発生なしとして誤つて発行してしまつた命令 をキャンセルしてから、 前記第 2の例外発生による例外処理ル一チンの命令発行 を再開する第 4命令制御部と、  After the second exception occurrence is detected and the instruction of the exception handling routine is issued, after waiting for all instructions before the old branch instruction to complete, the instruction causing the first exception occurrence and the instruction A fourth instruction control unit that cancels an instruction that is erroneously issued as no exception has occurred, and then resumes issuing instructions of the exception handling routine due to the second exception occurrence;
を備えたことを特徴とするプロセッサ。 A processor comprising:
1 6 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1命令制御部と、 1. A first instruction control unit which issues an instruction including an exception generating instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception;
第 1の例外発生を検出した際に、 例外発生なしとして誤って発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2命令制御部と、  A second instruction control unit that issues an instruction of an exception handling routine attached with a second identifier following the instruction that was erroneously issued as no exception when the first exception occurred, and
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発 行を開始した後に、 前記例外処理ルーチンにより発行した命令内の新しい命令で 第 2の例外発生を検出した場合、 前記新しい例外発生命令以前の命令が全て完了 するのを待つて例外発生命令及び後続する全ての命令をキャンセルしてから、 前 記第 1の例外発生による例外処理ルーチンの命令発行を開始する第 3命令制御部 と、  After starting the issuance of an exception handling routine in the correct direction by detecting the first exception occurrence, and detecting a second exception occurrence in a new instruction among the instructions issued by the exception handling routine, The third instruction that waits for all instructions before the new exception generation instruction to complete, cancels the exception generation instruction and all subsequent instructions, and then starts issuing the exception handling routine instruction when the first exception occurs. Control unit,
を備えたことを特徴とする命令制御方法。 An instruction control method, comprising:
1 7 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1命令制御部と、 1. A first instruction control unit that issues an instruction including an exception generating instruction with a first identifier attached thereto and executes the instruction speculatively without occurrence of an exception;
第 1の例外発生を検出した際に、 例外発生なしとして誤って発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2命令制御部と、 When the first exception occurred, it was incorrectly issued as no exception A second instruction control unit that issues the instruction of the exception handling routine with the second identifier attached thereto following the instruction;
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発 行を開始した後に、 前記例外処理ルーチンにより発行した命令内の新しい命令で 第 2の例外発生を検出した場合、 前記例外処理ルーチンの命令発行を抑止した状 態で、 前記第 1例外発生が検出された古い方の例外発生命令以前の命令が全て完 了するのを待つて、 前記古い例外発生命令及び該命令により例外発生なしとして 誤って発行してしまつた命令をキャンセルしてから、 前記抑止を解除して前記第 2の例外発生により正しい方向となる例外処理ルーチンの命令発行を開始する第 3命令制御部と、  After starting the issuance of an exception handling routine in the correct direction by detecting the first exception occurrence, and detecting a second exception occurrence in a new instruction among the instructions issued by the exception handling routine, In a state in which the issuance of the instruction of the exception handling routine is suppressed, the system waits for completion of all the instructions before the older exception occurrence instruction in which the first exception occurrence is detected, and then executes the old exception occurrence instruction and the instruction. A third instruction control unit for canceling the instruction erroneously issued as no exception has occurred, releasing the inhibition, and starting to issue an instruction of an exception handling routine which is oriented in a correct direction by the second exception occurrence; and ,
前記第 2の例外発生により例外処理ルーチンの命令が発行された後に、 新しい 例外発生命令以前の命令が全て完了するのを待って前記第 2の例外発生の命令及 び及び前記第 1の例外発生の例外処理ルーチンで発行された命令をキャンセルし てから、 前記第 2の例外発生による例外処理ルーチンの命令発行を再開する第 4 命令制御部と、  After the instruction of the exception handling routine is issued due to the second exception occurrence, the instruction of the second exception occurrence and the first exception occurrence are waited until all instructions before the new exception occurrence instruction are completed. A fourth instruction control unit that cancels the instruction issued in the exception handling routine of the second instruction, and then resumes issuing the instruction of the exception handling routine due to the occurrence of the second exception;
を備えたことを特徴とするプロセッサ。 A processor comprising:
1 8 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1ステツプと、 18. A first step of issuing an instruction including an exception generating instruction with a first identifier attached thereto and executing the instruction speculatively without occurrence of an exception;
例外発生を検出した際に、 例外発生なしとして誤って発行してしまった命令の 後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステ ップと、  A second step of, when an exception is detected, issuing an instruction of an exception handling routine with a second identifier attached after an instruction which is erroneously issued as no exception is generated,
前記例外発生命令以前の命令が全て完了した後に、 例外発生命令及び例外発生 なしとして発行してしまつた命令をキヤンセルして前記例外発生ルーチンの命令 発行を開始する第 3ステップと、  A third step of canceling the exception generating instruction and the instruction issued as no exception generation and starting the instruction generation of the exception generating routine after all instructions before the exception generating instruction are completed;
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
1 9 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 第 1の例外発生を検出した際に、 例外発生なしとして誤つて発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が 発行された後に、 それ以前の古い命令で第 2の例外発生を検出した場合、 前記古 い分岐命令以前の命令が全て完了するのを待って、 例外発生命令及び後続する全 ての命令をキャンセルしてから、 前記第 2の例外発生による例外処理ルーチンの 命令発行を開始する第 3ステツプと、 1 9. Attach the first identifier, issue the instruction including the instruction that caused the exception, and execute the instruction speculatively without exception. When detecting the occurrence of the first exception, the instruction of the exception handling routine is issued with the second identifier attached after the instruction that was erroneously issued as no exception occurred, and the first exception is generated. If the second exception is detected in the older instruction after the instruction of the exception handling routine in the correct direction has been issued and the previous instruction is issued, wait until all instructions before the old branch instruction have completed. A third step of canceling the exception generating instruction and all subsequent instructions, and then starting to issue an instruction in an exception handling routine based on the second exception generation;
を備えたことを特徵とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
2 0 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1ステップと、 20. A first step of issuing an instruction including an exception generating instruction with a first identifier attached thereto and executing the instruction speculatively without occurrence of an exception;
第 1の例外発生を検出した際に、 例外発生なしとして誤つて発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステップと、  A second step of, after detecting the first exception occurrence, issuing an instruction of an exception handling routine with a second identifier attached thereto following the instruction that was erroneously issued as no exception occurrence;
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令が 発行された後に、 それ以前のせい命令で第 2の例外発生を検出した場合、 前記第 1の例外発生の検出により発行した例外処理ルーチンの命令をキャンセルした後 に、 前記第 2の例外発生の検出により正しい方向となる例外処理ルーチンの命令 発行を開始する第 3ステップと、  After the first exception occurrence is detected and the instruction of the exception handling routine in the correct direction is issued, if a second exception occurrence is detected by an earlier fault instruction, the first exception occurrence is detected. A third step of, after canceling the issued instruction of the exception handling routine, starting to issue an instruction of the exception handling routine to be in a correct direction by detecting the occurrence of the second exception;
前記第 2の例外発生が検出されて例外処理ルーチンの命令が発行された後に、 前記古い分岐命令以前の命令が全て完了するのを待って、 前記第 1の例外発生を 起こした命令及び該命令により例外発生なしとして誤つて発行してしまつた命令 をキャンセルしてから、 前記第 2の例外発生による例外処理ルーチンの命令発行 を再開する第 4ステップと、  After the second exception occurrence is detected and the instruction of the exception handling routine is issued, after waiting for all instructions before the old branch instruction to complete, the instruction causing the first exception occurrence and the instruction A fourth step of canceling the instruction erroneously issued as no exception has occurred, and then restarting the issuance of the instruction of the exception handling routine due to the second exception occurrence;
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
2 1 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 第 1の例外発生を検出した際に、 例外発生なしとして誤って発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 2ステップと、 2 1. Attach the first identifier, issue the instruction including the instruction that caused the exception, and execute the instruction speculatively without exception. A second step of, after detecting the first exception occurrence, issuing an instruction of an exception handling routine attached with a second identifier following the instruction erroneously issued as no exception occurrence,
前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発 行を開始した後に、 前記例外処理ルーチンにより発行した命令内の新しい命令で 第 2の例外発生を検出した場合、 前記新しい例外発生命令以前の命令が全て完了 するのを待つて例外発生命令及び後続する全ての命令をキャンセルしてから、 前 記第 1の例外発生による例外処理ル一チンの命令発行を開始する第 3ステップと、 を備えたことを特徴とするプロセッザの命令制御方法。  After starting the issuance of an exception handling routine in the correct direction by detecting the first exception occurrence, and detecting a second exception occurrence in a new instruction among the instructions issued by the exception handling routine, Wait for all instructions before the new exception generation instruction to complete, cancel the exception generation instruction and all subsequent instructions, and then start issuing the exception handling routine for the first exception generation. An instruction control method for a processor, comprising: three steps:
2 2 . 第 1識別子を添付して例外発生命令を含む命令を発行し、 例外発生なしと して投機的に命令を実行する第 1ステップと、 2 2. A first step of issuing an instruction including an exception generating instruction with a first identifier attached thereto and executing the instruction speculatively without occurrence of an exception;
第 1の例外発生を検出した際に、 例外発生なしとして誤って発行してしまった 命令の後ろに続けて例外処理ルーチンの命令を第 2識別子を添付して発行する第 前記第 1の例外発生が検出されて正しい方向となる例外処理ルーチンの命令発 行を開始した後に、 前記例外処理ルーチンにより発行した命令内の新しい命令で 第 2の例外発生を検出した場合、 前記例外処理ルーチンの命令発行を抑止した状 態で、 前記第 1例外発生が検出された古い方の例外発生命令以前の命令が全て完 了するのを待って、 前記古い例外発生命令及び該命令により例外発生なしとして 誤って発行してしまった命令をキャンセルしてから、 前記抑止を解除して前記第 2の例外発生により正しい方向となる例外処理ルーチンの命令発行を開始する第 3ステップと、  When detecting the occurrence of the first exception, the instruction of the exception handling routine is issued with the second identifier attached after the instruction that was erroneously issued as no exception occurred. When the second exception is detected in a new instruction among the instructions issued by the exception handling routine after the instruction issuance of the exception handling routine in the correct direction is detected and the instruction issuance of the exception handling routine is started. In a state where the first exception occurrence is detected, the instruction before the old exception occurrence instruction in which the first exception occurrence is detected is completed. A third step of canceling the issued instruction, releasing the inhibition, and starting to issue an instruction of an exception handling routine that is in a correct direction due to the occurrence of the second exception;
前記第 2の例外発生により例外処理ル一チンの命令が発行された後に、 新しい 例外発生命令以前の命令が全て完了するのを待つて前記第 2の例外発生の命令及 び前記第 1の例外発生の例外処理ルーチンで発行された命令をキャンセルしてか ら、 前記第 2の例外発生による例外処理ルーチンの命令発行を再開する第 4ステ ップと、  After the instruction of the exception handling routine is issued due to the occurrence of the second exception, the instruction of the second exception and the first exception are waited until all instructions before the new exception occurrence instruction are completed. A fourth step of canceling the instruction issued in the generated exception handling routine and then restarting the issuance of the instruction in the exception handling routine due to the occurrence of the second exception;
を備えたことを特徴とするプロセッサの命令制御方法。 An instruction control method for a processor, comprising:
PCT/JP2002/010370 2002-10-04 2002-10-04 Processor and instruction control method WO2004031944A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2004541191A JP3807740B2 (en) 2002-10-04 2002-10-04 Processor and instruction control method
PCT/JP2002/010370 WO2004031944A1 (en) 2002-10-04 2002-10-04 Processor and instruction control method
US11/028,338 US20050125634A1 (en) 2002-10-04 2005-01-04 Processor and instruction control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2002/010370 WO2004031944A1 (en) 2002-10-04 2002-10-04 Processor and instruction control method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US11/028,338 Continuation US20050125634A1 (en) 2002-10-04 2005-01-04 Processor and instruction control method

Publications (1)

Publication Number Publication Date
WO2004031944A1 true WO2004031944A1 (en) 2004-04-15

Family

ID=32051297

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2002/010370 WO2004031944A1 (en) 2002-10-04 2002-10-04 Processor and instruction control method

Country Status (2)

Country Link
JP (1) JP3807740B2 (en)
WO (1) WO2004031944A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2007097017A1 (en) * 2006-02-27 2009-07-09 富士通株式会社 Buffering device and buffering method
JP2019212127A (en) * 2018-06-06 2019-12-12 富士通株式会社 Calculation processor and control method of calculation processor
US10929137B2 (en) 2018-10-10 2021-02-23 Fujitsu Limited Arithmetic processing device and control method for arithmetic processing device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04220722A (en) * 1990-12-20 1992-08-11 Fujitsu Ltd Pipeline control system
US5524224A (en) * 1994-04-15 1996-06-04 International Business Machines Corporation System for speculatively executing instructions wherein mispredicted instruction is executed prior to completion of branch processing
US5644779A (en) * 1994-04-15 1997-07-01 International Business Machines Corporation Processing system and method of operation for concurrent processing of branch instructions with cancelling of processing of a branch instruction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04220722A (en) * 1990-12-20 1992-08-11 Fujitsu Ltd Pipeline control system
US5524224A (en) * 1994-04-15 1996-06-04 International Business Machines Corporation System for speculatively executing instructions wherein mispredicted instruction is executed prior to completion of branch processing
US5644779A (en) * 1994-04-15 1997-07-01 International Business Machines Corporation Processing system and method of operation for concurrent processing of branch instructions with cancelling of processing of a branch instruction

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2007097017A1 (en) * 2006-02-27 2009-07-09 富士通株式会社 Buffering device and buffering method
JP4779010B2 (en) * 2006-02-27 2011-09-21 富士通株式会社 Buffering device and buffering method
US8533368B2 (en) 2006-02-27 2013-09-10 Fujitsu Limited Buffering device and buffering method
JP2019212127A (en) * 2018-06-06 2019-12-12 富士通株式会社 Calculation processor and control method of calculation processor
JP7041353B2 (en) 2018-06-06 2022-03-24 富士通株式会社 Arithmetic processing unit and control method of arithmetic processing unit
US10929137B2 (en) 2018-10-10 2021-02-23 Fujitsu Limited Arithmetic processing device and control method for arithmetic processing device

Also Published As

Publication number Publication date
JPWO2004031944A1 (en) 2006-02-02
JP3807740B2 (en) 2006-08-09

Similar Documents

Publication Publication Date Title
US6553480B1 (en) System and method for managing the execution of instruction groups having multiple executable instructions
US7330963B2 (en) Resolving all previous potentially excepting architectural operations before issuing store architectural operation
US6301655B1 (en) Exception processing in asynchronous processor
JP3602840B2 (en) Speculative execution control apparatus and method for instruction
JP2015164048A (en) System and method in which conditional instructions unconditionally provide output
US20170109166A1 (en) Method and apparatus for recovery in a microprocessor having a multi-execution slice architecture
JP3154660B2 (en) Method and system for temporarily buffering condition register data
US7228403B2 (en) Method for handling 32 bit results for an out-of-order processor with a 64 bit architecture
US20170109171A1 (en) Method and apparatus for processing instructions in a microprocessor having a multi-execution slice architecture
US6061777A (en) Apparatus and method for reducing the number of rename registers required in the operation of a processor
US5860014A (en) Method and apparatus for improved recovery of processor state using history buffer
US20080244244A1 (en) Parallel instruction processing and operand integrity verification
KR100305935B1 (en) Data processing system and method for capturing history buffer data
WO2001048598A1 (en) Mechanism for handling failing load check instructions
JP2000322257A (en) Speculative execution control method for conditional branch instruction
US5870612A (en) Method and apparatus for condensed history buffer
US6934828B2 (en) Decoupling floating point linear address
JP3518510B2 (en) Reorder buffer management method and processor
JP3800533B2 (en) Program counter control method and processor
US10255071B2 (en) Method and apparatus for managing a speculative transaction in a processing unit
JP3807740B2 (en) Processor and instruction control method
EP0969358A2 (en) Information processing device and method for performing parallel processing
US20050125634A1 (en) Processor and instruction control method
US5784606A (en) Method and system in a superscalar data processing system for the efficient handling of exceptions
JP3854200B2 (en) Processor and instruction control method

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): JP US

WWE Wipo information: entry into national phase

Ref document number: 2004541191

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 11028338

Country of ref document: US