Pipelined Processor

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

Which of the following best describes a pipelined processor?

  • Multiple instructions are broken up into a series of steps and executed concurrently. (correct)
  • Each instruction executes in a single clock cycle.
  • Instructions are executed sequentially, one after another.
  • Each instruction is broken up into a series of shorter steps, but only one instruction executes at a time.

In the context of pipelined processors, what is a 'hazard'?

  • A technique used to optimize the instruction fetch stage.
  • A method for predicting branch outcomes.
  • A situation that prevents the next instruction in the instruction stream from executing during its designated clock cycle. (correct)
  • A condition that allows instructions to execute out of order.

What is the primary goal of pipelining in processor design?

  • To simplify the instruction set architecture.
  • To increase the clock frequency.
  • To reduce the latency of individual instructions.
  • To improve processor throughput by allowing multiple instructions to be processed concurrently. (correct)

Which of the following is a type of data hazard?

<p>When an instruction attempts to use data before it is ready. (C)</p>
Signup and view all the answers

What is 'data forwarding' (also known as bypassing) used for in a pipelined processor?

<p>To resolve data dependencies by providing data to subsequent instructions directly from internal registers, rather than waiting for it to be written to memory. (D)</p>
Signup and view all the answers

What is 'stalling' in the context of pipeline hazards?

<p>Halting the pipeline temporarily to resolve a hazard. (D)</p>
Signup and view all the answers

What is the role of 'pipeline registers' in a pipelined processor?

<p>To isolate stages and hold data and control signals passing from one stage to the next. (B)</p>
Signup and view all the answers

Which stage typically calculates the target address for a branch instruction?

<p>Execute (EX). (D)</p>
Signup and view all the answers

What is a 'control hazard' in a pipelined processor?

<p>A situation where the pipeline must stall because the outcome of a branch instruction is not yet known. (C)</p>
Signup and view all the answers

What is branch prediction used for?

<p>To reduce the impact of control hazards by guessing the outcome of branch instructions. (D)</p>
Signup and view all the answers

What is the purpose of inserting 'nops' (no-operation instructions) into the code?

<p>To resolve data hazards by creating a delay, allowing the data to become available. (A)</p>
Signup and view all the answers

Why is the Decode stage often a critical bottleneck in a pipelined processor?

<p>Because it has to do multiple operations in the half cycle. (B)</p>
Signup and view all the answers

What is the role of the 'hazard detection unit' in a pipelined processor?

<p>To detect situations that could lead to incorrect execution due to pipeline hazards. (A)</p>
Signup and view all the answers

In a pipelined processor, what does 'flushing' the pipeline refer to?

<p>Removing instructions from the pipeline due to a mispredicted branch or exception. (B)</p>
Signup and view all the answers

Which of the following is most directly improved by using a pipelined architecture, compared to a single-cycle architecture?

<p>The instruction throughput. (C)</p>
Signup and view all the answers

Consider a pipelined processor with 5 stages. Ideally, what is the CPI (Cycles Per Instruction)?

<p>1 (C)</p>
Signup and view all the answers

For a program with 100 billion instruction where CPI = 1.15 and Tc = 550 ps, what is the execution time?

<p>63 seconds (A)</p>
Signup and view all the answers

Why does the ideal speedup of a pipelined processor is not achieved in real world?

<p>Because of instruction hazards. (A)</p>
Signup and view all the answers

Which type of hazard is resolved by branch prediction:

<p>Control Hazard (A)</p>
Signup and view all the answers

In the context of Instruction Level Parallelism (ILP), which of the following is a technique used by ""Out of Order"" processors to deal with dependencies?

<p>Write After Write(WAW) (C)</p>
Signup and view all the answers

In a laundry analogy to the pipeline, what is the data hazard?

<p>Load #2 needs a shirt still in Load #1's washer. (D)</p>
Signup and view all the answers

In a laundry analogy to the pipeline, what is the structural hazard?

<p>Only one dryer is an example. (B)</p>
Signup and view all the answers

Which of the following is NOT a stage for MIPS?

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

If we want throughput to improves, what do we need to do?

<p>Improve processor performance. (C)</p>
Signup and view all the answers

How many ARM processors does ARM9E have? Look at evolution table.

<p>5 (D)</p>
Signup and view all the answers

If EX/MEM.RegisterRd 0 and EX/MEM.RegisterRd = ID/EX.RegisterRs, what type of forwarding will it be?

<p>ForwardA = 10 (D)</p>
Signup and view all the answers

What should happens if one branch occurs when determining hazards?

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

Which of the following is not of the type of hazard:

<p>Instruction (C)</p>
Signup and view all the answers

Which of the following is not what we can do to handle data hazards?

<p>Calculate hazard (C)</p>
Signup and view all the answers

When does the pipeline occurs?

<p>When an instruction depend on results. (B)</p>
Signup and view all the answers

Select all write types when Out of Order Processors runs:

<p>WAW (write after write) (B), WAR (write after read) (C), RAW (read after write) (D)</p>
Signup and view all the answers

Why learn pipeline?

<p>How to increase clock frequency (C)</p>
Signup and view all the answers

Choose the single cycle parameter

<p>Register clock-to-Q (C)</p>
Signup and view all the answers

What does hazard unit detects?

<p>stallD (C)</p>
Signup and view all the answers

What affects the overall datapath?

<p>Sequencing overhead. (A)</p>
Signup and view all the answers

Which step does the equality comparator fall be moved back into in beq control hazards?

<p>Move back into the Decode stage (B)</p>
Signup and view all the answers

When the EX stage destination register matches the next instruction's source register, what is it called?

<p>Data forwarding (D)</p>
Signup and view all the answers

What does Single cycle execution time mean

<p>Memory Read (C)</p>
Signup and view all the answers

What does it mean when cycles per instruction is a clock cycle of 1?

<p>New instruction is issued every circle (B)</p>
Signup and view all the answers

Why is it crucial to learn about pipelining in processor design?

<p>It helps to improve processor throughput and increase processor performance. (A)</p>
Signup and view all the answers

In the context of pipelined processors, what is the purpose of data forwarding?

<p>To provide data to a subsequent instruction directly from a pipeline register, avoiding stalls. (D)</p>
Signup and view all the answers

What is the primary limitation of a single-cycle processor that pipelining aims to overcome?

<p>The length of the critical path, which determines the clock cycle time. (A)</p>
Signup and view all the answers

Which of the following is NOT a common method for handling data hazards in pipelined processors?

<p>Increasing the clock frequency. (C)</p>
Signup and view all the answers

What is the primary goal of Tomasulo's algorithm in out-of-order execution?

<p>Allowing instructions to execute as soon as their operands are available, regardless of the original program order. (B)</p>
Signup and view all the answers

Consider a pipelined processor. If an instruction in the Execute stage needs data that is only available in the Write Back stage of a previous instruction, what is the typical solution to resolve this data dependency?

<p>Stalling the pipeline until the data is available. (D)</p>
Signup and view all the answers

In a pipelined processor, what is the purpose of the Hazard Detection Unit?

<p>To detect data and control hazards and initiate appropriate actions. (A)</p>
Signup and view all the answers

How does increasing the number of pipeline stages typically affect the clock frequency of a processor?

<p>It allows for an increased clock frequency because each stage performs less work. (B)</p>
Signup and view all the answers

What is a structural hazard in a pipelined processor?

<p>When the processor attempts to use the same resource for two different instructions simultaneously. (B)</p>
Signup and view all the answers

In the laundry analogy for pipelining, which activity corresponds to 'Write Back' stage?

<p>Folding clean clothes. (A)</p>
Signup and view all the answers

Given a program running on a pipelined processor experiences both data and control hazards, which of the following is generally true regarding the processor's CPI (Cycles Per Instruction)?

<p>The CPI will be greater than 1 due to stalls and flushes. (C)</p>
Signup and view all the answers

What is the role of 'nops' (no-operation instructions) in the code?

<p>To handle data hazards by letting enough clock cycles pass. (B)</p>
Signup and view all the answers

What happens when a branch occurs when determining hazards?

<p>Instructions fetched after the branch must be flushed if the branch happens (D)</p>
Signup and view all the answers

What are the three types of dependencies?

<p>WAW, RAW, WAR (B)</p>
Signup and view all the answers

Flashcards

Single-Cycle Processor

Each instruction executes in a single clock cycle.

Multicycle Processor

Each instruction is divided into a series of shorter steps.

Pipelined Processor

Each instruction is broken into a series of steps; multiple instructions execute at once.

Program Execution Time

Time to execute a program, depends on instruction count, cycles per instruction (CPI), and cycle time.

Signup and view all the flashcards

Single-cycle Performance Limit

Limited by the longest (critical) path within a circuit.

Signup and view all the flashcards

Pipelining

Overlapping instruction execution to improve throughput.

Signup and view all the flashcards

Pipelined Processor Stages

Dividing the processor into multiple stages.

Signup and view all the flashcards

Temporal parallelism

Simultaneous execution of instructions in different stages.

Signup and view all the flashcards

Major Pipeline Components

Instruction Memory, Register File, Arithmetic Logic Unit, Data Memory

Signup and view all the flashcards

IF (Fetch) in Laundry Analogy

The first instruction loads dirty clothes into a washer.

Signup and view all the flashcards

ID (Decode) in Laundry Analogy

The second instruction sorts clothes by color/fabric.

Signup and view all the flashcards

EX (Execute) in Laundry Analogy

The third operation is washing the clothes.

Signup and view all the flashcards

MEM (Memory Access) in Laundry Analogy

The fourth action dries the clothes.

Signup and view all the flashcards

WB (Write Back) in Laundry Analogy

The last step is to fold the clean clothes.

Signup and view all the flashcards

Pipeline Hazard

When an instruction depends on results from a previous instruction that hasn't completed.

Signup and view all the flashcards

Structural Hazards

Attempt to use the same resource by two different instructions at the same time.

Signup and view all the flashcards

Data Hazards

Attempt to use data before it is ready.

Signup and view all the flashcards

Control Hazards

Attempt to decide about program control before condition is evaluated.

Signup and view all the flashcards

Data Hazard

When an instruction reads $s0 on cycle 3, when new $s0 has not been produced yet, obtaining the wrong value

Signup and view all the flashcards

Read After Write(RAW) hazard

One instruction writes and subsequent instructions read this register.

Signup and view all the flashcards

Handling Data Hazards

Forward data at runtime, insert nops, rearrange code, stall process

Signup and view all the flashcards

Data Forwarding

Forwarding a result to a dependent instruction in the Execute stage, Adding multiplexers

Signup and view all the flashcards

Stalling

Holding up operation until the data is available as a result can not be forwarded to the Execute stage of the next instruction.

Signup and view all the flashcards

Compile-Time Hazard Elimination

Insert enough nops or move independent instructions forward.

Signup and view all the flashcards

beq in Control Hazards

Branch is not determined until the fourth stage of the pipeline.

Signup and view all the flashcards

Corrected Pipelined Datapath

All signals associated with a particular instruction must advance through the pipeline in unison

Signup and view all the flashcards

Pipelined Control

Combinational logic determines control, but data and control are staged along.

Signup and view all the flashcards

EX/MEM.RegisterRd field

Where the register destination field comes from for either an ALU instruction or a load

Signup and view all the flashcards

beq instruction (Appendix)

Solving controlling hazards: The beq instruction presents a control hazard.

Signup and view all the flashcards

Data Forwarding (Appendix)

Forward to Execute stage from either memory.

Signup and view all the flashcards

Stalling (Appendix)

The pipeline, holding up operation until the data is available.

Signup and view all the flashcards

Stalling Hardware (Appendix)

Its Iw and its destination register (rtE) matches either source

Signup and view all the flashcards

Out of Order Processor

Looks ahead across multiple instructions and

Signup and view all the flashcards

Instruction level What

Instruction level parallelism (ILP): number of instruction that can be issued simultaneously

Signup and view all the flashcards

Study Notes

Pipeline Processor

  • Instructions execute in a single cycle in a single-cycle processor.
  • Instructions are broken into shorter steps in a multicycle processor.
  • Instructions are broken into a series of steps, executing multiple instructions at once in a pipelined processor.

Topics Overview

  • A review covered slides 3-5 focusing on single-cycle and multi-cycle processors.
  • Pipelining is taught using a laundry analogy.
  • The five stages of a pipelined processor are described.
  • Pipeline hazards are covered including types, handling, data forwarding, stalling, and control hazards.
  • Topics cover pipeline control, hazard detection, full hazard handling, and performance.

Processor Performance

  • Program Execution Time = (# instructions) * (cycles/instruction) * (seconds/cycle).
  • The formula can also be expressed as: # instructions * CPI * Tc.

Single-Cycle Processor

  • Tc is limited by the critical path.

Multi-Cycle MIPS Processor

  • Multicycle processor diagrams are shown which details components.

Reasons for Pipelining

  • Improves processor throughput.
  • Increases processor performance.
  • Increases clock frequency or reduce clock cycle time.

Laundry Analogy for Pipelining

  • Analogy includes Ann, Brian, Cathy, and Dave each doing laundry (wash, dry, fold).
  • Each task (washer, dryer, folder, stasher) takes 30 minutes.
  • Sequential laundry takes 8 hours for 4 loads.
  • Pipelining overlaps tasks and reduces it to 3.5 hours for 4 loads and a latency of 2 hours.
  • Throughput improves by a factor of 2.3 but decreases for more loads.

Laundry Analogy Stages and Key Parallelism

  • IF (Fetch): Dirty clothes are loaded (instruction fetched from memory).
  • ID (Decode): Sorting clothes by color/fabric (decoding opcode/registers).
  • EX (Execute): Washing (ALU performs arithmetic/logic operations).
  • MEM (Memory Access): Drying (loading/storing data from/to memory).
  • WB (Write Back): Folding clean clothes (writing results to registers).
  • Key Parallelism is achieved when Load #1 is drying, Load #2 is washing, and Load #3 is being sorted.
  • Throughput: 5 loads finish in ~7 hours (vs. 25 hours sequentially)

Hazards Exampled

  • Data Hazard: Load #2 needs a shirt still in Load #1's washer, causing a Stall (bubble).
  • Structural Hazard: only one dryer, so Load #3 waits for Load #2 to finish.

Pipelined MIPS Processor

  • Utilizes temporal parallelism.
  • Divides a single-cycle processor into 5 stages.
  • 5 Stages: Fetch, Decode, Execute, Memory, Write back.
  • Pipeline registers added between stages.
  • With pipelining, five instructions can run simultaneously, one in each stage.
  • Because each stage has only one-fifth of the entire logic, the clock frequency is almost five times faster.
  • The latency of each instruction remains ideally unchanged but the throughput is ideally five times better.

Pipelining Abstraction Points

  • Assume the register file is written in the first part of a cycle and read in the second part.
  • Major components: IM (instruction memory), RF (register file), DM (data memory).

Pipelined Datapath Stages

  • The single cycle is chopped into five stages separated by pipeline registers.
  • Each stage is doing a different instruction.
  • The stages and their boundaries are indicated in blue.
  • Signals are given a suffix (F,D,E, M or W) to indicate the stage in which they reside.

Corrected Pipelined Datapath

  • All signals for an instruction must advance through the pipeline in unison.
  • WriteReg must arrive at the same time as Result.
  • The WriteReg signal is pipelined along through the Memory and Writeback stages, and remains synchronized with the instruction.

Pipelined Control Unit

  • Combinational logic determines control, and data and control are staged along the pipeline.
  • Use similar control unit as a single-cycle processor
  • However the control must be delayed to the proper pipeline stage.

Pipeline Hazards

  • When an instruction depends on results from a previous instruction that hasn't finished.
  • Data hazard: register value not written back to register file yet
  • Control hazard: next instruction not decided yet (caused by branches)

Pipeline Hazards can be:

  • Structural Hazards which attempt to use the same resource by two instructions at the same time.
  • Data Hazards, which attempt to use data before it is ready.
  • Control Hazards attempt to make a decision about program control flow before the condition has been evaluated and the new PC target address.
  • Hazards are resolved by waiting, detecting the hazard by the pipeline control and actions taken to resolve them.

Data Hazards

  • The second instruction reads $s0 on cycle 3 before the new value of $s0 has been produced and causes it to have the wrong value.
  • Read After Write(RAW) hazard: one instruction writes a register and subsequent instructions read this register.
  • Data hazard can be detected by checking if the current instruction's destination register is the same as the next instruction's source register.

Handling Data Hazards

  • Forward data at run time
  • Insert nops in code at compile time
  • Rearrange code at compile time
  • Stall the processor at run time

Data Forwarding Technique

  • Solves data hazards by forwarding a result to a dependent instruction in the Execute stage.
  • Requires adding multiplexers in front of the ALU.
  • Forwarding is neeeded when an instruction in the Execute stage has a source register matching the destination register of an instruction in the Memory or Writeback stage.

Stalling

  • Stalling is when the pipeline operation is held until the data is available.
  • "lw" doesn't finish reading data until the end of Mem stage, the result can not be forwarded to the Execute stage of the next instruction, so it needs to stall.

Compile-Time Hazard Elimination

  • Insert enough NOP instructions to allow for the result to be ready.
  • Or move independent instructions forward.

Control Hazards occur with beq

  • branch is not determined until the fourth stage of the pipeline
  • Instructions after the branch are fetched before branch occurs, these instructions must be flushed if the branch happens
  • Branch misprediction penalty relates to the number of instruction flushed when the branch is taken and may be reduced by determining the branch earlier.

Detecting Hazards

  • An instruction must resolve destination register is the same as the next instruction's source register
  • Note the the EX/MEM.RegisterRd field is the register destination for either an ALU instruction (which comes from the Rd field of the instruction) or a load (which comes from the Rt field).

Pipelined Processor with Full Hazard Handling

  • Processors contain components which handle full hazards such as forwarind units
  • Full hazard processors also may need to stall the process

Pipeline Performance Metrics

  • Critical path considerations impact performance analysis
  • Clock-per-instruction (CPI)
  • Clock time (Tc Max)

Pipeline Performance Example and Metrics

  • Pipelined processors ideally would have a CPI of 1, but stalls and flushes can contribute to this value.
  • By calculating time and speed up it is possible to analyze processors
  • A SpecINT2000 Pipelined processor has a CPI of 1.15
  • The average CPI is the sum over each instruction of the CPI for that instruction multiplied by the fraction of time that instruction is used.

Pipeline Performance Example

  • For a program with 100 billion instructions executing on a pipelined MIPS processor, CPI = 1.15.
  • Execution time = (100 x 10^9)(1.15)(550x10^-12)
  • Execution Time = 63 seconds

Performance of Processors

  • Single Cylce takes 95 seconds
  • MultiCycle takes 133 seconds
  • Pipelined takes 63 seconds
  • But its advantage over the single-cycle processor is nowhere near the fivefold speedup one might hope to get from a five stage pipeline.
  • The pipeline hazards introduce a small CPI penalty. More significantly, the sequencing overhead (clk-to-Q and setup times) of the registers applies to every pipeline stage, not just once to the overall datapath.
  • Sequencing overhead limits the benefits one can hope to achieve from pipelining.

Appendices Includes

  • Control Hazards in beq for branching prediction for example
  • Data Forwarding where a stage should forward from a stage if that stage if that stage will write a destination register and the destination register matches the source register
  • Stalling which requires an analysis of read after write cycles
  • Stalling hardware has stalling logic

Evolution of ARM processors

  • Various processors have been released over the years such as the ARM1, ARM6, ARM7, ARM9E, ARM11, Cortex-A9, Cortex-A7, Cortex-A15, Cortex-M0, Cortex-A53, Cortex-A57
  • The release year varies between the years 1985 and 2012

(Optional) Out of Order Processor

  • Looks ahead across multiple instructions
  • Issues as many instructions as possible at once
  • Issues instructions out of order (as long as no dependencies)
  • Dependencies: RAW (read after write), WAR (write after read), WAW (write after write)
  • It has Instruction level parallelism (ILP) which relates to the number of instructions that can be issued simultaneously (average < 3)
  • The Scoreboard: table that keeps track of: Instructions waiting to issue ,Available functional units and Dependencies

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Popular ARM Architectures Quiz
17 questions
Understanding CPU Pipeline Stages and Hazards
12 questions

HandierConnemara618 avatar
HandierConnemara618
Arquitetura de Processadores UN_03
12 questions
Use Quizgecko on...
Browser
Browser