Unit - 1 Microprocessor Architecture
Unit - 1 Microprocessor Architecture
MICROPROCESSOR
ARCHITECTURE
CPU Structure
CPU must:
Fetch instructions
Interpret instructions
Fetch data
Process data
Write data
Registers
CPU must have some working space
(temporary storage) called registers
Number and function vary between
processor designs - One of the major
design decisions
Top level of memory hierarchy
General Purpose
Data
Address
Condition Codes
Addressing
Segment
How big?
Large enough to hold full address
Large enough to hold full word
Often possible to combine two data
registers
Program Counter
Instruction Decoding Register
Memory Address Register
Memory Buffer Register
A set of bits
Includes Condition Codes
Sign of last result
Zero
Carry
Equal
Overflow
Interrupt enable/disable
Supervisor
Supervisor Mode
Other Registers
May have registers pointing to:
Process control blocks
Interrupt Vectors
Prefetch
Fetch accessing main memory
Execution usually does not access main
memory
Can fetch next instruction during
execution of current instruction
Called instruction prefetch
Improved Performance
But not doubled:
Fetch usually shorter than execution
Any jump or branch means that prefetched
instructions are not the required instructions
Pipelining
Fetch instruction
Decode instruction
Calculate operands (i.e. EAs)
Fetch operands
Execute instructions
Write result
Six Stage
Instruction Pipeline
Speedup Factors
with Instruction
Pipelining
Pipeline Hazards
Pipeline, or some portion of pipeline, must
stall
Also called pipeline bubble
Types of hazards
Resource
Data
Control
Resource Hazards
Data Hazards
Control Hazard
Also known as branch hazard
Pipeline makes wrong decision on branch
prediction
Brings instructions into pipeline that must
subsequently be discarded
Dealing with Branches
Multiple Streams
Prefetch Branch Target
Loop buffer
Branch prediction
Delayed branching
Multiple Streams
Have two pipelines
Prefetch each branch into a separate
pipeline
Use appropriate pipeline
Leads to bus & register contention
Multiple branches lead to further pipelines
being needed
Loop Buffer
Correlation-based
In loop-closing branches, history is good predictor
In more complex structures, branch direction
correlates with that of related branches
Use recent branch history as well
Dealing With
Branches