Open In App

Difference between 3-address instruction and 1-address instruction

Improve
Improve
Like Article
Like
Save
Share
Report

The main difference between 3-address instructions and 1-address instructions is the number of operands or addresses they can operate on.

  1. 1-address instructions have only one operand or address specified in the instruction, which is typically a memory location or a register. The instruction operates on the contents of that operand and the result may be stored in the same or a different location. For example, a 1-address instruction like “MOV R1, [R2]” would move the contents of memory location pointed to by R2 into register R1.
  2. 3-address instructions, on the other hand, have three operands or addresses specified in the instruction, which can be either memory locations or registers. The instruction operates on the contents of all three operands, and the result may be stored in the same or a different location. For example, a 3-address instruction like “ADD R1, R2, R3” would add the contents of registers R2 and R3 and store the result in R1.

So, the main difference is that 3-address instructions can operate on three operands or addresses, whereas 1-address instructions can operate on only one operand or address. This means that 3-address instructions are more powerful and can perform more complex operations, while 1-address instructions are simpler and more limited in their functionality.

Another difference is that 3-address instructions typically require more memory space than 1-address instructions because they have to specify three operands, which can result in longer instruction words. This can affect the overall performance and efficiency of the computer.

Overall, the choice of instruction format depends on the specific requirements of the computer architecture and the trade-offs between code size, execution time, and flexibility.

Prerequisite – Instruction Formats 1. Three-Address Instructions: Three-address instruction is a format of machine instruction. It has one opcode and three address fields. 2. One-Address Instructions: One-Address instruction is also a format. It has only two fields. One for opcode and other for operand. Difference between Three-Address Instruction and One-Address Instruction:

Three-Address Instruction One-Address Instruction
It has four fields. It has only two fields.
It has one field for opcode and three fields for address. It also has one field for opcode but there is only one field for address.
It has long instruction length. It has shorter instruction.
There may be three memory accesses needed for an instruction. There is a single memory access needed for an instruction.
It is slower accessing location inside processor than memory. It is faster accessing location inside processor than memory.
It disadvantage i.e. three memory access is eliminated by two-address memory. It eliminated two memory access.
There are three location for operand and result. There is only one location for operand and result.

Last Updated : 19 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads