In this lesson, you will learn how a centralized scoreboard tracks instruction status and register availability to allow out-of-order execution while maintaining correctness.
The Problem: Pipeline Stalls
In a standard scalar pipeline, we often stall the entire processor when a data dependency occurs—like when one instruction needs the result of a previous one that hasn't finished yet. As we move toward superscalar execution (executing multiple instructions at once), we need a smarter way to manage these dependencies than just stopping everything.
What is a Scoreboard?
A scoreboard is a centralized hardware unit that acts as a "bookkeeper" for the CPU. It maintains a table that tracks the state of every functional unit (like the ALU or Multiplier) and every register in the system. Instead of waiting for a global stall, the scoreboard allows instructions to proceed as soon as their specific data dependencies are satisfied.
It manages three key status checks for each instruction:
- Issue: Is the required functional unit available?
- Read Operands: Are the registers currently being written to by a previous instruction? If yes, the instruction waits.
- Write Result: Is the functional unit finished? Once written, the scoreboard updates the register status so waiting instructions can proceed.
How it Works in Practice
Consider these two instructions:
ADD R1, R2, R3 ; Instruction A
MUL R4, R1, R5 ; Instruction B
The scoreboard keeps track of R1. When the ADD is issued, the scoreboard notes that R1 is "pending" (being written to). When the MUL attempts to read R1, the scoreboard sees the "pending" flag and forces the MUL to wait. However, if a third instruction used R6 and R7, the scoreboard would see those are ready and allow that instruction to execute in parallel with the ADD, even if the MUL is still stalled.
By tracking the status of resources in real-time, the scoreboard eliminates unnecessary stalls, ensuring that we only block execution when a true data dependency exists, rather than simply because a pipeline stage is "busy."
Key Takeaway: The scoreboard maximizes throughput by tracking register and functional unit status, allowing the CPU to execute independent instructions out-of-order while safely managing data dependencies.