Scoreboard
In the scoreboard architecture we divide the ID stage:
Another characteristic of the scoreboard is that there are no forwarding paths.
Instructions executed whenever not dependent on previous instructions and there are no hazards. This implies in-order issue but out-of-order read-operands, so out-of-order execution and completion.
We distinguish when an instruction begins execution and it completes execution: between the two times, the instruction is in execution.
Handling WAR and WAW
Since we have out of order completition there may be WAW and WAR hazards. They need to be solved:
Hazard detection and resolution
Hazard detection and resolution is centralized in the scoreboard: every instruction goes through the Scoreboard, where a record of data dependences is constructed.
The Scoreboard then determines when the instruction can read its operand and begin execution. If the scoreboard decides the instruction cannot execute immediately, it monitors every change and decides when the instruction can execute.
The scoreboard controls when the instruction can write its result into destination register.
Four Stages of Scoreboard Control
1) Issue
Decode instruction and check for structural hazards & WAW hazards. Instructions issued in program order (for hazard checking).
If a functional unit for the instruction is free and no other active instruction has the same destination register (no WAW), the scoreboard issues the instruction to the functional unit and updates its internal data structure.
If a structural hazard or a WAW hazard exists, then the instruction issue stalls, and no further instructions will issue until these hazards are cleared.
2) Read Operands
Wait until there are no RAW hazards, then read operands. Check for structural hazards in reading RF.
A source operand is available if:
When the source operands are available, the scoreboard tells the functional unit to proceed to read the operands from the registers and begin execution. RAW hazards are solved dynamically in this step. Out-of-order reading of operands then instructions are sent into execution out-of-order.
3) Execution
The functional unit begins execution upon receiving operands. When the result is ready, it notifies the scoreboard that it has completed execution.
4) Write result
Check for WAR hazards and finish execution
Once the scoreboard is aware that the functional unit has completed execution, the scoreboard checks for WAR hazards.
Scoreboard Structure
In the scoreboard we need to save: