CH10-Processor Structure and Function
CH10-Processor Structure and Function
+ Processor Organization 3 4
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
Register Organization
Within the processor there is a set of registers that function as a
level of memory above main memory and cache in the
hierarchy
7 8
User-Visible Registers Table 14.1
Condition Codes
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
+ 9
+ Program Status Word (PSW) 10
11 12
15 16
17 18
Pipelining Strategy
19
+ Additional Stages 20
23 24
25
Pipeline Hazards 26
Also referred to as a
pipeline bubble
27 28
+ Types of Data Hazard 29
+ 30
Control Hazard
Read after write (RAW), or true dependency
Also known as a branch hazard
An instruction modifies a register or memory location
Succeeding instruction reads data in memory or register Occurs when the pipeline makes the wrong decision on a
location
Hazard occurs if the read takes place before write operation is branch prediction
complete
Brings instructions into the pipeline that must subsequently
Write after read (WAR), or antidependency be discarded
An instruction reads a register or memory location
Succeeding instruction writes to the location Dealing with Branches:
Hazard occurs if the write operation completes before the Multiple streams
read operation takes place Prefetch branch target
Write after write (WAW), or output dependency Loop buffer
Two instructions both write to the same location Branch prediction
Hazard occurs if the write operations take place in the reverse Delayed branch
order of the intended sequence
31 32
Multiple Streams Prefetch Branch Target
A simple pipeline suffers a penalty for a When a conditional branch is recognized, the
branch instruction because it must choose target of the branch is prefetched, in addition
one of two instructions to fetch next and may
make the wrong choice to the instruction following the branch
Loop Buffer
Small, very-high speed memory maintained by the
instruction fetch stage of the pipeline and containing the n
most recently fetched instructions, in sequence
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
+ 35 36
Branch Prediction
Fetch
Objective is to fill the prefetch buffers with new data as soon as Operates independently of the other stages to keep the prefetch
the old data have been consumed by the instruction decoder buffers full
Decode stage 1
All opcode and addressing-mode 3 bytes of instruction are passed to the D1 D1 decoder can then direct the D2 stage to
information is decoded in the D1 stage stage from the prefetch buffers capture the rest of the instruction
Decode stage 2
Also controls the computation of the more complex addressing
Expands each opcode into control signals for the ALU
modes
Execute
Write back
Updates registers and status flags modified during the preceding execute stage
41 42
Table 14.2
x86
Processor
Registers
43 44
+ 45 46
Interrupt Processing
Interrupts and Exceptions
Table 14.3
Interrupts
Generated by a signal from hardware and it may occur at random x86
times during the execution of a program Exception
Maskable and
Nonmaskable Interrupt
Vector Table
Exceptions
Generated from software and is provoked by the execution of an
instruction
Processor detected
Programmed
51 52
53
+ Summary
54
Processor Structure
and Function
Chapter 14
Table 14.4
Processor organization Instruction pipelining
Pipelining strategy
ARM
Register organization
Pipeline performance
User-visible registers
Interrupt
Dealing with branches
Intel 80486 pipelining
The indirect cycle
The Arm processor
Data flow
Processor organization
The x86 processor family Processor modes
Register organization Register organization
Interrupt processing Interrupt processing