SlideShare ist ein Scribd-Unternehmen logo
1 von 41
 A technique used in advanced microprocessors where the
microprocessor begins executing a second instruction
before the first has been completed.
- A Pipeline is a series of stages, where some work is done at
each stage. The work is not finished until it has passed
through all stages.
 With pipelining, the computer architecture allows the next
instructions to be fetched while the processor is
performing arithmetic operations, holding them in a buffer
close to the processor until each instruction operation can
performed.
 The pipeline is divided into segments and each
segment can execute it operation concurrently with
the other segments. Once a segment completes an
operations, it passes the result to the next segment in
the pipeline and fetches the next operations from the
preceding segment.
Four Pipelined Instructions
IF
IF
IF
IF
ID
ID
ID
ID
EX
EX
EX
EX M
M
M
M
W
W
W
W
5
1
1
1
Instructions Fetch
 The instruction Fetch (IF) stage is responsible for obtaining
the requested instruction from memory. The instruction
and the program counter (which is incremented to the next
instruction) are stored in the IF/ID pipeline register as
temporary storage so that may be used in the next stage at
the start of the next clock cycle.
Instruction Decode
 The Instruction Decode (ID) stage is responsible for
decoding the instruction and sending out the various
control lines to the other parts of the processor. The
instruction is sent to the control unit where it is decoded
and the registers are fetched from the register file.
Execution
 The Execution (EX) stage is where any calculations are
performed. The main component in this stage is the ALU.
The ALU is made up of arithmetic, logic and capabilities.
Memory and IO
 The Memory and IO (MEM) stage is responsible for storing
and loading values to and from memory. It also responsible
for input or output from the processor. If the current
instruction is not of Memory or IO type than the result
from the ALU is passed through to the write back stage.
Write Back
 The Write Back (WB) stage is responsible for writing
the result of a calculation, memory access or input into
the register file.
Decode
Instruction and
Calculate Effective
Address
Fetch Instruction
From Memory
Branch ?
Update PC
Empty Pipe
Interrupt
Handling
Fetch Operand
From memory
Execute
Instruction
Interrupt
YES
NO
YES NO
INTRODUCTION
Pipelining is technique of decomposing a
sequential process into suboperation, with each
subprocess being executed in a special dedicated
segment that operates concurrently with all other
segments.
The name “pipeline” implies a flows of
information analogous to an industrial assembly
line.
The name “pipeline” implies a flow of
information analogous to an industrial assembly
line.
It is characteristic of pipelines that several
computation can be in progress in distinct at the
same time.
Each subtask can be processed independently
on a different machine.
The pipelining design provides a way to start a
new task before an old one has been completed.
F
1
E
1
F
2
E
2
F
3
E
3
I1 I2 I3
(a) Sequential execution
Instruction
fetch
unit
Exelution
unit
Interstage buffer
B1
(b) Hardware organization
Time
F1 E1
F2 E2
F3 E3
I1
I2
I3
Instruction
(c) Pipelined execution
Clock cycle 1 2 3 4
Time
Fetch + Execution
 pipelining processing:
 Perform arithmetic operation (Ai*Bi)+(Ci*Di) with a
stream of number. A specify pipeline configuration to
carry out the task. Register in the pipeline for i=1
through 6.
It consist of seven registers that receive new data with
every clock pulse ,two multipliers and one adder circuits .
R1 R2 R3 R4
MULTIPLIER MULTIPLIER
R5 R6
ADDER
R7
Stage 1
Stage 2
Stage 3
Ai Bi Ci Di
 The performance gain from using pipelining occurs
because we can start the execution of a new
instruction each clock cycle. In a real implementation
this is not always possible.
 Another important note is that in a pipelined
processor, a particular instruction still takes at least as
long to execute as non-pipelined.
 Pipeline hazards prevent the execution of the next
instruction during the appropriate clock cycle.
 There are three types of hazards in a pipeline, they are
as follows:
 Structural Hazards: are created when the data path hardware
in the pipeline cannot support all of the overlapped
instructions in the pipeline.
 Data Hazards: When there is an instruction in the pipeline
that affects the result of another instruction in the pipeline.
 Control Hazards: The PC causes these due to the pipelining
of branches and other instructions that change the PC.
 Structural hazards result from the CPU data path
not having resources to service all the required
overlapping resources.
 Suppose a processor can only read and write from
the registers in one clock cycle. This would cause a
problem during the ID and WB stages.
 Assume that there are not separate instruction and
data caches, and only one memory access can occur
during one clock cycle. A hazard would be caused
during the IF and MEM cycles.
 A structural hazard is dealt with by inserting a stall or
pipeline bubble into the pipeline. This means that for that
clock cycle, nothing happens for that instruction. This
effectively “slides” that instruction, and subsequent
instructions, by one clock cycle.
 This effectively increases the average CPI.
 EX: Assume that you need to compare two processors, one
with a structural hazard that occurs 40% for the time,
causing a stall. Assume that the processor with the hazard
has a clock rate 1.05 times faster than the processor without
the hazard. How fast is the processor with the hazard
compared to the one without the hazard?
 We can see that even though the clock speed of the
processor with the hazard is a little faster, the
speedup is still less than 1.
 Therefore the hazard has quite an effect on the
performance.
 Sometimes computer architects will opt to design a
processor that exhibits a structural hazard. Why?
• .
 We haven’t looked at assembly programming in
detail at this point.
 Consider the following operations:
DADD R1, R2, R3
DSUB R4, R1, R5
AND R6, R1, R7
OR R8, R1, R9
XOR R10, R1, R11
Pipeline Registers
What are the problems?
 In this trivial example, we cannot expect the programmer to
reorder his/her operations. Assuming this is the only code we
want to execute.
 Data forwarding can be used to solve this problem.
 To implement data forwarding we need to bypass the
pipeline register flow:
 instruction depends on the write of a previous instruction.
 It is easy to see how data forwarding can be used by
drawing out the pipelined execution of each
instruction.
 Now consider the following instructions:
DADD R1, R2, R3
LD R4, O(R1)
SD R4, 12(R1)
ENGR9861 Winter 2007 RV
 Can data forwarding prevent all data hazards?
 NO!
 The following operations will still cause a data
hazard. This happens because the further down the
pipeline we get, the less we can use forwarding.
LD R1, O(R2)
DSUB R4, R1, R5
AND R6, R1, R7
OR R8, R1, R9
 We can avoid the hazard by using a pipeline
interlock.
 The pipeline interlock will detect when data
forwarding will not be able to get the data to the
next instruction in time.
 A stall is introduced until the instruction can get
the appropriate data from the previous instruction.
ENGR9861 Winter 2007 RV
 Control hazards are caused by branches in the
code.
 During the IF stage remember that the PC is
incremented by 4 in preparation for the next IF
cycle of the next instruction.
 What happens if there is a branch performed and
we aren’t simply incrementing the PC by 4.
 The easiest way to deal with the occurrence of a
branch is to perform the IF stage again once the
branch occurs.
 These following solutions assume that we are
dealing with static branches. Meaning that the
actions taken during a branch do not change.
 We already saw the first example, we stall the
pipeline until the branch is resolved (in our case we
repeated the IF stage until the branch resolved and
modified the PC)
 The next two examples will always make an
assumption about the branch instruction.
ENGR9861 Winter 2007 RV
 What if we treat every branch as “not taken”
remember that not only do we read the registers
during ID, but we also perform an equality test in
case we need to branch or not.
 We can improve performance by assuming that the
branch will not be taken.
 What in this case we can simply load in the next
instruction (PC+4) can continue. The complexity
arises when the branch evaluates and we end up
needing to actually take the branch.
ENGR9861 Winter 2007 RV
 The “branch-not taken” scheme is the same as performing
the IF stage a second time in our 5 stage pipeline if the
branch is taken.
 If not there is no performance degradation.
 The “branch taken” scheme is no benefit in our case because
we evaluate the branch target address in the ID stage.
 The fourth method for dealing with a control hazard is to
implement a “delayed” branch scheme.
 In this scheme an instruction is inserted into the pipeline
that is useful and not dependent on whether the branch is
taken or not. It is the job of the compiler to determine the
delayed branch instruction.
 Sometimes operations require more than one clock
cycle to complete. Examples are:
 Floating Point Multiply
 Floating Point Divide
 Floating Point Add
 We can assume that there is hardware available on
the processor for performing the operations.
 Assume that the FP Mul and Add are fully
pipelined, and the divide is un-pipelined.
 The multiplier and the divider are fully pipelined.
The divider is not pipelined at all.
 Take a look at figure A.34 for a good example of
how pipelining will function in the case of longer
instruction execution. The author assumes a single
floating point register port.
 Structural hazards are avoided in the ID stage by
assigning a memory bit in a shift register. Incoming
instructions can then check to see if they should
stall.
ENGR9861 Winter 2007 RV
 Data Dependence:
 Instruction i produces a result the instruction j will
use or instruction i is data dependent on instruction
j and vice versa.
 Name Dependence:
 Occurs when two instructions use the same register
and memory location. But there is no flow of data
between the instructions. Instruction order must be
preserved.
ENGR9861 Winter 2007 RV
 Types of data hazards:
 RAW: read after write
 WAW: write after write
 WAR: write after read
 We have already seen a RAW hazard. WAW hazards
occur due to output dependence.
 WAR hazards do not usually occur because of the
amount of time between the read cycle and write
cycle in a pipeline.
39
Read After Write (RAW)
InstrJ tries to read operand before InstrI writes it
• Caused by a “Dependence” (in compiler nomenclature).
This hazard results from an actual need for
communication.
Execution Order is:
InstrI
InstrJ
I: add r1,r2,r3
J: sub r4,r1,r3
Write After Read (WAR)
InstrJ tries to write operand before InstrI reads i
– Gets wrong operand
– Called an “anti-dependence” by compiler writers.
This results from reuse of the name “r1”.
• Can’t happen in MIPS 5 stage pipeline because:
– All instructions take 5 stages, and
– Reads are always in stage 2, and
– Writes are always in stage 5
Execution Order is:
InstrI
InstrJ
I: sub r4,r1,r3
J: add r1,r2,r3
K: mul r6,r1,r7
Write After Write (WAW)
InstrJ tries to write operand before InstrI writes it
– Leaves wrong result ( InstrI not InstrJ )
• Called an “output dependence” by compiler writers
This also results from the reuse of name “r1”.
• Can’t happen in MIPS 5 stage pipeline because:
– All instructions take 5 stages, and
– Writes are always in stage 5
• Will see WAR and WAW in later more complicated pipes
Execution Order is:
InstrI
InstrJ
I: sub r1,r4,r3
J: add r1,r2,r3
K: mul r6,r1,r7

Weitere ähnliche Inhalte

Was ist angesagt?

Pipeline Mechanism
Pipeline MechanismPipeline Mechanism
Pipeline MechanismAshik Iqbal
 
Pipelining
PipeliningPipelining
PipeliningAJAL A J
 
Loop parallelization & pipelining
Loop parallelization & pipeliningLoop parallelization & pipelining
Loop parallelization & pipeliningjagrat123
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of PipeliningSHAKOOR AB
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipeliningMazin Alwaaly
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture S. Hasnain Raza
 
Instruction pipeline
Instruction pipelineInstruction pipeline
Instruction pipelineajay_a
 
INSTRUCTION PIPELINING
INSTRUCTION PIPELININGINSTRUCTION PIPELINING
INSTRUCTION PIPELININGrubysistec
 
Lec18 pipeline
Lec18 pipelineLec18 pipeline
Lec18 pipelineGRajendra
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMKamran Ashraf
 
pipeline and pipeline hazards
pipeline and pipeline hazards pipeline and pipeline hazards
pipeline and pipeline hazards Bharti Khemani
 
Pipelining, processors, risc and cisc
Pipelining, processors, risc and ciscPipelining, processors, risc and cisc
Pipelining, processors, risc and ciscMark Gibbs
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazardsMunaam Munawar
 

Was ist angesagt? (20)

