Docsity

Differences in Instruction Execution: Pipelined vs Non-Pipelined, Study notes of Computer Applications

Partial preview of the text

Download Differences in Instruction Execution: Pipelined vs Non-Pipelined and more Study notes Computer Applications in PDF only on Docsity!

PIPELINING

“An implementation technique in which

multiple instructions are overlapped in

execution, much like an assembly line.”

DIFFERENCE B/W PIPELINED AND NONPIPELNED Example: Steps for laundry

1. Place one dirty load of clothes in the washer.

2. When the washer is finished, place the wet load in the dryer.

3. When the dryer is finished, place the dry load on a table and fold.

4. When folding is finished, ask your roommate to put the clothes

away.

Pipeline concept in Instruction execution

Steps:

1. Fetch instruction from memory.

2. Read registers while decoding the instruction.

The regular format of MIPS instructions allows

reading and decoding to occur simultaneously.

3. Execute the operation or calculate an address.

4. Access an operand in data memory.

5. Write the result into a register.

Nonpipelined and pipelined Instruction execution

example

Pipeline

Total Execution time for pipelined
instruction execution =1400ps
Num of instructions=1,000,
Additional execution time for each
instruction=200ps
So, 1,000,000*200ps+1400ps

NonPipeline

Total Execution time for
nonpipelined instruction
execution =2400ps
Num of instructions=1,000,
Additional execution time for each
instruction=800ps
So,1000000*800ps+2400ps

Ratio b/w pipelined and non pipelined

TYPES

Data hazard Control hazard  Structural hazard

Structural Hazard

  • (^) Attempt to use the same resource by two or more instructions

lw $r0, 10($r1) IM^ REG^ ALU^ DM^ REG sw $r3, 20($r4) add $r5, $r6, $r CC 1 CC 2 CC 3 CC 4 CC 5 CC 6 CC 7 IM REG ALU DM REG IM REG ALU DM REG sub $r8, $r9, $r10 (^) IM REG ALU DM REG CC 8

Memory Conflict

How to avoid structural hazards

Stall

  • (^) low cost, simple
  • (^) Increases CPI
  • (^) use for rare case since stalling has performance

effect

Pipeline hardware resource

  • (^) useful for multi-cycle resources
  • (^) good performance
  • (^) sometimes complex e.g., RAM

Data hazards

  • (^) Data hazards occur when data is used before it is ready

IM Reg IM Reg CC 1 CC 2 CC 3 CC 4 CC 5 CC 6 Time (in clock cycles) sub $ 2 , $ 1 , $ 3 Program execution order (in instructions) and $ 12 , $ 2 , $ 5 IM (^) Reg DM Reg IM DM Reg IM DM Reg CC 7 CC 8 CC 9 10 10 10 10 10 /– 20 – 20 – 20 – 20 – 20 or $ 13 , $ 6 , $ 2 add $ 14 , $ 2 , $ 2 sw $ 15 , 100 ($ 2 ) Value of register $ 2 : DM Reg Reg Reg Reg DM

RAW(Read After Write)

WAR(Write After Read)