0% found this document useful (0 votes)
58 views3 pages

Pipelining Hazards and Solutions

Uploaded by

aabilakim17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views3 pages

Pipelining Hazards and Solutions

Uploaded by

aabilakim17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Architecture and Organization of Computer System

Worksheet# 7
Abilakim Alisher
IT2-2205

Q 1: Discuss different kinds of Hazards in pipelining?

Q 2: What are the Structural Hazards and how do we solve it?

Q 3: What are the Data Hazards and how do we solve it??

Q 4: How do we compare whether Destination matches with the source explain with example?

Q 5: Explain the Forwarding technique in pipelining with example?

Write structural and data hazards, compare Destination matches with the source in data hazards
also discuss the forwarding technique.

Q1: Different Kinds of Hazards in Pipelining

Pipelining hazards are classified into three main types:

1. Structural Hazards: Occur when multiple instructions require the same hardware re-
source simultaneously.
2. Data Hazards: Arise when an instruction depends on the data from a previous instruc-
tion that hasn't completed.
3. Control Hazards: Occur due to branch instructions that alter the flow of control, causing
delays.

Q2: What are Structural Hazards, and How Do We Solve Them?

Structural Hazards happen when instructions compete for the same hardware resource, like
memory or ALU, causing a conflict. To solve them:

 Add Hardware Resources: Duplicate the resource to allow parallel operations.


 Stall the Pipeline: Temporarily halt the pipeline to wait for the resource to become avail-
able.

Q3: What are Data Hazards, and How Do We Solve Them?


Data Hazards occur when instructions depend on the results of previous instructions still in the
pipeline. Types of data hazards include:

 RAW (Read After Write)


 WAR (Write After Read)
 WAW (Write After Write)

Solutions:

 Forwarding (Data Bypassing): Directly pass the result from one pipeline stage to an-
other.
 Pipeline Stalling: Delay the execution of dependent instructions until the required data is
available.

Q4: Comparing Destination with Source in Data Hazards

To handle data hazards, we compare the destination register of one instruction with the source
register of another:

 If the destination register of a previous instruction matches the source register of a current
instruction, it indicates a dependency.
 Example: If instruction 1 writes to register R1 and instruction 2 reads from R1, there is a
RAW hazard.

Q5: Explain the Forwarding Technique in Pipelining with Example

Forwarding (or data bypassing) helps prevent data hazards by directly passing the output of
one instruction to another before the write-back stage.

 Example: If instruction 1 produces a result in register R2 that instruction 2 needs, for-


warding allows instruction 2 to use that result immediately without waiting for instruction
1 to complete fully.

You might also like