Pipelining In computer
Pipelining In computer Pipelining In computer
Pipelining In computer
 
Pipeline Mechanism
Pipeline MechanismPipeline Mechanism
Pipeline Mechanism
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
 
Chapter6 pipelining
Chapter6  pipeliningChapter6  pipelining
Chapter6 pipelining
 
Pipelining
PipeliningPipelining
Pipelining
 
Loop parallelization & pipelining
Loop parallelization & pipeliningLoop parallelization & pipelining
Loop parallelization & pipelining
 
Design a pipeline
Design a pipelineDesign a pipeline
Design a pipeline
 
Concept of Pipelining
Concept of PipeliningConcept of Pipelining
Concept of Pipelining
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture Pipeline processing - Computer Architecture
Pipeline processing - Computer Architecture
 
3 Pipelining
3 Pipelining3 Pipelining
3 Pipelining
 
Instruction pipeline
Instruction pipelineInstruction pipeline
Instruction pipeline
 
INSTRUCTION PIPELINING
INSTRUCTION PIPELININGINSTRUCTION PIPELINING
INSTRUCTION PIPELINING
 
Lec18 pipeline
Lec18 pipelineLec18 pipeline
Lec18 pipeline
 
pipelining
pipeliningpipelining
pipelining
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
 
pipeline and pipeline hazards
pipeline and pipeline hazards pipeline and pipeline hazards
pipeline and pipeline hazards
 
Pipelining, processors, risc and cisc
Pipelining, processors, risc and ciscPipelining, processors, risc and cisc
Pipelining, processors, risc and cisc
 
Pipelining , structural hazards
Pipelining , structural hazardsPipelining , structural hazards
Pipelining , structural hazards
 

Andere mochten auch

Aseguramiento de calidad y costos
Aseguramiento de calidad y costosAseguramiento de calidad y costos
Aseguramiento de calidad y costosJavier Lugo Dreyer
 
Investigacion computacion
Investigacion computacionInvestigacion computacion
Investigacion computacionDiana06vensan
 
Robert Louis stevenson
Robert Louis stevensonRobert Louis stevenson
Robert Louis stevensonIrene12233
 
Uso responsable de internet powerpoint
Uso responsable de internet powerpointUso responsable de internet powerpoint
Uso responsable de internet powerpointjuanpi mastromonaco
 

Andere mochten auch (6)

Dianaventura metodo
Dianaventura metodoDianaventura metodo
Dianaventura metodo
 
Aseguramiento de calidad y costos
Aseguramiento de calidad y costosAseguramiento de calidad y costos
Aseguramiento de calidad y costos
 
Reflection Paper - GEL
Reflection Paper - GELReflection Paper - GEL
Reflection Paper - GEL
 
Investigacion computacion
Investigacion computacionInvestigacion computacion
Investigacion computacion
 
Robert Louis stevenson
Robert Louis stevensonRobert Louis stevenson
Robert Louis stevenson
 
Uso responsable de internet powerpoint
Uso responsable de internet powerpointUso responsable de internet powerpoint
Uso responsable de internet powerpoint
 

Ähnlich wie Assembly p1

Pipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdfPipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdfarasanlethers
 
Pipelining 16 computers Artitacher pdf
Pipelining   16 computers Artitacher  pdfPipelining   16 computers Artitacher  pdf
Pipelining 16 computers Artitacher pdfMadhuGupta99385
 
Pipelining in Computer System Achitecture
Pipelining in Computer System AchitecturePipelining in Computer System Achitecture
Pipelining in Computer System AchitectureYashiUpadhyay3
 
A survey of paradigms for building and
A survey of paradigms for building andA survey of paradigms for building and
A survey of paradigms for building andcseij
 
Advanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPAdvanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPA B Shinde
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelinesturki_09
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipeliningTech_MX
 
03. top level view of computer function & interconnection
03. top level view of computer function & interconnection03. top level view of computer function & interconnection
03. top level view of computer function & interconnectionnoman yasin
 
Ch2 embedded processors-i
Ch2 embedded processors-iCh2 embedded processors-i
Ch2 embedded processors-iAnkit Shah
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processingKamal Acharya
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csaAnjaan Gajendra
 
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...IDES Editor
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionDilum Bandara
 

