WO2007099605A1 - 圧縮したアドレス情報により分岐予測する処理装置 - Google Patents

圧縮したアドレス情報により分岐予測する処理装置 Download PDF

Info

Publication number
WO2007099605A1
WO2007099605A1 PCT/JP2006/303770 JP2006303770W WO2007099605A1 WO 2007099605 A1 WO2007099605 A1 WO 2007099605A1 JP 2006303770 W JP2006303770 W JP 2006303770W WO 2007099605 A1 WO2007099605 A1 WO 2007099605A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
instruction
branch
bit
bits
Prior art date
Application number
PCT/JP2006/303770
Other languages
English (en)
French (fr)
Inventor
Megumi Yokoi
Masaki Ukai
Takashi Suzuki
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 DE602006013515T priority Critical patent/DE602006013515D1/de
Priority to EP06714899A priority patent/EP1990714B1/en
Priority to JP2008502592A priority patent/JP5136405B2/ja
Priority to PCT/JP2006/303770 priority patent/WO2007099605A1/ja
Publication of WO2007099605A1 publication Critical patent/WO2007099605A1/ja
Priority to US12/195,738 priority patent/US7949862B2/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
    • G06F9/3806Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer
    • 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/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • G06F9/322Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
    • 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/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • G06F9/322Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
    • G06F9/324Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address using program counter relative addressing
    • 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

