ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
CA UNIT III.pptx
UNIT III
A Basic MIPS implementation – Building a
Datapath – Control Implementation Scheme –
Pipelining – Pipelined datapath and control –
Handling Data Hazards & Control Hazards –
Exceptions.
Basic MIPS Implementation
• MIPS - Million Instructions Per Second
• Instruction set is divided into three classes:
1. Memory-reference – load word (lw) and store
word (sw)
2. Arithmetic-logical – add, sub, AND, OR
3. Branch instruction – branch equal (beq) and
jump (j)
MIPS Instruction Execution :
MIPS instructions classically take five steps:
ï‚ž Fetch instruction from memory
ï‚ž Read registers while decoding the instruction.
The format of MIPS instructions allows reading
and decoding to occur simultaneously
ï‚ž Execute the operation or calculate an address
ï‚ž Access an operand in data memory
ï‚ž Write the result into a register
CA UNIT III.pptx
dfgdfg
Basic implementation
of MIPS with control
signals
Building a Datapath
ï‚ž Elements that process data and addresses in
the CPU - Memories, registers, Program
Counter(PC), ALUs, adders.
Datapath for different instructions:
ï‚ž Datapath for arithmetic-logic instructions
ï‚ž Datapath for Load and Store word instructions
ï‚ž Datapath for Branch instructions
ï‚ž Creating a Single Datapath
1. Datapath for arithmetic-logic
instructions
• R-type instructions set. Eg. sub $s1, $s3, $s2
2. Datapath for Load and Store
word instructions
• Load or store instruction set. Eg. Sw $s1, -50
3. Datapath for Branch instructions
• Conditional statement. Eg. beq $s1, $s2, 25
4. Creating a Single Datapath
• To execute a instructions at least one clock
cycle is required.
Control implementation Scheme
• Designing the main control unit
• The ALU control
• Operation of the Datapath
• Datapath for an R-type instruction
• Datapath for Load word instruction
• Datapath for Branch-on-equal instruction
The ALU control
0110
0111
ï‚ž ALU control inputs based on the 2 bits ALUOp
control and the 6 bits function code.
Designing the main control unit
Datapath with all necessary multiplexers
and all control unit
Operation of the Datapath
Datapath for Load word instruction
Pipeline
• Pipelining is an implementation technique in
which multiple instructions are overlapped in
execution. Used to increase the speed and
performance of the processor.
• Two stage methods available for pipeline:
1. Four stage
2. Six Stage
1.Four stage
2. Six stage
2. Six stage
Pipeline Stages in the MIPS
1. Fetch instruction
2. Decode and read register simultaneously
3. Execute the operation
4. Access an operand in data memory
5. Write result to register/memory
Pipeline Hazards
• A hazards is a condition that prevents an
instruction in the pipeline from executing its next
scheduled pipeline stage.
• Any reason that cause the pipeline to stall is called
a hazard.
Types of hazards:
1. Structural hazards
When two instructions require the use of a given
hardware resource at the same time.
2. Data hazards
Instructions depends on result of prior computation
which is not ready (computed or stored) yet.
3. Control hazards
Arise from the pipelining of branches and other
instructions that change the PC.
Unconditional branching:
Branch Penalty:
Time lost due to branch instruction is
known as branch penalty.
Factor effecting branch penalty:
It is more for complex instructions
For a longer pipeline, branch penalty is
more.
Pipeline Performance
• Clock cycle – time period for the clock cycle it
is necessary to consider stage delay and
interstage delay.
Time 
(cycle)
Pipeline Performance
Total time required is, Tm = [m + (n-1)]t
Speedup factor: non-pipelined processor is
defined as,
Sm = (nm / m +(n-1) )
Where, n = segment/stages
M = no. of ins
Pipeline Performance
Efficiency: The ratio of speedup factor and the
number of stages in the pipeline.
Em = n / m+(n-1)
Performance/Cost Ratio (PCR): Total cost of
pipeline is estimated by c + mh, where
PCR = 1 / ((t/ m+d)(c+mh)
Pipeline Datapath and control
Pipeline processor consists of a sequence of data
processing circuits, called elements, stages or
segments
Each stage consists of two major blocks:
ï‚žMultiword input register
ï‚žDatapath circuit
R 1 C1 R2 C2 R3 C3……Rm Cm
CONTROL UNIT
Data
in
Data
out
• Implementation of Two stage instruction
pipelining
Breaks a single instruction into two parts:
1. A fetch stage s1
2. An execute stage s2
4 stage Instruction pipelining with
CPU
• CPU is directly connected to cache memory
and it is represented as I-cache and D-cache.
• This permits both instruction and memory data
to be accessed with same clock cycle.
1. IF: instruction fetch and decode using I
cache.(S1)
2. OL: operand loading from D-cache to register
file.(S2)
3. EX: data processing using the ALU and
register file.(S3)
4. OS: operand storing to the D-cache from
register file.(S4)
CA UNIT III.pptx
Implementation of MIPS
instruction pipeline
• Five stage pipeline
1. IF : Instruction Fetch S1
2. ID : Instruction Decode S2
3. EX : Execution S3
4. MEM : Data memory access S4
5. WB : Write Back S5
Implementation of MIPS instruction
pipeline
Pipeline Control
• Signle-cycle datapath. The datapath uses the
control logic for PC source, register destination
number and ALU control.
ï‚ž Control Lines into 5 groups.
1. Instruction Fetch: Control signals to read
instruction and write PC
2. Instruction decode/register file read: control is
not required to this pipeline
3. Execution/address calculation: Control signals
are Regdst, ALUop or src.
4. Memory access: Signals are Branch,Memread
and Memwrite.
5. Write-back : Mem to reg and RegWrite
CA UNIT III.pptx
Handling data hazards
Operand forwarding
• A simple h/w techniques which can handle
data hazard is called Operand Forwarding or
register by passing.
• ALU results are fed back as ALU i/ps.
• The forwarding logic detects the previous ALU
operation has the operand for current
instruction, it forwards ALU o/p instead of
register file.
• Ex: add $s1,$s2,$s3
mul $s4,$s1,$s5
 mul $s4, o/p of s2+s3,$s5
Operand forwarding
Modified datapath in MIPS
implementation
Handling data hazards in software
• S/W detects the data dependencies.
• Necessary delay b/w 2 instructions by inserting NOP
(no-operation) instructions as follows:
I1 : MUL R2, R3, R4
NOP
NOP
ADD R4, R5, R6
Disadvantages of adding NOP instructions:
• It leads to larger code size.
• It has several H/W implementation.
Side Effects
• When destination register of the current instruction
is the source register of the next instruction there is
a data dependency. It is explicit and it is identified
by register name.
• The addition of these 2 numbers may be
accomplished as follows:
ADD R1,R3
ADD with carry R2, R4
R2<- [R2]+[R4]+Carry
Handling Control Hazards
Instruction queue and prefetching
• Fetch unit fetches and stores instruction queue.
• A separate unit called Dispatch unit.
• If instruction queue failed to give the instruction to
dispatch unit, fetch instruction automatically
transfer the instruction for decoding.
• Fetch unit always keep the queue full.
Instruction queue and prefetching
Instruction queue and prefetching
Instruction queue during branch instruction
Instruction queue and prefetching
Branch Folding
• Fetch unit executes branch instruction
concurrently with the execution of other
instruction is known as branch folding.
• Branch folding occurs only if there exists at least
one instruction in the queue other than the branch
instruction.
Approaches to Deal
• The conditional branching is a major factor that
affects the performance of instruction pipelining.
1. Multiple streams
2. Prefetch branch target
3. Loop buffer
4. Branch prediction
1.Multiple streams
- Two stream to Store fetched instruction.
2.Prefetch branch target
- Prefetched the target instruction if its recognized
3.Loop buffer
- Small/Temporary memory to store recently
prefetched instructions
4. Branch prediction
- To check whether a branch will be valid or not valid.
These techniques reduce the branch penalty.
Techniques:
•predict never taken,
•predict always taken,
•predict by opcode,
•taken and not taken switch,
•branch history table
Branch prediction strategies
Static branch strategy: branch can be predicted
based on branch code type.
Dynamic branch strategy : uses recent branch
history during the program execution to predict
whether branch should be taken when next time
occurs.
Branch prediction strategies
The recent branch information includes branch
prediction statistics such as:
T – Taken
N – Not taken
NN - Last two branches not taken
NT - Not branch taken and previous taken
TT - Both last two branch taken
TN - Last branch taken and Previous not taken
Branch target buffer
• The recent branch
information is stored in
the buffer called BTB.
• Stores branch
information for
prediction
A typical state diagram used in dynamic
branch prediction
Exception
• One of the difficult parts of control is to
implement exceptions and interrupts-
events other than branches or jumps.
Handling exceptions in the MIPS
Architecture
Types of Exception:
1. Execution of an undefined instruction
2. Arithmetic overflow in the instruction add
$1,$2,$2.
Methods to communicate
exceptions
1. Status register method
The MIPS architecture uses a status
register, which holds a field that indicates
the reason for the exception.
2. Vectored interrupts method
Vector interrupts are used. The address to
which control is transferred is determined
by the cause of the exception.
Exception in a pipelined
Implementation
ï‚ž Multiple exception can occur in a single
clock cycle.
1. Imprecise Interrupts or Imprecise
exception
2. Precise Interrupts or precise exception

More Related Content

Similar to CA UNIT III.pptx (20)

Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architecture
ishapadhy
Ìý
CMPN301-Pipelining_V2.pptx
CMPN301-Pipelining_V2.pptxCMPN301-Pipelining_V2.pptx
CMPN301-Pipelining_V2.pptx
NadaAAmin
Ìý
Pipelining in Computer System Achitecture
Pipelining in Computer System AchitecturePipelining in Computer System Achitecture
Pipelining in Computer System Achitecture
YashiUpadhyay3
Ìý
Basic MIPS implementation
Basic MIPS implementationBasic MIPS implementation
Basic MIPS implementation
kavitha2009
Ìý
Basic MIPS implementation
Basic MIPS implementationBasic MIPS implementation
Basic MIPS implementation
kavitha2009
Ìý
Digital-Unit-III.ppt
Digital-Unit-III.pptDigital-Unit-III.ppt
Digital-Unit-III.ppt
VijayalakshmiV16
Ìý
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
turki_09
Ìý
COA Unit-5.pptx
COA Unit-5.pptxCOA Unit-5.pptx
COA Unit-5.pptx
Bharti189559
Ìý
dspa details
dspa detailsdspa details
dspa details
pankajrangaree2
Ìý
CAO_lecutre4 Processor basics (1) (1)smmsnsm
CAO_lecutre4 Processor basics (1) (1)smmsnsmCAO_lecutre4 Processor basics (1) (1)smmsnsm
CAO_lecutre4 Processor basics (1) (1)smmsnsm
2kawserahmed7
Ìý
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
ssuser87fa0c1
Ìý
Computer Organozation
Computer OrganozationComputer Organozation
Computer Organozation
Aabha Tiwari
Ìý
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
Kamal Acharya
Ìý
Computer organisation and architecture .
Computer organisation and architecture .Computer organisation and architecture .
Computer organisation and architecture .
MalligaarjunanN
Ìý
computer architecture module3 notes module
computer architecture module3 notes modulecomputer architecture module3 notes module
computer architecture module3 notes module
thirugnanasambandham4
Ìý
Unit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptxUnit - 5 Pipelining.pptx
Unit - 5 Pipelining.pptx
Medicaps University
Ìý
CALecture3Module1.ppt
CALecture3Module1.pptCALecture3Module1.ppt
CALecture3Module1.ppt
BeeMUcz
Ìý
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
SOLOMONCHINAEMEUCHEA
Ìý
Advanced Pipelining in ARM Processors.pptx
Advanced Pipelining  in ARM Processors.pptxAdvanced Pipelining  in ARM Processors.pptx
Advanced Pipelining in ARM Processors.pptx
JoyChowdhury30
Ìý
CO Module 5
CO Module 5CO Module 5
CO Module 5
Alan Leewllyn Bivera
Ìý
Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architecture
ishapadhy
Ìý
CMPN301-Pipelining_V2.pptx
CMPN301-Pipelining_V2.pptxCMPN301-Pipelining_V2.pptx
CMPN301-Pipelining_V2.pptx
NadaAAmin
Ìý
Pipelining in Computer System Achitecture
Pipelining in Computer System AchitecturePipelining in Computer System Achitecture
Pipelining in Computer System Achitecture
YashiUpadhyay3
Ìý
Basic MIPS implementation
Basic MIPS implementationBasic MIPS implementation
Basic MIPS implementation
kavitha2009
Ìý
Basic MIPS implementation
Basic MIPS implementationBasic MIPS implementation
Basic MIPS implementation
kavitha2009
Ìý
Digital-Unit-III.ppt
Digital-Unit-III.pptDigital-Unit-III.ppt
Digital-Unit-III.ppt
VijayalakshmiV16
Ìý
Topic2a ss pipelines
Topic2a ss pipelinesTopic2a ss pipelines
Topic2a ss pipelines
turki_09
Ìý
COA Unit-5.pptx
COA Unit-5.pptxCOA Unit-5.pptx
COA Unit-5.pptx
Bharti189559
Ìý
CAO_lecutre4 Processor basics (1) (1)smmsnsm
CAO_lecutre4 Processor basics (1) (1)smmsnsmCAO_lecutre4 Processor basics (1) (1)smmsnsm
CAO_lecutre4 Processor basics (1) (1)smmsnsm
2kawserahmed7
Ìý
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
ssuser87fa0c1
Ìý
Computer Organozation
Computer OrganozationComputer Organozation
Computer Organozation
Aabha Tiwari
Ìý
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
Kamal Acharya
Ìý
Computer organisation and architecture .
Computer organisation and architecture .Computer organisation and architecture .
Computer organisation and architecture .
MalligaarjunanN
Ìý
computer architecture module3 notes module
computer architecture module3 notes modulecomputer architecture module3 notes module
computer architecture module3 notes module
thirugnanasambandham4
Ìý
CALecture3Module1.ppt
CALecture3Module1.pptCALecture3Module1.ppt
CALecture3Module1.ppt
BeeMUcz
Ìý
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
HHCJ AMUMARA:COMPUTER STUDIES LECTURE NOTE FOR SS3:005
SOLOMONCHINAEMEUCHEA
Ìý
Advanced Pipelining in ARM Processors.pptx
Advanced Pipelining  in ARM Processors.pptxAdvanced Pipelining  in ARM Processors.pptx
Advanced Pipelining in ARM Processors.pptx
JoyChowdhury30
Ìý

More from ssuser9dbd7e (6)

UHV PPT.doc
UHV PPT.docUHV PPT.doc
UHV PPT.doc
ssuser9dbd7e
Ìý
CA UNIT V..pptx
CA UNIT V..pptxCA UNIT V..pptx
CA UNIT V..pptx
ssuser9dbd7e
Ìý
CA UNIT IV.pptx
CA UNIT IV.pptxCA UNIT IV.pptx
CA UNIT IV.pptx
ssuser9dbd7e
Ìý
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
ssuser9dbd7e
Ìý
CA UNIT I.pptx
CA UNIT I.pptxCA UNIT I.pptx
CA UNIT I.pptx
ssuser9dbd7e
Ìý
CN PPT.docx
CN PPT.docxCN PPT.docx
CN PPT.docx
ssuser9dbd7e
Ìý
CA UNIT V..pptx
CA UNIT V..pptxCA UNIT V..pptx
CA UNIT V..pptx
ssuser9dbd7e
Ìý
CA UNIT IV.pptx
CA UNIT IV.pptxCA UNIT IV.pptx
CA UNIT IV.pptx
ssuser9dbd7e
Ìý
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
ssuser9dbd7e
Ìý
CA UNIT I.pptx
CA UNIT I.pptxCA UNIT I.pptx
CA UNIT I.pptx
ssuser9dbd7e
Ìý

Recently uploaded (20)

Mathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptxMathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptx
ppkmurthy2006
Ìý
Piping-and-pipeline-calculations-manual.pdf
Piping-and-pipeline-calculations-manual.pdfPiping-and-pipeline-calculations-manual.pdf
Piping-and-pipeline-calculations-manual.pdf
OMI0721
Ìý
Industrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products ProfileIndustrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products Profile
zebcoeng
Ìý
Indian Soil Classification System in Geotechnical Engineering
Indian Soil Classification System in Geotechnical EngineeringIndian Soil Classification System in Geotechnical Engineering
Indian Soil Classification System in Geotechnical Engineering
Rajani Vyawahare
Ìý
Power Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.pptPower Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.ppt
Aniket_1415
Ìý
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptxGROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
meneememoo
Ìý
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Ìý
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
sreenath seenu
Ìý
Equipment for Gas Metal Arc Welding Process
Equipment for Gas Metal Arc Welding ProcessEquipment for Gas Metal Arc Welding Process
Equipment for Gas Metal Arc Welding Process
AhmadKamil87
Ìý
eng funda notes.pdfddddddddddddddddddddddd
eng funda notes.pdfdddddddddddddddddddddddeng funda notes.pdfddddddddddddddddddddddd
eng funda notes.pdfddddddddddddddddddddddd
aayushkumarsinghec22
Ìý
GM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptxGM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptx
crdslalcomumbai
Ìý
CONTRACTOR ALL RISK INSURANCESAR (1).ppt
CONTRACTOR ALL RISK INSURANCESAR (1).pptCONTRACTOR ALL RISK INSURANCESAR (1).ppt
CONTRACTOR ALL RISK INSURANCESAR (1).ppt
suaktonny
Ìý
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
Ìý
Lecture -3 Cold water supply system.pptx
Lecture -3 Cold water supply system.pptxLecture -3 Cold water supply system.pptx
Lecture -3 Cold water supply system.pptx
rabiaatif2
Ìý
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptxUNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
KesavanT10
Ìý
Embedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.pptEmbedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.ppt
23ucc580
Ìý
Engineering at Lovely Professional University (LPU).pdf
Engineering at Lovely Professional University (LPU).pdfEngineering at Lovely Professional University (LPU).pdf
Engineering at Lovely Professional University (LPU).pdf
Sona
Ìý
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVName.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
MerijimArsedelPalmad1
Ìý
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Ìý
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
ssuserd9338b
Ìý
Mathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptxMathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptx
ppkmurthy2006
Ìý
Piping-and-pipeline-calculations-manual.pdf
Piping-and-pipeline-calculations-manual.pdfPiping-and-pipeline-calculations-manual.pdf
Piping-and-pipeline-calculations-manual.pdf
OMI0721
Ìý
Industrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products ProfileIndustrial Valves, Instruments Products Profile
Industrial Valves, Instruments Products Profile
zebcoeng
Ìý
Indian Soil Classification System in Geotechnical Engineering
Indian Soil Classification System in Geotechnical EngineeringIndian Soil Classification System in Geotechnical Engineering
Indian Soil Classification System in Geotechnical Engineering
Rajani Vyawahare
Ìý
Power Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.pptPower Point Presentation for Electrical Engineering 3-phase.ppt
Power Point Presentation for Electrical Engineering 3-phase.ppt
Aniket_1415
Ìý
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptxGROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
GROUP-3-GRID-CODE-AND-DISTRIBUTION-CODE.pptx
meneememoo
Ìý
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Ìý
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
sreenath seenu
Ìý
Equipment for Gas Metal Arc Welding Process
Equipment for Gas Metal Arc Welding ProcessEquipment for Gas Metal Arc Welding Process
Equipment for Gas Metal Arc Welding Process
AhmadKamil87
Ìý
eng funda notes.pdfddddddddddddddddddddddd
eng funda notes.pdfdddddddddddddddddddddddeng funda notes.pdfddddddddddddddddddddddd
eng funda notes.pdfddddddddddddddddddddddd
aayushkumarsinghec22
Ìý
GM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptxGM Meeting 070225 TO 130225 for 2024.pptx
GM Meeting 070225 TO 130225 for 2024.pptx
crdslalcomumbai
Ìý
CONTRACTOR ALL RISK INSURANCESAR (1).ppt
CONTRACTOR ALL RISK INSURANCESAR (1).pptCONTRACTOR ALL RISK INSURANCESAR (1).ppt
CONTRACTOR ALL RISK INSURANCESAR (1).ppt
suaktonny
Ìý
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
Ìý
Lecture -3 Cold water supply system.pptx
Lecture -3 Cold water supply system.pptxLecture -3 Cold water supply system.pptx
Lecture -3 Cold water supply system.pptx
rabiaatif2
Ìý
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptxUNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
UNIT 1FUNDAMENTALS OF OPERATING SYSTEMS.pptx
KesavanT10
Ìý
Embedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.pptEmbedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.ppt
23ucc580
Ìý
Engineering at Lovely Professional University (LPU).pdf
Engineering at Lovely Professional University (LPU).pdfEngineering at Lovely Professional University (LPU).pdf
Engineering at Lovely Professional University (LPU).pdf
Sona
Ìý
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVName.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Name.docxVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
MerijimArsedelPalmad1
Ìý
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Ìý
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
IPC-9716_2024 Requirements for Automated Optical Inspection (AOI) Process Con...
ssuserd9338b
Ìý

CA UNIT III.pptx

  • 2. UNIT III A Basic MIPS implementation – Building a Datapath – Control Implementation Scheme – Pipelining – Pipelined datapath and control – Handling Data Hazards & Control Hazards – Exceptions.
  • 3. Basic MIPS Implementation • MIPS - Million Instructions Per Second • Instruction set is divided into three classes: 1. Memory-reference – load word (lw) and store word (sw) 2. Arithmetic-logical – add, sub, AND, OR 3. Branch instruction – branch equal (beq) and jump (j)
  • 4. MIPS Instruction Execution : MIPS instructions classically take five steps: ï‚ž Fetch instruction from memory ï‚ž Read registers while decoding the instruction. The format of MIPS instructions allows reading and decoding to occur simultaneously ï‚ž Execute the operation or calculate an address ï‚ž Access an operand in data memory ï‚ž Write the result into a register
  • 6. dfgdfg Basic implementation of MIPS with control signals
  • 7. Building a Datapath ï‚ž Elements that process data and addresses in the CPU - Memories, registers, Program Counter(PC), ALUs, adders.
  • 8. Datapath for different instructions: ï‚ž Datapath for arithmetic-logic instructions ï‚ž Datapath for Load and Store word instructions ï‚ž Datapath for Branch instructions ï‚ž Creating a Single Datapath
  • 9. 1. Datapath for arithmetic-logic instructions • R-type instructions set. Eg. sub $s1, $s3, $s2
  • 10. 2. Datapath for Load and Store word instructions • Load or store instruction set. Eg. Sw $s1, -50
  • 11. 3. Datapath for Branch instructions • Conditional statement. Eg. beq $s1, $s2, 25
  • 12. 4. Creating a Single Datapath • To execute a instructions at least one clock cycle is required.
  • 13. Control implementation Scheme • Designing the main control unit • The ALU control • Operation of the Datapath • Datapath for an R-type instruction • Datapath for Load word instruction • Datapath for Branch-on-equal instruction
  • 15. ï‚ž ALU control inputs based on the 2 bits ALUOp control and the 6 bits function code.
  • 16. Designing the main control unit
  • 17. Datapath with all necessary multiplexers and all control unit
  • 18. Operation of the Datapath
  • 19. Datapath for Load word instruction
  • 20. Pipeline • Pipelining is an implementation technique in which multiple instructions are overlapped in execution. Used to increase the speed and performance of the processor. • Two stage methods available for pipeline: 1. Four stage 2. Six Stage
  • 24. Pipeline Stages in the MIPS 1. Fetch instruction 2. Decode and read register simultaneously 3. Execute the operation 4. Access an operand in data memory 5. Write result to register/memory
  • 25. Pipeline Hazards • A hazards is a condition that prevents an instruction in the pipeline from executing its next scheduled pipeline stage. • Any reason that cause the pipeline to stall is called a hazard. Types of hazards: 1. Structural hazards When two instructions require the use of a given hardware resource at the same time. 2. Data hazards Instructions depends on result of prior computation which is not ready (computed or stored) yet.
  • 26. 3. Control hazards Arise from the pipelining of branches and other instructions that change the PC. Unconditional branching:
  • 27. Branch Penalty: Time lost due to branch instruction is known as branch penalty. Factor effecting branch penalty: It is more for complex instructions For a longer pipeline, branch penalty is more.
  • 28. Pipeline Performance • Clock cycle – time period for the clock cycle it is necessary to consider stage delay and interstage delay. Time  (cycle)
  • 29. Pipeline Performance Total time required is, Tm = [m + (n-1)]t Speedup factor: non-pipelined processor is defined as, Sm = (nm / m +(n-1) ) Where, n = segment/stages M = no. of ins
  • 30. Pipeline Performance Efficiency: The ratio of speedup factor and the number of stages in the pipeline. Em = n / m+(n-1) Performance/Cost Ratio (PCR): Total cost of pipeline is estimated by c + mh, where PCR = 1 / ((t/ m+d)(c+mh)
  • 31. Pipeline Datapath and control Pipeline processor consists of a sequence of data processing circuits, called elements, stages or segments Each stage consists of two major blocks: ï‚žMultiword input register ï‚žDatapath circuit R 1 C1 R2 C2 R3 C3……Rm Cm CONTROL UNIT Data in Data out
  • 32. • Implementation of Two stage instruction pipelining Breaks a single instruction into two parts: 1. A fetch stage s1 2. An execute stage s2
  • 33. 4 stage Instruction pipelining with CPU • CPU is directly connected to cache memory and it is represented as I-cache and D-cache. • This permits both instruction and memory data to be accessed with same clock cycle. 1. IF: instruction fetch and decode using I cache.(S1) 2. OL: operand loading from D-cache to register file.(S2) 3. EX: data processing using the ALU and register file.(S3) 4. OS: operand storing to the D-cache from register file.(S4)
  • 35. Implementation of MIPS instruction pipeline • Five stage pipeline 1. IF : Instruction Fetch S1 2. ID : Instruction Decode S2 3. EX : Execution S3 4. MEM : Data memory access S4 5. WB : Write Back S5
  • 36. Implementation of MIPS instruction pipeline
  • 37. Pipeline Control • Signle-cycle datapath. The datapath uses the control logic for PC source, register destination number and ALU control. ï‚ž Control Lines into 5 groups. 1. Instruction Fetch: Control signals to read instruction and write PC 2. Instruction decode/register file read: control is not required to this pipeline 3. Execution/address calculation: Control signals are Regdst, ALUop or src. 4. Memory access: Signals are Branch,Memread and Memwrite. 5. Write-back : Mem to reg and RegWrite
  • 39. Handling data hazards Operand forwarding • A simple h/w techniques which can handle data hazard is called Operand Forwarding or register by passing. • ALU results are fed back as ALU i/ps. • The forwarding logic detects the previous ALU operation has the operand for current instruction, it forwards ALU o/p instead of register file. • Ex: add $s1,$s2,$s3 mul $s4,$s1,$s5  mul $s4, o/p of s2+s3,$s5
  • 41. Modified datapath in MIPS implementation
  • 42. Handling data hazards in software • S/W detects the data dependencies. • Necessary delay b/w 2 instructions by inserting NOP (no-operation) instructions as follows: I1 : MUL R2, R3, R4 NOP NOP ADD R4, R5, R6 Disadvantages of adding NOP instructions: • It leads to larger code size. • It has several H/W implementation.
  • 43. Side Effects • When destination register of the current instruction is the source register of the next instruction there is a data dependency. It is explicit and it is identified by register name. • The addition of these 2 numbers may be accomplished as follows: ADD R1,R3 ADD with carry R2, R4 R2<- [R2]+[R4]+Carry
  • 44. Handling Control Hazards Instruction queue and prefetching • Fetch unit fetches and stores instruction queue. • A separate unit called Dispatch unit. • If instruction queue failed to give the instruction to dispatch unit, fetch instruction automatically transfer the instruction for decoding. • Fetch unit always keep the queue full.
  • 45. Instruction queue and prefetching
  • 46. Instruction queue and prefetching Instruction queue during branch instruction
  • 47. Instruction queue and prefetching Branch Folding • Fetch unit executes branch instruction concurrently with the execution of other instruction is known as branch folding. • Branch folding occurs only if there exists at least one instruction in the queue other than the branch instruction.
  • 48. Approaches to Deal • The conditional branching is a major factor that affects the performance of instruction pipelining. 1. Multiple streams 2. Prefetch branch target 3. Loop buffer 4. Branch prediction
  • 49. 1.Multiple streams - Two stream to Store fetched instruction. 2.Prefetch branch target - Prefetched the target instruction if its recognized 3.Loop buffer - Small/Temporary memory to store recently prefetched instructions
  • 50. 4. Branch prediction - To check whether a branch will be valid or not valid. These techniques reduce the branch penalty. Techniques: •predict never taken, •predict always taken, •predict by opcode, •taken and not taken switch, •branch history table
  • 51. Branch prediction strategies Static branch strategy: branch can be predicted based on branch code type. Dynamic branch strategy : uses recent branch history during the program execution to predict whether branch should be taken when next time occurs.
  • 52. Branch prediction strategies The recent branch information includes branch prediction statistics such as: T – Taken N – Not taken NN - Last two branches not taken NT - Not branch taken and previous taken TT - Both last two branch taken TN - Last branch taken and Previous not taken
  • 53. Branch target buffer • The recent branch information is stored in the buffer called BTB. • Stores branch information for prediction
  • 54. A typical state diagram used in dynamic branch prediction
  • 55. Exception • One of the difficult parts of control is to implement exceptions and interrupts- events other than branches or jumps. Handling exceptions in the MIPS Architecture Types of Exception: 1. Execution of an undefined instruction 2. Arithmetic overflow in the instruction add $1,$2,$2.
  • 56. Methods to communicate exceptions 1. Status register method The MIPS architecture uses a status register, which holds a field that indicates the reason for the exception. 2. Vectored interrupts method Vector interrupts are used. The address to which control is transferred is determined by the cause of the exception.
  • 57. Exception in a pipelined Implementation ï‚ž Multiple exception can occur in a single clock cycle. 1. Imprecise Interrupts or Imprecise exception 2. Precise Interrupts or precise exception

Editor's Notes

  • #31: Efficiency - The ratio of the output to the input of any system
  • #32: Efficiency - The ratio of the output to the input of any system
  • #33: Efficiency - The ratio of the output to the input of any system
  • #34: Efficiency - The ratio of the output to the input of any system
  • #36: Efficiency - The ratio of the output to the input of any system
  • #37: Efficiency - The ratio of the output to the input of any system
  • #38: Efficiency - The ratio of the output to the input of any system
  • #39: Efficiency - The ratio of the output to the input of any system
  • #40: Efficiency - The ratio of the output to the input of any system
  • #41: Efficiency - The ratio of the output to the input of any system
  • #42: Efficiency - The ratio of the output to the input of any system
  • #43: Efficiency - The ratio of the output to the input of any system
  • #44: Efficiency - The ratio of the output to the input of any system
  • #45: Efficiency - The ratio of the output to the input of any system
  • #46: Efficiency - The ratio of the output to the input of any system
  • #47: Efficiency - The ratio of the output to the input of any system
  • #48: Efficiency - The ratio of the output to the input of any system
  • #49: Efficiency - The ratio of the output to the input of any system
  • #50: Efficiency - The ratio of the output to the input of any system
  • #51: Efficiency - The ratio of the output to the input of any system
  • #52: Efficiency - The ratio of the output to the input of any system
  • #53: Efficiency - The ratio of the output to the input of any system
  • #54: Efficiency - The ratio of the output to the input of any system
  • #55: Efficiency - The ratio of the output to the input of any system