4-Addressing modes-24-01-2025
4-Addressing modes-24-01-2025
Dr. P.Keerthika
Associate Professor
School of Computer Science and Engineering
Vellore Institute of Technology, Vellore
Computer Instructions: Instruction sets
• Instruction
• Is a statement by which the operation of CPU is determined.
• These instructions referred as “Machine instructions or computer Instructions”
is fetched. = 3
• Then the two words representing the operands themselves need to be fetched into he CPU and after the addition
has been performed, Result overwrites Operand =3
• Total= 06
• add Op1Addr Op2Addr
Memory Required to store an Instruction: 2 x 3 bytes = 06 Bytes
1-address Instruction :
• Special CPU register, the accumulator, supplies 1 operand and stores result
• One memory address used for other operand
• Need instructions to load and store operands:
• LDA OpAddr
• STA OpAddr
• This Instruction will require 1X3+1= 4 bytes to encode a 1-address ALU instruction
36 30 12 9 21
Two-address
Memory Memory M/As to M/As to Memory
load a, b ab
to Store to encode Fetch Execute Traffic
add a, c aa+c
3*3=9 1+(2*3)=7 3 2 3+2=5
mpy a, d aa*d
sub a, e aa-e 3*3=9 1+(2*3)=7 3 3 3+3=6
36 28 12 11 23
Memory Memory M/As to M/As to Memory
One-address to Store to encode Fetch Execute Traffic
2*3=6 1+(1*3)=4 2 1 2+1=3
load b Accb
2*3=6 1+(1*3)=4 2 1 2+1=3
add c AccAcc+c
2*3=6 1+(1*3)=4 2 1 2+1=3
mpy d AccAcc*d
2*3=6 1+(1*3)=4 2 1 2+1=3
sub e AccAcc-e
2*3=6 1+(1*3)=4 2 1 2+1=3
store a aAcc
30 20 10 5 15
• Develop a comparative table for the performance parameters such as memory to store, memory to encode,
M/As to fetch , M/As to execute and total memory Traffic for 4-,3-,2-,1-,0- address machine instructions.
• Consider the following specifications: Memory word size is 1 byte, Memory/register Address size is 2byte,
Opcode size is 1 byte.
i. Write an appropriate assembly language programming using 3-Address, 2-Address, 1-Address and 0-
address machine instructions for the following expression ( with registers & without registers). Assume
that all are integer operations.
X= (A / B + C * D) / (D * E - F + C / A) + G
ii. Compute various performance factors such as memory to store a program, memory to encode a whole
program, Memory access to fetch & execute and memory traffic.