Definitions

  • the present invention relates to an information processing apparatus, and more particularly to an instruction processing apparatus.
  • a branch prediction mechanism of an information processing device manages the execution history of a branch instruction based on a memory address (hereinafter referred to as an instruction address) of a previously executed instruction in memory.
  • the branch destination is predicted when a branch instruction is executed at the time (for example, see Patent Document 1 below).
  • the branch prediction mechanism is also a set associative method in which the partial bit force of the instruction address (branch source address) of the branch instruction that has been fetched from the memory source in the past (V is fetched when the instruction is fetched) Determine the set of storage devices. Then, the branch prediction mechanism stores the branch destination address in one way in the set by using another bit part of the branch source address as a tag.
  • the branch prediction mechanism searches the storage device using the instruction address in the instruction fetch stage. If the branch destination address is stored in the storage device for a previously executed branch instruction, the branch prediction mechanism also obtains the branch destination address for the way force that matches the tag contents in the corresponding set. it can. In other words, in parallel with the fetching of an instruction, it is determined whether or not the instruction is a branch instruction (that is, the branch destination address is stored using the branch source instruction address as a tag). I was able to.
  • the information processing apparatus determines whether the instruction is a branch instruction in parallel with the instruction fetch by acquiring the address of the instruction currently being fetched, A predicted branch destination address can be obtained when the instruction is a branch instruction. Therefore, even when the information processing device is performing pipeline processing, it prepares an instruction foot in the next stage in parallel with the current instruction foot, which is predicted in advance. can do.
  • the branch destination obtained is the predicted branch destination. In this case, each stage can be operated in parallel without stopping the knock line processing.
  • the branch destination from which the instruction power currently being fetched is obtained does not reach the predicted branch destination, the correct branch destination instruction fetch is resumed. Even if the branch destination is not stored in the storage means corresponding to the instruction address of the branch instruction currently being fetched (the branch instruction is not hit but the branch instruction is executed), the branch is also executed. The prediction cannot be used, and the instruction fetch is resumed from the branch destination address obtained by decoding the branch instruction after the fetch.
  • a space for storing instructions is a 32-bit address space.
  • some address spaces have been expanded to 64 bits to accommodate the increased amount of data being processed.
  • the instruction space has been made 64-bit.
  • the upper 32 bits of the address are fixed in advance, and the instruction fetch is performed using the fixed upper 32 bits and the lower 32 bits of 4 Gbyte space. Then, if the 4G byte space is exceeded, the upper 32 bits can be redefined.
  • the upper 32 bits of the program counter are normally fixed.
  • the upper 32 bits are obtained again.
  • the instruction footing Z instruction execution pipeline being speculatively processed is completely cleared.
  • the program may not be scattered in the 64-bit virtual memory space. Then, even if the individual program is small, it is possible that the branch instruction frequently causes a branch exceeding the 32-bit 4G byte address.
  • Patent Document 1 JP 2004-38398 A
  • the speculative instruction fetch fails during the period until the upper 32 bits are redefined. For example, if there is a branch instruction exceeding 4 Gbytes, even if the lower 32 bits are correctly predicted by the branch prediction mechanism, the upper 32 bits remain old, and the prediction is incorrect.
  • the present invention employs the following means in order to solve the above problems. That is, the present invention repeats an execution cycle including at least an acquisition stage for acquiring an instruction from a storage source of instructions and an execution stage for processing the instruction, and acquires an instruction at the acquisition stage of such a computer. And an address control unit that determines an instruction address that is a storage source of an instruction acquired by the acquisition unit, and whether or not an instruction processed by the computer in the next instruction execution stage is a branch instruction.
  • a branch instruction prediction unit that predicts according to the history information of the instruction, and an execution unit that processes at least one of the acquired instructions in the execution stage, wherein the address control unit includes the instruction Included in the address A code part that generates upper address information obtained by compressing the upper bit part, and a restoration part that restores the upper bit part.
  • the branch instruction prediction unit includes upper address information and a lower bit part corresponding to a branch destination address of the processed branch instruction, and upper address information and a lower bit part corresponding to a storage instruction instruction address of the branch instruction. It is a processing apparatus having a history storage unit that stores the history information in any of a plurality of storage destinations determined.
  • upper address information, lower bit part and force corresponding to the branch destination address of the processed branch instruction, upper address information and lower bit partial force corresponding to the instruction address of the branch instruction storage source It is stored as history information in one of the determined storage locations.
  • the upper address information is information obtained by compressing the upper bit part. Therefore, even when the instruction address length is extended and the address space is increased, the information corresponding to the branch destination address can be efficiently managed by the compressed upper address information and the lower bit part.
  • processing an instruction means executing a predetermined process according to the instruction.For example, in the case of a conditional branch instruction, the branch to the branch destination based on the determination of the condition and the determination result is performed. Includes processing that branches or does not branch.
  • the encoding unit divides the upper bit part into a plurality of address ranges, and the first upper address information for identifying the divided first address ranges and the first address ranges other than Second address information for identifying an address range is generated, and the address control unit branches the branch destination address of the branch instruction to the first address range identified by the first higher address information.
  • a branch instruction that generates an upper bit portion corresponding to the first address range through the restoration unit and branches the branch instruction to an address range identified by the second upper address information. If it is an instruction, the upper bit part may be restored according to the type of branch instruction.
  • the upper bit portion is divided for each of a plurality of address ranges. If the branch destination address is the first address range identified by the first higher address information, the upper bit portion corresponding to the first address range is generated. On the other hand, the branch destination address is an address range identified by the second upper address information. In this case, the upper bit part is restored according to the type of branch instruction. For this reason, for example
  • the upper bit part corresponding to the address range can be effectively identified by configuring the address range with the first higher address information. Can be generated.
  • the address control unit receives a signal identifying the type of branch instruction from the execution unit. And when the branch instruction is a relative branch instruction that branches relative to the branch source address force with the range of the lower bit part as a limit, the branch instruction processing in the execution unit The range of the low-order bit part also receives the overflow information indicating that an overflow has occurred in the positive or negative direction, and the upper bit of the branch source address when the overflow has occurred. Since it has an arithmetic part that acquires the high-order bit part of the branch destination address by addition / subtraction to the part, it is a good idea.
  • the branch instruction is a branch instruction that branches to an address range identified by the second upper address information, and the branch instruction is limited to the range of the lower bit portion.
  • Branch source address force For a relative branch instruction that performs a relative branch, the upper bit part of the branch destination address can be obtained by addition / subtraction to the upper bit part of the branch source address. In other words, it is only necessary to detect overflow in the positive or negative direction from the range of the lower bit part and add or subtract the overflow from the upper bit part!
  • the address control unit is a calculation unit that calculates the branch destination of the branch instruction.
  • the branch instruction when the branch instruction is a branch instruction that branches to the address range identified by the second higher-order address information, and the branch instruction is not the relative branch instruction,
  • the upper bit part can no longer be obtained by adding or subtracting the overflow to the upper bit part.
  • the higher-order bit part of the branch destination address can be acquired from the arithmetic unit that calculated the branch destination.
  • FIG. 1 is a diagram showing an image of a process allocated to a 64-bit address space.
  • FIG. 2 is a diagram showing the definition of upper 32 bits definition code.
  • FIG. 3 is a system configuration diagram of a processing apparatus according to an embodiment of the present invention.
  • FIG. 4 is a diagram for explaining the configuration of each way constituting the set of branch history storage devices.
  • FIG. 5 is a diagram showing a detailed configuration of a processing apparatus.
  • FIG. 6 is a diagram showing a circuit configuration of an upper bit decoder.
  • FIG. 7 is a diagram showing a configuration of an upper bit encoder.
  • FIG. 8 is a diagram showing a processing sequence of an upper bit encoder.
  • FIG. 9 is a diagram showing a processing sequence of an upper bit decoder.
  • FIG. 10 is a diagram showing a branch destination restoration process.
  • FIG. 11 is a diagram showing a branch destination restoring process of a PC relative branch instruction.
  • the 64-bit address space was created in accordance with the convenience of 64-bit expansion of the data space, there is currently a bias in the addresses where instruction sequences are actually placed in the space. Therefore, using these biases, the upper 32 bits are represented by a small number of bits in a pseudo manner. In other words, a high-order address that frequently appears is anticipated, and a high-order address that appears frequently with a code using a small number of bits is expressed.
  • Frequent upper addresses may be fixedly determined by predicting the specifications of the OS, or may be dynamically set by providing an address frequency counter or the like.
  • FIG. 1 A 64-bit address space as shown in Fig. 1 is defined in recent OSs (see, for example, the reference “all of solaris internal kernel structure" (Pearson's Education) p. 13 8).
  • FIG. 1 is a diagram showing an image of a process allocated to a 64-bit address space.
  • the shaded area indicates the address area that cannot be used by any process.
  • the address space in general OS control, the address space (virtual dressless space) is prepared separately for the kernel and the user process.
  • the OS address space is a kernel mode address space ranging from 0000000: 000 00001 to 0000000: FFFFFF (where 0, 1, F, etc. are hexadecimal numbers, and so on.
  • 0000000: 000 00001 to 0000000: FFFFFFFF where 0, 1, F, etc. are hexadecimal numbers, and so on.
  • Areas after 0000001: 00000000 are a heap area and a cache area.
  • the text space in which the execution format is stored in the user space starts with 00000001: 0000000 force.
  • FFFFFFFF: 7FFFC000 force FFFFFFFF: 7F7F Up to 000, a stack area is provided.
  • FFFFFFFF: 7F7F000 force stores the library in the direction of decreasing address.
  • the OS kernel area has a high-order 32-bit power of 0x00000000.
  • FIG. 2 shows the definition of the code (hereinafter referred to as the upper 32 bits definition code).
  • the upper 32-bit definition code is 00 (b) (bit data is indicated by (b), and so on). If the upper 32-bit address is ⁇ , 0x00000001 ", the upper 32-bit definition code is 01 (b). If the upper 32-bit address is" OxFFFFFFFF ", the upper 32-bit definition code is 11 (b). In addition, when the upper 32 bits address is "other than the above, the upper 32 bits definition code is 10 (b).
  • the processing apparatus processes the branch prediction process with the lower 32-bit address + the upper 32-bit definition code of 2 bits.
  • branch prediction is executed with a total of 34 bits of pseudo addresses.
  • the upper 32-bit definition code is 00 (b), 01 (b), or 11 (b)
  • the upper 32-bit force S is fixed to 0x00000000, 0x00000001, and OxFFFFFF, respectively.
  • the conventional branch prediction method in the 32-bit range is applied as it is, that is, branch prediction with a 34-bit address is performed.
  • the upper 32-bit definition code is 10 (b)
  • the branch destination exceeds the range of the 32-bit address and the upper 32 bits are not one of the above three types. Taste. In that case, the upper 32-bit address is unknown. Therefore, the operation assuming that the upper 32 bits of the current PC is used as it is when the upper 32 bits definition code by branch prediction becomes 10, that is, the 32-bit prediction itself is performed.
  • the present processing device is within the range of each of the above three areas (the upper 32-bit address is defined by the upper 32-bit definition codes 00 (b), 01 (b), 11 (b). Address range), and branching between the above three areas, convert the conventional 32-bit branch prediction method into a 34-bit address (upper 32-bit definition code + lower 32-bit address) and apply be able to.
  • FIG. 3 is a system configuration diagram of the processing apparatus.
  • This processing apparatus is, for example, a so-called program built-in computer that reads and executes instructions stored in the main storage device 121.
  • the processing device includes an arithmetic unit 120 that executes instructions, a main storage device 121 that stores instructions executed by the arithmetic unit 120, data processed by the arithmetic unit 120, and the like. And a program counter 122 for designating an address on the main memory 121 of an instruction to be executed by the arithmetic unit 120.
  • a program counter 122 for designating an address on the main memory 121 of an instruction to be executed by the arithmetic unit 120.
  • FIG. 3 more specifically, from an instruction foot control unit 123 that controls the foot of an instruction based on an address generated by the program counter 122, and an instruction fetch control unit 123 that manages the instruction cache 102.
  • An instruction cache control unit 124 that fetches an instruction according to the instruction fetch request, an instruction buffer 125 that holds an instruction fetched from the instruction cache 102, a decoder 103 that decodes an instruction in the instruction buffer 125, and a decoded Reservation station that controls instruction execution timing (branch reservation station 126 that controls the execution of branch instructions and other reservation stations 127 that control the execution of register operation instructions and address operation instructions)
  • An instruction completion management unit 128 that monitors instruction execution completion, It has an operand cache 129 that supplies the operands of instructions executed in the unit 120 to the arithmetic unit 120 at high speed, and a data cache control unit 131 that manages the exchange of data between the main storage device 121 and the operand cache 129. /!
  • the branch prediction device 100 includes a branch history storage device 130 that stores a branch history of a branch instruction (see FIG. 5).
  • the branch history storage device 130 is a 4-way set associative storage device.
  • FIG. 4 is a diagram for explaining the configuration of each way configuring the set of the branch history storage device 130.
  • the branch history storage device 130 is a storage device such as SRAM that can be accessed at a relatively high speed.
  • the 4-way branch history storage unit 130 has four ways in one set. Has an entry corresponding to. As shown in FIG. 4, each entry includes a tag part TG and a data part DT.
  • the tag part TG consists of (part of) the instruction address TG1, the NORMAL flag V, the replacement flag scale, and other flags TG2.
  • the data part DT consists of a branch destination address DT1 as predetermined data.
  • One set is determined by a part of the instruction address output from the address generation unit 101 (for example, 15: 5>).
  • the address generation unit 101 since there are four ways, four entries are specified by determining the set.
  • one of the four entries is determined by the other part of the instruction address.
  • the instruction address TG1 includes the upper 32-bit definition code 1: 0> and a part of the instruction address (for example, 31:16>). Stored. For example, at the time of registration, a set is determined using part of the instruction address 15: 5>, and the remaining part is one of the entries in the set (one of the four entries corresponding to the four ways) It is stored as data in the tag part (including instruction address TG1).
  • the instruction address 31:16> means that the instruction address TG1 is part of the instruction address (for example, 32 bits) and the 31st bit is the 16th bit.
  • the upper 32 bits definition codes (00 (b), 01 (b), 11 (b), and One of 10 (b)) and a part of the lower 32-bit address 31:16> are used.
  • the nodal flag is a flag indicating whether the entry is valid or invalid. For example, if it is a NORMAL FLOWER, it indicates that the entry including the NORMAL flag is valid, and if the NORMAL flag is "0", it indicates that the entry including the valid flag is invalid.
  • the entry is valid means that the branch destination address, which is data registered in the way, is deleted.
  • the nodding flag is also used to select the way to be replaced.
  • the replace flag is a flag used for selecting a replacement target way.
  • the branch destination address stores the branch destination address of the branch instruction fetched from the cache memory 102 (or main storage device). In the present embodiment, details of the replacement flag and the valid flag processing are omitted.
  • the instruction address (the address on the main memory 121 where the instruction is stored) is sent to the instruction foot control unit 123.
  • the instruction fetch unit 123 instructs the instruction cache control unit 124 to acquire an instruction at the instruction address, and also instructs the branch prediction apparatus 100 to perform branch prediction. Then, in parallel with the instruction acquisition processing in the instruction cache 102, the branch history storage device 130 is searched in the branch prediction device 100.
  • the branch prediction apparatus 100 sends the branch destination address to the instruction fetch control unit 123.
  • the instruction foot control unit 123 further instructs the instruction cache control unit 124 to acquire the next instruction according to the branch destination address of the branch instruction hit in the branch prediction device 100. Forming a pipeline stage). If the branch prediction power S does not hit, the next instruction address is generated by the address adder 184 included in the instruction fetch control unit 123 without branching, and the next instruction is acquired. Command the command cache control unit 124.
  • the fetched and decoded instruction is not a branch instruction, it is queued for execution by the other reservation station 127 based on operand processing or the like. When the operands are ready, each instruction is executed by the arithmetic unit 120.
  • the branch reservation station 126 waits for the instruction. Then, when the branch destination address is determined by branch execution of the branch instruction, a completion report is sent from the branch reservation station 126 to the instruction completion management unit 128 and the branch prediction device 100.
  • the branch reservation station 126 determines whether or not the branch prediction is correct. That is, (al) the branch prediction device 100 hits the branch prediction power S at that instruction address (the branch destination address was stored in the branch history storage device 130), and (a2) the fetched branch instruction It can be seen that the branch prediction was correct when branching to the destination address. Alternatively, (bl) the branch predictor 100 does not hit at the instruction address, and (b2) the fetched instruction is a force that is not a branch instruction or a branch instruction. It can be seen that the branch prediction is correct when the power is divergent.
  • the instruction fetch that has already been requested to the cache control unit 124 may be continued as it is.
  • branch prediction If the branch prediction is correct, the instruction fetch that has already been requested to the cache control unit 124 and the subsequent series of processes will be interrupted. At the same time, the branch reservation station 126 instructs the instruction fetch control unit 123 to perform re-instruction fetch from the correct branch destination.
  • the branch prediction apparatus 100 stores the branch instruction executed via the selector 132 in the way.
  • processing an instruction means executing a predetermined process according to the instruction. For example, in the case of a conditional branch instruction, branching to a branch destination based on the determination of the condition and the determination result is not performed.
  • FIG. 5 is a diagram illustrating a detailed configuration of the processing apparatus according to the embodiment.
  • the program counter control device 122A (corresponding to the address control unit of the present invention)
  • the instruction foot control unit 123 (corresponding to the acquisition unit of the present invention)
  • the branch reservation station 126 The branch predicting device 100 (corresponding to the branch predicting unit of the present invention), the arithmetic unit counter address calculator 168, the arithmetic unit 167, and the executing unit of the present invention are clearly shown.
  • components of each part of the processing apparatus will be described.
  • the program counter controller 122A controls the calculation of the next value NPC151 of the program counter based on the current value PC152 of the program counter (or the execution result of the branch instruction).
  • the current value PC152 of the program counter is the upper 32-bit PC 63:32>
  • the lower 32 bits of the PC are shown separately as 31: 0>.
  • the current value (all bits) of the program counter is used.
  • next value NPC 151 of the program counter is divided into an upper 32-bit NPC 63:32> and a lower 32-bit NPC 31: 0>.
  • NPC152 refers to the next value of the program counter itself (all bits).
  • the overflow information of the branch destination address (hereinafter simply referred to as the overflow information) is whether the relative address to the branch destination exceeds the lower 32 bits when the PC relative branch instruction branches. It is information which shows.
  • branch instructions can be classified into PC relative address branch instructions and register indirect branch instructions.
  • the PC relative address branch instruction is a branch instruction having a relative branch address for the current program counter value as an operand.
  • the branch destination of the PC relative address branch instruction is the address obtained by adding the relative branch address to the current program counter value.
  • the relative branch address as an operand is in a range that can be described with a maximum of 32 bits. For this reason, when the PC relative address branch instruction branches, the upper 32 bits of the branch destination will be +1 at the maximum (a state overflowing in the positive direction) and a minimum of 1 (a state overflowing in the negative direction) .
  • the branch reservation station 126 sets a bit (+1 bit) indicating the overflow condition in the positive direction (+1 bit) and a bit (1 bit) indicating the overflow condition in the negative direction as the program counter. Notify controller 122A.
  • the program counter controller 122A that receives this signal corresponds to the overflow information receiver of the present invention.
  • the register indirect branch instruction is a branch instruction that designates a register number as an operand and uses an address stored in the designated register as a branch destination address.
  • Register Indirect branch instructions can specify the branch destination address within the bit width of the register, that is, in the range of 64 bits.
  • the program counter controller 122A has an upper bit decoder 150A.
  • the upper bit decoder 150A has a function of returning the upper 32 bit definition code to the original upper 32 bit address (the same applies to the upper bit decoder 150B).
  • the upper bit definition code is input from the branch reservation station 126. This is because the next branch destination is finally determined at the branch reservation station 126.
  • the buffer TGT-PC171 shown in the branch reservation station 126 stores the upper 32-bit definition code and the lower 32-bit address of the branch destination address where the instruction is decoded and the branch is determined. Yes.
  • the upper bit decoder 150A receives the upper 32 bit definition code of the determined branch destination address.
  • the decoder 150A of this embodiment always converts the upper 2-bit definition code into an upper 32-bit address. Furthermore, the next value of the program counter, NPC151, receives a notification from the instruction completion management unit 128 (see Fig. 3) that the execution completion of the branch instruction has been confirmed. Bit is set.
  • the program counter controller 122A receives the lower 32-bit TGT —PC 1: 0> of the branch destination address determined from the branch reservation station 126 and receives the program counter.
  • the lower 32 bits of the next value of NPC are set to 31: 0>. In this way, even if a branch instruction occurs, if the upper 32 bits of the branch destination address can be uniquely determined by the upper 32 bits definition code, the program counter must restore the address from the upper 32 bits definition code.
  • the branch destination address is set as positive. It will be.
  • the program counter controller 122A determines the range of addresses in which the branch destination by the branch instruction is uniquely defined by the upper 32-bit definition code. Is temporarily determined (the program counter control device 122A that executes this determination corresponds to the determination unit of the present invention). In this case, the branch destination address cannot be restored using the upper 32 bits definition code. In this embodiment, a method for restoring the branch destination address is selected according to the type of branch instruction.
  • the branch instruction is a PC relative branch instruction
  • a signal indicating that (for example, an HI signal) is sent from the relative branch computing unit 168 to the program counter controller 122 A through the line 191.
  • the program counter controller 122A reads the overflow information from the branch reservation station 126. Based on the overflow information, the upper 32 bits of the current value PC152 of the program counter are changed and the upper 32 bits of the branch destination address are generated.
  • FIG. 11 shows the flow of the branch destination restoration process of the PC relative branch instruction.
  • the program counter control unit 122A passes the upper 32 bits PC 63:32> of the current value of the program counter through the adder / subtractor 154 to 1 The added value is used as the upper 32 bits of the branch destination address (S193). If the overflow information is -1 (S194), the program counter controller 122A uses the adder / subtracter to subtract 1 from the upper 32 bits PC ⁇ 63:32> of the current value of the program counter. The upper 32 bits of the branch destination address (S195). If the overflow information is neither +1 nor -1, the program counter controller 122A sets the upper 32 bits of the current value of the program power counter 63: 32> as is in the upper 32 of the branch destination address. It is a bit (S196). The adder / subtractor 155 that executes this processing corresponds to the arithmetic unit of the present invention.
  • the value TGT_PC 31: 0> sent from the branch reservation station 126 is set as it is in the lower 32 bits of the branch destination address.
  • the branch instruction is a register indirect branch instruction
  • a signal indicating that (for example, LO signal) is notified to the program counter control unit 122A through the line 191 from the relative branch computing unit 168.
  • the program counter controller 122A cannot specify the upper 32 bits of the branch destination address from the current value PC upper 32 bits [63:32] of the program counter.
  • the branch destination address of the register indirect branch instruction is input from the arithmetic unit 167 to the program counter controller 122A.
  • the calculator 167 is a calculator that calculates the branch destination address of the register indirect branch instruction.
  • the program counter controller 122A reads the upper 32-bit address as it is from the output of the arithmetic unit 167 that calculated the branch destination address of the register indirect branch instruction, and sets it as the upper 32 bits of the branch destination address.
  • the value TGT_PC 31: 0> sent from the branch reservation station 126 is set as it is in the lower 32 bits of the branch destination address.
  • the program counter control device 122A selects one of the branch address forces set by the above method by the selection circuit 155, and sets the selected branch destination address to the next value NPC 151 of the program counter.
  • FIG. 10 shows the flow of branch destination address restoration processing.
  • the upper 32 bits definition code is 00 (b), 01 (b), or 11 (b) (S20)
  • the upper 32 bits are the upper 32 bits definition code input from the branch reservation station 126.
  • the value restored by the decoder 150A is set to the next 32 bits of the program counter in the upper 32 bits of the NPC151 (S18).
  • the upper 32 bits of the definition code is 10 (b) and the branch instruction is a PC relative branch instruction.
  • the signal is notified (S21)
  • the upper 32 bits are the value obtained by adding / subtracting the upper 32 bits of the current value of the program counter through the adder / subtractor 154 to the upper 32 bits of the next value of the program counter NPC 151 ( S19).
  • the instruction fetch control unit 123 includes an upper bit encoder 153A (corresponding to the sign part of the present invention) that converts the upper 32 bits of the address into an upper 32 bit definition code, and the output and branch reservation of the upper bit encoder 153A.
  • Selection circuit 161 that selects the upper 32 bits definition code from station 126, buffer IA RX162 that holds the signal from selection circuit 161, address adder 184 to which the instruction address being fetched is input, and address calculation A buffer SEQ163 that holds the output of the device 184, a buffer TIAR164 that stores the next branch destination address predicted by the branch prediction device 100, a plurality of instructions held in the buffer IARX162, the buffer SEQ163, the buffer TIAR164, etc.
  • Selection circuit that selects between address data (upper 32-bit definition code and lower 32-bit address) 165, an instruction fetch address holding circuit 166 that holds the instruction address data selected by the selection circuit 165, an upper bit decoder 150B that generates an upper 32 bit address as well as an upper 32 bit definition code power for instruction fetching, Have! /
  • the upper 32 bits PC 63:32> of the current value PC152 of the program counter is encoded into the upper 32 bits definition code by the upper bit encoder 153A.
  • the encoded upper 32 bits definition code is selected by the selection circuit 161 and set in the notifier IAR X162.
  • Buffer IARX162 is a notifier used when instruction fetch is executed by a fetch request from the program counter.
  • the selection circuit 165 selects instruction address data (upper 32-bit definition code and lower 32-bit address) output from the buffer IARX162, and the upper 32 The bit definition code is sent to the upper bit decoder 150B and the branch prediction device 100. In this case, the selection circuit 165 The lower 32 bits address output from the IARX 162 is sent to the instruction fetch address holding circuit 166 and the branch predicting device 100.
  • the upper bit decoder 150B converts the upper 32 bit definition code into an upper 32 bit address. This high-order 32-bit address is added to the low-order 32-bit address that has passed through the branch predictor 100 (in the branch predictor 100, a line specified as IF—EAG 31: 0>), and a 64-bit instruction address IF—EAG is used for instruction fetch as 63: 0> (arrow 190).
  • the lower 32 bits IF—EAG 31: 0> of this instruction address are input to the address adder 184, and the address is incremented by one unit and stored in the buffer SEQ163.
  • one unit is the number by which the address on the main memory 121 is advanced by the number of instructions for which the memory (main memory 121 or instruction cache 102) power is also acquired in one fetch. For example, when fetching 32 bytes and 8 instructions in one fetch stage, one unit is 32 bytes.
  • the current upper 32 bits definition code is set as the upper 32 bits definition code of the buffer SEQ163 as it is.
  • the selection circuit 165 selects instruction address data (upper 32-bit definition code and lower 32-bit address) output from the buffer SEQ163.
  • instruction address data from the selected buffer SEQ163 is processed in the same manner as the instruction address data from the buffer IARX162.
  • branch predictor 100 when a branch instruction hits at the currently fetched instruction address and a branch to that branch destination address is predicted, the branch predictor 100 sends the branch destination instruction address data (upper (32-bit definition code and lower 32-bit address) Output buffer Sent to TIAR164.
  • branch destination instruction address data upper (32-bit definition code and lower 32-bit address
  • the selection circuit 165 selects the instruction address data output from the buffer TIAR 164 on condition that the branch prediction apparatus 100 has transmitted the branch prediction.
  • the instruction address data from the buffer TIAR 164 is processed in the same manner as the instruction address data from the buffer IARX162.
  • the arithmetic unit 167 stores instructions fetched under the control of the instruction fetch control unit 123. If it is a register indirect branch instruction, the branch destination address is calculated. The calculated branch destination address is sent to the branch reservation station 126. Of these, the upper 32-bit address is converted into an upper 32-bit definition code by the upper bit encoder 153B. The upper 32 bits of the branch destination address calculated by the arithmetic unit 167 are sent to the program counter controller 122A via the selection circuit 169.
  • the relative address calculator 168 holds an instruction fetch address that holds an address corresponding to the instruction address of the branch instruction when the instruction fetched by the control of the instruction fetch control unit 123 is a relative address branch instruction. An address displaced by the relative address is calculated based on the lower 32 bits of the PC 166 3 1: 0>. The calculated branch destination address is sent to the branch reservation station 126 through the selection circuit 169.
  • the relative address calculator 168 generates an overflow when calculating an address displaced by the above relative address from the program counter value (current instruction fetch address) (positive overflow: +1, negative Direction overflow: 1) is detected. The detected overflow is notified to the program counter controller 122A through the branch reservation station 126 as overflow information (+1, ⁇ 1).
  • the current upper 32-bit definition code is input from the instruction fetch address holding circuit 166 to the relative address calculator 168.
  • the upper 32-bit definition code input from the instruction fetch address holding circuit 166 is set in the buffer 171 as it is.
  • the upper 32-bit definition code of the branch destination address is calculated from the upper 32-bit definition code input from the instruction fetch address holding circuit 166. If a positive overflow occurs, the upper 32-bit definition code moves in the positive direction, and 00 (b)-> 01 (b), 01 (b) —> 10 (b), 10 (b) —> 10 (b), 11 (b) —> 00 (b). At this time, 01 (b) and 10 (b) both move to 10 (b).
  • Selection circuit 169 determines whether the branch instruction is a relative address branch instruction or a register indirect branch instruction. Depending on the result, the address calculation result of either the relative address calculator 168 or the calculator 167 is selected.
  • the branch reservation station 126 includes a selection circuit 169, a buffer 170, and a notch 171.
  • the branch reservation station 126 holds the branch destination address calculated by the relative address calculator 168 or the calculator 167 in the buffers 170 and 171 and adjusts the timing of branch execution.
  • the buffer 170 stores the instruction address data in the current fetch supplied from the instruction fetch address holding circuit 166 (or the branch source address when the fetched instruction is a branch instruction). .
  • This branch destination address data includes the upper 32-bit definition code and the lower 32-bit address.
  • branch destination address data selected by the selection circuit 169 (the address calculated by the calculator 167 or the address calculated by the relative address calculator 168) is stored in the notifier 171.
  • This branch destination address data includes the upper 32-bit definition code and the lower 32-bit address.
  • branch instruction register indirect branch instruction or PC relative branch instruction
  • the branch source address is changed from the nofer 170 to the branch predictor. Sent to 100.
  • the branch destination address is sent from the notifier 171 to the branch prediction device 100.
  • the branch prediction apparatus 100 stores the branch destination address of the branch instruction (PC relative branch instruction or register indirect branch instruction) whose branch execution is confirmed in the branch reservation station 126 as the branch history.
  • the branch prediction device 100 includes a branch history storage device 13 0 (corresponding to a history storage unit of the present invention), a match circuit 180, and a selection circuit 183. Note that the branch prediction device 100 simply stores a branch instruction for which branch execution has been determined, and also determines the branch destination address of the branch instruction from which the next branch is predicted based on a plurality of branch histories (so-called global history). You can store it!
  • the branch history storage device 130 is a set associative storage device. Branch history The set of the storage device 130 is specified by a part of the branch source address of the branch instruction (for example, ⁇ 15: 5> (the 15th bit is up to the 5th bit)).
  • the way in the set is determined by the tag stored in the tag unit 130A.
  • the tag portion 130A stores the upper 32-bit definition code of the branch source address and a part of the lower 32-bit address (eg, 31:16> (from the 31st bit to the 16th bit).
  • the data portion 130B corresponding to the tag portion stores the upper 32-bit definition code and the lower 32-bit address of the branch destination address.
  • the branch prediction device 100 acquires the instruction address (branch source address) currently being fetched through the selection circuit 165 when reading from the branch history storage device 130. Then, the branch prediction apparatus 100 determines a corresponding set based on the instruction address, and further searches the tag unit 130A in the set. Then, the branch prediction device 100 determines whether or not the upper 32-bit definition code stored in the tag unit 130A and a part of the lower address (for example, 31:16>) match the power acquired from the 1S selection circuit 165 Is confirmed by the match circuit 180.
  • the instruction address branch source address
  • the branch prediction apparatus 100 determines a corresponding set based on the instruction address, and further searches the tag unit 130A in the set. Then, the branch prediction device 100 determines whether or not the upper 32-bit definition code stored in the tag unit 130A and a part of the lower address (for example, 31:16>) match the power acquired from the 1S selection circuit 165 Is confirmed by the match circuit 180.
  • the upper 32 bits definition code and a part of the lower address (for example, 31:16>) are input to one input of the match circuit 180 through the FF182.
  • the other input of the match circuit 180 is stored in the tag unit 130A and is stored in the tag (a part of the upper 32-bit definition code and the lower address of the branch source of the branch instruction predicted to branch next time in the past). 31: 16 »is entered.
  • the match circuit detects that the branch prediction is hit, a signal indicating the hit is sent to the selection circuit 183.
  • the selection circuit 183 also sends the instruction address data (upper 32-bit definition code and lower 32-bit address) of the branch destination to the buffer TIAR164 of the instruction fetch control unit corresponding to the entry hit in the tag part 130A. The As a result, the next instruction fetch is executed based on the branch prediction.
  • FIG. 6 shows the circuit configuration of the upper bit decoder 150A (and 150B).
  • the upper bit decoder 150A (and 150B) restores the upper 32 bit address when the upper 32 bit definition code is 00 (b), 01 (b), and 11 (b), respectively.
  • Upper bit decoders 150A and 150B can be configured by a combination of selector 300, four AND gates, and an inverter.
  • the inverter is indicated by a circle on the input terminal side of the AND gate.
  • an inverter built in such an input side is also called an AND gate.
  • the upper 32-bit definition code (indicated by HIGH—32BIT—CODE ⁇ 1> and ⁇ 0> in FIG. 6) is input to each AND gate.
  • selector 300 when each AND gate is turned on, the selector 300 outputs the input signal at the corresponding location.
  • three fixed data registers Ox FFFFFFFF, 0x00000001, and 0x00000000
  • a register that stores the upper 32-bit address itself ADRESS-IN 63: 32>
  • FIG. 7 shows the configuration of the upper bit encoder 153A (153B).
  • the upper bit encoder receives the upper 32 bit address (shown as ADDRESS IN 63:32> in Figure 7) Outputs the 32-bit definition code (shown as HIGH — 32BITCODE 1: 0> in Figure 7).
  • the upper bit encoder 153A (153B) has a bit pattern 32-bit bit pattern, 111... 11 ”(all bits 1, ie, OxFFFFFFFF),“ 000. 01 “(lowest bit strength Sl, remaining power S all 0, ie, 0x00000001),” 000... 00 “(all bits 0, ie, 0x00000000), human data strength S matching power failure A selector that outputs 2 bits of "11", “10", "01”, or "00” according to the output of the match circuit that matches the input data with three match circuits that half-IJ And have.
  • FIG. 8 shows a processing sequence of the upper bit encoder.
  • the upper bit encoder determines whether or not the upper 32-bit address power OxFFFFFF, 0x00000001, or just 0x00000000 matches (Sl, S3, S5).
  • the upper bit encoder outputs 2 bits 01 (b) (S4).
  • the upper bit encoder outputs 2 bits 00 (b) (S6).
  • the upper bit encoder outputs 2 bits 10 (b).
  • FIG. 9 shows the processing sequence of the upper bit decoder.
  • the upper bit decoder determines whether the upper 32 bit definition code (2 bits) matches either 11 (b), 01 (b), or 00 (b) (S11, S13, S15). ).
  • the upper bit decoder outputs 1 .... 11 (all bits 1, that is, OxFFFFFFFF) (S12). [0136] If the upper 32 bits of the defined code power is 01 (b), the upper bit decoder outputs 0... 01 (0 other than the least significant bit, that is, OxOOOOOOOl) (S14).
  • the upper bit decoder outputs 0... 00 (all bits 0, that is, 0x00000000) (S16).
  • the upper 32-bit definition code is 10 (b).
  • the upper bit decoder outputs the input 32-bit address, which is the upper 32 bits of the current value PC152 of the program counter in this embodiment (S17).
  • the upper 32-bit address is converted into the 2-bit upper 32-bit definition code 00 (b), 01 (b), 11 Classify by the codes (b) and 01 (b). Then, the branch instruction history is stored by executing the combination of upper 32 bits definition code and lower 32 bits address, and branch prediction is executed.

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

取得段階で命令を取得する取得部と、取得部が取得する命令の記憶元である命令アドレスを決定するアドレス制御部と、次の命令実行段階で処理される命令が分岐命令であるか否かを過去に処理された命令の履歴情報にしたがって予測する分岐命令予測部と、取得された命令の少なくとも1つを実行段階で実行する実行部と、を備え、アドレス制御部は、命令アドレスに含まれる所定の上位ビット部分と下位ビット部分のうち、上位ビット部分を圧縮した上位アドレス情報を生成する符号化部と、上位アドレス情報から上位ビット部分を復元する復元部とを有し、分岐命令予測部は、処理された分岐命令の分岐先アドレスに対応する上位アドレス情報と下位ビット部分とを、分岐命令の記憶元の命令アドレスに対応する上位アドレス情報と下位ビット部分から決定される複数の格納先のいずれかに履歴情報として記憶する履歴記憶部を有する処理装置である。                                                                       

Description

明 細 書
圧縮したアドレス情報により分岐予測する処理装置
技術分野
[0001] 本発明は、情報処理装置、特に命令処理装置に関する。
背景技術
[0002] 情報処理装置の分岐予測機構は、過去に実行された命令のメモリ上での記憶アド レス(以下、命令アドレスと 、う)を基に分岐命令の実行履歴を管理することによって、 次に分岐命令が実行される場合の分岐先を予測していた (例えば、下記特許文献 1 参照)。
[0003] その場合、分岐予測機構は、過去に記憶元から命令を取得 (命令をフェッチすると V、う)された分岐命令の命令アドレス (分岐元アドレス)の一部のビット部分力もセット ァソァシァティブ方式の記憶装置のセットを決定する。そして、分岐予測機構は、分 岐元アドレスのさらに他のビット部分をタグにして、当該セット内の 1つのウェイに分岐 先アドレスを記憶しておく。
[0004] そして、分岐予測機構は、命令のフェッチ段階で命令アドレスを利用して、上記記 憶装置を検索する。そして、過去に実行済みの分岐命令で、その分岐先アドレスが 記憶装置に記憶されている場合には、分岐予測機構は、該当するセット内のタグの 内容が一致するウェイ力も分岐先アドレスを入手できる。すなわち、命令のフェッチと 並行して、その命令が分岐命令である力否か (分岐元の命令アドレスの部分をタグに して分岐先アドレスが記憶されて 、る力否力 )を判定することができた。
[0005] すなわち、この技術では、情報処理装置は、現在のフェッチ中の命令のアドレスを 取得することにより、命令のフェッチと並行して、その命令が分岐命令である力否かを 判定し、命令が分岐命令であった場合に予測される分岐先アドレスを入手できる。し たがって、情報処理装置がパイプライン処理を行っている場合であっても、現在の命 令フ ツチと並行して、事前に予測される分岐先力 次のステージでの命令フ ツチ を準備することができる。
[0006] そして、現在フ ツチ中の命令力 得られた分岐先が予測された分岐先であった場 合には、ノ ィプライン処理を止めることなく各ステージを並列動作できる。一方、現在 フェッチ中の命令力も得られた分岐先が予測された分岐先でな力つた場合には、正 しい分岐先力 命令フェッチを再開することになる。現在フェッチ中の分岐命令の命 令アドレスに対応して上記記憶手段に分岐先が記憶されていな力つた場合 (分岐予 測がヒットしな力 たが分岐命令が実行された場合)も、分岐予測を利用できず、フエ ツチ後の分岐命令をデコードして得られた分岐先アドレスから命令フェッチを再開す ることになる。
[0007] ところで、従来、情報処理装置において、命令が格納される空間は、 32ビットァドレ ス空間であった。し力し、処理されるデータ量の増加に対応して、アドレス空間を 64 ビットに拡張したものも存在する。そのような情報処理装置では、データ空間のみなら ず命令空間も 64ビット化された。
[0008] しかし、実際のプログラムのサイズは 4GBよりもかなり小さく(最も大き 、プログラムで も数百 MB程度である)、 64ビット分の完全なアドレスすべてを投機的な実行処理部 に記憶または処理させるのは、ハードウェア資源の無駄といえる。
[0009] したがって命令セットアーキテクチャで定義されたやむを得な 、部分だけを 64ビット 化することが効率的である。そこで、分岐予測により投機的に命令フ ツチを制御す る制御部などは極力下位 32ビットのアドレスだけを用いて、従来と同様の命令フェツ チ等の制御を行ってきた。
[0010] 具体的な方法としては、予め上位 32ビットのアドレスを固定しておき、その固定され た上位 32ビットと下位 32ビットの 4Gバイト空間とを用いて命令フェッチを行う。そして 、 4Gバイト空間を越えれば、上位 32ビットを再定義する、というものが考えられる。
[0011] つまり、プログラムカウンタの上位 32ビットは通常固定しておく。そして、上位 32ビッ トを変更するような、分岐命令や例外、割り込みなどでプログラムカウンタの上位 32ビ ットを変える事象が発生したときには、上位 32ビットを改めて求める。この場合、その 上位 32ビットを変更しょうとする命令 (事象)の完了をもって投機処理中の命令フヱッ チ Z命令実行パイプラインをー且完全にクリアすることになる。
[0012] そのため、プログラムカウンタの上位 32ビットを新しい値に書き換えたのちに、その 新しいアドレスでもって命令フェッチより再開する。すなわち、上位 32ビットが変更さ れる事象があるときには投機実行の恩恵を全く受けることができな ヽ。これでもプログ ラムサイズが小さい以上問題はないはずであった。ところが、実際の OSは、割り付け るべきプログラムサイズが小さ 、場合でも、 64ビットの命令アドレスの上位 32ビットを 複数個所利用する制御をするようになった。
[0013] この場合には、 64ビットの仮想メモリ空間に、プログラムが散在することもありえない ことではない。そうすると、個々のプログラムが小さい場合でも、分岐命令によって 32 ビットの 4Gバイトアドレスを越える分岐が頻繁に発生することもありえる。
特許文献 1:特開 2004— 38398号公報
発明の開示
発明が解決しょうとする課題
[0014] 従来の方法では、 32ビットの 4Gバイトアドレスを越える度に、上位 32ビットを再定 義するまでの期間は投機命令フェッチを失敗するということになる。例えば、 4Gバイト を越えた分岐命令があつたとして、たとえ下位 32ビットが正しく分岐予測機構により 予測されたとしても、上位 32ビットは古いままであるために、予測を誤ることになる。
[0015] 投機命令フェッチを失敗すると!/、うことは、結果として一切の投機実行が失敗すると いうことであり、その損失は計り知れない。これを改善し、より高い性能を求めるために は、すべてにおいて 64ビットアドレスを完全に使用して分岐予測等を行うことが考え られる。しかし、前述の通り、コストやクロックサイクルを考慮すると、これは現実解では ない。本発明の目的は、このような従来の問題点を解決することにある。
課題を解決するための手段
[0016] 本発明は前記課題を解決するために、以下の手段を採用した。すなわち、本発明 は、少なくとも命令の記憶元から命令を取得する取得段階と前記命令を処理する実 行段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で 命令を取得する取得部と、前記取得部が取得する命令の記憶元である命令アドレス を決定するアドレス制御部と、前記コンピュータによって次の命令実行段階で処理さ れる命令が分岐命令であるか否かを過去に処理された命令の履歴情報にしたがつ て予測する分岐命令予測部と、前記取得された命令の少なくとも 1つを前記実行段 階で処理する実行部と、を備え、前記アドレス制御部は、前記命令アドレスに含まれ る所定の上位ビット部分と下位ビット部分のうち、前記上位ビット部分を圧縮した上位 アドレス情報を生成する符号ィ匕部と、前記上位アドレス情報力 上位ビット部分を復 元する復元部とを有し、前記分岐命令予測部は、前記処理された分岐命令の分岐 先アドレスに対応する上位アドレス情報と下位ビット部分とを、前記分岐命令の記憶 元の命令アドレスに対応する上位アドレス情報と下位ビット部分力 決定される複数 の格納先のいずれかに前記履歴情報として記憶する履歴記憶部を有する処理装置 である。
[0017] 本発明によれば、処理された分岐命令の分岐先アドレスに対応する上位アドレス情 報と下位ビット部分と力 分岐命令の記憶元の命令アドレスに対応する上位アドレス 情報と下位ビット部分力 決定される複数の格納先のいずれかに履歴情報として記 憶される。この場合、上位アドレス情報は、上位ビット部分を圧縮した情報である。し たがって、命令アドレス長が拡張され、アドレス空間が増加した場合であっても、圧縮 された上位アドレス情報と下位ビット部分によって効率的に分岐先アドレスに対応す る情報を管理できる。なお、ここで、命令を処理するとは、命令にしたがった所定の処 理を実行することをいい、例えば、条件付き分岐命令の場合には、条件の判定と判 定結果に基づく分岐先への分岐または分岐しない処理を含む。
[0018] 前記符号化部は、前記上位ビット部分を複数のアドレス範囲ごとに区分し、区分さ れた第 1のアドレス範囲を識別する第 1の上位アドレス情報と前記第 1のアドレス範囲 以外のアドレス範囲を識別する第 2の上位アドレス情報とを生成し、前記アドレス制御 部は、前記分岐命令の分岐先アドレスが、前記第 1の上位アドレス情報で識別される 前記第 1のアドレス範囲に分岐する分岐命令である場合に、前記復元部を通じて前 記第 1のアドレス範囲に対応する上位ビット部分を生成し、前記分岐命令が前記第 2 の上位アドレス情報で識別されるアドレス範囲に分岐する分岐命令である場合に前 記分岐命令の種類に応じて上位ビット部分を復元するようにしてもょ 、。
[0019] 本発明によれば、上位ビット部分が複数のアドレス範囲ごとに区分されている。そし て、分岐先アドレスが第 1の上位アドレス情報で識別される前記第 1のアドレス範囲で ある場合には、その第 1のアドレス範囲に対応する上位ビット部分が生成される。一 方、分岐先アドレスが前記第 2の上位アドレス情報で識別されるアドレス範囲である 場合には、分岐命令の種類に応じて上位ビット部分が復元される。このため、例えば
、特定のアドレス範囲への分岐命令が頻発する場合には、そのアドレス範囲を第 1の 上位アドレス情報で識別するように構成することで、効果的に、そのアドレス範囲に対 応する上位ビット部分を生成することができる。
[0020] 前記アドレス制御部は、前記分岐命令が前記第 2の上位アドレス情報で識別される アドレス範囲に分岐する分岐命令である場合に、分岐命令の種類を識別する信号を 前記実行部から受信する分岐種別情報受信部と、前記分岐命令が前記下位ビット 部分の範囲を限界として分岐元アドレス力 相対分岐する相対分岐命令である場合 に、前記実行部における前記分岐命令の処理にぉ 、て前記下位ビット部分の範囲 力も正方向または負方向に桁あふれが発生したことを示す桁あふれ情報を受信する 桁あふれ情報受信部と、前記桁あふれが発生した場合に、分岐元アドレスの上位ビ ット部分への加減算によって分岐先アドレスの上位ビット部分を取得する算術部とを 有するちのでちょい。
[0021] 本発明によれば、分岐命令が前記第 2の上位アドレス情報で識別されるアドレス範 囲に分岐する分岐命令である場合で、かつ、分岐命令が前記下位ビット部分の範囲 を限界として分岐元アドレス力 相対分岐する相対分岐命令である場合に、分岐元 アドレスの上位ビット部分への加減算によって分岐先アドレスの上位ビット部分を取 得することができる。すなわち、下位ビット部分の範囲から正方向または負方向への 桁あふれを検知し、その桁あふれ分を上位ビット部分に加減算すればよ!、。
[0022] 前記アドレス制御部は、分岐種別情報受信部が前記相対分岐命令でな!、場合に、 分岐命令の分岐先を算出した演算部力 分岐先アドレスの上位ビット部分を取得す る上位ビット取得部を有するものでもよ!/、。
[0023] 本発明によれば、分岐命令が前記第 2の上位アドレス情報で識別されるアドレス範 囲に分岐する分岐命令である場合で、分岐命令が上記の相対分岐命令でな 、場合 には、もはやあふれ分を上位ビット部分への加減算によっては上位ビット部分を取得 できない。この場合には、分岐先を算出した演算部から分岐先アドレスの上位ビット 部分を取得することができる。
発明の効果 [0024] アドレス空間が拡張された場合に、その拡張されたアドレス空間で使用される上位 ビットに偏りがある場合には、効率的に分岐予測を実現できる。
図面の簡単な説明
[0025] [図 1]64ビットのアドレス空間に割り付けられるプロセスのイメージを示す図である。
[図 2]上位 32ビット定義コードの定義を示す図である。
[図 3]本発明の実施形態に係る処理装置のシステム構成図である。
[図 4]分岐履歴記憶装置のセットを構成する各ウェイの構成を説明するための図であ る。
[図 5]処理装置の詳細構成を示す図である。
[図 6]上位ビットデコーダの回路構成を示す図である。
[図 7]上位ビットエンコーダの構成を示す図である。
[図 8]上位ビットエンコーダの処理シーケンスを示す図である。
[図 9]上位ビットデコーダの処理シーケンスを示す図である。
[図 10]分岐先復元処理を示す図である。
[図 11]PC相対分岐命令の分岐先復元処理を示す図である。
符号の説明
[0026] 100 分岐予測装置
122A プログラムカウンタ制御装置
123 命令フェッチ制御ユニット
126 分岐リザべーシヨンステーション
130 分岐履歴記憶装置
150Aゝ 150B 上位ビットデコーダ
153A、 15B 上位ビットエンコーダ
167 演算器
168 相対アドレス演算器
発明を実施するための最良の形態
[0027] 以下、図面を参照して本発明を実施するための最良の形態 (以下、実施形態という )に係る処理装置について説明する。以下の実施形態の構成は例示であり、本発明 は実施形態の構成に限定されない。
[0028] 《発明の骨子》
64ビットアドレス空間は、データ空間の 64ビット拡張の都合に合わせて行われたも のであるため、現状では空間内で実際に命令列が配置されるアドレスには偏りがある 。そこで、これらの偏りを利用して、上位 32ビットを擬似的に少数のビットで表現する 。つまり、頻出の上位アドレスを見込んでおき、少数ビットを用いたコードで頻出する 上位アドレスを表現する。
[0029] その少数ビットを下位 32ビットに加えてアドレスとして取り扱!/、、分岐予測などを行う ようにすれば、従来の装置に少しの拡張を加えるだけで、プログラムの 64ビットァドレ ス空間への割り付け(以下、このような OSによるプロセスのアドレス空間への割り付け を 64ビットアドレスモードという)に対応することができるようになる。すなわち、例えば 、 OSが 64ビットのアドレス空間を利用する制御を行ったとしても、参照されるアドレス の偏りを利用し、効率的な分岐予測ができる。
[0030] 頻出の上位アドレスは、 OSの仕様力も予測して固定的に決定してもよいし、またァ ドレスの頻度カウンタなどを設けて動的に設定することも考えられる。
[0031] 近年の OSでは、図 1のような 64ビットアドレス空間が定義されている(例えば、参考 文献「solarisインターナルカーネル構造のすべて」(ピアソン 'エデュケーション) p. 13 8参照)。
[0032] 図 1は、 64ビットのアドレス空間に割り付けられるプロセスのイメージを示す図である 。図 1で、斜線部分は、いずれのプロセスも使用できないアドレスの領域を示している 。図 1のように、一般的な OSの制御では、アドレス空間(仮想ドレレス空間)は、カー ネルとユーザプロセスとで、別々に用意されている。
[0033] 例えば、 OSのアドレス空間は、カーネルモードのアドレス空間で、 0000000 : 000 00001から 0000000 :FFFFFFFFの範囲である(ここで、 0、 1、 F等は 16進数であ る。以下同様である。ここで、 32ビットごとに:(コロン)で区切って示している)。また、 0000001 : 00000000以降の領域は、ヒープ領域およびキャッシュ領域である。
[0034] また、ユーザの空間のうち、実行形式が格納されるテキストの空間は、 00000001: 0000000力ら開始する。また、 FFFFFFFF: 7FFFC000力ら FFFFFFFF: 7F7F 000までは、スタックの領域が設けられる。さらに、 FFFFFFFF: 7F7F000力ら、アド レスが小さくなる方向にラリブラリが格納される。
[0035] この図力 以下のことが理解される。
(1) OSカーネルの領域は、上位 32ビッ卜力 0x00000000である。
(2)テキスト(実行形式のプログラム)の領域は、上位 32ビット力 OxOOOOOOOlである
(3)ライブラリが上位 32ビットが OxFFFFFFFF力も始まり、順番に下がっていく。
[0036] 一般的なアプリケーションで使用されるライブラリの数はせいぜい 10程度までであり
、かつライブラリ単体のサイズは小さ!/、のであるプログラムで使用されるライブラリをす ベて合わせても普通は上位 32ビットの変化しない範囲で収まる。
[0037] よって、頻出する上位 32ビットのアドレスは、以下の 3種類であると考えられる。
[0038] 0x00000000 (16進数で、 0カ )
0x00000001 (16進数で、 0力 7個と 1力 個)
0xFFFFFFFF (16進数で、 Fが 8個;)
そこで、上位の 32ビットアドレスに代えて、これら 3種類の上位アドレスと「それ以外 の上位アドレス」とをそれぞれ識別するコードを導入する。分岐予測装置には、これま での下位 32ビットアドレスとともに該コードを登録する。予測された分岐先アドレスの 命令フェッチ時には該コード力も元の上位 32ビットアドレスを生成し、使用する。該コ ードが頻出する 3種類ではなく「それ以外の上位アドレス」であった場合は、上位ビッ トは不明だ力 上位ビットを正しく計算するところ力もやり直せばよい。こうすることでこ れまでは「4G越え =投機フェッチ失敗」であったのが、少なくとも上記 3種類の上位 アドレスについては、従来の 32ビット範囲内と同じように投機フェッチ成功の可能性 が出てくる。
[0039] ほとんどの命令が上記 3種類のアドレスに含まれること、かつ、それら 3つの領域の 行き来はそれなりに多くそれ以外に行くことがほとんどないことを考えれば、 64ビット アドレスモードにおいて、性能は飛躍的に向上することが見込まれる。また、従来の 3 2ビットアプリケーションで性能が損なわれることもない。
[0040] 図 2に、コード(以下、上位 32ビット定義コードという)の定義を示す。図 2のように、 上位 32ビッ卜アドレス力 , 0x00000000,,の場合、上位 32ビッ卜定義コードを 00 (b) ( ビットデータであることを (b)で示す。以下、同様)とする。また、上位 32ビットアドレス 力 ^,0x00000001"の場合、上位 32ビット定義コードを 01 (b)とする。また、上位 32ビ ットアドレスが" OxFFFFFFFF"の場合、上位 32ビット定義コードを 11 (b)とする。さ らに、上位 32ビットアドレスが"上記以外の場合に、上位 32ビット定義コードを 10 (b) とする。
[0041] このようにして、本処理装置は、分岐予測処理を下位 32ビットアドレス + 2ビットの上 位 32ビット定義コードで処理する。本処理装置では、 32ビットを越える分岐命令が発 生しなければ、合計 34ビットの擬似的なアドレスで分岐予測を実行する。
[0042] さらに、上記上位 32ビット定義コードが 00 (b)、 01 (b)または 11 (b)の場合には、 上位 32ビッ卜力 Sそれぞれ 0x00000000、 0x00000001および OxFFFFFFFFに固 定されたものとなる。したがって、この場合の分岐予測は、従来の 32ビットの範囲での 分岐予測の手法がそのまま適用され、 、わば 34ビットアドレスでの分岐予測が実施 される。
[0043] 一方、上位 32ビット定義コードが 10 (b)の場合には、分岐先が 32ビットアドレスの 範囲を越え、かつ、上位 32ビットが上記 3種類のいずれでもないものであることを意 味する。その場合には、上位 32ビットアドレスは、不明になる。そこで、分岐予測によ る上位 32ビット定義コードが 10となったときに現在の PCの上位 32ビットをそのまま使 うと仮定した動作、つまり 32ビット予測そのものをする。
[0044] このようにして、本処理装置は、上記 3つの領域それぞれの範囲内(上位 32ビットァ ドレスが上位 32ビット定義コード 00 (b)、 01 (b) , 11 (b)によって規定されるアドレス の範囲)、および、上記 3つの領域相互間の分岐については、従来の 32ビットでの分 岐予測手段を 34ビットアドレス(上位 32ビット定義コード +下位 32ビットアドレス)に 変換して適用することができる。
[0045] 一方、上記 3つの領域を越える領域、すなわち、上位 32ビット定義コード 10 (b)で 規定される上位 32ビットの範囲への分岐が発生した場合には、従来の技術を適用し て上位 32ビットを正確に求め直す必要が発生する。
[0046] し力しながら、プログラム領域 (OS域、テキスト領域、およびライブラリ領域のそれぞ れ)力 ¾2ビットアドレスの範囲(4GB)を越えて使用されることはまれであるので、大半 の処理にぉ 、て、 34ビットの範囲で分岐予測を実行できる。
[0047] 図 3は、本処理装置のシステム構成図である。本処理装置は、例えば、主記憶装置 121に格納された命令を読み出して実行する、いわゆるプログラム内蔵方式のコンビ ユータである。
[0048] 図 3のように、この処理装置は、命令を実行する演算ユニット 120と、演算ユニット 1 20で実行される命令および演算ユニット 120が処理するデータ等を格納する主記憶 装置 121と、演算ユニット 120が実行すべき命令の主記憶装置 121上のアドレスを指 定するプログラムカウンタ 122とを有している。このようなプログラムカウンタ 122の制 御に基づく処理装置の制御は周知である。
[0049] 図 3では、さらに具体的に、プログラムカウンタ 122の生成するアドレスに基づいて 命令のフ ツチを制御する命令フ ツチ制御ユニット 123と、命令キャッシュ 102を管 理し命令フェッチ制御ユニット 123からの命令フェッチ要求にしたがって命令をフェツ チする命令キャッシュ制御ユニット 124と、命令キャッシュ 102からフェッチされた命令 を保持する命令バッファ 125と、命令バッファ 125の命令をデコードするデコーダ 10 3と、デコードされた命令の実行タイミングを制御するリザべーシヨンステーション (分 岐命令の実行を制御する分岐リザべーシヨンステーション 126およびレジスタ演算命 令、アドレス演算命令の実行を制御するその他リザべーシヨンステーション 127)と、 命令の実行完了を監視する命令完了管理ユニット 128と、演算ユニット 120で実行さ れる命令のオペランドを高速に演算ユニット 120に供給するオペランドキャッシュ 129 と、主記憶装置 121とオペランドキャッシュ 129との間でデータの授受を管理するデ ータキャッシュ制御ユニット 131とを有して!/、る。
[0050] このうち、分岐予測装置 100は、分岐命令の分岐履歴を記憶する分岐履歴記憶装 置 130を有している(図 5参照)。分岐履歴記憶装置 130は、 4ウェイセットァソァシァ ティブ方式の記憶装置である。
[0051] 図 4は、分岐履歴記憶装置 130のセットを構成する各ウェイの構成を説明するため の図である。分岐履歴記憶装置 130は、 SRAM等の比較的高速にアクセス可能な 記憶装置である。 4ウェイの分岐履歴記憶装置 130は、 1つのセット内に 4つのウェイ に対応するエントリを有する。図 4に示すように、各エントリは、タグ部 TGとデータ部 D Tを含む。タグ部 TGは、命令アドレス(の一部) TG1、 ノ リツドフラグ V、リプレースフラ グ尺、および、その他のフラグ TG2からなる。データ部 DTは、所定データとしての分 岐先アドレス DT1からなる。
[0052] 1つのセットは、アドレス生成ユニット 101から出力される命令アドレスの一部(例え ばく 15 : 5 >)によって決定される。本実施形態では 4ウェイなので、セットの決定によ り 4つのエントリが指定されることになる。さらに、その 4つのエントリのうち、命令アドレ スの他の一部によって 1つのエントリが決定される。
[0053] 本処理装置では、この 1つのエントリを決定するために、命令アドレス TG1には、上 位 32ビット定義コードく 1 : 0>と命令アドレスの一部(例えばく 31: 16 >)が格納さ れている。例えば、登録時に、命令アドレスの一部く 15 : 5 >を使ってセットが決定さ れ、残りの部分がセット内のいずれかのエントリ(4つのウェイに対応する 4つのェント リのいずれか)のタグ部 (命令アドレス TG1を含む)にデータとして格納されるようにな つている。なお、命令アドレスく 31 : 16 >との記載は、命令アドレス TG1が命令アド レス (例えば 32ビット)の一部 31ビット目力 16ビット目であることを意味する。
[0054] したがって、本処理装置では、 1つのセット内の 4つのエントリを検索するときに使用 するタグとして、上位 32ビット定義コード(00 (b)、 01 (b)、 11 (b) ,および 10 (b)のい ずれか 1つ)と下位 32ビットアドレスの一部く 31: 16 >が使用される。
[0055] ノ リツドフラグは、エントリの有効又は無効を示すフラグである。例えば、ノ リツドフラ ダカ であればそのノ リツドフラグを含むエントリが有効であること、ノ リツドフラグが "0"であればそのバリッドフラグを含むエントリが無効であることを示す。エントリが有 効とは、ウェイに登録されたデータである分岐先アドレスが抹消されて 、な 、と 、う意 味である。ノ リツドフラグは、置換対象のウェイを選択するためにも用いられる。
[0056] リプレースフラグは、置換対象のウェイを選択するために用いられるフラグである。
分岐先アドレスには、キャッシュメモリ 102 (または主記憶装置)からフェッチされた分 岐命令の分岐先アドレスが格納される。本実施形態では、リプレースフラグおよびバ リツドフラグの処理にっ 、ては、詳細を省略する。
[0057] 以下、本処理装置の制御手順を説明する。まず、プログラムカウンタ 122からの命 令アドレス (命令が格納された主記憶装置 121上のアドレス)が命令フ ツチ制御ュ ニット 123に送出される。
[0058] 命令フェッチユニット 123は、命令キャッシュ制御ユニット 124にその命令アドレスの 命令取得を指示するとともに、分岐予測装置 100に対して、分岐予測を指示する。す ると命令キャッシュ 102での命令取得処理と並行して、分岐予測装置 100での分岐 履歴記憶装置 130の検索がなされる。
[0059] そして、分岐予測装置 100は、現在の命令アドレスで分岐命令がヒットした場合に は、その分岐先アドレスを命令フェッチ制御ユニット 123に送出する。
[0060] 命令フ ツチ制御ユニット 123は、分岐予測装置 100でヒットした分岐命令の分岐 先アドレスによって、さらに、次の命令取得を命令キャッシュ制御ユニット 124に指示 する(このような処理は、通常、パイプラインのステージを形成する)。なお、分岐予測 力 Sヒットしな力つた場合には、分岐しな 、次の命令アドレスを命令フェッチ制御ュ-ッ ト 123の内部に含まれるアドレス加算器 184で生成し、次の命令取得を命令キヤッシ ュ制御ユニット 124に指示する。
[0061] フェッチされ、デコードされた命令は、それが分岐命令でな力つた場合には、その 他リザべーシヨンステーション 127によってオペランドの処理等に基づいて、実行の 待ち合わせを受ける。そして、オペランドが揃った時点で、各命令が演算ユニット 120 で実行される。
[0062] 一方、分岐命令については、分岐リザべーシヨンステーション 126によって命令の 待ち合わせがなされる。そして、分岐命令の分岐実行によって分岐先アドレスが確定 したときに、完了報告が分岐リザべーシヨンステーション 126から、命令完了管理ュ- ット 128および分岐予測装置 100に送出される。
[0063] このとき、分岐リザべーシヨンステーション 126は分岐予測が正しかったか否かを判 定する。すなわち、(al)その命令アドレスにて分岐予測装置 100によって分岐予測 力 Sヒットし (分岐履歴記憶装置 130に分岐先アドレスが格納されていた)、 (a2)フェツ チされた分岐命令がその分岐先アドレスに分岐した場合に、分岐予測が正し力つた ことが分かる。あるいは、(bl)その命令アドレスにて分岐予測装置 100がヒットせず、 (b2)フェッチされた命令が分岐命令ではな力つた力もしくは分岐命令であっても分 岐しな力つた場合に、分岐予測が正し力つたことがわかる。
[0064] この場合、すでにキャッシュ制御ユニット 124に依頼済みの命令フェッチは、そのま ま続行されること〖こなる。
[0065] また、分岐予測が正しくな力つた場合には、すでに、キャッシュ制御ユニット 124に 依頼済みの命令フェッチおよびその後に続く一連の処理はは、処理が中断されるこ とになる。同時に分岐リザべーシヨンステーション 126からは、正しい分岐先からの再 命令フェッチを行うよう、命令フェッチ制御ユニット 123に指示が出される。
[0066] 分岐予測装置 100は、セレクタ 132を介して実行された分岐命令をウェイに格納す る。
[0067] なお、分岐命令は、命令の実行によって分岐先に分岐する場合と、分岐せずに次 のアドレスにプログラムカウンタが移動する場合がある。そこで、本実施形態では、命 令を実行することを"命令を処理する"と呼ぶ。すなわち、命令を処理するとは、命令 にしたがった所定の処理を実行することをいい、例えば、条件付き分岐命令の場合 には、条件の判定と判定結果に基づく分岐先への分岐または分岐しな 、処理を含む
《実施例》
図 5から図 11に図面に基づいて本発明の一実施例に係る処理装置を説明する。 図 5は、実施例に係る処理装置の詳細構成を示す図である。図 5では、本処理装置 のうち、特に、プログラムカウンタ制御装置 122A (本発明のアドレス制御部に相当)、 命令フ ツチ制御ユニット 123 (本発明の取得部に相当)、分岐リザべーシヨンステー シヨン 126、分岐予測装置 100 (本発明の分岐予測部に相当)、および演算器湘対 アドレス演算器 168、演算器 167、本発明の実行部に相当)が明示されている。以下 、本処理装置の各部の構成要素を説明する。
[0068] (プログラムカウンタ制御装置 122A)
プログラムカウンタ制御装置 122Aは、プログラムカウンタの現在値 PC152 (または分 岐命令の実行結果)に基づいてプログラムカウンタの次の値 NPC151の算出を制御 する。
[0069] 図 5では、プログラムカウンタの現在値 PC152は、上位 32ビット PCく 63 : 32 >と、 下位 32ビット PCく 31 : 0>とに分けて示されている。ただし、 PC152というときは、プ ログラムカウンタの現在値そのもの(全部のビット)を 、うこととする。
[0070] 同様に、プログラムカウンタの次の値 NPC151は、上位 32ビット NPCく 63 : 32>と 、下位 32ビット NPCく 31 : 0>とに分けて示されている。ただし、 NPC152というとき は、プログラムカウンタの次の値そのもの(全部のビット)を 、うこととする。
[0071] 図 5のように、分岐命令が処理され、分岐先アドレスが確定した場合、分岐リザべ一 シヨンステーション 126からプログラムカウンタ制御装置 122Aへ、上位 32ビット定義 コード、分岐先アドレスの桁あふれ情報、および下位 32ビットアドレスが送出される。 ここで、分岐先アドレスの桁あふれ情報(以下、単に桁あふれ情報という)とは、 PC相 対分岐命令が分岐した場合に、分岐先までの相対アドレスが下位 32ビットの範囲を 超える力否かを示す情報である。
[0072] 以下、この桁あふれ情報について説明する。本処理装置では、分岐命令は、 PC相 対アドレス分岐命令と、レジスタ間接分岐命令とに分類することができる。
[0073] PC相対アドレス分岐命令とは、現在のプログラムカウンタの値に対する相対分岐ァ ドレスをオペランドとする分岐命令である。 PC相対アドレス分岐命令の分岐先は、現 在のプログラムカウンタの値に相対分岐アドレスが加算されたアドレスとなる。本実施 形態の場合、オペランドである相対分岐アドレスは、最大 32ビットで記述できる範囲 である。このため、 PC相対アドレス分岐命令が分岐したときの分岐先の上位 32ビット は、最大で + 1 (正方向に桁あふれした状態)、最小で 1 (負方向に桁あふれした状 態)となる。
[0074] 本実施形態では、分岐リザべーシヨンステーション 126は、正方向に桁あふれした 状態を示すビット ( + 1ビット)、負方向に桁あふれした状態を示すビット( 1ビット)を プログラムカウンタ制御装置 122Aに通知する。この信号を受信するプログラムカウン タ制御装置 122Aが本発明の桁あふれ情報受信部に相当する。
[0075] さらに、 PC相対分岐命令が実行された場合には、その実行を示す信号が相対アド レス演算器 168からプログラムカウンタ制御装置 122Aに通知される(ライン 191)。こ の信号を受信するプログラムカウンタ制御装置 122Aが本発明の分岐種別情報受信 部に相当する。 [0076] 一方、レジスタ間接分岐命令とは、レジスタの番号をオペランドとして指定し、指定 したレジスタに格納されたアドレスを分岐先アドレスとする分岐命令である。レジスタ 間接分岐命令は、レジスタのビット幅、すなわち、 64ビットの範囲で分岐先アドレスを 指定できる。
[0077] 図 5のように、プログラムカウンタ制御装置 122Aは、上位ビットデコーダ 150Aを有 している。上位ビットデコーダ 150Aは、上位 32ビット定義コードを本来の上位 32ビッ トアドレスに戻す機能を有する(上位ビットデコーダ 150Bも同様である)。
[0078] 上位ビット定義コードは、分岐リザべーシヨンステーション 126から入力される。これ は、分岐リザべーシヨンステーション 126において、最終的に次の分岐先が確定する ためである。すなわち、分岐リザべーシヨンステーション 126に示されているバッファ T GT— PC171には、命令がデコードされ、分岐が確定した分岐先アドレスの上位 32 ビット定義コードと、下位 32ビットアドレスが格納されている。上位ビットデコーダ 150 Aには、この確定した分岐先アドレスの上位 32ビット定義コードが入力される。
[0079] 本実施形態のデコーダ 150Aは、常時、この上位 2ビット定義コードを上位 32ビット アドレスに変換している。さらに、プログラムカウンタの次の値 NPC151には、命令完 了管理ユニット 128 (図 3参照)から分岐命令の実行完了が確認されたとの通知を受 け取ったとき、確定した分岐先アドレスの上位 32ビットが設定される。
[0080] したがって、分岐命令が発生しても、分岐先アドレスの上位 32ビット定義コードが 0 0 (b) , 01 (b)、または 11 (b)の場合には、プログラムカウンタ制御装置 122Aは、そ のまま上位ビットデコーダ 150Aによって上位 32ビット定義コードから上位 32ビットァ ドレスを生成する。上位 32ビットが上位 32ビット定義コードから一意に確定可能だか らである。。
[0081] また、下位 32ビットアドレスについては、プログラムカウンタ制御装置 122Aは、分 岐リザべーシヨンステーション 126から確定した分岐先アドレスの下位 32ビット TGT —PCく 31 : 0>を受け取り、プログラムカウンタの次の値の下位 32ビット NPCく 31 : 0>に設定する。このようにして、分岐命令が発生しても、分岐先アドレス上位 32ビッ トが上位 32ビット定義コードで一意に確定可能な場合、プログラムカウンタは、上位 3 2ビット定義コードからアドレスを復元することで、正 、分岐先アドレスを設定される ことになる。
[0082] 一方、上位 32ビット定義コードが 10 (b) (その他)の場合には、プログラムカウンタ 制御装置 122Aは、分岐命令による分岐先が上位 32ビット定義コードで一意に定義 されたアドレスの範囲を超えたと仮に判定する(この判定を実行するプログラムカウン タ制御装置 122Aが本発明の判定部に相当する)。この場合分岐先アドレスは上位 3 2ビット定義コードで復元不可能である。本実施形態では、分岐命令の種類に応じて 、分岐先アドレスを復元する方法を選択する。
[0083] 以下で、上位 32ビット定義コード力も分岐先アドレス上位 32ビットが生成不可能な 場合の分岐先アドレス生成方法を記述する。
[0084] まず、分岐命令が PC相対分岐命令であった場合には、ライン 191を通じて相対分 岐演算器 168からその旨の信号 (例えば HI信号)がプログラムカウンタ制御装置 122 Aに通知される。その場合、プログラムカウンタ制御装置 122Aは、分岐リザべーショ ンステーション 126から、桁あふれ情報を読み取る。そして、桁あふれ情報を元にプ ログラムカウンタの現在値 PC152の上位 32ビットに変更をカ卩え、分岐先アドレスの上 位 32ビットを生成する。
[0085] 図 11に PC相対分岐命令の分岐先復元処理の流れを示す。
[0086] 桁あふれ情報が + 1であった場合には(S192)、プログラムカウンタ制御装置 122 Aは、プログラムカウンタの現在値の上位 32ビット PCく 63 : 32〉を加減算器 154を 通して 1加算した値を分岐先アドレスの上位 32ビットとする(S193)。また、桁あふれ 情報が— 1であった場合には(S194)、プログラムカウンタ制御装置 122Aは、プログ ラムカウンタの現在値の上位 32ビット PC< 63 : 32 >を加減算器を通して 1減算した 値を分岐先アドレスの上位 32ビットとする(S195)。また、桁あふれ情報が + 1および —1のいずれでもない場合には、プログラムカウンタ制御装置 122Aは、プログラム力 ゥンタの現在値の上位 32ビット PCく 63: 32 >をそのまま分岐先アドレスの上位 32ビ ットとする(S196)。この処理を実行する加減算器 155が本発明の算術部に相当する
[0087] 一方、分岐先アドレスの下位 32ビットには、分岐リザべーシヨンステーション 126力 ら送出された値 TGT_PCく 31: 0 >をそのまま設定する。 [0088] 次に、分岐命令がレジスタ間接分岐命令であった場合には、ライン 191を通じて相 対分岐演算器 168からその旨の信号 (例えば LO信号)がプログラムカウンタ制御装 置 122Aに通知される。その場合には、プログラムカウンタ制御装置 122Aは、プログ ラムカウンタの現在値 PC上位 32ビットく 63 : 32 >からは、分岐先アドレス上位 32ビ ットを特定できない。
[0089] この場合には、プログラムカウンタ制御装置 122Aには、演算器 167から、レジスタ 間接分岐命令の分岐先アドレスが入力される。ここで、演算器 167は、レジスタ間接 分岐命令の分岐先アドレスを計算する演算器である。そして、プログラムカウンタ制御 装置 122Aは、レジスタ間接分岐命令の分岐先アドレスを計算した演算器 167の出 力から、そのまま上位 32ビットアドレスを読み取り、分岐先アドレス上位 32ビットとする
[0090] 一方、分岐先アドレス下位 32ビットには、分岐リザべーシヨンステーション 126から 送出された値 TGT_PCく 31: 0 >をそのまま設定する。
[0091] プログラムカウンタ制御装置 122Aは、上記方法により設定した分岐アドレス力も選 択回路 155により 1つを選択し、選択した分岐先アドレスをプログラムカウンタの次の 値 NPC151に設定する。
[0092] 図 10に分岐先アドレス復元処理の流れを示す。上位 32ビット定義コードが 00 (b)、 01 (b)、または 11 (b)の場合(S20)、上位 32ビットは分岐リザべーシヨンステーション 126から入力された上位 32ビット定義コードを上位ビットデコーダ 150Aによって復 元された値をプログラムカウンタの次の値 NPC151の上位 32ビットに設定する(S18 ) o上位 32ビット定義コードが 10 (b)かつ、分岐命令が PC相対分岐命令である旨の 信号が通知された場合(S21)、上位 32ビットはプログラムカウンタの現在値 PCの上 位 32ビットを加減算器 154を通して加減算した値をプログラムカウンタの次の値 NPC 151の上位 32ビットに設定する(S19)。上位 32ビット定義コードが 10 (b)かつ、分岐 命令がレジスタ間接分岐命令である旨の信号が通知された場合、レジスタ間接分岐 命令の分岐先アドレスを計算した演算器 167から入力された値をプログラムカウンタ の次の値 NPC151の上位 32ビットに設定する(S22)。
[0093] プログラムカウンタの次の値 NPC151の下位 32ビットは分岐命令が実行される場 合常に、分岐リザべーシヨンステーション 126から入力された TGT— PCく 31 : 0>が 設定される。
[0094] なお、分岐命令が実行されない場合には、プログラムカウンタ制御装置 122Aは、 プログラムカウンタの次の値 NPC151く 63 : 0>を、同時に完了した命令数分 (各命 令長の合計)だけ進める。例えば、 4命令同時完了でかつ一命令の長さが各々すべ て 4バイトであれば、 4バイト X 4命令 = 16バイトである。
[0095] (命令フ ツチ制御ユニット)
命令フェッチ制御ユニット 123は、アドレスの上位 32ビットを上位 32ビット定義コード に変換する上位ビットエンコーダ 153A (本発明の符号ィ匕部に相当)と、上位ビットェ ンコーダ 153Aの出力と分岐リザべーシヨンステーション 126からの上位 32ビット定義 コードとを選択する選択回路 161と、選択回路 161からの信号を保持するバッファ IA RX162と、フェッチ中の命令アドレスが入力されるアドレス加算器 184と、アドレスカロ 算器 184の出力を保持するバッファ SEQ163と、分岐予測装置 100において予測さ れた次の分岐先アドレスを格納するバッファ TIAR164と、ノ ッファ IARX162、バッフ ァ SEQ163およびバッファ TIAR164等に保持された複数の命令アドレスデータ(上 位 32ビット定義コードおよび下位 32ビットアドレス)の 、ずれかを選択する選択回路 165と、選択回路 165によって選択された命令アドレスデータを保持する命令フェツ チアドレス保持回路 166と、命令フェッチのために上位 32ビット定義コード力も上位 3 2ビットアドレスを生成する上位ビットデコーダ 150Bと、を有して!/、る。
[0096] 図 5のように、プログラムカウンタの現在値 PC152の上位 32ビット PCく 63 : 32>が 上位ビットエンコーダ 153Aにて、上位 32ビット定義コードにエンコードされる。ェンコ ードされた上位 32ビット定義コードは、選択回路 161によって選択され、ノ ッファ IAR X162に設定される。バッファ IARX162は、プログラムカウンタからのフェッチ要求に よって命令フェッチを実行する場合に使用するノッファである。
[0097] プログラムカウンタからのフェッチ要求があった場合には、選択回路 165は、バッフ ァ IARX162から出力される命令アドレスデータ(上位 32ビット定義コードおよび下位 32ビットアドレス)を選択し、その上位 32ビット定義コードを上位ビットデコーダ 150B 、および分岐予測装置 100に送出する。また、その場合に、選択回路 165は、ノ ッフ ァ IARX162から出力される下位 32ビットアドレスを命令フェッチアドレス保持回路 16 6、および分岐予測装置 100に送出する。
[0098] 上位ビットデコーダ 150Bは、上位 32ビット定義コードを上位 32ビットアドレスに変 換する。この上位 32ビットアドレスは、分岐予測装置 100内を通過した下位 32ビット アドレス(分岐予測装置 100内に、 IF— EAGく 31 : 0>で明示された線)に付加され 、 64ビットの命令アドレス IF— EAGく 63 : 0>として命令フェッチに使用される(矢印 190)。
[0099] また、この命令アドレスの下位 32ビット IF— EAGく 31 : 0>は、アドレス加算器 184 に入力され、アドレスが 1単位インクリメントされてバッファ SEQ163に格納される。こ こで 1単位とは、 1回のフェッチにおいてメモリ(主記憶装置 121または命令キャッシュ 102)力も取得される命令数分だけ主記憶装置 121上のアドレスを進める数である。 例えば、 32バイト 8命令を 1フェッチステージでフェッチする場合には、 1単位は 32バ イトである。また、現在の上位 32ビット定義コードは、そのままバッファ SEQ163の上 位 32ビット定義コードとして設定される。
[0100] したがって、分岐命令が実行されな力つたことを条件に、選択回路 165は、バッファ SEQ163から出力される命令アドレスデータ(上位 32ビット定義コードおよび下位 32 ビットアドレス)を選択する。選択されたバッファ SEQ163からの命令アドレスデータは 、上記バッファ IARX162からの命令アドレスデータと同様に処理される。
[0101] また、分岐予測装置において、現在フェッチ中の命令アドレスにおいて分岐命令が ヒットし、その分岐先アドレスへの分岐が予測される場合に、分岐予測装置 100から 分岐先の命令アドレスデータ(上位 32ビット定義コードおよび下位 32ビットアドレス) 力 バッファ TIAR164に送出される。
[0102] この場合、分岐予測装置 100が分岐予測を送出したことを条件に、選択回路 165 は、バッファ TIAR164から出力される命令アドレスデータを選択する。バッファ TIAR 164からの命令アドレスデータは、上記バッファ IARX162からの命令アドレスデータ と同様に処理される。
[0103] (演算器)
演算器 167は、命令フェッチ制御ユニット 123の制御によってフェッチされた命令が レジスタ間接分岐命令であった場合に、その分岐先アドレスを計算する。計算された 分岐先アドレスは、分岐リザべーシヨンステーション 126に送出される。このうち、上位 32ビットアドレスは、上位ビットエンコーダ 153Bによって上位 32ビット定義コードに変 換される。なお、演算器 167によって計算された分岐先アドレスの上位 32ビットは、 選択回路 169を介してプログラムカウンタ制御装置 122Aに送出される。
[0104] 相対アドレス演算器 168は、命令フェッチ制御ユニット 123の制御によってフェッチ された命令が相対アドレス分岐命令であった場合に、分岐命令の命令アドレスに相 当するアドレスを保持する命令フェッチアドレス保持回路 166の下位 32ビット PCく 3 1 : 0 >を基準にして相対アドレス分だけ変位したアドレスを計算する。計算された分 岐先アドレスは、選択回路 169を通じて分岐リザべーシヨンステーション 126に送出さ れる。
[0105] また、相対アドレス演算器 168は、プログラムカウンタ値 (現在の命令フェツチアドレ ス)から上記相対アドレスだけ変位したアドレスを計算するときの桁あふれの発生 (正 方向の桁あふれ: + 1、負方向の桁あふれ: 1)を検知する。検知された桁あふれは 、桁あふれ情報( + 1、— 1)として、分岐リザべーシヨンステーション 126を通じて、プ ログラムカウンタ制御装置 122Aに通知される。
[0106] さらに、相対アドレス演算器 168には、命令フェッチアドレス保持回路 166から現在 の上位 32ビット定義コードが入力されている。上記桁あふれが検知されない場合に は、命令フェッチアドレス保持回路 166から入力された上位 32ビット定義コードがそ のままバッファ 171に設定される。また、上記桁あふれが検知された場合には、命令 フェッチアドレス保持回路 166から入力された上位 32ビット定義コードから分岐先ァ ドレスの上位 32ビット定義コードを算出する。正方向の桁あふれが発生した場合は、 上位 32ビット定義コードは正の方向に移行し、 00 (b) - >01 (b)、 01 (b)— > 10 (b )、 10 (b)— > 10 (b)、 11 (b)— >00 (b)となる。このとき、 01 (b)、 10 (b)は共に 10 (b)へと移行する。負方向の桁あふれが発生した場合は、上位 32ビット定義コードは 負の方向に移行し、 00 (b)— > 11 (b)、 01 (b)— >00 (b)、 10 (b)— > 10 (b)、 11 (b)—〉 10 (b)へと移行する。このとき、 l l (b)、 10 (b)は共に 10 (b)へと移行する。
[0107] 選択回路 169は、分岐命令が相対アドレス分岐命令か、レジスタ間接分岐命令か に応じて、相対アドレス演算器 168または演算器 167のいずれのアドレス計算の結 果を選択する。
[0108] (分岐リザべーシヨンステーション)
分岐リザべーシヨンステーション 126は、選択回路 169、バッファ 170および、ノ ッファ 171を有する。分岐リザべーシヨンステーション 126は、相対アドレス演算器 168また は演算器 167において算出された分岐先アドレスをバッファ 170、 171に保持すると ともに、分岐実行のタイミングを調整する。
[0109] バッファ 170には、命令フェッチアドレス保持回路 166から供給される現在のフェツ チ中の命令アドレスデータ (フ ツチされる命令が分岐命令の場合には、分岐元アド レス)が格納される。この分岐先アドレスデータは、上位 32ビット定義コードと、下位 3 2ビットアドレスを含む。
[0110] また、ノ ッファ 171には、選択回路 169によって選択された分岐先アドレスデータ( 演算器 167によって計算されたアドレスまたは相対アドレス演算器 168によって計算 されたアドレス)が格納される。この分岐先アドレスデータは、上位 32ビット定義コード と、下位 32ビットアドレスを含む。
[0111] 分岐命令 (レジスタ間接分岐命令または PC相対分岐命令)が演算器 167または相 対アドレス演算器 168で処理され、分岐先アドレスが確定すると、分岐元アドレスが、 ノ ッファ 170から分岐予測装置 100に送出される。また、このとき、分岐先アドレスが ノ ッファ 171から分岐予測装置 100に送出される。
[0112] (分岐予測装置)
分岐予測装置 100は、分岐リザべーシヨンステーション 126において分岐実行が確 定された分岐命令 (PC相対分岐命令、または、レジスタ間接分岐命令)の分岐先ァ ドレスを分岐履歴として格納する。分岐予測装置装置 100は、分岐履歴記憶装置 13 0 (本発明の履歴記憶部に相当)と、マッチ回路 180と、選択回路 183とを含む。なお 、分岐予測装置装置 100は、単に分岐実行が確定された分岐命令を格納する他、 複数回の分岐履歴 (いわゆるグローバルヒストリ)に基づいて、次回分岐が予測される 分岐命令の分岐先アドレスを格納するようにしてもよ!、。
[0113] 分岐履歴記憶装置 130は、セットァソシァティブ方式の記憶装置である。分岐履歴 記憶装置 130のセットは、分岐命令の分岐元アドレスの一部(例えば、 < 15 : 5 > (第 15ビット目力も第 5ビット目まで) )によって指定される。
[0114] セット内のウェイは、タグ部 130Aに格納されたタグによって決定される。タグ部 130 Aには、分岐元アドレスの上位 32ビット定義コードおよび下位 32ビットアドレスの一部 (例えば、く 31: 16 > (第 31ビット目力ら第 16ビット目まで)が格納される。
[0115] 一方、そのタグ部に対応するデータ部 130Bには、分岐先アドレスの上位 32ビット 定義コードおよび下位 32ビットアドレスが格納される。
[0116] また、分岐予測装置 100は、分岐履歴記憶装置 130の読み出しにおいては、選択 回路 165を通じて現在フェッチ中の命令アドレス (分岐元アドレス)を取得する。そし て、分岐予測装置 100は、その命令アドレスによって、該当するセットを決定し、さら にセット内のタグ部 130Aを検索する。そして、分岐予測装置 100は、タグ部 130Aに 格納された上位 32ビット定義コードおよび下位アドレスの一部(例えば、く 31: 16 > ) 1S 選択回路 165から取得されたものと一致する力否かをマッチ回路 180によって 確認する。
[0117] マッチ回路 180の一方の入力には、 FF182を通じて、上位 32ビット定義コードおよ び下位アドレスの一部(例えば、く 31 : 16 >)が、入力されている。マッチ回路 180の 他方の入力には、タグ部 130Aに記憶されて 、たタグ (過去にお 、て次回分岐すると 予測された分岐命令の分岐元の上位 32ビット定義コードおよび下位アドレスの一部 く 31 : 16 »が入力される。
[0118] したがって、現在フェッチ中の命令アドレスに対応する上位 32ビット定義コードおよ び下位アドレスの一部く 31: 16 >がタグ部 130Aの内容と一致した場合に、分岐予 柳』がヒッ卜すること〖こなる。
[0119] 分岐予測がヒットしたことがマッチ回路で検知されると、そのヒットを示した信号が選 択回路 183に送出される。選択回路 183は、タグ部 130Aのヒットしたエントリに対応 するデータ部 130B力も分岐先の命令アドレスデータ(上位 32ビット定義コードおよ び下位 32ビットアドレス)を命令フェッチ制御ユニットのバッファ TIAR164に送出す る。これによつて、分岐予測に基づいて次の命令フェッチが実行されることになる。
[0120] (上位ビットデコーダ) 図 6に、上位ビットデコーダ 150A (および 150B)の回路構成を示す。上位ビットデコ ーダ 150A (および 150B)は、それぞれ、上位 32ビット定義コードが 00 (b)、 01 (b)、 および 11 (b)の場合の上位 32ビットアドレスを復元する。
[0121] 上位ビットデコーダ 150A、 150Bは、セレクタ 300と、 4つの ANDゲートと、インバ ータの組合せで構成することができる。なお、図 6では、インバータは、 ANDゲートの 入力端子側の丸印で示されている。ここでは、このような入力側にインバータが組み 込まれたものについても、 ANDゲートと呼ぶことにする。
[0122] それぞれの ANDゲートには、上位 32ビット定義コード(図 6では、 HIGH— 32BIT —CODE < 1 >およびく 0>で表示)が入力される。 "11 "のラベルが付された AND は、上位 32ビット定義コードく 1 : 0> = 11 (b)の場合に、 HI出力となる。
[0123] 同様に、 "10"のラベルが付された ANDは、上位 32ビット定義コードく 1 : 0> = 10
(b)の場合に、 HI出力となる。また、 ' 01 'のラベルが付された ANDは、上位 32ビット 定義コードく l : 0 > =01 (b)の場合に、 HI出力となる。また、 "00"のラベルが付され た ANDは、上位 32ビット定義コードく l : 0> =00 (b)の場合に、 HI出力となる。
[0124] 一方、セレクタ 300は、それぞれの ANDゲートがオンになると、対応する箇所の入 力信号を出力する。セレクタ 300の入力側には、 3つの固定のデータのレジスタ(Ox FFFFFFFF、 0x00000001、および 0x00000000)と、上位 32ビットアドレスその もの(ADDRESS— INく 63: 32 >)を格納したレジスタが接続される。
[0125] すなわち、 "11"のラベルが付された ANDがオンになることによって、上位 32ビット すべてが 1のビットパターン(OxFFFFFFFF)が出力される。また、 "01"のラベルが 付された ANDがオンになることによって、上位 32ビットのうち最下位ビットが 1で、残 りのビットが 0のビットパターン(0x00000001)が出力される。また、 "00"のラベルが 付された ANDがオンになることによって、上位 32ビットすべてが 0のビットパターン(0 xOOOOOOOO)力出力される。また、 "10"のラベルが付された ANDがオンになること によって、上位 32ビットアドレスそのものが出力される。
[0126] (上位ビットエンコーダ)
図 7に、上位ビットエンコーダ 153A(153B)の構成を示す。上位ビットエンコーダは、 上位 32ビットアドレス(図 7に、 ADDRESS INく 63 : 32 >と表示)が入力され、上 位 32ビット定義コード(図 7に、 HIGH— 32BITCODEく 1 : 0>と表示)を出力する。
[0127] 図 7のように、上位ビットエンコーダ 153A (153B)は、ビットパターン 32ビットのビッ 卜ノ ターン,, 111. . . 11" (全ビット 1、すなわち、 OxFFFFFFFF)、 "000. . . 01" ( 最下位ビッ卜力 Sl、残り力 Sすべて 0、すなわち、 0x00000001)、 "000. . . 00" (全ビ ッ卜 0、すなわち、 0x00000000)〖こ、人力データ力 Sマッチする力否力を半 IJ定する 3つ のマッチ回路と、入力データとマッチしたマッチ回路の出力に応じて、 "11"、 "10"、 " 01"、または" 00"の 2ビットを出力するセレクタ 301とを有している。
[0128] (処理シーケンス)
図 8から図 11のフローチャートにより、上述の構成要素によって実行される処理シー ケンスを説明する。ここでは、処理シーケンスをフローチャートで示すが、この処理シ 一ケンスは、基本的には、ハードウェアの論理回路で実現される。
[0129] 図 8は、上位ビットエンコーダの処理シーケンスを示す。上位ビットエンコーダは、上 位 32ビッ卜アドレス力 OxFFFFFFFF、 0x00000001、また ίま 0x00000000の!ヽず かにマッチするか否かを判定する(Sl、 S3、 S5)。
[0130] 上位 32ビットアドレス力 OxFFFFFFFFにマッチする場合、上位ビットエンコーダは 、 2ビット 11 (b)を出力する(S2)。
[0131] また、上位 32ビットアドレス力 OxOOOOOOOlにマッチする場合、上位ビットェンコ一 ダは、 2ビット 01 (b)を出力する(S4)。
[0132] また、上位 32ビットアドレス力 0x00000000にマッチする場合、上位ビットェンコ一 ダは、 2ビット 00 (b)を出力する(S6)。
[0133] そして、上位 32ビッ卜アドレス力 0xFFFFFFFF、 0x00000001、または 0x00000 000のいずかにもマッチしない場合、上位ビットエンコーダは、 2ビット 10 (b)を出力 する。
[0134] 図 9に上位ビットデコーダの処理シーケンスを示す。上位ビットデコーダは、上位 32 ビット定義コード(2ビット)が 11 (b)、 01 (b)、または 00 (b)のいずかにマッチするか 否力を判定する(S 11、 S13、 S15)。
[0135] 上位 32ビット定義コード力 11 (b)である場合、上位ビットデコーダは、 1. . . 11 ( 全ビット 1、すなわち、 OxFFFFFFFF)を出力する(S12)。 [0136] 上位 32ビット定義コード力 01 (b)である場合、上位ビットデコーダは、 0. . . 01 ( 最下位ビット以外 0、すなわち、 OxOOOOOOOl)を出力する(S 14)。
[0137] 上位 32ビット定義コード力 00 (b)である場合、上位ビットデコーダは、 0. . . 00 ( 全ビット 0、すなわち、 0x00000000)を出力する(S 16)。
[0138] 上位 32ビット定義コードが、以上のいずれでもない場合、上位 32ビット定義コード は、 10 (b)となる。この場合、上位ビットデコーダは、入力された 32ビットアドレス、本 実施形態ではプログラムカウンタの現在値 PC152の上位 32ビットを出力する(S17)
[0139] 以上述べたように、本実施形態の処理装置によれば、 64ビットアドレス空間のうち、 上位 32ビットアドレスを 2ビットの上位 32ビット定義コード 00 (b)、 01 (b)、 11 (b)、お よび 01 (b)のコードで分類する。そして、上位 32ビット定義コードと下位 32ビットアド レスの組合せによって、分岐命令の履歴を記憶し、分岐予測を実行する。
[0140] したがって、 64ビットアドレス空間に、カーネル、ユーザプロセスの実行形式、およ び、スタック Zライブラリを分散配置する OSの制御に対して、上位 32ビットアドレスの 使用に偏りがある場合、効率的に分岐予測を実現できる。
[0141] すなわち、上位 32ビット定義コードのうち、 00 (b)、 01 (b)、 11 (b)を頻繁するアド レスの範囲に割り付け、 10 (b)をまれにしか発生しないアドレスの範囲に割り付ける。 このような上位 32ビット定義コードの定義により、分岐先アドレスが、下位 32ビットの 範囲で収まる場合は、もちろん、分岐先の上位 32ビットが 00 (b)、 01 (b)、 11 (b)で 分類されるアドレス空間相互で分岐が発生する場合にも、正し 、分岐予測結果を得 ることができる。したがって、分岐先の上位 32ビットが 10 (b) (その他の場合)を除外 して、分岐履歴を有効に使用することができる。
[0142] また、 PC相対分岐の場合に、プログラムカウンタの現在の値 PC152から分岐先ァ ドレスを復元することにより、相対アドレス演算器 168の演算結果が確定する前に桁 あふれが検知された段階で、分岐先アドレスを算出できる。

Claims

請求の範囲
[1] 少なくとも命令の記憶元から命令を取得する取得段階と前記命令を処理する実行 段階とを含む実行サイクルを繰り返す、そのようなコンピュータの前記取得段階で命 令を取得する取得部と、
前記取得部が取得する命令の記憶元である命令アドレスを決定するアドレス制御 部と、
前記コンピュータによって次の命令実行段階で処理される命令が分岐命令である か否かを過去に処理された命令の履歴情報にしたがって予測する分岐命令予測部 と、
前記取得された命令の少なくとも 1つを前記実行段階で処理する実行部と、を備え 前記アドレス制御部は、前記命令アドレスに含まれる所定の上位ビット部分と下位 ビット部分のうち、前記上位ビット部分を圧縮した上位アドレス情報を生成する符号ィ匕 部と、
前記上位アドレス情報力 上位ビット部分を復元する復元部とを有し、
前記分岐命令予測部は、
前記処理された分岐命令の分岐先アドレスに対応する上位アドレス情報と下位ビ ット部分とを、前記分岐命令の記憶元の命令アドレスに対応する上位アドレス情報と 下位ビット部分力 決定される複数の格納先のいずれかに前記履歴情報として記憶 する履歴記憶部を有する処理装置。
[2] 前記符号化部は、前記上位ビット部分を複数のアドレス範囲ごとに区分し、区分さ れた第 1のアドレス範囲を識別する第 1の上位アドレス情報と前記第 1のアドレス範囲 以外のアドレス範囲を識別する第 2の上位アドレス情報とを生成し、
前記アドレス制御部は、前記分岐命令の分岐先アドレスが、前記第 1の上位アドレ ス情報で識別される前記第 1のアドレス範囲に分岐する分岐命令である場合に、前 記復元部を通じて前記第 1のアドレス範囲に対応する上位ビット部分を生成し、 前記分岐命令が前記第 2の上位アドレス情報で識別されるアドレス範囲に分岐する 分岐命令である場合に前記分岐命令の種類に応じて上位ビット部分を復元する請 求項 1に記載の処理装置。
[3] 前記アドレス制御部は、
前記分岐命令が前記第 2の上位アドレス情報で識別されるアドレス範囲に分岐す る分岐命令である場合に、分岐命令の種類を識別する信号を前記実行部から受信 する分岐種別情報受信部と、
前記分岐命令が前記下位ビット部分の範囲を限界として分岐元アドレス力 相対 分岐する相対分岐命令である場合に、前記実行部における前記分岐命令の処理に ぉ 、て前記下位ビット部分の範囲から正方向または負方向に桁あふれが発生したこ とを示す桁あふれ情報を受信する桁あふれ情報受信部と、
前記桁あふれが発生した場合に、分岐元アドレスの上位ビット部分への加減算に よって分岐先アドレスの上位ビット部分を取得する算術部とを有する請求項 3に記載 の処理装置。
[4] 前記アドレス制御部は、分岐種別情報受信部が前記相対分岐命令でな!ヽ場合に、 分岐命令の分岐先を算出した前記実行部力 分岐先アドレスの上位ビット部分を取 得する上位ビット取得部を有する請求項 3に記載の処理装置。
PCT/JP2006/303770 2006-02-28 2006-02-28 圧縮したアドレス情報により分岐予測する処理装置 WO2007099605A1 (ja)

Priority Applications (5)

Application Number Priority Date Filing Date Title
DE602006013515T DE602006013515D1 (de) 2006-02-28 2006-02-28 Verarbeitungseinrichtung durch vorhersage einer abzweigung aus komprimierten adresseninformationen
EP06714899A EP1990714B1 (en) 2006-02-28 2006-02-28 Processing device by predicting branch from compressed address information
JP2008502592A JP5136405B2 (ja) 2006-02-28 2006-02-28 演算処理装置及び演算処理装置の制御方法
PCT/JP2006/303770 WO2007099605A1 (ja) 2006-02-28 2006-02-28 圧縮したアドレス情報により分岐予測する処理装置
US12/195,738 US7949862B2 (en) 2006-02-28 2008-08-21 Branch prediction table storing addresses with compressed high order bits

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2006/303770 WO2007099605A1 (ja) 2006-02-28 2006-02-28 圧縮したアドレス情報により分岐予測する処理装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US12/195,738 Continuation US7949862B2 (en) 2006-02-28 2008-08-21 Branch prediction table storing addresses with compressed high order bits

Publications (1)

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

Family

ID=38458729

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2006/303770 WO2007099605A1 (ja) 2006-02-28 2006-02-28 圧縮したアドレス情報により分岐予測する処理装置

Country Status (5)

Country Link
US (1) US7949862B2 (ja)
EP (1) EP1990714B1 (ja)
JP (1) JP5136405B2 (ja)
DE (1) DE602006013515D1 (ja)
WO (1) WO2007099605A1 (ja)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012155539A (ja) * 2011-01-26 2012-08-16 Fujitsu Ltd 処理装置
JP2014109953A (ja) * 2012-12-03 2014-06-12 Fujitsu Ltd 演算処理装置、演算処理方法
WO2021059906A1 (ja) * 2019-09-27 2021-04-01 日本電気株式会社 分岐予測回路および命令処理方法

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008165589A (ja) * 2006-12-28 2008-07-17 Fujitsu Ltd 情報処理装置
US8898426B2 (en) 2012-06-11 2014-11-25 International Business Machines Corporation Target buffer address region tracking
US10061580B2 (en) * 2016-02-25 2018-08-28 International Business Machines Corporation Implementing a received add program counter immediate shift (ADDPCIS) instruction using a micro-coded or cracked sequence
US10277247B1 (en) * 2018-04-11 2019-04-30 Bae Systems Information And Electronic Systems Integration Inc. Stateful compression scheme for efficient packing of kinematic data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07210383A (ja) * 1994-01-04 1995-08-11 Intel Corp 分岐命令予測機構及び予測方法
JPH08234980A (ja) * 1995-02-27 1996-09-13 Mitsubishi Electric Corp 分岐先バッファを用いた分岐予測システム
JPH09311787A (ja) * 1996-05-23 1997-12-02 Toshiba Corp データ処理装置
JP2004038398A (ja) 2002-07-01 2004-02-05 Konami Co Ltd 3次元画像処理プログラム、3次元画像処理方法及びビデオゲーム装置
JP2004038298A (ja) * 2002-06-28 2004-02-05 Fujitsu Ltd セットアソシアティブ方式の記憶装置及びキャッシュメモリ装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3599409B2 (ja) * 1994-06-14 2004-12-08 株式会社ルネサステクノロジ 分岐予測装置
GB9521980D0 (en) * 1995-10-26 1996-01-03 Sgs Thomson Microelectronics Branch target buffer
US5701448A (en) * 1995-12-15 1997-12-23 Cyrix Corporation Detecting segment limit violations for branch target when the branch unit does not supply the linear address
US5938761A (en) * 1997-11-24 1999-08-17 Sun Microsystems Method and apparatus for branch target prediction
US6622241B1 (en) * 2000-02-18 2003-09-16 Hewlett-Packard Development Company, L.P. Method and apparatus for reducing branch prediction table pollution
JP3800533B2 (ja) * 2002-06-28 2006-07-26 富士通株式会社 プログラムカウンタ制御方法及びプロセッサ

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07210383A (ja) * 1994-01-04 1995-08-11 Intel Corp 分岐命令予測機構及び予測方法
US5574871A (en) 1994-01-04 1996-11-12 Intel Corporation Method and apparatus for implementing a set-associative branch target buffer
JPH08234980A (ja) * 1995-02-27 1996-09-13 Mitsubishi Electric Corp 分岐先バッファを用いた分岐予測システム
JPH09311787A (ja) * 1996-05-23 1997-12-02 Toshiba Corp データ処理装置
JP2004038298A (ja) * 2002-06-28 2004-02-05 Fujitsu Ltd セットアソシアティブ方式の記憶装置及びキャッシュメモリ装置
JP2004038398A (ja) 2002-07-01 2004-02-05 Konami Co Ltd 3次元画像処理プログラム、3次元画像処理方法及びビデオゲーム装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Dynamic Distinction of Distinguished Segments", IBM TECHNICAL DISCLOSURE BULLETIN, vol. 28, no. 9, February 1986 (1986-02-01)
See also references of EP1990714A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012155539A (ja) * 2011-01-26 2012-08-16 Fujitsu Ltd 処理装置
JP2014109953A (ja) * 2012-12-03 2014-06-12 Fujitsu Ltd 演算処理装置、演算処理方法
WO2021059906A1 (ja) * 2019-09-27 2021-04-01 日本電気株式会社 分岐予測回路および命令処理方法
JP2021056598A (ja) * 2019-09-27 2021-04-08 日本電気株式会社 分岐予測回路および命令処理方法

Also Published As

Publication number Publication date
EP1990714A1 (en) 2008-11-12
EP1990714B1 (en) 2010-04-07
EP1990714A4 (en) 2009-04-29
JPWO2007099605A1 (ja) 2009-07-16
DE602006013515D1 (de) 2010-05-20
US20080313446A1 (en) 2008-12-18
US7949862B2 (en) 2011-05-24
JP5136405B2 (ja) 2013-02-06

Similar Documents

Publication Publication Date Title
JP5313279B2 (ja) 非アラインドメモリアクセス予測
USRE35794E (en) System for reducing delay for execution subsequent to correctly predicted branch instruction using fetch information stored with each block of instructions in cache
JP5889986B2 (ja) 実行された命令の結果を選択的にコミットするためのシステムおよび方法
JP3397081B2 (ja) 複数の分岐予測方式のうちの選択された1つを使用して条件分岐命令を推測的に実行するためのプロセッサ、データ処理システム及び方法
US5740417A (en) Pipelined processor operating in different power mode based on branch prediction state of branch history bit encoded as taken weakly not taken and strongly not taken states
KR101493019B1 (ko) 희소 및 조밀 예측 캐쉬들을 갖는 하이브리드 브랜치 예측 장치
US5761723A (en) Data processor with branch prediction and method of operation
WO2007099605A1 (ja) 圧縮したアドレス情報により分岐予測する処理装置
JP2008530714A5 (ja)
EP2864868A1 (en) Methods and apparatus to extend software branch target hints
KR20090009955A (ko) 블록-기반 브랜치 타겟 어드레스 캐시
JP2006520964A (ja) 分岐ターゲットに基づいて分岐予測をするための方法および装置
US7849292B1 (en) Flag optimization of a trace
JP2006520964A5 (ja)
US7877578B2 (en) Processing apparatus for storing branch history information in predecode instruction cache
US7010676B2 (en) Last iteration loop branch prediction upon counter threshold and resolution upon counter one
US20160196156A1 (en) Simulation apparatus, simulation method, and computer product
JP3345787B2 (ja) データ処理装置
JP3983482B2 (ja) 高速ディスプレースメント付きpc相対分岐方式
US20110047355A1 (en) Offset Based Register Address Indexing
WO2023146519A1 (en) Parallel decode instruction set computer architecture with variable-length instructions
EP0666538A2 (en) Data processor with branch target address cache and method of operation
US20230401067A1 (en) Concurrently fetching instructions for multiple decode clusters
US20240036866A1 (en) Multiple instruction set architectures on a processing device
CN114281411A (zh) 指令处理方法、指令执行方法以及处理器

Legal Events

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

Ref document number: 2008502592

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2006714899

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE