5.3.3 · D5Advanced Microarchitecture
Question bank — Tomasulo's algorithm
Before the traps, three words we lean on repeatedly:
True or false — justify
True or false: Tomasulo removes true (RAW) data dependencies.
False — it only removes false name dependencies (WAR/WAW). A true read-after-write dependency is a real flow of data, so the consumer genuinely must wait for the producer's CDB broadcast.
True or false: If two instructions write the same register, Tomasulo makes them execute in program order.
False — they can execute in any order. Ordering is enforced only on the register's final tag: whichever writer the register's tag currently names is the one whose broadcast is accepted; the other is simply ignored.
True or false: Once an operand's tag is copied into a reservation station, later changes to that register's tag affect the waiting instruction.
False — the RS snapshot is frozen at Issue. It waits for the specific tag it copied, so overwriting the register's tag afterwards (a WAR situation) cannot disturb it.
True or false: The CDB broadcasts a result only to the instruction that needs it most.
False — it broadcasts to everyone. Every RS and register listens simultaneously, because at Issue time the hardware cannot know how many future instructions will consume the value.
True or false: An instruction can begin Execute the same cycle its last operand arrives on the CDB.
True — the RS latches the broadcast value and clears its
Q field in that cycle, so with both Q fields now NULL it may start immediately without waiting for a fresh clock edge to "notice."True or false: Tomasulo needs a reorder buffer to work.
False — the classic algorithm has no ROB; it commits results directly to registers. An ROB is a later addition to also give precise exceptions and speculation recovery.
True or false: Tomasulo and scoreboarding both stall on WAR hazards.
False — scoreboarding stalls a write until earlier reads finish (WAR stall); Tomasulo eliminates WAR entirely by renaming, so writers never wait on earlier readers.
True or false: If no reservation station is free, the instruction still issues but waits inside the register file.
False — a full RS pool is a structural hazard; the instruction stalls at Issue and blocks the in-order front end until a slot frees.
True or false: A register whose tag field is NULL currently holds a valid, usable value.
True —
NULL tag means "no producer pending," so RegFile[r].value is the live value. A non-NULL tag means the register is an IOU waiting on that RS.Spot the error
Statement: "When Mult1 finishes and broadcasts, register R1 must accept the value since Mult1 wrote R1." — find the flaw.
R1 accepts the broadcast only if R1's tag still equals
Mult1. If a later instruction retagged R1 (say to Add2), R1 ignores Mult1's result — that older write was renamed away.Statement: "An instruction with Qj = NULL and Qk = Add1 is ready to execute." — find the flaw.
It is not ready. Execution requires both
Qj = NULL and Qk = NULL; one missing operand (Qk still waiting on Add1) blocks it, because you cannot compute A + B without B.Statement: "At Issue we read both operand values from the register file every time." — find the flaw.
Only when the source register's tag is
NULL. If the source is still pending (tag set), we copy the tag, not a value — the value doesn't exist yet, so we record the IOU instead.Statement: "Tomasulo increases performance by making each functional unit faster." — find the flaw.
It changes nothing about unit latency (a DIV still takes its 40 cycles). It raises throughput by letting independent instructions overlap and start early, extracting ILP.
Statement: "The destination tag stored in a reservation station is the name of the register being written." — find the flaw.
The destination tag is the RS's own name (like
Add1), not the register name. That RS name is precisely the temporary rename that replaces the register name across the machine.Statement: "Because everyone listens to the CDB, we can broadcast many results in one cycle." — find the flaw.
A single CDB is one broadcast channel per cycle — it is a structural bottleneck. If two units finish together, one must wait, which is why real designs may add multiple CDBs.
Why questions
Why copy a tag at Issue instead of just stalling until the value exists?
Because the producer may still be mid-execution. The tag is a forward-looking IOU that lets the consumer issue now and grab the value later off the CDB, keeping the pipeline flowing.
Why does Tomasulo broadcast to all reservation stations rather than routing to specific consumers?
At Issue time the number of future consumers of a result is unknown (could be zero, could be five). A broadcast-and-latch scheme is simpler than maintaining a consumer list per producer.
Why does eliminating WAW hazards require checking "if the tag still points to this RS" at Write?
Two instructions may target the same register; only the latest writer should win. The tag check lets the register accept only the broadcast whose RS name it currently holds, silently discarding the stale write.
Why can a SUB that comes after a MUL in program order start executing first?
If
SUB's operands are ready and it gets its own RS, its false (name) dependency on the shared register is renamed away, so nothing forces it to wait for the earlier MUL. This is out-of-order execution in action.Why does Tomasulo not stall on WAR hazards the way a scoreboard does?
A later writer gets a fresh RS tag, and the earlier reader already froze either the value or the old producing tag at Issue. The reader is immune to the register's tag changing, so the writer need not wait.
Why is a single reservation station name able to act as a "register"?
Because dependencies are resolved by tag matching, not register names. The RS name uniquely identifies one pending value, giving far more distinct names than the small architectural register set — that is hardware register renaming.
Edge cases
Edge case: An instruction issues and both source registers already hold valid values. What happens?
Both
Q fields are set to NULL and both V fields loaded at Issue, so the instruction is immediately execute-ready and can start the very next cycle — no CDB wait at all.Edge case: A result is broadcast on the CDB but no RS and no register are listening for that tag.
The broadcast is harmless — it simply latches nowhere. This happens when a write was fully renamed over (a dead result), so the value is correctly discarded.
Edge case: Two source operands of one instruction both depend on the same producing RS (e.g. ADD R4, R1, R1).
Both
Qj and Qk hold that same tag; when the CDB broadcasts it, both fields match and are filled in the same cycle, then execution proceeds normally.Edge case: An instruction depends on a value that will never be produced (source register tag points to an RS that got flushed).
In the classic non-speculative algorithm this cannot arise, because tags are only set to live producers and cleared on broadcast; deadlock-free progress relies on every set tag eventually broadcasting.
Edge case: The very same register is read and then overwritten by a single later instruction pair with zero cycles between them. Does renaming still protect correctness?
Yes — each write gets a distinct RS tag at its own Issue, and each reader froze the tag valid at its Issue moment, so read/write ordering is preserved purely by the tag snapshots.
Edge case: A functional unit finishes but the CDB is busy carrying another result this cycle.
The finished result waits (arbitration for the shared bus); its RS stays busy until it wins the CDB, which can delay dependent instructions — a real structural limit of a single-CDB design.
Recall One-line self-test
The single sentence that captures Tomasulo ::: Instructions wait on tags (producers), never on register names, so false dependencies vanish while true data flow is preserved via the CDB.