This application is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2013-141015, filed on Jul. 4, 2013, the entire contents of which are incorporated herein by reference.
The embodiments discussed herein are directed to a processing device and a control method of the processing device.
A processing device having a register file including a plurality of register windows, and an arithmetic unit executing an instruction in which data held in the register file is set as an operand, has been known (refer to Patent Document 1, for example). A current window pointer unit holds address information which designates, among the plurality of register windows included by the register file, a register window to be a current window. When a window switching instruction indicating a switching of the current window is decoded, the address information held by the current window pointer unit is updated. A period of time from when the decode of the window switching instruction is started to a point of time right before a commit is started, is controlled so that the arithmetic unit can read, from the register file, data of a first register window designated by address information before the update and data of a second register window designated by address information after the update.
Further, there has been known a processing device having at least one register file having a plurality of register windows formed of sets of registers in an order of in registers, local registers and out registers, in which the plurality of register windows are formed in a ring shape (refer to Patent Document 2, for example). A current window pointer unit indicates, when accessing a register window, a current register window position by a pointer value. A current register reads data held by a register window designated by the pointer value indicated by the current window pointer unit from the register file, and holds the data. A replacement buffer is mounted between the register file and the current register, and holds data transferred from the register file to the current register. An arithmetic unit executes a window switching instruction and processing of instruction related to data held in the current register or data held in the replacement buffer. If, when the arithmetic unit executes a window switching instruction of executing a switching of a register window, a window switching instruction is decoded, data of a register window designated by the current window pointer unit by the execution of the window switching instruction is transferred to the replacement buffer.
Further, there has been known a processing device having an arithmetic part performing arithmetic processing, and a register window having K pieces of windows each including N pieces of registers, in which it is configured such that some registers forming the respective windows are shared by registers forming the windows at both sides, and the shared part is used for a delivery of argument at a time of subroutine call (refer to Patent Document 3, for example). A current window selecting unit selects one piece of window out of the K pieces of windows. A register selecting unit selects a read register based on a read address. A control part outputs a window address signal for selecting a window with the use of the current window selecting unit.
Patent Document 1: Japanese Laid-open Patent Publication No. 2008-234075
Patent Document 2: Japanese Laid-open Patent Publication No. 2007-87108
Patent Document 3: International Publication Pamphlet No. WO 2010/016097
If, during an execution of window switching instruction of changing a number of register window by one, another window switching instruction is input, a decode of the input window switching instruction is waited until when the execution is completed. In such a case, a speed of executing the instruction is lowered, which is a problem.
A processing device has: a plurality of registers configured to correspond to a plurality of accessible register windows; and an instruction decoder configured to inhibit, when, during an execution of a first instruction of changing a number of a current register window by one, a second instruction of changing the number of the current register window by one in a direction same as a direction of the first instruction is input, a decode of the second instruction until when the execution of the first instruction is completed, and to perform, when, during the execution of the first instruction of changing the number of the current register window by one, a second instruction of changing the number of the current register window by one in a direction opposite to the direction of the first instruction is input, a decode of the second instruction during the execution of the first instruction.
The object and advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention.
Until when data is written into the register 216 by the completion of instruction, data being a writing target is written into the renaming register 215. A succeeding instruction can be processed at high speed by using the data of the renaming register 215. When the data is written into the register 216 by the completion of instruction, the succeeding instruction uses the data of the register 216.
When the SAVE instruction or the RESTORE instruction is executed for switching the register windows W0 to W7, a succeeding instruction has to be read from a new register window. For this reason, the register renaming map is switched to a new renaming map of register windows W0 to W7 when decoding an instruction of switching the register windows W0 to W7. At this time, there is no information regarding the new renaming map of register windows, so that the existing register renaming map is reset.
In step S602, the instruction decoder 204 determines, based on an instruction completion notice from the instruction completion control part 210, whether or not the instruction of switching the register window is in execution. When the instruction is in execution, the process proceeds to step S603, and when it is not in execution, the process proceeds to step S605. Specifically, when, during the execution of the instruction of switching the register window, another instruction of switching the register window is input into the instruction decoder 204, the process proceeds to step S603.
In step S603, the instruction decoder 204 determines whether or not a direction of switching the register window coincides with a direction in which the register window is switched the last time. When both of a preceding instruction and a succeeding instruction are the SAVE instructions, since the both instructions indicate a switching in an increment direction, it is determined that the directions coincide. When both of the preceding instruction and the succeeding instruction are the RESTORE instructions, since the both instructions indicate a switching in a decrement direction, it is determined that the directions coincide. When the preceding instruction and the succeeding instruction are the SAVE instruction and the RESTORE instruction, respectively, it is determined that the switching directions do not coincide. When the directions coincide, the process proceeds to step S604, and when they do not coincide, the process proceeds to step S605.
In step S604, the instruction decoder 204 inhibits the decode of the above-described input instruction of switching the register window, and the process returns to step S602. Specifically, the instruction decoder 204 makes the decode processing of the succeeding register window switching instruction wait until the execution of the preceding register window switching instruction is completed.
In step S605, the instruction decoder 204 performs the decode processing of the above-described input instruction. After that, in step S606, processing of the next instruction is conducted.
Next, the instruction decoder 204 decodes the SAVE instruction. The CWP of 0 at the time of decoding the instruction is incremented to be 1. The information of the renaming register when the CWP equals to 0 stored in the latest register renaming map storage part 501 is copied to the saving register renaming map storage part 502. In the latest register renaming map storage part 501, the latest information of the renaming register when the CWP equals to 1 is written. After that, the instruction before the SAVE instruction is executed under the state where the CWP equals to 0, and the instruction after the SAVE instruction is executed under the state where the CWP equals to 1.
Next, the instruction decoder 204 decodes the RESTORE instruction. The CWP of 1 at the time of decoding the instruction is decremented to be 0. The information of the renaming register when the CWP equals to 1 stored in the latest register renaming map storage part 501 is copied to the saving register renaming map storage part 502. The information of the renaming register when the CWP equals to 0 stored in the saving register renaming map storage part 502 is copied to the latest register renaming map storage part 501. Accordingly, a succeeding instruction of the RESTORE instruction can use the information of the renaming register when the CWP equals to 0 stored in the latest register renaming map storage part 501.
When the SAVE instruction is input and then the RESTORE instruction is input, the number of CWP is changed from 0 to 1 to 0, and thus it returns to its original number. By corresponding to this, the information of the renaming register when the CWP equals to 0 is moved from the latest register renaming map storage part 501 to the saving register renaming map storage part 502 to the latest register renaming map storage part 501. By providing the saving register renaming map 502, the information of the renaming register when the CWP equals to 0 can be returned to the latest register renaming map storage part 501 without being deleted. Accordingly, when the SAVE instruction is in execution and the process proceeds to step S605 from step S603, the decode of the RESTORE instruction is not inhibited and the decode processing of the RESTORE instruction can be conducted, resulting in that the speed of the processing can be increased. Note that the same applies to not only the case where the preceding instruction is the SAVE instruction and the succeeding instruction is the RESTORE instruction, but also a case where the preceding instruction is the RESTORE instruction and the succeeding instruction is the SAVE instruction.
In the present embodiment, when the instruction of switching the register window is decoded, the direction of switching the register window is held. The direction of switching the register window indicates a direction in which the number of CWP is incremented by one or decremented by one. Further, at the time of decoding the instruction, the current register renaming map is not discarded but is held by being stored in the saving register renaming map storage part 502. When the instruction registered in the saving register renaming map storage part 502 is completed, the effective flag of the saving renaming register map storage part 502 is also invalidated.
In a case where an instruction of switching the register window again is decoded until when the instruction of switching the register window is completed, if a switching direction of the register window and the held switching direction do not coincide, the process proceeds to step S605 from step S603, in which the instruction can be decoded. At the time of decoding the instruction, the direction of switching the register window is updated and held. Further, by moving the information of the latest register renaming map storage part 501 to the saving register renaming map storage part 502, and by moving the information of the saving renaming map storage part 502 to the latest register renaming map storage part 501, the succeeding instruction can use a correct renaming map.
As described above, when an instruction of switching the register window is decoded, an instruction of switching the register window is in execution, and a switching direction of the instruction to be decoded and a switching direction of the register window of the last instruction of switching the register window coincide, the instruction decoder 204 inhibits the instruction decode. Further, the instruction decoder 204 inhibits the instruction decode until when the last instruction of switching the register window is completed.
After that, when the instruction decoder 204 decodes the instruction of switching the register window again, it moves the information of the latest register renaming map storage part 501 to the saving register renaming map storage part 502, and moves the information of the saving register renaming map storage part 502 to the latest register renaming map storage part 501. An address registered in the information of the latest register renaming map storage part 501 and the saving register renaming map storage part 502 after the instruction decode is directly moved in an effective state.
By the completion of the instruction, the data of the renaming register 215 is written into the fixed-point register 216. The saving register renaming map storage part 502 holds the registered address of the renaming register 215. When the instruction completion notice is input into a renaming map reset circuit 1004 from the instruction completion control part 210, and if the completed instruction coincides with the address registered in the latest register renaming map storage part 501, the renaming map reset circuit 1004 invalidates the address registered in the latest register renaming map storage part 501. In like manner, when the instruction completion notice is input into a renaming map reset circuit 1003 from the instruction completion control part 210, and if the completed instruction coincides with the address registered in the saving register renaming map storage part 502, the renaming map reset circuit 1003 invalidates the address registered in the saving register renaming map storage part 502. Accordingly, the latest register renaming map storage part 501 and the saving register renaming map storage part 502 can constantly maintain a state necessary for the latest register renaming.
Note that when the instruction of switching the register window is decoded during when the instruction of switching the register window is not in execution, the saving register renaming map storage part 502 is in a totally invalid state. This is because, when the instruction of switching the register window is not in execution, only one register window is used. For this reason, since the saving register renaming map storage part 502 is in a totally invalid state when the instruction of switching the register window is not in execution, there is no problem if the information of the saving register renaming map storage part 502 is moved to the latest register renaming map storage part 501.
When the instruction decoder 204 decodes the instruction of switching the register window (SAVE instruction or RESTORE instruction), it stores the signal SAVE_PENDING or RESTORE_PENDING indicating that the instruction of switching the register window is in execution, and at the same time, it stores and holds an instruction identifier IID as SAVE_PENDING_IID or RESTORE_PENDING_IID. The instruction identifier IID indicates a number of entry of the CSE 210 controlling the completion of instruction, and is assigned at the time of instruction decode. When the SAVE instruction or the RESTORE instruction is completed, a coincidence of a completed instruction identifier IID and the instruction identifier SAVE_PENDING_IID or RESTORE_PENDING_IID indicating that the instruction of switching the register window is in execution is checked, and when the coincidence is confirmed, the signal SAVE_PENDING or RESTORE_PENDING indicating that the instruction is in execution is reset.
When the instruction decoder 204 decodes the instruction of switching the register window, it also stores and holds a direction LAST_SAVE of switching the register window. In a case of the SAVE instruction, 1 is stored in the switching direction LAST_SAVE, and in a case of the RESTORE instruction, 0 is stored in the switching direction LAST_SAVE. The switching direction LAST_SAVE stores a direction of switching the register window when decoding the instruction of switching the register window the last time.
The instruction decoder 204 performs, based on the signals SAVE_PENDING and RESTORE_PENDING indicating that the SAVE instruction and the RESTORE instruction described above are in execution, and the direction LAST_SAVE of switching the register window, a control of the decode of the succeeding instruction of switching the register window. When the instruction of switching the register window is input, the instruction decode is conducted normally if both of the SAVE instruction and the RESTORE instruction are not in execution. When either of the SAVE instruction and the RESTORE instruction is in execution, the instruction decode is conducted if a direction of switching the register window of the instruction of switching the register window and the direction LAST_SAVE of switching the register window the last time are different, and the instruction decode is inhibited if the directions are the same.
“D” in
Regarding the SAVE instruction of (1), the signals SAVE_PENDING and RESTORE_PENDING are “0”, and thus both of the SAVE instruction and the RESTORE instruction are not in execution, so that the instruction decode D is conducted. At this time, the signal SAVE_PENDING becomes “1”, and the identifier SAVE_PENDING_IID becomes “0x4” assigned at the time of instruction decode. The switching direction LAST_SAVE becomes “1”.
Regarding the RESTORE instruction of (2), the signal SAVE_PENDING is “1”, and thus the SAVE instruction is in execution, so that the instruction decoder 204 checks the switching direction LAST_SAVE. Since the switching direction LAST_SAVE is “1”, the RESTORE instruction of (2) indicates a switching in a direction different from that of the previous switching instruction, so that it is judged that the RESTORE instruction can be decoded, and the instruction decode D is conducted. The signal RESTORE_PENDING becomes “1”, and the identifier RESTORE_PENDING_IID becomes “0x10” assigned at the time of instruction decode. The switching direction LAST_SAVE becomes “0”.
Regarding the SAVE instruction of (3), the signals SAVE_PENDING and RESTORE_PENDING are “1”, and thus the SAVE instruction and the RESTORE instruction are in execution, so that the instruction decoder 204 checks the switching direction LAST_SAVE. At this time, since the switching direction LAST_SAVE is “0”, the SAVE instruction of (3) indicates a switching in a direction different from that of the previous switching instruction, so that it is judged that the SAVE instruction can be decoded, and the instruction decode is conducted. At this time, the signal SAVE_PENDING maintains “1”, and the identifier SAVE_PENDING_IID is updated from “0x4” to “0x15” assigned at the time of instruction decode. The switching direction LAST_SAVE becomes “1”.
Regarding the SAVE instruction of (4), the signals SAVE_PENDING and RESTORE_PENDING are “1”, and thus the SAVE instruction and the RESTORE instruction are in execution, so that the instruction decoder 204 checks the switching direction LAST_SAVE. At this time, since the switching direction LAST_SAVE is “1”, the SAVE instruction of (4) indicates a switching in a direction same as that of the previous switching instruction, so that it is judged that it is not possible to decode the SAVE instruction, and the instruction decode is inhibited.
In the cycle W after the SAVE instruction of (1) is completed, the identifier IID (0x4) after completing the instruction and the identifier IID (0x15) stored in the identifier SAVE_PENDING_IID are compared, and the identifiers do not coincide, so that “1” is held in the signal SAVE_PENDING. In the cycle W after the RESTORE instruction of (2) is completed, the identifier IID (0x10) after completing the instruction and the identifier IID (0x10) stored in the identifier RESTORE_PENDING_IID are compared, and the identifiers coincide, so that the signal RESTORE_PENDING is reset to “0”. In the cycle W after the SAVE instruction of (3) is completed, the identifier IID (0x15) after completing the instruction and the identifier IID (0x15) stored in the identifier SAVE_PENDING_IID are compared, and the identifiers coincide, so that the signal SAVE_PENDING is reset to “0”.
Regarding the SAVE instruction of (4), since the signals SAVE_PENDING and RESTORE_PENDING become “0”, it is judged that the instruction decode can be conducted, resulting in that the instruction decode D is conducted. At this time, the signal SAVE_PENDING becomes “1”, and the identifier SAVE_PENDING_IID becomes “0x20” assigned at the time of instruction decode. The switching direction LAST_SAVE becomes “1”.
Although the generation circuit of the signal SAVE_PENDING and the identifier SAVE_PENDING_IID is explained in the above description, a generation circuit of the signal RESTORE_PENDING and the identifier RESTORE_PENDING_IID also has AND circuits 1208, 1209, 1212, OR circuits 1207, 1210, and a comparator 1211, and generates the signal RESTORE_PENDING and the identifier RESTORE_PENDING_IID through similar processing.
If an instruction of switching the register window is decoded when an instruction of switching the register window is not executed, the register window to be updated by the instruction of switching the register window becomes the prefetch register window, and can be read by the succeeding instruction. When the instruction of switching the register window is completed, a content of CWP of the prefetch register window becomes a content of CWP of the current register window. When, during the execution of the instruction of switching the register window, an instruction of switching the register window is decoded, the current register window and the prefetch register window are not changed. If, when the instruction of switching the register window is completed, the instruction of switching the register window whose direction of switching the register window is the opposite direction is in execution, the content of CWP of the current register window is changed to the content of CWP of the prefetch register window, and the content of CWP of the prefetch register window is changed to the content of CWP of the current register window.
When the CWP equals to 0, the content when the CWP equals to 0 is assigned to the content of the current register window. The prefetch register window at this time is invalid since the instruction of switching the register window is not in execution. When the SAVE instruction of (1) is decoded, the content when the CWP equals to 1 is assigned to the prefetch register window. When the RESTORE instruction of (2) is decoded, since the SAVE instruction is in execution, the current register window and the prefetch register window are not changed. The same applies to a case where the SAVE instruction of (3) is decoded, in which since the RESTORE instruction is in execution, the current register window and the prefetch register window are not changed. When the SAVE instruction of (1) is completed, the CWP is updated to 1. At this time, the content of the prefetch register window is assigned to the current register window. Further, when the SAVE instruction of (1) is completed, since the RESTORE instruction is in execution, the content of the current register window is assigned to the prefetch register window. When the RESTORE instruction of (2) is completed, the CWP is updated to 0. At this time, the content of the prefetch register window is assigned to the current register window. Further, when the RESTORE instruction of (2) is completed, since the SAVE instruction is in execution, the content of the current register window is assigned to the prefetch register window. When the SAVE instruction of (3) is completed, the CWP is updated to 1. At this time, the content of the prefetch register window is assigned to the current register window. Further, when the SAVE instruction of (3) is completed, since the RESTORE instruction is not in execution, the prefetch register window becomes invalid.
The value of the counter READ_REG_WIN_CNT is incremented by one when decoding the SAVE instruction, the value is decremented by one when completing the SAVE instruction, the value is decremented by one when decoding the RESTORE instruction, and the value is incremented by one when completing the RESTORE instruction. When the value of the counter READ_REG_WIN_CNT is “0”, the assignment is conducted so that the reading is performed from the current register window, and when the value of the counter READ_REG_WIN_CNT is “+1” or “−1”, the assignment is conducted so that the reading is performed from the prefetch register window.
When the instruction of switching the register window is not in execution under the state where the CWP equals to 0, the value of the counter READ_REG_WIN_CNT is “0”. The instruction decoded at this time is read from the current register window. When the SAVE instruction of (1) is decoded, the value of the counter READ_REG_WIN_CNT is incremented by one to be “1”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the prefetch register window. When the RESTORE instruction of (2) is decoded, the value of the counter READ_REG_WIN_CNT is decremented by one to be “0”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the current register window. When the SAVE instruction of (3) is decoded, the value of the counter READ_REG_WIN_CNT is incremented by one to be “1”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the prefetch register window. After that, since the SAVE instruction of (1) is completed, the value of the counter READ_REG_WIN_CNT is decremented by one to be “0”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the current register window. When the RESTORE instruction of (2) is completed, the value of the counter READ_REG_WIN_CNT is incremented by one to be “1”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the prefetch register window. When the SAVE instruction of (3) is completed, the value of the counter READ_REG_WIN_CNT is decremented by one to be “0”. The assignment is conducted with respect to the succeeding instruction so that the reading is performed from the current register window.
The execution of instruction is conducted from the reservation station 207. Through the above-described control, the register window to be read is assigned, and the decoded instruction is stored in the reservation station 207. It is not possible for the reservation station 207 to execute the instruction until when the preparation of execution is done, and thus the instruction remains in the reservation station 207. If, during this period of time, the instruction of switching the register window is completed, the positional relationship between the current register window and the prefetch register window is changed, so that there is a need to change the read register window assigned at the time of the instruction decode. At the time of completing the instruction of switching the register window, if a read register with an entry effective for the reservation station 207 is the current register window, the read register window is changed to the prefetch register window, and if it is the prefetch register window, the read register window is changed to the current register window, resulting in that the reading can be performed from a correct register window.
As described above, the fixed-point register 216 has the plurality of registers corresponding to the plurality of accessible register windows W0 to W7. When, during the execution of first instruction of changing the number of current register window (CWP) by one, a second instruction of changing the number of current register window (CWP) by one in a direction same as that of the first instruction is input, the instruction decoder 204 makes the process proceed to step S604 from step S603 in
The renaming register 215 stores the content of the fixed-point register 216. The latest register renaming map storage part 501 stores the latest register renaming map indicating the address of the renaming register 215. The saving register renaming map storage part 502 stores the old register renaming map indicating the address of the renaming register 215.
When the first instruction is decoded, the register renaming map stored in the latest register renaming map storage part 501 is stored in the saving register renaming map storage part 502, and the register renaming map of the current register window (CWP) corresponding to the first instruction is stored in the latest register renaming map storage part 501.
When the second instruction in the direction opposite to that of the first instruction is decoded, the register renaming map stored in the latest register renaming map storage part 501 is stored in the saving register renaming map storage part 502, and the register renaming map stored in the saving register renaming map storage part 502 is stored in the latest register renaming map storage part 501.
When the content of the renaming register 215 is written into the fixed-point register 216 by the completion of the instruction, the address of the register renaming map described above is invalidated.
According to the present embodiment, since the decode of the second instruction can be performed during the execution of the first instruction, the second instruction can be processed at high speed. Specifically, when the instruction of switching the register window input again during the execution of the instruction of switching the register window indicates a switching in a direction opposite to that of the instruction of switching the register window the last time, the instruction decode is conducted without being inhibited, so that it becomes possible to realize the operation without inhibiting the decode of the succeeding instruction. Accordingly, it becomes possible to execute the instruction at high speed, which leads to an improvement in performance.
A second instruction can be decoded during an execution of a first instruction, so that the second instruction can be processed at high speed.
Note that the above-described embodiments merely illustrate concrete examples of implementing the present embodiments, and the technical scope of the present embodiments is not to be construed in a restrictive manner by these embodiments. That is, the present embodiments may be implemented in various forms without departing from the technical spirit or main features thereof.
All examples and conditional language provided herein are intended for the pedagogical purposes of aiding the reader in understanding the invention and the concepts contributed by the inventor to further the art, and are not to be construed as limitations to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although one or more embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2013-141015 | Jul 2013 | JP | national |