Lecture6 COA
Lecture6 COA
Lecture6 COA
Pilani Campus
DS Rao
COA -IS ZC353
Objectives
•
•
•
Sign bit: b31= 0 for positive numbers
b31= 1 for negative numbers
(a) A signed integer
1K(kilo)=210
1T(tera)=240
Word
address Byte address Byte address
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
• •
• •
• •
k k k k k k k k k k
2 -4 2 -4 2 -3 2- 2 2 - 1 2 - 4 2- 1 2 - 2 2 -3 2 -4
Three-Address Instructions
▪ ADD R1, R2, R3 R1 ← R2 + R3 or R3 ← R1 + R2
Two-Address Instructions
▪ ADD R1, R2 R1 ← R1 + R2
One-Address Instructions
▪ ADD M AC ← AC + M[AR]
Zero-Address Instructions
▪ ADD TOS ← TOS + (TOS – 1)
RISC Instructions
▪ Lots of registers. Memory is restricted to Load & Store
words.
Status register access instructions: ARM provides the ability to read and
Example: A: 11110000
▪ A: 1 1 1 1 0 0 0 0
▪ B: 0 0 0 1 0 1 0 0 +(−B): 1 1 1 0 1 1 0 0
11011100
C=1 Z=0
S=1
V=0
Overflow can only happen when adding two numbers of the same sign
and getting a different sign. So, to detect overflow we don't care about any bits except
the sign bits. Ignore the other bits.
𝑎 + (𝑏 × 𝑐), becomes a b c x +
(𝑎 + 𝑏) × 𝑐 becomes a b + c x
4. PUSH C ; TOS ← C
5. PUSH D ; TOS ← D
6. ADD ; TOS ← (C + D)
7. MUL ; TOS ← (C+D)(A+B)
8. POP X ; M[X] ← TOS
Already included this in 8086 , students have to learn this on their own
Addressing Modes
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
• 8086 Intel Microprocessor Architecture
Implied
▪ AC is implied in “ADD M[AR]” in “One-Address”
instr.
▪ TOS is implied in “ADD” in “Zero-Address” instr.
Immediate
▪ The use of a constant in “MOV R1, 5”, i.e. R1 ←
5
Register
▪ Indicate which register holds the operand
Register Indirect
▪ Indicate the register that holds the number of the register that holds
the operand
MOV R1, (R2)
Autoincrement / Autodecrement R1
▪ Access & update in 1 instr.
Direct Address R2 = 3
▪ Use the given address to access a memory location
R3 = 5
AR = 101
100
101 0 1 0 4
102
103
104 1 1 0 A
Relative Address
▪ EA = PC + Relative Addr 0
1
PC = 2 2
+
100
AR = 100
101
Could be 102 1 1 0 A
Positive or 103
Negative 104
(2’s
Complement)
Indexed
▪ EA = Index Register + Relative Addr
Useful with
“Autoincrement” XR = 2
or
“Autodecrement” +
100
AR = 100
101
102 1 1 0 A
Could be 103
Positive or 104
Negative
(2’s
Complement)
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Addressing Modes
Base Register
▪ EA = Base Register + Relative Addr
Could be Positive or AR = 2
Negative
(2’s Complement)
+
100 0 0 0 5
BR = 100
101 0 0 1 2
102 0 0 0 A
Usually points to 103 0 1 0 7
the beginning of 104 0 0 5 9
an array
Offset
Preindex
Base register acts as index register for preindex and postindex addressing
Data Processing
Register addressing
Branch
Immediate
– On word boundary
before
access
Instruction Length
Affected by and affects:
Memory size
Memory organization
Bus structure
CPU complexity
CPU speed
Trade off between powerful instruction repertoire and saving space
Can also be downloaded from the below link and installed on your PC, it is
a free tool
STB #51,@R01
STB #51,@R01
Opcode
Operand
Direct
operand references
Eg: Add A 87H
or Add A B
Next Instruction
Instruction Set Design Issue
Type of Operation ?
Kind of Data ?
Instruction Format ?
Number of internal Registers in CPU ?
Addressing Modes?
Type of Operation ?
Kind of Data ?
Instruction Format ?
Number of internal Registers in CPU ?
Addressing Modes?
▪ Compliers
▪ I/O routines
Sol:
a. 20
b. 40 d. 30 e. 50 f . 70
c. 60
MUL
C
B
A
X = (A + B X C) ∕ (D - E X F)
BXC
A
X = (A + B X C) ∕ (D - E X F)
F
E
D
A+BXC
X = (A + B X C) ∕ (D - E X F)
ExF
D
A+BXC
X = (A + B X C) ∕ (D - E X F)
D-ExF
A+BXC
X = (A + B X C) ∕ (D - E X F)
A+BxC /
D-ExF
X = (A + B X C) ∕ (D - E X F)