Sun, 17 Feb 2013, 23:48
A student writes: > Dear Professor, > > In Question 12, it says *The microengine must wait until a result is in a > register before it sources it (reads it as a source operand). > > Does this imply that we can not overwrite Tag in a Register until we store > result associated with that Tag into the register or is it a simple case > where we don't allow data forwarding and we update tag depending upon > latest result to be stored in that register? > > Thanks, > <<name withheld to protect the student who correctly saw we were not clear>> Actually, our statement that he quoted above can be misleading, so it is our fault for not making it clear. If you have already worked the problem with somewhat different interpretations of what I meant, please do not feel the need to redo it. However, do make a point of writing down your assumptions as to how you interpreted it, and when you have time later, redo it based on what you read below. It could be useful on the midterm. To try to make it clear, the statement he quoted was meant to imply no data forwarding. What exactly is data forwarding? Data forwarding allows you to send a result directly to the functional units, rather than first write that result to a register or reservation station, and in the next cycle send the result (as a source operand) to the functional unit. That is, data fowarding has additional logic to keep track of when operations in progress will finish, so that, for example, since an ADD needs two sources, if one is in the reservation station, both operands can be forwarded to the functional unit at the end of the cycle in which the second operand is produced, rather than having the second source sent to the reservation station first, and the two sources sent to the functional unit in the next cycle. Thus, a clock cycle is saved. As to overwriting tags and waiting until a result is in a register before overwriting a tag, that would unacceptably slow down the machine. Out-of-order execution (such as with the Tomasulo algorithm in 1966 or with today's microprocessors) allows you to fetch in one cycle, decode in the next, and then get the instruction out of the way immediately "if it needs gas" so we can continue fetching and decoding subsequent instructions. The tag provides the connection between the instruction that produces a result and subsequent instructions that need that result. Writing tags into the Register Alias Table occurs at the end of Decode to identify the destination register. Writing tags into reservation stations occurs when the instruction is assigned to a reservation station. Recall in class, we saw the example of an instruction that produced a result that was not wanted in the Register File by the time the result was produced because the tag had been overwritten as a consequence of a later instruction that was storing its result in the same register. The result was still wanted as a source for an instruction that was in the reservation station waiting for that result to be produced. Example: 1. ADD R1,R2,R3 2. ADD R4,R1,R5 3. ADD R1,R6,R7 The second instruction is in the reservation station waiting for the result of the first. But by the time the first instruction has executed, R1 no longer wants the result. It has been overwritten as a result of the third instruction. Recall if a subsequent instruction sources R1, it wants the result of the third instruction, NOT the first instruction. OK? Yale Patt