Академический Документы
Профессиональный Документы
Культура Документы
Representation of Instructions
(Instruction set Architecture)
Design hardware
for CPI = 1; seek
improvements with
CPI > 1
Computer Architecture,
Instruction-Set Architecture
Harvard architecture
address
data memory
data
address
program memory
data
PC
CPU
CISC Disadvantages:
Many specialized instructions aren't
used frequently
Earlier generations of a processor
family generally were contained as a
subset in every new version
Different instructions take different
amount of clock time to execute, due to
their variable length, slowing down the
overall performance of the machine
RISC Disadvantages :
poor code density (because of
fixed instruction size)
don't execute X86 code
One side supported CISC designs due to its low burden on compiler
developers and wide availability of existing software.
The other camp supported RISC designs because of its simplicity and
efficiency.
processor designers realize that RISC designs might benefit from the
addition of some CISC characteristics and vice-versa.
These designs use a decoder to convert CISC instructions into RISC
instructions before execution.
They are then processed by a RISC core, which performs a few basic
instructions very quickly.
Having a RISC core is advantageous because it allows performance
enhancing features, such as pipelining and branch prediction.
Popular examples of hybrid designs include the Pentium and Athlon family
of processors.
VLIW instruction
c=e/g
F=a+b
F
PU
c
PU
d
PU
w
PU
d=x&y
w=z*h
Pentium
CPU1
CPU2
16 K L1 cache
Co pros
EFLAGS
Carry
unsigned arithmetic out of range
Overflow
signed arithmetic out of range
Sign
result is negative
Zero
result is zero
Auxiliary Carry
carry from bit 3 to bit 4
Parity
sum of 1 bits is an even number
Direction
Increment & decrement the SI and DI registers
Interrupt
controls operation of the INTR (interrupt request) input pin
Trap
trapping through an on-chip debugging feature
Nested Task
Indicates if current task is nested
Input / output privilege level
Priority level of current task
Flags are divided into two groups:
1. Control flags - IF, DF, TF
2. Status flags
The transient program area (TPA) holds the DOS (disk operating
system) operating system; other programs that control the computer
system.
Functional
Block
Diagram of
Pentium
Addressing Modes
Register Addressing
MOV BX, CX
Immediate Addressing
MOV AX, 3456H
Direct Addressing
MOV AL,[1234H]
Register Indirect Addressing
MOV AX,[BX]
Base-Plus-Index Addressing
MOV DX,[BX + DI]
Register Relative Addressing
MOV AX,[BX+1000H]
Port addressing
1. The port specified in the operand
field. Address bus contains the
address of an I/O port.
For eg: IN AL, 80H
(00 FF) 256 I/O port locations.
2.
Scaled-Index Addressing
Unique to 80386 - Core2 microprocessors.
uses two 32-bit registers (a base register and an index register) to
access the memory.
The second register (index) is multiplied by a scaling factor.
the scaling factor can be 1x, 2x, 4x, 8x
index
scale displacement
32 bit addressing modes may be used while running in real mode by using
Address size prefix
Db 67h
MOV EAX, [EBX] [ECX * 4 + 6]
Pipelining
Arithmetic Instructions
80286 onwards
CBW convert byte to word
Extend a signed 8 bit number in AL into a signed 16 bit number in AX
Performed before IDIV or IMUL
CWD convert word to double word
Extend a signed 16 bit number in AX into a signed 32 bit number in DX : AX
Performed before IDIV or IMUL
80386 onwards
CWDE - convert word to double word extended
Extend a signed 16 bit number in AX into a signed 32 bit number in EAX
CDQ convert double word to quad word
The sign bit of EAX is extended through EDX.
64 bit results in EDX : EAX
80486 onwards
CMPXCHG compare and exchange
CMPXCHG dst, src
Compares the dst operand with the accumulator.
AL,AX or EAX depending on the size of the dst.
If acc = dst - src is copied to dst.
If acc = dst - acc is replaced by the value in the dst.
Very useful in operating system s/w that supports multiple process
through the use of semaphores.
XADD exchange and add byte, word or double word
XADD dst, src
Pentium instruction
CMPXCHG8B - compare and exchange 8 bytes
CMPXCHG8B dst
ECX : EBX - source
EDX : EAX compared with dst
BT bit scan
BT dst, src
To determine the value of a specific bit in the 16 or 32 bit
destination operand.
The bit to be tested is indicated by the source operand
The state of the bit that is tested is copied into the carry flag
BTC after testing the bit - complements
BTS - after testing the bit sets
BTR - after testing the bit resets
Control applications: Single bit is used to operate a device.
Open/close - relay or door
On /off light or indicator
Sense a specific condition of the device.
Power PC family
Mid seventies
First RISC type computer IBM 801
Execute an instruction at almost every clock cycles
(To achieve this - hardwired - RISC property)
all 801 instructions - 32 bits long
Mid eighties
IBM developed - commercial RISC type processor
ROMP - Research office products division Microprocessor
65% of the instructions were 16 bits long others were 32 bits long.
In 1990
IBM developed - RS 6000
POWER Performance Optimization with enhanced RISC
RS 6000 - POWER architecture
IBM RS 6000 is a predecessor of the POWER PC architecture
In 1991
IBM + Motorola + Apple - developed a new powerful family of
RISC type Micro processor
POWER PC family
The first POWER PC implementation is the POWER PC 601
Microprocessor also called MPC 601 by Motorola and PPC 601 by
IBM
MPC 603, 604, 620 - based on the POWER PC architecture
derived from the IBM POWER architecture
Power PC Architecture
3 layers
1.User instruction set architecture - includes user level registers,
programming model, data types, addressing modes and the base user
level instruction set (non privileged instruction)
2. Virtual environment architecture - (additional user level
functionality) memory model, cache model, cache control instruction,
address aliasing and other related issues. (user level timer support)
FPR0 to FPR31
32 floating-point registers with
64-bit precision.
source and destination operands
of all floating-point operations.
FPRs also provide access to the
FPSCR(Floating-Point Status and
Control Register)
The Link Register (LR) contains the address to return to at the end of a
function call.
The number of bytes to transfer during load and store string instruction
lswx ( load string word indexed ) and stswx (store string word indexed)
Instruction formats
Format
0-5
6-10
11-15
16-20
21-25
26-29
30
31
D-form
opcd
D
tgt/src
A
src/tgt
X-form
opcd
D
tgt/src
A
src/tgt
B
src
opcd
D
tgt/src
A
src/tgt
B
src
C
src
extended opcd
Rc
opcd
D
tgt/src
A
src/tgt
B
src
OE
extended opcd
Rc
BD-form
opcd
BO
BI
I-form
opcd
SIMM
immediate
extended opcd
A-form
BD
LI
AA
LK
AA
LK
Addressing Modes
1. All operations are reg to reg using the following two modes:
Reg direct: operand is in a GPR or FPR (A form)
Immediate : operand is a part of the instruction (D form)
Instruction formats
upper
A form
integer arithmetic have four forms of operation
add add rd, ra, rb (rd ra+rb)
(OE =0 RC =0)
add. add with CR update
(OE =0 RC =1)
addo add with overflow update
(OE =1 RC =0)
addo. add with overflow and CR updated (OE =1 RC =1)
floating point instruction
fadd floating point add
fadd. floating point add with CR update
Composite instructions
fmadd frd, fra, frb, frc (floating point multiply and add)
frd
fra * frb + frc
Load & store ins A field-reg indirect, B field index reg
D field - dst (load) or src (store)
X form
Load & store ins
I form
BD form :
Conditional branch instruction format
BO field- specifies the conditions under which the branch is taken (type of
condition true or false)
BI field specifies the bit in the CR to be used as a condition of the branch
(which CR bit is to be used as the condition)
BD field is used to form the branch target address (LI field)
bc BO, BI, target address (branch conditional)
bca, bcl and bcla
bclr
branch conditional to link register
bclr BO, BI
(lk=0)
bclrl
(lk =1)
bcctr branch conditional to count register
bcctr BO, BI
(lk=0)
bcctrl BO, BI
(lk=1)
Instruction types
EE
PR
FP
ME
FE0
SE
FE1
EP
IT
DT
LE
1-15
16
17
18
19
20
21
22
23
24
25
26
27
28-30
31
MPC 601
First Microprocessor
Implementation of the Power PC
66 Mhz, power dissipation is 9w
at 3.6 volts
Integer Execution Unit
Floating Point Unit
Load/Store Unit (LSU)
Branch Execution Units
Memory Management Unit
Memory Unit
Cache
Data Types