A method for scheduling micro-instructions, performed by a first qualifier, is provided. The method includes the following steps: detecting a write-back signal broadcasted by a second qualifier; determining whether a value of a first load-detection counting logic is to be synchronized with a value of a second load-detection counting logic carried by the write-back signal according to content of the write-back signal; determining whether execution statuses of all load micro-instructions are cache hit when the synchronized value of the first load-detection counting logic reaches a predetermined value; and driving a release circuit to remove a micro-instruction in a reservation station queue when the execution statuses of the all load micro-instructions are cache hit and the micro-instruction has been dispatched to an arithmetic and logic unit for execution.
|
1. A method for scheduling micro-instructions, performed by a first qualifier, wherein the first qualifier is associated with a first micro-instruction, the first micro-instruction depends on a second micro-instruction, and the second micro-instruction depends on one or a plurality of load micro-instructions executed by one or a plurality of load execution units, the method comprising:
detecting a write-back signal broadcasted by a second qualifier associated with the second micro-instruction;
determining whether a value of a first load-detection counting logic is to be synchronized with a value of a second load-detection counting logic carried by the write-back signal according to content of the write-back signal;
determining whether execution statuses of all of the load micro-instructions are cache hit when the synchronized value of the first load-detection counting logic reaches a predetermined value; and
driving a release circuit to remove the first micro-instruction in a reservation station queue when the execution statuses of all of the load micro-instructions are cache hit and the first micro-instruction has been dispatched to an arithmetic and logic unit for execution.
7. A scheduler device for micro-instructions comprising:
a reservation station queue; a release circuit coupled to the reservation station queue; and
a first qualifier, coupled to the release circuit, detecting a write-back signal broadcasted by a second qualifier, determining whether a value of a first load-detection counting logic is to be synchronized with a value of a second load-detection counting logic carried by the write-back signal according to content of the write-back signal, determining whether execution statuses of all of the load micro-instructions are cache hit when the synchronized value of the first load-detection counting logic reaches a first predetermined value, and driving the release circuit to remove the first micro-instruction in the reservation station queue when the execution statuses of all of the load micro-instructions are cache hit and the first micro-instruction has been dispatched to an arithmetic and logic unit for execution,
wherein the first qualifier is associated with the first micro-instruction, the first micro-instruction depends on a second micro-instruction, and the second micro-instruction depends on one or a plurality of load micro-instructions executed by one or a plurality of load execution units.
2. The method for scheduling micro-instructions as claimed in
driving the arithmetic and logic unit to kill execution of the first micro-instruction when the execution status of any one of the load micro-instructions is cache miss.
3. The method for scheduling micro-instructions as claimed in
4. The method for scheduling micro-instructions as claimed in
5. The method for scheduling micro-instructions as claimed in
6. The method for scheduling micro-instructions as claimed in
determining that the value of the first load-detection counting logic is to be synchronized with the value of the second load-detection counting logic carried by the write-back signal when a unique identification code of the second micro-instruction contained in the write-back signal is equal to a unique identification code on which the first micro-instruction depends.
8. The scheduler device as claimed in
a plurality of operand qualifiers, each operand qualifier associated with one of a plurality of operands of the first micro-instruction, and each operand qualifier comprising one load-detection counting logic, wherein when the synchronized value of the first load-detection counting logic reaches the first predetermined value, the corresponding operand qualifier determines whether the execution status of the load micro-instruction on which the corresponding operand directly depends is cache hit or cache miss according to a cache access status signal broadcasted by one load execution unit, and when the execution status of the load micro-instruction is cache hit, the corresponding operand qualifier outputs a load-confirmed signal; and
an AND gate coupled to the plurality of operand qualifiers, wherein when each of the plurality of operand qualifiers outputs the load-confirmed signal, the AND gate outputs an all-load-confirmed signal to drive the release circuit to remove the micro-instruction of an entry in the reservation station queue.
9. The scheduler device as claimed in
the load-detection counting logic initially latching a first value and changing the latched value every clock cycle;
a first comparator, coupled to the load-detection counting logic, repeatedly comparing a unique identification code on which the first micro-instruction directly depends with a unique identification code carried by the write-back signal and changing the first value to a second value carried by the write-back signal when the unique identification code on which the first micro-instruction directly depends is equal to the unique identification code carried by the write-back signal;
a second comparator, coupled to the load-detection counting logic, continuing to compare the value latched in the load-detection counting logic with a first predetermined value and outputting an enable signal to a third comparator when the latched value is equal to the first predetermined value; and
the third comparator, coupled to the second comparator, determining whether the cache access status signal indicates a cache hit or cache miss and outputting the load-confirmed signal when the cache access status signal indicates the cache hit.
10. The scheduler device as claimed in
11. The scheduler device as claimed in
the load-detection counting logic initially latching a first value and changing the latched value every clock cycle;
a first comparator, coupled to the load-detection counting logic, repeatedly comparing a unique identification code on which the first micro-instruction directly depends with a unique identification code carried by the write-back signal and changing the first value to a second value carried by the write-back signal when the unique identification code on which the first micro-instruction directly depends is equal to the unique identification code carried by the write-back signal;
a second comparator, coupled to the load-detection counting logic, continuing to compare the value latched in the load-detection counting logic with the first predetermined value and outputting a first enable signal to a third comparator when the latched value is equal to the first predetermined value;
the third comparator, coupled to the second comparator, determining whether a first cache access status signal indicates a cache hit or cache miss and outputting the load-confirmed signal when the first cache access status signal indicates the cache hit;
the fourth comparator, coupled to the load-detection counting logic, continuing to compare the value latched in the load-detection counting logic with a second first predetermined value and outputting a second enable signal to a fifth comparator when the latched value is equal to the second predetermined value; and
the fifth comparator, coupled to the fourth comparator, determining whether a second cache access status signal indicates a cache hit or cache miss and outputting the load-confirmed signal when the second cache access status signal indicates the cache hit.
12. The scheduler device as claimed in
13. The scheduler device as claimed in
14. The scheduler device as claimed in
|
This Application claims priority of China Patent Application No. 201810088159.1, filed on Jan. 30, 2018, the entirety of which is incorporated by reference herein.
The invention relates to a microprocessor technology, and more particularly to a method for scheduling micro-instructions and an apparatus using the same.
For current superscalar microprocessors, a reservation station is responsible for scheduling all micro-instructions. Except for load micro-instructions, the delay of the execution of the most micro-instructions is fixed. Memory systems in microprocessors typically employ a hierarchical architecture, including: a Level-1 data cache, a Level-2 data cache, and a main memory. Since a miss may occur in the Level-1 data cache (referred to as “L1 cache miss”) when a load micro-instruction is executed, the delay is variable. Some arithmetic logic micro-instructions depend on the load micro-instruction, that is, the arithmetic logic micro-instructions require the execution result of the load micro-instruction as its source operand. In order to simplify the design, a conventional reservation station usually also regards the delay of the execution of a load micro-instruction as a fixed value. That is, the reservation station assumes that a result can be obtained at the nth clock cycle which occurs after a load micro-instruction is dispatched to the load pipeline. Therefore, the reservation station dispatches a following arithmetic logic micro-instruction depending on the load micro-instruction to the arithmetic and logic unit (ALU) at the (n−2)th clock cycle after the load micro-instruction is dispatched to the load pipeline, and further clears the arithmetic logic micro-instruction in the corresponding queue. When a miss occurs in the cache (cache miss) after the nth clock cycles after the load micro-instruction is dispatched, the arithmetic logic micro-instruction that has been dispatched to the arithmetic and logic unit would fail because the data is not ready yet, resulting that the reservation station needs to replay the arithmetic logic micro-instruction. However, replaying the arithmetic logic micro-instruction may take a lot of time and reduce the performance of the microprocessor. Therefore, a method for scheduling arithmetic logic micro-instructions and an apparatus using the same to avoid replaying the arithmetic logic micro-instructions due to cache misses.
An exemplary embodiment of a method for scheduling micro-instructions is provided. The method is performed by a first qualifier and comprises the steps of detecting a write-back signal broadcasted by a second qualifier; determining whether a value of a first load-detection counting logic is to be synchronized with a value of a second load-detection counting logic carried by the write-back signal according to content of the write-back signal; determining whether execution statuses of all load micro-instructions are cache hit when the synchronized value of the first load-detection counting logic reaches a predetermined value; and driving a release circuit to remove a micro-instruction in a reservation station queue when the execution statuses of the all load micro-instructions are cache hit and the micro-instruction has been dispatched to an arithmetic and logic unit for execution.
An exemplary embodiment of a scheduler device for micro-instructions is provided. The scheduler comprises a reservation station queue, a release circuit, and a first qualifier. The release circuit is coupled to the reservation station queue. The first qualifier is coupled to the release circuit. The first qualifier detects a write-back signal broadcasted by a second qualifier and determines whether a value of a first load-detection counting logic is to be synchronized with a value of a second load-detection counting logic carried by the write-back signal according to content of the write-back signal. The first qualifier determines whether execution statuses of all of load micro-instructions are cache hit when the synchronized value of the first load-detection counting logic reaches a predetermined value and drives the release circuit to remove the first micro-instruction in the reservation station queue when the execution statuses of all of the load micro-instructions are cache hit and the first micro-instruction has been dispatched to an arithmetic and logic unit for execution.
In an exemplary embodiment, the qualifier is associated with the micro-instruction, and the micro-instruction depends on one or a plurality of load micro-instructions executed by the load execution unit.
According to the above method and device for scheduling micro-instructions, the micro-instruction in the reservation station queue is retained, which avoids a replay operation.
In addition, it is worth noted that since the execution state broadcasted by the load execution unit does not carry any unique identification code, the above method and device for scheduling micro-instructions of the present invention ensures the micro-instruction associated with the qualifier in which the load-detection counting logic reaches the predetermined value must directly or indirectly depend on the load micro-instruction corresponding to the execution state broadcasted by the load execution unit through the load-detection counting logic of the present invention.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
It should be understand that, in this specification, the terms “including”, “comprising”, and the like are used to indicate the presence of particular features, values, method steps, operation processing, elements, and components, but it is not excludes that more technical features, values, method steps, operation processing, elements, components, or any combination thereof may be added.
The terms, such as “first,” “second,” and “third,” recited in the claims are used to describe elements of the claims, and are not intended to indicate the priority order, the precedence relationship, the order in which one element precedes another, or the chronological order for executing the method steps, only to distinguish elements with the same name.
The load execution unit 155 is a pipeline. When executing micro-instructions, the load execution unit 155 requests data of a memory address from the level-1 L1 data cache 170 first. If the level-1 L1 data cache 170 has temporarily stored the data of the memory address (that is, a hit occurs in the level-1 L1 data cache 170, referred to as “L1 cache hit”), the data is stored to a specified location, such as a specified register. If the level-1 L1 data cache 170 does not temporarily store the data of the memory address (that is, a miss occurs in the level-1 L1 data cache 170, also referred to as “L1 cache miss”), the load execution unit 155 requests the data of the memory address from the level-2 L2 data cache 180. If the level-2 L2 data cache 180 has temporarily stored the data of the memory address (that is, a hit occurs in the level-2 L2 data cache 180, referred to as “L2 cache hit”), the data is returned to the level-1 L1 data cache 170. If the second level data cache 180 also does not temporarily store the data of the memory address (that is, a miss occurs in the level-2 L2 data cache 180, referred to as “L2 cache miss”), the data is read from the main memory (not shown in
There are various dependencies among the micro-instructions executed by the integer execution unit 151, the floating-point execution unit 153, the load execution unit 155, and the storage execution unit 157. A common dependency is that a source operand of an integer or floating-point arithmetic micro-instruction comes from the result of a load micro-instruction, for example:
In a normal case, the load execution unit 155 can acquire the data of the memory address Addr1 via the level-1 L1 data cache 170 at the nth clock cycle. In some embodiments, for the consideration for overall performance, at the (n−2)th clock cycle occurring after the scheduler 140 dispatches the micro-instruction “A1=LD [Addr1];” to the load execution unit 155 (hereinafter referred to as the (n−2)th clock cycle), the scheduler 140 dispatches the micro-instruction “A3=IADD A1, A2;” to the integer execution unit 151. It is assumed that the micro-instruction “A3=IADD A1, A2;” can be successfully executed at the next clock cycle after being dispatched to the integer execution unit 151 (hereinafter referred to as the (n−1)th clock cycle): the scheduler 140 removes the micro-instruction “A3=IADD A1, A2;” from the operation queue 141. Next, the scheduler 140 dispatches the micro-instruction “B1=IMUL A3, “3”;” at the (n−1)th clock cycle. At the nth clock cycle, if a miss occurs in the data cache (cache miss), the execution of the micro-instruction “A3=IADD A1, A2” failed because the load execution unit 155 has not yet obtained the data of the memory address Addr1. Also, because the execution of the micro-instruction “A3=IADD A1, A2;” is failed, the integer execution unit 151 fails to execute the micro-instruction “B1=IMUL A3, “3”;”. However, at the nth clock cycle, the micro-instruction “A3=IADD A1, A2;” has been removed from the operation queue 141. Thus, scheduler 140 must perform a re-dispatch operation, including fetching the integer addition micro-instruction from the reorder buffer 160, inserting the integer addition micro-instruction into the appropriate location in the operation queue 141, and the like. It should be noted that the performing the re-dispatch operation will consume a lot of time and computing resources, which reduces the overall system performance.
At the (n−2)th clock cycle occurring after the load instruction dispatch unit (not shown in
When each of the qualifiers 210(0)˜210(q) receives the load write-back signal S11, it determines whether the unique identification code on which its operands depend is equal to the unique identifier of the load instruction contained in the load write-back signal S11, that is, it determines whether one of the source operands of the micro-instruction of the corresponding entry depends on the execution result of the load micro-instruction. If so, a load-detection counting logic is triggered. When the value of the triggered load-detection counting logic reaches a predetermined value (for example, a value of 2, indicating that the second clock cycle which occurs after the load write-back signal S11 of the load instruction is broadcasted by the load execution unit 155 is reached), and the micro-instruction associated with the qualifier 210(i) has been dispatched to the arithmetic and logic unit 251 for execution (e.g., at the (n−1)th clock cycle, the micro-instruction is selected from the reservation station queue 241 by the instruction dispatch unit 242 and dispatched to the arithmetic and logic unit 251 for execution). When a cache hit is found for the load micro-instruction through a cache access status signal S12 broadcasted by the load execution unit 155, the qualifiers 210(i) generates a signal S13 indicating a load-confirmed to drive a release circuit 250 to remove micro-instruction of the entry 241(i) in the reservation station queue 241, where i is an integer between 0 and q. When a cache miss is found for the load micro-instruction through the cache access status signal S12 broadcasted by the load execution unit 155, the qualifiers 210(i) generates the signal S13 indicating a load-unconfirmed. The hardware architecture and detailed operation of the qualifier 210(i) can refer to the following paragraphs. It should be noted that the above-mentioned process of determining whether a cache hit occurs must be after the micro-instruction is selected by the instruction dispatch unit 242 from the reservation station queue 241 and dispatched to the arithmetic and logic unit 251 for execution and be executed by the qualifiers 210(i) associated with the micro-instruction. This is because a ready signal is set for the micro-instruction when it is determined to trigger the aforementioned load-detection counting logic. However, since there several operands in a micro-instruction, the micro-instruction will be selected and dispatched to the arithmetic and logic unit 251 for execution only when all of the ready signals for the micro-instruction are set. When the value of the triggered load-detection counting logic reaches the predetermined value (for example, indicating that the second clock cycle which occurs after the load write-back signal S11 of the load instruction is broadcasted by the load execution unit 155 is reached), but the micro-instruction is not selected by the instruction dispatch unit 242 and dispatched to the arithmetic and logic unit 251 because it is not ready or for other reasons, even if it is determined that a cache hit occurs, the qualifier 210(i) cannot issue the signal S13 to drive the release circuit 250 for removing the micro-instruction of the entry 241(i) in the reservation station queue 241. Therefore, the logic in the qualifier 210(i) that is configured to accomplish the above operation of determining whether a cache hit occurs should be synchronized with the pipeline of the arithmetic and logic unit 251.
A window checker 230 repeatedly detects the signals S13 generated by the qualifiers 210(0)˜210(q). When the signal S13 indicating a load-unconfirmed of the qualifier 210(i) is detected, a signal S17 is issued to drive the arithmetic and logic unit 251 to kill the execution of the micro-instruction of the entry (i), and a signal S16 is issued to drive the scheduler 140 to delete the micro-instruction from the instruction dispatch unit 242 (that is, the instruction dispatch unit 242 will not dispatch this micro-instruction to the arithmetic and logic unit 251 at the next clock cycle). At this time, the micro-instruction of the entry (i) that has been dispatched to the arithmetic and logic unit 251 and the micro-instruction that has been selected by the load execution unit 155 may be referred to as a polluted micro-instruction because the load micro-instruction on which they directly or indirectly depend has not been executed successfully to read the data of the specific memory address through the data cache. It should be noted that the arithmetic and logic unit 251 does not complete the execution of the micro-instruction of the entry (i) and terminates it prematurely, and the qualifier (i) does not issue the signal S13 to drive the release circuit 250 to remove the micro-instruction of the entry 241(i) in the reservation station queue 241. Thus, the micro-instruction of the entry 241(i) in the reservation station queue 241 is retained, thereby avoiding a replay operation. In addition, if the micro-instruction in the load execution unit 155 has not been dispatched to the arithmetic and logic unit 251, the above logic for determining whether a cache hit has occurred will not be triggered, and the micro-instruction of the entry (i) in the reservation station queue 241 will not be removed. For example, it is assumed that entry 241(i) stores the micro-instruction “A3=IADD A1, A2;”. When the value of the triggered load-detection counting logic reaches the predetermined value and it found that that the load micro-instruction “A1=LD [Addr1];” is cache hit, the qualifier 210(i) generates the signal S13 indicating the load-confirmed, and the signal S13 is generated to drive the release circuit 250 to remove the micro-instruction of the entry 241 in the reservation station queue 241. When the value of the triggered load-detection counting logic reaches the predetermined value and it is found that the load micro-instruction “A1=LD [Addr1];” is cache miss, the qualifier 210(i) generates the signal S23 indicating the load-unconfirmed. When the window checker 230 detects the signal S23 indicating the load-unconfirmed of the qualifier 210(i), the window checker 230 drives the arithmetic logic unit 251 to kill the execution of the micro-instruction “A3=IADD A1, A2;” of the entry (i) and drives the scheduler 140 to deletes the micro-instruction “B1=IMUL A3, “3”;” in the instruction dispatch unit 242 (that is, the instruction dispatch unit 242 will not dispatch the micro-instruction “B1=IMUL A3, “3”;” to the arithmetic and logic unit 251 at the next clock cycle). In one embodiment, when it is determined that the aforementioned load-detection counting logic is to be triggered (for example, when the unique identification code of the load micro-instruction contained in the write write-back signal S11 is equal to the unique identification code which the micro-instruction associated with the qualifier 210(i) depends), one of the ready signals of the micro-instruction is set. When the value of the triggered load-detection counting logic reaches the predetermined value and it is found that a cache miss occurs for the load micro-instruction, the qualifier 210(i) further clears the aforementioned ready signal of the micro-instruction of entry in the reservation station queue 241. After a plurality of subsequent clock cycles, when the execution of the load micro-instruction is actually completed, for example, when the load micro-instruction is executed to load the correct data from the level-2 L2 data cache 180 or the main memory, the ready signal is set again.
Furthermore, after the micro-instruction of the entry (i) is dispatched to the arithmetic and logic unit 251, the qualifier 210(i) or the arithmetic and logic unit 251 executing the micro-instruction of the entry (i) broadcasts a write-back signal S43 to other qualifiers, so that the values of the load-detection counting logics of the corresponding second qualifier 210(k) is synchronized with the values of the load-detection counting logics of the first qualifier 210(i). The second qualifier 210(k) is associated with an entry in the reservation station queue 241, and the micro-instruction of the entry contains at least one operand depending on the execution result of the micro-instruction of the entry (i). In an embodiment, the write-back signal S43 contains a unique identification code of the micro-instruction of the entry (i), and a unique identification code on which the micro-instruction associated with the second qualifier 210(k) depends is equal to the unique identifier of the micro-instruction of the entry (i) contained in the write-back signal S43, that is, the second qualifier 210(k) determines that its associated micro-instruction directly depends on the micro-instruction of the entry (i).
The operand qualifier 310(j) comprises a load-detection counting logic 440 that changes the latched value at each clock cycle to allow other components to recognize the current phase status according to, for example, whether the value reaches a predetermined value. The load-detection counting logic 440 may comprise a 3-bit shift register that is cyclically shifted by one bit per clock cycle. A comparator 431 compares the value stored in the dependency register 410 with the unique identification code of the load micro-instruction carried by the load write-back signal S11 at each clock cycle. The load write-back signal S11 is broadcasted by the load execution unit 155 for awaking at least one micro-instruction depending on a particular load micro-instruction, and the load write-back signal S11 carries a unique identification code to identify the particular load micro-instruction. When the two are the same and the counting value carried by the load write-back signal S11 is “2′b000”, the comparator 431 outputs an enable signal E41 to an input circuit 433 to the input circuit and drives the input circuit 443 to reset the load-detection counting logic 440 to the value “2′b001” for triggering the load-detection counting logic 440. At each clock cycle, the value of the load-detection counting logic 440 is shifted left by one bit. For example, during the period from the (n−2)th clock cycle to the nth clock cycle, the value D43 of the load-detection counting logic 440 is sequentially changed to “2′b001”, “2′b010”, and “2′b100”. A comparator 450 continues to compare the value D43 of the load-detection counting logic 440 with the predetermined value “2′b100”. When the two values are the same, the comparator 450 outputs an enable signal E43 to a comparator 471 and drives the comparator 471 to determine whether the cache access status signal S12 broadcasted by the load execution unit 155 indicates a hit or miss. The hit and the miss can be represented by using different numbers or voltage levels. From the above description, those skilled in the art will appreciate that the load-detection counting logic 440 is used to control the time point for the determination of the comparator 471. Although the load-detection counting logic 440 described in the embodiment may comprise a 3-bit shift register, those skilled in the art may implement the load-detection counting logic 440 by using a 4-bit or 5-bit shift register according to different design requirements for determining whether a cache hit or cache miss occurs in the execution of the depended-on load micro-instruction at the third or fourth clock cycle occurring after the load confirmation process is triggered, however, the present invention is not limited to the above. When the cache access status signal S12 indicates a hit, the comparator 471 outputs a disabled signal E45 to the input circuit 473, and the input circuit 473 drives the load confirmation register 420 to output the signal S31(j) indicating a load-confirmed. When all of the operand qualifiers 310(j) of the source operands of the micro-instruction of the entry 241(i) which trigger the load-detection counting logics 440 output the signals S31(j) indicating the load-confirmed respectively, the qualifier 210(i) of the micro-instruction of the entry 241(i) outputs the signal S13(i) indicating an all-load-confirmed to drive the release circuit 240 to remove the micro-instruction of the entry 241(i) in the reservation station queue 241, as described above. When the cache access status signal S12 indicates a miss, the comparator 471 outputs the enabled signal E45 to the input circuit 473 and drives the input circuit 473 to reset the load confirmation register 420 to “0”. Then, the load confirmation register 420 outputs the signal S31(j) indicating a load-unconfirmed to show that the jth operand of the micro-instruction of the entry 241(i) is load unconfirmed. Once the operand qualifier 310(j) of one source operand of the micro-instruction of the entry 241(i) outputs the signal S31(j) (such as “0”) indicating the load-unconfirmed, the qualifier 210(i) of the micro-instruction of the entry 241(i) outputs the signal S13(i) indicating a not-all-load-confirmed to drive the window checker 230. Then, the window checker 230 issues the signal S17 to drive the arithmetic and logic unit 251 to kill the execution of the micro-instruction of the entry (i) or issues the signal S16 to delete the micro-instruction in the instruction dispatch unit 242, as described above.
In another aspect, an operand of another micro-instruction may depend on the execution result of the micro-instruction of the entry 241(i). For example, the operand “A3” of the micro-instruction “B1=IMUL A3, “3”;” depends on the execution result of the micro-instruction “A3=IADD A1, A2;”. The operand qualifier 310(j) must cooperate with other corresponding qualifier to determine whether a cache hit or cache miss occurs in the execution of the same load micro-instruction at the same preset time point (for example, at the second clock cycle occurring after the load write-back signal S11 of the load instruction is broadcasted by the execution unit 155. In detail, the operand qualifier 310(j) further comprises a micro-instruction register 463 for storing the unique identification code of the micro-instruction of the entry (i). A dispatch confirmation logic 461 confirms whether the micro-instruction of the entry 241(i) has been dispatched to the arithmetic and logic unit 251 by the instruction dispatch unit 242 shown in
In another aspect, the jth operand of the micro-instruction of entry 241(i) may depend on the execution result of the load micro-instruction indirectly. For example, the operand “A3” of the micro-instruction “B1=IMUL A3, “3”;” depends on the execution result of the micro-instruction “A3=IADD A1, A2;”, while the operand “A1” of the micro-instruction “A3=IADD A1, A2;” depends on the execution result of the micro-instruction “A1=LD [Addr1];”. The operand qualifier 310(j) may determine whether a cache hit or cache miss occurs in the execution of the indirectly depended-on load micro-instruction when its load-detection counting logic reaches a predetermined value. In detail, the operand qualifier 310(j) receives the write-back signals S41 broadcasted by another operand qualifier or arithmetic logic unit 251 (that is, the write-back signal S43 broadcast by another operand qualifier described above. In the embodiment in which only one micro-instruction is written back at each clock cycle, the write-back signal S41 can be combined with the load write-back signal S11 to form one write-back signal), and the write-back signal S41 contains the unique identification code of another micro-instruction (for example, “A3=IADD A1, A2;”) and the counting value of the load-detection counting logic in the operand qualifier of the another micro-instruction. The comparator 421 compares the value of the dependency register 410 and the unique identification code of the micro-instruction that is carried by the write-back signal S41 at each clock cycle. When the two are the same, the comparator 421 outputs the enable signal E42 to an input circuit 423 and drives the input circuit to output the counting value of the load-detection counting logic in the operand qualifier of this another micro-instruction carried by the write-back signal S41 to its load-detection counting logic 440, such as “2′b010”. The subsequent operation of the load-detection counting logic 440 may refer to the description of the above paragraphs, and the description will not be repeated for brevity. It should be noted that the cache access status signal S12 broadcasted by the load execution unit 155 does not carry any unique identification code. The present invention ensures that the source operand corresponding to the operand qualifier 310(j) in which the load-detection counting logic 440 reaches the predetermined value “2′b100” must directly or indirectly depend on the load micro-instruction corresponding to the cache access status signal S12 broadcasted by the load execution unit 155.
Table 1 shows the actuation sequence of the micro-instructions in a superscalar microprocessor according to an embodiment:
TABLE 1
Micro-instruction
T0
. . .
Tn−2
Tn−1
Tn
A1 = LD [Addr1];
X
. . .
LD0
LD1
LD2
A3 = IADD A1, A2;
. . .
Disp
EX0
B1 = IMUL A3, “3”;
. . .
Disp
The value of the first load-
000
000
001
010
100
detection counting logic
The value of the second load-
000
000
000
010
100
detection counting logic
The first load-detection counting logic is associated with the operand “A1” of the micro-instruction “A3=IADD A1, A2;”, and the second load-detection counting logic is associated with the operand “A3” of the micro-instruction “B1=IMUL A3, “3”;”. At the time point T0, the load micro-instruction “A1=LD [Addr1];” is dispatched to the load execution unit 155. At the time point Tn-2, the load execution unit 155 broadcasts the load write-back signal S11, so that the value of the first load-detection counting logic is set to “2′b001”. At the time point Tn-1, the micro-instruction “A3=IADD A1, A2;” is selected (labeled as “Disp”), the value of the first load-detection counting logic is updated to “2′b010”, and the value of the second load-detection counting logic is synchronized with “2′b010”. At the time point Tn, the micro-instruction “A3=IADD A1, A2;” is dispatched to the arithmetic and logic unit 251 (labeled “EX0”), the micro-instruction “B=IMUL A3, “3”;” is selected (labeled as “Disp”), the value of the first load-detection counting logic is updated to “2′b100”, and the value of the second load-detection counting logic is synchronized with “2′b100”. Since both of the values of the first and second load-detection counting logics reach “2′b100”, the qualifiers associated with the micro-instructions “A3=IADD A1, A2;” and “B1=IMUL A3, “3”;” must check the cache access status signal S12 broadcast by the load execution unit 155.
In some embodiments, to improve the efficiency of data loading, the architecture described in
The microprocessor may comprise a qualifier collection 510, and the qualifier collection 510 comprises a plurality of qualifiers 510(0)˜510(q). Each of the qualifier uniquely corresponds to one entry in the reservation station queue 241 for determining whether the load micro-instruction on which the micro-instruction in the entry depends (directly or indirectly) is ready. Each micro-instruction may contain a plurality of operands directly depending on the execution results of the load micro-instructions or a plurality of operands indirectly depending on the execution results of the load micro-instructions, for example, the operand “A1” of the micro-instruction “A3=IADD A1, A2;” depends on the execution result of the load micro-instruction “A1=LD0 [Addr1];”, and the operand “A1” thereof depends on the execution result of the load micro-instruction “A2=LD1 [Addr2];”.
At the (n−2)th clock cycle occurring after the load instruction dispatch unit (not shown in
When each of the qualifiers 510(0)˜510(q) receives the load write-back signal S11(0), it determines whether the unique identification code on which its operands depend is equal to the unique identifier of the load instruction contained in the load write-back signal S11(0), that is, it determines whether one of the source operands of the micro-instruction of the corresponding entry depends on the execution result of the first load micro-instruction. If so, a load-detection counting logic is triggered. When each of the qualifiers 510(0)˜510(q) receives the load write-back signal S11(1), it determines whether the unique identification code on which its operands depend is equal to the unique identifier of the load instruction contained in the load write-back signal S11(1), that is, it determines whether one of the source operands of the micro-instruction of the corresponding entry depends on the execution result of the second load micro-instruction. If so, a load-detection counting logic is triggered, too. When the value of the triggered load-detection counting logic reaches a predetermined value (for example, a value of 2, indicating that the second clock cycle which occurs after the load write-back signals S11 of the load instructions are broadcasted by the load execution unit 155 is reached), and the micro-instruction associated with the qualifier 210(i) has been dispatched to the arithmetic and logic unit 251 for execution (e.g., at the (n−1)th clock cycle, the micro-instruction is selected from the reservation station queue 241 by the instruction dispatch unit 242 and dispatched to the arithmetic and logic unit 251 for execution). When a cache hit is found for both of the load micro-instructions which need to be confirmed through cache access status signals S12(0) and S12(1) broadcasted by the load execution units 155(0) and 155(1), the qualifiers 510(i) generates a signal S13 indicating a load-confirmed to drive a release circuit 250 to remove micro-instruction of the entry 241(i) in the reservation station queue 241, where i is an integer between 0 and q. When a cache miss is found for one of the load micro-instructions which need to be confirmed through the cache access status signals S12(0) and S12(1) broadcasted by the load execution units 155(0) and 155(1), the qualifiers 510(i) generates the signal S13 indicating a load-unconfirmed.
Each operand qualifier 310(j) comprises one of the aforementioned load-detection counting logics. When an corresponding load-detection counting logic is triggered and reaches a predetermined value (for example, a value of 2, indicating that the second clock cycle which occurs after the load write-back signal S11 of the load instruction is broadcasted by the load execution unit 155 is reached), the operand qualifier 310(j) determines whether the execution status of the load micro-instruction on which the corresponding source operand depends directly or indirectly is cache hit or cache miss according to the cache access status signal S12 broadcast by the load execution unit 155. When the cache access status signal S12 indicates a cache hit, a S31(j) indicating a load-confirmed is output; when the data cache access status signal S12 indicates a cache miss, the signal S31(j) indicating a load-unconfirmed is output, where j is an integer between 0 and p. The qualifier 210(i) further comprises an AND gate 330 that is coupled to the signals S31(0)˜S31(p) of all of the operand qualifiers 310(0)˜(p). An output S31(j) indicates whether the jth source operand is load confirmed, that is, the information indicating whether the depended-on load micro-instruction is cache hit. For example, S31(j)=“1” represents the load-confirmed, S31(j)=“0” means the load-unconfirmed. If all of the operand qualifiers which trigger the load-detection counting logics output the signals indicating the load-confirmed respectively, the AND gate 330 outputs a signal S13(i) indicating an all-load-confirmed to the window checker 230. If any one of the operand qualifiers which trigger the load-detection counting logics output a signal indicating the load-unconfirmed, the AND gate 330 outputs a signal S13(i) indicating a not-all-load-confirmed to the window checker 230.
The comparator 450 continues to compare the value D43 of the load-detection counting logic 440 with the predetermined value “2′b100”. When the two values are the same, the comparator 450 outputs an enable signal E43 to the comparator 471 and drives the comparator 471 to determine whether the cache access status signal S12(0) broadcasted by the load execution unit 155(0) indicates a hit or miss. When the cache access status signal S12(0) indicates a miss, the comparator 471 drives the input circuit 473 to reset the load confirmation register 420 to “0”, which indicates that the data of the jth operand of the micro-instruction of the entry 241(i) is load confirmed The comparator 460 continues to compare the value D43 of the load-detection counting logic 440 with the predetermined value “2′b101”. When the two values are the same, the comparator 460 outputs an enable signal E47 to the comparator 472 and drives the comparator 472 to determine whether the cache access status signal S12(1) broadcasted by the load execution unit 155(1) indicates a hit or miss. When the cache access status signal S12(1) indicates a miss, the comparator 472 drives the input circuit 473 to reset the load confirmation register 420 to “0”, which indicates that the data of the jth operand of the micro-instruction of the entry 241(i) is load confirmed. The detailed operations of other components in FIG. may refer to the related description of
Table 2 shows the actuation sequence of the micro-instructions in a superscalar microprocessor according to another embodiment:
TABLE 2
Micro-instruction
T0
. . .
Tn−2
Tn−1
Tn
A1 = LD0 [Addr1];
X
. . .
LD0
LD1
LD2
A2 = LD1 [Addr2];
X
. . .
LD0
LD1
LD2
A3 = IADD A1, A2;
. . .
Disp
EX0
The value of the first load-
000
. . .
001
010
100
detection counting logic
The value of the second load-
000
. . .
011
110
101
detection counting logic
The first load-detection counting logic is associated with the operand “A1” of the micro-instruction “A3=IADD A1, A2;”, and the second load-detection counting logic is associated with the operand “A2” of the micro-instruction “A3=IADD A1, A2;”. At the time point T0, the load micro-instruction “A1=LD0 [Addr1];” is dispatched to the load execution unit 155(0), and the load micro-instruction “A2=LD1 [Addr2];” is dispatched to the load execution unit 155(1), simultaneously. At the time point Tn-2, the load execution unit 155(0) broadcasts the load write-back signal S11(0), so that the value of the first load-detection counting logic is set to “2′b001”; the load execution unit 155(1) broadcasts the load write-back signal S11(1), so that the value of the second load-detection counting logic is set to “2′b011”. At the time point Tn-1, the micro-instruction “A3=IADD A1, A2;” is selected (labeled as “Disp”), the value of the first load-detection counting logic associated with “A1” is updated to “2′b010”, and the value of the second load-detection counting logic associated with “A2” is updated to “2′b110”. At the time point Tn, the micro-instruction “A3=IADD A1, A2;” is dispatched to the arithmetic and logic unit 251 (labeled “EX0”), the value of the first load-detection counting logic is updated to “2′b100”, and the value of the second load-detection counting logic is updated to “2′b101”. Since the values of the first and second load-detection counting logics reach “2′b100” and “2′b101” respectively, the qualifiers associated with the operands “A1” and “A2” of the micro-instruction “A3=IADD A1, A2;” must check the cache access status signals S12(0) and S12(1) broadcast by the load execution units 155(0) and 155(1), respectively.
In some embodiments, those skilled in the art can modify the operand qualifier 610(j) shown in
When the operand qualifier 610(j) of the operand “A3” of the micro-instruction “B=IMUL A3, “3”;” depending on the micro-instruction “A3=IADD A1, A2” receives the aforementioned write-back signal S43 (for example, corresponding to the write-back signal S41 of
It is worth noted that in the embodiment of
Although
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
5778210, | Jan 11 1996 | Intel Corporation | Method and apparatus for recovering the state of a speculatively scheduled operation in a processor which cannot be executed at the speculated time |
6094717, | Jul 31 1998 | Intel Corp. | Computer processor with a replay system having a plurality of checkers |
6728843, | Nov 30 1999 | SAMSUNG ELECTRONICS CO , LTD | System and method for tracking and processing parallel coherent memory accesses |
6912648, | Dec 31 2001 | Intel Corporation | Stick and spoke replay with selectable delays |
6950925, | Aug 28 2002 | Advanced Micro Devices, INC; Advanced Micro Devices, Inc. | Scheduler for use in a microprocessor that supports data-speculative execution |
7111153, | Sep 30 2003 | Intel Corporation | Early data return indication mechanism |
7200737, | Nov 13 1996 | Intel Corporation | Processor with a replay system that includes a replay queue for improved throughput |
7363470, | May 02 2003 | Advanced Micro Devices, Inc. | System and method to prevent in-flight instances of operations from disrupting operation replay within a data-speculative microprocessor |
7861066, | Jul 20 2007 | Advanced Micro Devices, Inc. | Mechanism for predicting and suppressing instruction replay in a processor |
8918625, | Nov 24 2010 | CAVIUM INTERNATIONAL; MARVELL ASIA PTE, LTD | Speculative scheduling of memory instructions in out-of-order processor based on addressing mode comparison |
9921833, | Dec 15 2015 | International Business Machines Corporation | Determining of validity of speculative load data after a predetermined period of time in a multi-slice processor |
20030126417, | |||
20070083742, | |||
20090222625, | |||
20100049954, | |||
20150026685, | |||
20160328237, | |||
20170109172, | |||
CN104808996, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Sep 13 2018 | FEI, XIAOLONG | SHANGHAI ZHAOXIN SEMICONDUCTOR CO , LTD | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 047039 | /0238 | |
Oct 02 2018 | SHANGHAI ZHAOXIN SEMICONDUCTOR CO., LTD. | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Oct 02 2018 | BIG: Entity status set to Undiscounted (note the period is included in the code). |
Jan 02 2024 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Date | Maintenance Schedule |
Jul 07 2023 | 4 years fee payment window open |
Jan 07 2024 | 6 months grace period start (w surcharge) |
Jul 07 2024 | patent expiry (for year 4) |
Jul 07 2026 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jul 07 2027 | 8 years fee payment window open |
Jan 07 2028 | 6 months grace period start (w surcharge) |
Jul 07 2028 | patent expiry (for year 8) |
Jul 07 2030 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jul 07 2031 | 12 years fee payment window open |
Jan 07 2032 | 6 months grace period start (w surcharge) |
Jul 07 2032 | patent expiry (for year 12) |
Jul 07 2034 | 2 years to revive unintentionally abandoned end. (for year 12) |