UNIT2.2-PPT
UNIT2.2-PPT
and Organization
UNIT II
SYLLABUS
Instruction formats – Three Address Instructions, Two Address Instructions, One Address Instructions,
Zero Address Instructions, RISC Instructions,
Addressing modes – Numerical Example,
Data Transfer and manipulation – Data Transfer Instructions, Data Manipulation Instructions, Arithmetic
Instructions, Logical and Bit Manipulation Instructions, Shift Instructions,
Program control – Status Bit Conditions, Conditional Branch Instructions, Subroutine Call and Return,
Program Interrupt, Types of Interrupts,
2
INSTRUCTION FORMAT
Instruction Fields
OP-code field - specifies the operation to be performed
Address field - designates memory address(s) or a processor register(s)
Mode field - specifies the way the operand or the
effective address is determined
The number of address fields in the instruction format depends on the internal
organization of CPU
Three-Address Instructions:
Program to evaluate X = (A + B) * (C + D) :
ADD R1, A, B /* R1 M[A] + M[B] */
ADD R2, C, D /* R2 M[C] + M[D] */
MUL X, R1, R2 /* M[X] R1 * R2 */
Two-Address Instructions:
Program to evaluate X = (A + B) * (C + D) :
12
RISC Instructions:
- Program to evaluate X = (A + B) * (C + D) :
ADDRESSING MODES
Addressing Modes:
13
TYPES OF ADDRESSING MODES
Implied Mode
Address of the operands are specified implicitly
in the definition of the instruction
- No need to specify address in the instruction
- EA = AC, or EA = Stack[SP],
EA: Effective Address.
Immediate Mode
Instead of specifying the address of the operand,
operand itself is specified
- No need to specify address in the instruction
- However, operand itself needs to be specified
- Sometimes, require more bits than the address
- Fast to acquire an operand
Register Mode
Address specified in the instruction is the register
address
- Designated operand need to be in a register
- Shorter address than the memory address
- Saving address field in the instruction
- Faster to acquire an operand than the memory 14
TYPES OF ADDRESSING MODES
15
TYPES OF ADDRESSING MODES
Direct Address Mode
Instruction specifies the memory address which
can be used directly to the physical memory
- Faster than the other memory addressing
modes
- Too many bits are needed to specify the
address for a large physical memory
space
- EA = IR(address), (IR(address): address field of
IR)
R1 = 400
399 450
XR = 100 700
400
AC
500 800
900
600
Addressing Effective Content
Mode Address of AC
Direct address 500 /* AC (500) */ 800 325
702
Immediate operand - /* AC 500 */ 500
Indirect address 800 /* AC ((500)) */ 300
Relative address 702 /* AC (PC+500) */ 325 300
Indexed address 600 /* AC (XR+500) */ 900 800
Register - /* AC R1 */ 400
Register indirect 400 /* AC (R1) */ 700
Autoincrement 400 /* AC (R1)+ */ 700
Autodecrement 399 /* AC -(R) */ 450
18
DATA TRANSFER INSTRUCTIONS
Typical Data Transfer Instructions
Name Mnemonic
Load LD
Store ST
Move MOV
Exchange XCH
Input IN
Output OUT
Push PUSH
Pop POP
Software Interrupts
Both External and Internal Interrupts are initiated by the computer Hardware.
Software Interrupts are initiated by executing an instruction.
- Supervisor Call -> Switching from a user mode to the supervisor mode
-> Allows to execute a certain class of operations
which are not allowed in the user mode
24
INTERRUPT PROCEDURE
Interrupt Procedure and Subroutine Call
- The interrupt is usually initiated by an internal or
an external signal rather than from the execution
of an instruction (except for the software
interrupt)