Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Difference between 2-address instruction and 1-address instructions

  • Last Updated : 19 Jun, 2020

Prerequisite – Instruction Formats
1. Two-Address Instructions :
Two-address instruction is a format of machine instruction. It has one opcode and two address fields. One address field is common and can be used for either destination or source and other address field for source.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

Example:



X = (A + B) x (C + D) 

Solution:

MOV R1, A      R1 <- M[A]
ADD R1, B      R1 <- R1 + M[B]
MOV R2, C      R2 <- M[C]
ADD R2, D      R2 <- R2 + D
MUL R1, R2     R1 <- R1 x R2
MOV X, R1      M[X] <- R1 

2. One-Address Instructions :
One-Address instruction is also a format of machine instruction. It has only two fields. One for opcode and other for operand.

Example:

X = (A + B) x (C + D) 

Solution:

LOAD A      AC <- M[A]
ADD B       AC <- AC + M[B]
STORE T     M[T] <- AC
LOAD C      AC <- M[C]
ADD D       AC <- AC + M[D]
MUL T       AC <- AC x M[T]
STORE X     M[X] <- AC  

Difference between Two-Address Instruction and One-Address Instruction :

TWO-ADDRESS INSTRUCTIONONE-ADDRESS INSTRUCTION
It has three fields.It has only two fields.
It has one field for opcode and two fields for address.It has one field for opcode and one field for address.
It has long instruction length as compared to one-address.While it has shorter instruction length.
It is slower accessing location inside processor than memory.It is faster accessing location inside processor than memory.
It generally needs two memory accesses.It generally needs one memory accesses.
There may be three memory accesses needed for an instruction.There is a single memory access needed for an instruction.
It can’t completely eliminate three memory access.It eliminates two memory access completely.

My Personal Notes arrow_drop_up
Recommended Articles
Page :