Processor Structure and Function
Processor Structure and Function
William Stallings
Computer Organization
and Architecture
9th Edition
+
Chapter 14
Processor Structure and Function
+
Processor Organization
Processor Requirements:
Fetch instruction
The processor reads an instruction from memory (register, cache, main memory)
Interpret instruction
The instruction is decoded to determine what action is required
Fetch data
The execution of an instruction may require reading data from memory or an I/O
module
Process data
The execution of an instruction may require performing some arithmetic or logical
operation on data
Write data
The results of an execution may require writing data to memory or an I/O module
Categories:
Referenced by means of • General purpose
the machine language • Can be assigned to a variety of functions by
the programmer
that the processor • Data
executes • May be used only to hold data and cannot
be employed in the calculation of an
operand address
• Address
• May be somewhat general purpose or may
be devoted to a particular addressing mode
• Examples: segment pointers, index
registers, stack pointer
• Condition codes
• Also referred to as flags
• Bits set by the processor hardware as the
result of operations
Table 14.1
Condition Codes
+
Control and Status Registers
Four registers are essential to instruction execution:
If interrupts are
Read the next enabled and an
Interpret the opcode
instruction from interrupt has occurred,
and perform the
memory into the save the current
indicated operation
processor process state and
service the interrupt
Instruction Cycle
Instruction Cycle State Diagram
Data Flow, Fetch Cycle
Data Flow, Indirect Cycle
Data Flow, Interrupt Cycle
Pipelining Strategy
Six Stage
Instruction Pipeline
+
Alternative Pipeline
Depiction
+
Speedup Factors
with Instruction
Pipelining
Pipeline Hazards
Occur when the
pipeline, or some
portion of the There are three
pipeline, must stall types of hazards:
because conditions • Resource
do not permit • Data
continued execution • Control
Also referred to as a
pipeline bubble
+
Resource
Hazards
Hazard
+
Data Hazards
A data hazard occurs when there is a conflict in the
access of an operand location
+
Types of Data Hazard
Read after write (RAW), or true dependency
An instruction modifies a register or memory location
Succeeding instruction reads data in memory or register location
Hazard occurs if the read takes place before write operation is
complete
Drawbacks:
• With multiple pipelines there are contention delays
for access to the registers and to memory
• Additional branch instructions may enter the pipeline
before the original branch decision is resolved
Prefetch Branch Target
Benefits:
Instructions fetched in sequence will be available without the
usual memory access time
If a branch occurs to a target just a few locations ahead of the
address of the branch instruction, the target will already be in the
buffer
This strategy is particularly well suited to dealing with loops
Branch Prediction
Flow Chart
Branch Prediction State Diagram
+
Dealing With
Branches
+
Intel 80486 Pipelining
Fetch
Objective is to fill the prefetch buffers with new data as soon as the old data
have been consumed by the instruction decoder
Operates independently of the other stages to keep the prefetch buffers full
Decode stage 1
All opcode and addressing-mode information is decoded in the D1 stage
3 bytes of instruction are passed to the D1 stage from the prefetch buffers
D1 decoder can then direct the D2 stage to capture the rest of the instruction
Decode stage 2
Expands each opcode into control signals for the ALU
Also controls the computation of the more complex addressing modes
Execute
Stage includes ALU operations, cache access, and register update
Write back
Updates registers and status flags modified during the preceding execute
stage
+
80486
Instruction
Pipeline
Examples
Table 14.2
x86 Processor Registers
Table 14.2
x86 Processor Registers
x86 EFLAGS Register
Control
Registers
Mapping of MMX Registers to
Floating-Point Registers
+
Interrupt Processing
Interrupts and Exceptions
Interrupts
Generated by a signal from hardware and it may occur at random
times during the execution of a program
Maskable
Nonmaskable
Exceptions
Generated from software and is provoked by the execution of an
instruction
Processor detected
Programmed
Simplified ARM
Organization
Processor Modes
Most application
programs execute in
ARM user mode
architecture • While the processor is in
supports seven user mode the program
being executed is unable
execution to access protected
modes system resources or to
change mode, other than
by causing an exception
to occur
ARM
Register
Organization
Format of ARM CPSR and SPSR
Table 14.4
ARM
Interrupt
Vector
+ Summary Processor Structure
and Function
Chapter 14
Instruction pipelining
Processor organization
Pipelining strategy
Register organization Pipeline performance
User-visible registers Pipeline hazards
Control and status registers Dealing with branches
Intel 80486 pipelining
Instruction cycle
The indirect cycle The Arm processor
Data flow Processor organization
Processor modes
The x86 processor family
Register organization
Register organization
Interrupt processing
Interrupt processing