Difference between 3-address and 1-address Instructions


A computer system performs operations based on the instruction provided to it. These computer instructions are written in different formats based on the number of addresses that they contain. In this article, we will discuss the two types of computer instructions namely, 3-address instruction and 1-address instruction, and the important differences between them.

The fundamental difference between 3-address instruction and 1-address instruction is that the 3-address instruction requires three operands, while the 1-address instruction requires only a single operand.

Before discussing the differences, let us first know a bit about 3-address and 1-address instructions individually. So, let gets started with the introduction of 1-address instruction.

What is a 1-Address Instruction?

A type of instruction in computer system that takes only one operand to perform operations is called a 1-address instruction. In the case of 1-address instruction, the result of operation is stored either in the same operand or in a memory register.

The 1-address instruction mostly used to perform unary operations like increment or decrement a value stored in a register.

Syntax

The 1-addresss instruction takes the following syntax −

A B

Where, A is an opcode like INC for increment, and B is the operand on which the operation is to be performed. Thus, in the case of 1-address instruction, the operand is modified.

Example

The following example illustrate the 1-address instruction −

INC A

It will increment the content of the register A.

What is 3-Address Instruction?

The type of computer instruction that takes three operands to perform tasks is called a 3-address instruction. In the case of 3-address instruction, all the three operands on which it performs operations are specified in the instruction explicitly. Therefore, these computer instructions are more flexible than 0-address, 1-address, and 2-address instructions. However, they are relatively more complex in terms of operations that they perform.

In a 3-address instruction, the operands represent the following −

  • The first operand denotes the destination operand.

  • The second and third operands denote the source operands.

The 3-address instructions are widely used to perform various operations such as arithmetic operations, logical operations, memory operations, etc.

Example

The following example illustrate the syntax of a 3-address instruction −

ADD A, B, C

Here, A is the destination operand, and B and C represent the source operands.

After discussing the basics of 1-address instruction and 3-address instruction, let us now discuss all the significant differences between them.

Difference between 3-Address Instruction and 1-Address Instruction

The following table highlights all the significant differences between 3-address instructions and 1-address instructions −

Parameter

3-Address Instruction

1-Address Instruction

Basic

A type of computer instruction that takes three operands is referred to as a 3-address instruction.

A type of computer instruction that takes only a single operand is referred to as a 1-address instruction.

Number memory addresses

3-address instruction requires three memory addresses.

1-address instruction requires only one memory address.

Memory usage

3-address instruction consume more memory space.

1-address instruction consume less memory space.

Length of instruction

3-address instruction includes more memory addresses, and hence it is longer.

1-address instruction is shorter than 3-address instruction.

Flexibility

3-address instruction is more flexible as it allows to perform more complex operations.

1-address instruction is less flexible.

Readability of instruction code

3-address instructions are less readable as they are complicated to understand.

1-address instructions are simple and easy to understand, and hence they are more readable as compared to the 3-address instructions.

Code density

In the 3-address instruction, the code density is high as they can perform more operations in a single instruction.

1-address instructions are less code dense as compared to 3-address instructions.

Execution speed

Due to need of more processing and high complexity, the 3-address instructions are slower to execute.

1-address instructions are relatively faster than 3-address instructions.

System architecture

3-address instructions are better suited to use in CISC (Complex Instruction Set Computer) architecture.

1-address instructions are better suited to use in RISC (Reduced Instruction Set Computer) architecture

Number of registers

3-address instruction requires more number of registers to store operands.

1-address instruction requires lesser number of registers to store operand.

Efficiency

3-address instructions are relatively more efficient as they can perform more operations with fewer instruction codes.

1-address instructions are less efficient than 3-address instructions.

Conclusion

In conclusion, the most significant difference between 3-address instruction and 1-address instruction is that the 3-address instruction takes three operands to perform operations, while the 1-address instruction takes only one.

Updated on: 21-Apr-2023

283 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements