Computer System Structure: The CPU

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the main purpose of a two-level adaptive predictor in branch prediction?

  • To memorize jump sequence patterns (correct)
  • To reduce the size of the branch history table
  • To increase the speed of the CPU
  • To perform static branch prediction

Local branch predictors use a shared history buffer for all conditional jump instructions.

False (B)

What is the role of the global history buffer in a global branch predictor?

To keep a shared history of all conditional jumps for better prediction.

A _______ predictor uses a XOR between the global history buffer and the jump address for indexing in the prediction history table.

<p>gshare</p> Signup and view all the answers

Match the following branch prediction techniques with their descriptions:

<p>Gshare = Uses XOR for indexing with global history Gselect = Uses concatenation of history buffer and jump address Agree Predictor = Makes XOR between local and global predictions Hybrid Predictor = Combines multiple prediction strategies based on results</p> Signup and view all the answers

What is the primary function of Tomasulo's algorithm?

<p>To resolve data dependencies and avoid structural hazards (C)</p> Signup and view all the answers

The Scoreboard method solves structural hazards and does not introduce stall phases.

<p>False (B)</p> Signup and view all the answers

What are reservation stations used for in Tomasulo's algorithm?

<p>To fetch and store instruction operands as they become available.</p> Signup and view all the answers

The main cost of the Scoreboard hardware is due to the increased number of __________.

<p>buses</p> Signup and view all the answers

Match the following terms with their descriptions:

<p>Scoreboard Method = Introduces stalls when a functional unit is busy Tomasulo's Algorithm = Uses register renaming to resolve dependencies Reservation Stations = Buffers that store instruction operands Common Data Bus = Transmits data as soon as it becomes available</p> Signup and view all the answers

What is the primary purpose of the scoreboard method in the context of CPU instruction scheduling?

<p>To dynamically schedule a pipeline for out-of-order execution (C)</p> Signup and view all the answers

The scoreboard method was first utilized in the CDC 6000 computer.

<p>False (B)</p> Signup and view all the answers

What do the four stages of an instruction in the scoreboard method include?

<p>Issue (ID1), Read operands (ID2), Execution (EX), Write result (WB)</p> Signup and view all the answers

In the scoreboard method, an instruction may be stalled due to a ______ hazard.

<p>WAR</p> Signup and view all the answers

Match the following stages of the scoreboard method with their descriptions:

<p>Issue (ID1) = Decode instructions and check for structural hazards Read operands (ID2) = Wait until no RAW hazards before reading Execution (EX) = Operate on operands and notify scoreboard when done Write result (WB) = Finish execution and stall if WAR hazard arises</p> Signup and view all the answers

What is the main purpose of the re-order buffer (ROB) in Tomasulo's algorithm?

<p>To commit instructions executed in order (A), To store instructions in their original order (B)</p> Signup and view all the answers

Dynamic branch prediction is based solely on the nature of the branch instruction.

<p>False (B)</p> Signup and view all the answers

What are the two types of methods used in branch prediction?

<p>Static prediction and dynamic prediction</p> Signup and view all the answers

In dynamic prediction, the __________ stores the decision and target address for executed conditional jumps.

<p>Branch History Table (BHT)</p> Signup and view all the answers

Match the following branch prediction methods with their descriptions:

<p>Static prediction = Based on inherent characteristics of branches Dynamic prediction = Based on the history of previous branches Next line predictor = Stores the next instruction pointer Saturating counters = Tracks decisions made in branch execution</p> Signup and view all the answers

Flashcards

Scoreboard Method

A technique used in pipelined processors to resolve hazards by dynamically scheduling instructions. It ensures instructions execute out-of-order when safe, avoiding conflicts and resource contention.

Instruction Status

Indicates the current stage (Issue, Read operands, Execution, Write result) an instruction is in during the pipeline.

Functional Unit Status

Indicates the state of a functional unit (FU) in the processor, including whether it's busy, the operation it's performing, and the registers involved.

Register Result Status

Used in the Scoreboard method to track which functional unit is responsible for writing to each register, if assigned.

Signup and view all the flashcards

RAW (Read After Write) Hazard

A hazard condition that occurs when an instruction tries to read from a register that is being written to by a previous instruction that hasn't completed.

Signup and view all the flashcards

Tomasulo's Algorithm

A technique that employs register renaming and a common data bus (CDB) to eliminate structural hazards, as well as WAR and WAW dependencies. It efficiently utilizes functional units and optimizes instruction execution by avoiding unnecessary delays.

Signup and view all the flashcards

Reservation Stations

Specialized buffers that hold instruction operands and results. They act as temporary storage units, keeping data ready for immediate use and preventing stalls caused by data dependencies. Reservation stations make Tomasulo's algorithm efficient.

Signup and view all the flashcards

Register Renaming

A mechanism used in Tomasulo's algorithm to eliminate WAR and WAW hazards, allowing multiple copies of the same physical register to coexist. It allows instructions to use different versions of the same register, thus avoiding data dependencies caused by register limitations.

Signup and view all the flashcards

Common Data Bus (CDB)

A shared bus in Tomasulo's algorithm that broadcasts calculated results as soon as they become available. This allows other instructions to access the results immediately, preventing unnecessary waiting for data to be written to registers, and optimizing performance.

Signup and view all the flashcards

Commit Stage

An extra stage in instruction execution, after issuing, executing, and writing the result, used to further improve Tomasulo's algorithm. It ensures instructions are committed in the original order even if executed out-of-order. The Re-order Buffer (ROB) holds the results of instructions, allowing later instructions to use them before being formally committed to registers or memory.

Signup and view all the flashcards

Re-order Buffer (ROB)

A buffer used to commit instructions executed out-of-order. It stores data about instructions in their original order, allowing for out-of-order execution but ensuring eventual commit in the correct order. It can be used for rollback purposes in case of branch prediction errors or exceptions.

Signup and view all the flashcards

Branch Prediction

A technique used to resolve control hazards caused by branch instructions in pipelined processors. It tries to predict whether a branch will be taken or not, loading the pipeline with instructions from the predicted branch. Static prediction is based on the instruction's nature, while dynamic prediction uses the historical behavior of the branch.

Signup and view all the flashcards

Static Branch Prediction

A type of branch prediction based on the nature of the branch instruction itself. Specific cases like procedure calls, unconditional jumps, and loop branches have predictable behavior. It offers simplicity and works well for programs with loops, but has limitations with numerous conditional jumps.

Signup and view all the flashcards

Dynamic Branch Prediction

A type of branch prediction that considers the historical behavior of a conditional branch instruction. By tracking previous executions and their outcomes, it attempts to predict the next execution. Methods like saturating counters and branch history tables are used to improve prediction accuracy.

Signup and view all the flashcards

Local Branch Prediction

A type of branch prediction that stores a separate history buffer for each conditional jump instruction, allowing the prediction to be tailored to the specific behavior of that jump. It can use a two level branch predictor with either a shared or individual pattern history table.

Signup and view all the flashcards

Global Branch Prediction

A type of branch prediction that tracks the taken/not taken decisions of all conditional jumps in a shared global history buffer. Predictions are based on the correlations between different jumps.

Signup and view all the flashcards

Gshare Predictor

A specific implementation of global branch prediction where the index used for prediction is a combination of the global history buffer and the jump address, achieved by performing an XOR operation on these two elements.

Signup and view all the flashcards

Alloyed Branch Prediction

A type of branch prediction that combines both global and local branch history, often including the jump address. It aims to leverage both jump-specific and global patterns for better accuracy.

Signup and view all the flashcards

Loop Predictor

A branch predictor that specifically detects repeating loops. It usually tracks the number of times a conditional jump is taken within a loop, making predictions based on the loop's iterative behavior.

Signup and view all the flashcards

Study Notes

Computer System Structure - The Central Processing Unit (CPU)

  • The CPU is a crucial component of computer systems.
  • Solutions for hazards include scoreboard method, Tomasulo's method, and branch prediction.

Scoreboard Method

  • First used in the CDC 6600 computer (1966).
  • Used for dynamically scheduling pipeline instructions, allowing out-of-order execution when no conflicts exist and hardware resources are available (no structural hazard).
  • Logs data dependencies between instructions.
  • Releases instructions only when no conflicts exist with previously issued, incomplete instructions.
  • Monitors executing instructions until dependencies are resolved before permitting stalled instructions.
  • Instructions go through four stages: Issue (ID1), Decode instructions, check for structural and WAW hazards, stall until structural and WAW hazards are resolved. Read operands (ID2), wait until no RAW hazards, execute operands, may be multiple cycles, notify scoreboard when done. Write result (WB), finish execution, stall if WAR hazard.
  • Scoreboard structure includes: Instruction status (indicates instruction stage: ID1, ID2, EX, or WB), Functional unit status (indicates the FU's state), Busy (indicates if the unit is busy or not), Op (operation to perform, e.g., + or -), Fi (destination register), Fj and Fk (source register numbers), Qj and Qk (functional units producing source registers), Rj and Rk (flags indicating when source registers are ready), Register result status (indicates which functional unit writes each register).
  • Speedup from scoreboard: 1.7 for Fortran programs, 2.5 for hand-coded assembly language programs.
  • Hardware: Scoreboard hardware is approximately equal to one FPU; main cost is buses (four times the normal amount). Hardware implementation might be more complex for modern processors.
  • Issues: does not solve structural hazards, no forwarding logic, and introduces stalls when a required functional unit is busy.

Tomasulo's Method

  • Avoids structural hazards and resolves WAR and WAW hazards using register renaming and a common data bus (CDB).
  • First used in the IBM 360/91 computer (1969).
  • Register renaming: Keeps multiple copies of the same physical register, preventing data dependencies that arise from limited register availability; this only matters if registers/allocation are limited and the dependency isn't due to data dependencies.
  • Common data bus (CDB): A data is put on a common bus as soon as it's available; prevents unnecessary stalls.
  • Instruction stages: Issue; issues an instruction if the functional unit and operands are available, otherwise stalls; considers a virtual value until the real value becomes available; renames registers to avoid hazards, Execute - carries out instructions as long as necessary operands are available or present on the CDB; special care for load and stores, and Write result - result is written to the destination register with memory operations (see commit stage).
  • Reservation stations: Buffers that fetch and store instruction operands as they're available; reservation stations hold instruction data and results; points to registers or other reservation stations with necessary data as soon as it's available (before it's written back into a register).
  • To avoid structural hazard, redundant functional units are used, including multiple integer ALUs, floating-point ALUs, or address computing ALUs.
  • Example: Pentium II and III architectures with multiple ALUs (2 integer unit executions, 1 floating-point execution, 1 MMX, 3 address generation units). Functional unit buffers store requests/instructions destined for that unit (e.g., Netburst architecture, Pentium IV reservation stations).
  • Commit: An extra stage in the instruction execution sequence; data is written to re-order buffers instead of directly to destination registers or memory; enables data to be used by other instructions; enables avoidance of some stalls.

Branch Prediction

  • A method for solving control hazards in pipelines.
  • Problem: a branch in the program disturbs pipeline execution; if the branch is taken, pipeline must be flushed and reinitialized.
  • Principle: Predicts the direction of a branch instruction (mainly conditional branches) to load the pipeline with instructions from the correct branch.
  • Methods: Static prediction (nature of the branch instruction):
    • Cases: Procedure calls (taken), Unconditional jumps (taken), Backward branches (taken), Forward branches (not taken). Advantage: simple, fast, and works well for programs with many loops. Drawback: does not work well for programs with many conditional jumps.
  • Methods: Dynamic prediction (considering the history of branch instructions): methods include Next line predictor, stores pointer to next instruction; stores decision and target; saturating counters store decisions in bits (1 or 2), such as strongly not taken, weakly not taken, weakly taken, and strongly taken; every occurrence of the branch updates state of counter.
  • Dynamic prediction methods (cont.): Local branch prediction (a separate history buffer for each jump). Global branch prediction (keeps a shared history of all conditional jumps). Two-level adaptive predictor (necessary for alternating/imbedded conditional jumps; memorizes patterns of taken/not taken branches).
  • Correlated prediction: predictor between local and global prediction. Global branch predictor: XOR (Exclusive-OR) between global-history buffer and jump's address in BHT. Gshare Predictor. Gselect Predictor. Hybrid Predictor(combines local & global predictors, such as Pentium IV).
  • Branch Target Buffer (BTB): Contains target of taken branches, an associative access memory, jump instruction address, target address, and prediction state

Misprediction Statistics

  • Data presented on misprediction rates for various branch prediction methods using various test cases. Graphs showing how misprediction rates correlate to predictor size.

Tournament Predictor

  • Combines local and global predictors with a selector, aiming to pick the correct predictor for a branch or context.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

SSC Course 5 CPU PDF

More Like This

Computer and CPU Architecture Quiz
17 questions
CPU Instruction Cycle
10 questions
CPU Architecture and Instruction Sets
20 questions
Use Quizgecko on...
Browser
Browser