Unit V
Unit V
Instruction Types
■ Data processing
■ Data storage (main
memory) ■ Data movement
(I/O) ■ Program flow control
Types of
Operand ■ Addresses
■ Numbers
– Integer/floating point
■ Characters
– ASCII etc.
■ Logical Data
– Bits or flags
Pentium Data Types
■ 8 bit Byte
■ 16 bit word
■ 32 bit double word
■ 64 bit quad word
■ Addressing is by 8 bit unit
■ A 32 bit double word is read at addresses
divisible by 4
Specific Data Types
■ General - arbitrary binary contents
■ Integer - single binary value
■ Ordinal - unsigned integer
■ Unpacked BCD - One digit per byte ■
Packed BCD - 2 BCD digits per byte ■ Near
Pointer - 32 bit offset within segment ■ Bit
field
■ Byte String
■ Floating Point
■ Registers
– Number of CPU registers available –
Which operations can be performed on
which registers?
■ Addressing modes
Pipelining
■ Fetch instruction
■ Decode instruction
■ Calculate operands (i.e. EAs)
■ Fetch operands
■ Execute instructions
■ Write result
Pipeline Hazards
■ The situation that prevents the starting of
the next instruction in next cycle
■ They reduce the speedup of pipeline
Pipeline Hazards
■ Structural Hazard
– attempt to use the same resource by two or
more instructions
■ Data Hazard
– attempt to use data before it is ready
■ Control Hazard
– attempt to make branching decisions
before branch condition is evaluated
Structural Hazards – Memory
A
Structural Hazards – Memory
r Stall Instr 3
der
Bubble Bubble Bubble Bubble
BubbleIfetch DMem Reg
Reg
UL
Data Hazards
■ RAW – Read after Write
Instr i ■ WAW – Write after Write
– j tries to write a source
before i writes it.
Instr j
– j tries to read a source before ■ WAR – Write after Read
i writes it. – j tries to write a source
before i reads it.
Control Hazards
■ Multiple Streams
■ Prefetch Branch Target
■ Loop buffer
■ Branch prediction
■ Delayed branching
Multiple Streams
Loop Buffer
Branch Prediction
■ Predict never taken
– Assume that jump will not happen
– Always fetch next instruction
■ Predict always taken
– Assume that jump will happen
– Always fetch target instruction
■ Predict by Opcode
– Some instructions are more likely to result in a jump than
others
– Can get up to 75% success
Branch Prediction