Ähnlich wie Assembly p1 (20)

Pipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdfPipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdf
 
Pipelining 16 computers Artitacher pdf
Pipelining   16 computers Artitacher  pdfPipelining   16 computers Artitacher  pdf
Pipelining 16 computers Artitacher pdf
 
Pipelining in Computer System Achitecture
Pipelining in Computer System AchitecturePipelining in Computer System Achitecture
Pipelining in Computer System Achitecture
 
A survey of paradigms for building and
A survey of paradigms for building andA survey of paradigms for building and
A survey of paradigms for building and
 
Advanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILPAdvanced Techniques for Exploiting ILP
Advanced Techniques for Exploiting ILP
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
 
Reconfigurable computing
Reconfigurable computingReconfigurable computing
Reconfigurable computing
 
Instruction pipelining
Instruction pipeliningInstruction pipelining
Instruction pipelining
 
03. top level view of computer function & interconnection
03. top level view of computer function & interconnection03. top level view of computer function & interconnection
03. top level view of computer function & interconnection
 
Ch2 embedded processors-i
Ch2 embedded processors-iCh2 embedded processors-i
Ch2 embedded processors-i
 
pipelining
pipeliningpipelining
pipelining
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
 
Bc0040
Bc0040Bc0040
Bc0040
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
 
Unit 4 COA.pptx
Unit 4 COA.pptxUnit 4 COA.pptx
Unit 4 COA.pptx
 
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...
Implementing True Zero Cycle Branching in Scalar and Superscalar Pipelined Pr...
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
Oversimplified CA
Oversimplified CAOversimplified CA
Oversimplified CA
 

Kürzlich hochgeladen

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 

Kürzlich hochgeladen (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 

Assembly p1

  • 1.
  • 2.  A technique used in advanced microprocessors where the microprocessor begins executing a second instruction before the first has been completed. - A Pipeline is a series of stages, where some work is done at each stage. The work is not finished until it has passed through all stages.  With pipelining, the computer architecture allows the next instructions to be fetched while the processor is performing arithmetic operations, holding them in a buffer close to the processor until each instruction operation can performed.
  • 3.  The pipeline is divided into segments and each segment can execute it operation concurrently with the other segments. Once a segment completes an operations, it passes the result to the next segment in the pipeline and fetches the next operations from the preceding segment.
  • 5. Instructions Fetch  The instruction Fetch (IF) stage is responsible for obtaining the requested instruction from memory. The instruction and the program counter (which is incremented to the next instruction) are stored in the IF/ID pipeline register as temporary storage so that may be used in the next stage at the start of the next clock cycle.
  • 6. Instruction Decode  The Instruction Decode (ID) stage is responsible for decoding the instruction and sending out the various control lines to the other parts of the processor. The instruction is sent to the control unit where it is decoded and the registers are fetched from the register file.
  • 7. Execution  The Execution (EX) stage is where any calculations are performed. The main component in this stage is the ALU. The ALU is made up of arithmetic, logic and capabilities.
  • 8. Memory and IO  The Memory and IO (MEM) stage is responsible for storing and loading values to and from memory. It also responsible for input or output from the processor. If the current instruction is not of Memory or IO type than the result from the ALU is passed through to the write back stage.
  • 9. Write Back  The Write Back (WB) stage is responsible for writing the result of a calculation, memory access or input into the register file.
  • 10. Decode Instruction and Calculate Effective Address Fetch Instruction From Memory Branch ? Update PC Empty Pipe Interrupt Handling Fetch Operand From memory Execute Instruction Interrupt YES NO YES NO
  • 11. INTRODUCTION Pipelining is technique of decomposing a sequential process into suboperation, with each subprocess being executed in a special dedicated segment that operates concurrently with all other segments. The name “pipeline” implies a flows of information analogous to an industrial assembly line.
  • 12. The name “pipeline” implies a flow of information analogous to an industrial assembly line. It is characteristic of pipelines that several computation can be in progress in distinct at the same time. Each subtask can be processed independently on a different machine. The pipelining design provides a way to start a new task before an old one has been completed.
  • 13. F 1 E 1 F 2 E 2 F 3 E 3 I1 I2 I3 (a) Sequential execution Instruction fetch unit Exelution unit Interstage buffer B1 (b) Hardware organization Time F1 E1 F2 E2 F3 E3 I1 I2 I3 Instruction (c) Pipelined execution Clock cycle 1 2 3 4 Time Fetch + Execution
  • 14.  pipelining processing:  Perform arithmetic operation (Ai*Bi)+(Ci*Di) with a stream of number. A specify pipeline configuration to carry out the task. Register in the pipeline for i=1 through 6. It consist of seven registers that receive new data with every clock pulse ,two multipliers and one adder circuits .
  • 15. R1 R2 R3 R4 MULTIPLIER MULTIPLIER R5 R6 ADDER R7 Stage 1 Stage 2 Stage 3 Ai Bi Ci Di
  • 16.  The performance gain from using pipelining occurs because we can start the execution of a new instruction each clock cycle. In a real implementation this is not always possible.  Another important note is that in a pipelined processor, a particular instruction still takes at least as long to execute as non-pipelined.  Pipeline hazards prevent the execution of the next instruction during the appropriate clock cycle.
  • 17.  There are three types of hazards in a pipeline, they are as follows:  Structural Hazards: are created when the data path hardware in the pipeline cannot support all of the overlapped instructions in the pipeline.  Data Hazards: When there is an instruction in the pipeline that affects the result of another instruction in the pipeline.  Control Hazards: The PC causes these due to the pipelining of branches and other instructions that change the PC.
  • 18.  Structural hazards result from the CPU data path not having resources to service all the required overlapping resources.  Suppose a processor can only read and write from the registers in one clock cycle. This would cause a problem during the ID and WB stages.  Assume that there are not separate instruction and data caches, and only one memory access can occur during one clock cycle. A hazard would be caused during the IF and MEM cycles.
  • 19.
  • 20.  A structural hazard is dealt with by inserting a stall or pipeline bubble into the pipeline. This means that for that clock cycle, nothing happens for that instruction. This effectively “slides” that instruction, and subsequent instructions, by one clock cycle.  This effectively increases the average CPI.  EX: Assume that you need to compare two processors, one with a structural hazard that occurs 40% for the time, causing a stall. Assume that the processor with the hazard has a clock rate 1.05 times faster than the processor without the hazard. How fast is the processor with the hazard compared to the one without the hazard?
  • 21.  We can see that even though the clock speed of the processor with the hazard is a little faster, the speedup is still less than 1.  Therefore the hazard has quite an effect on the performance.  Sometimes computer architects will opt to design a processor that exhibits a structural hazard. Why? • .
  • 22.  We haven’t looked at assembly programming in detail at this point.  Consider the following operations: DADD R1, R2, R3 DSUB R4, R1, R5 AND R6, R1, R7 OR R8, R1, R9 XOR R10, R1, R11
  • 24.  In this trivial example, we cannot expect the programmer to reorder his/her operations. Assuming this is the only code we want to execute.  Data forwarding can be used to solve this problem.  To implement data forwarding we need to bypass the pipeline register flow:  instruction depends on the write of a previous instruction.
  • 25.
  • 26.  It is easy to see how data forwarding can be used by drawing out the pipelined execution of each instruction.  Now consider the following instructions: DADD R1, R2, R3 LD R4, O(R1) SD R4, 12(R1)
  • 27.
  • 28. ENGR9861 Winter 2007 RV  Can data forwarding prevent all data hazards?  NO!  The following operations will still cause a data hazard. This happens because the further down the pipeline we get, the less we can use forwarding. LD R1, O(R2) DSUB R4, R1, R5 AND R6, R1, R7 OR R8, R1, R9
  • 29.
  • 30.  We can avoid the hazard by using a pipeline interlock.  The pipeline interlock will detect when data forwarding will not be able to get the data to the next instruction in time.  A stall is introduced until the instruction can get the appropriate data from the previous instruction.
  • 31. ENGR9861 Winter 2007 RV  Control hazards are caused by branches in the code.  During the IF stage remember that the PC is incremented by 4 in preparation for the next IF cycle of the next instruction.  What happens if there is a branch performed and we aren’t simply incrementing the PC by 4.  The easiest way to deal with the occurrence of a branch is to perform the IF stage again once the branch occurs.
  • 32.  These following solutions assume that we are dealing with static branches. Meaning that the actions taken during a branch do not change.  We already saw the first example, we stall the pipeline until the branch is resolved (in our case we repeated the IF stage until the branch resolved and modified the PC)  The next two examples will always make an assumption about the branch instruction.
  • 33. ENGR9861 Winter 2007 RV  What if we treat every branch as “not taken” remember that not only do we read the registers during ID, but we also perform an equality test in case we need to branch or not.  We can improve performance by assuming that the branch will not be taken.  What in this case we can simply load in the next instruction (PC+4) can continue. The complexity arises when the branch evaluates and we end up needing to actually take the branch.
  • 34. ENGR9861 Winter 2007 RV  The “branch-not taken” scheme is the same as performing the IF stage a second time in our 5 stage pipeline if the branch is taken.  If not there is no performance degradation.  The “branch taken” scheme is no benefit in our case because we evaluate the branch target address in the ID stage.  The fourth method for dealing with a control hazard is to implement a “delayed” branch scheme.  In this scheme an instruction is inserted into the pipeline that is useful and not dependent on whether the branch is taken or not. It is the job of the compiler to determine the delayed branch instruction.
  • 35.  Sometimes operations require more than one clock cycle to complete. Examples are:  Floating Point Multiply  Floating Point Divide  Floating Point Add  We can assume that there is hardware available on the processor for performing the operations.  Assume that the FP Mul and Add are fully pipelined, and the divide is un-pipelined.
  • 36.  The multiplier and the divider are fully pipelined. The divider is not pipelined at all.  Take a look at figure A.34 for a good example of how pipelining will function in the case of longer instruction execution. The author assumes a single floating point register port.  Structural hazards are avoided in the ID stage by assigning a memory bit in a shift register. Incoming instructions can then check to see if they should stall.
  • 37. ENGR9861 Winter 2007 RV  Data Dependence:  Instruction i produces a result the instruction j will use or instruction i is data dependent on instruction j and vice versa.  Name Dependence:  Occurs when two instructions use the same register and memory location. But there is no flow of data between the instructions. Instruction order must be preserved.
  • 38. ENGR9861 Winter 2007 RV  Types of data hazards:  RAW: read after write  WAW: write after write  WAR: write after read  We have already seen a RAW hazard. WAW hazards occur due to output dependence.  WAR hazards do not usually occur because of the amount of time between the read cycle and write cycle in a pipeline.
  • 39. 39 Read After Write (RAW) InstrJ tries to read operand before InstrI writes it • Caused by a “Dependence” (in compiler nomenclature). This hazard results from an actual need for communication. Execution Order is: InstrI InstrJ I: add r1,r2,r3 J: sub r4,r1,r3
  • 40. Write After Read (WAR) InstrJ tries to write operand before InstrI reads i – Gets wrong operand – Called an “anti-dependence” by compiler writers. This results from reuse of the name “r1”. • Can’t happen in MIPS 5 stage pipeline because: – All instructions take 5 stages, and – Reads are always in stage 2, and – Writes are always in stage 5 Execution Order is: InstrI InstrJ I: sub r4,r1,r3 J: add r1,r2,r3 K: mul r6,r1,r7
  • 41. Write After Write (WAW) InstrJ tries to write operand before InstrI writes it – Leaves wrong result ( InstrI not InstrJ ) • Called an “output dependence” by compiler writers This also results from the reuse of name “r1”. • Can’t happen in MIPS 5 stage pipeline because: – All instructions take 5 stages, and – Writes are always in stage 5 • Will see WAR and WAW in later more complicated pipes Execution Order is: InstrI InstrJ I: sub r1,r4,r3 J: add r1,r2,r3 K: mul r6,r1,r7