NTA UGC NET 2023 » NTA Study Materials » Computer Science » One-Address Instructions

One-Address Instructions

One-Address Instructions - They consist of only one address field. That instruction has two operands, one in the accumulator and the other one in some general-purpose register or memory location.

In assembly language, the sequence of instructions is usually not as important as the actual data. Because of this, a considerable amount of time is saved by orthogonalizing the instruction syntax to allow multiple operations to be done in a single command. This results in what is known as a one-address instruction where no addresses are required for basic arithmetic and logical operations. One of the more common accumulator-related operations involves copying the contents of one operand into another; this is usually accomplished with a MOV instruction. A MOV rn, acc would copy the value from register rn into the accumulator (acc).

Instruction Formats

A field is a group of bits consisting of different significance as they are used at different places. Every field contains some information, so we can say that computers perform a task based on instructions provided. These instructions comprise groups called fields, so for computers, everything is 0 and 1, so each field has different importance. When a CPU decides what to perform, it reads an instruction from the source and then compares its content with its content because the CPU has its memory too, which contains different memory locations.

By reading these contents, there can be a comparison between their producing output.

One-Address Instructions

The One-Address Instruction format provides for a single instruction execution cycle. This is accomplished by allowing the implied ACCUMULATOR register to be either the source or destination of the operation. In most instances, the implied ACCUMULATOR is the operand that is already in the accumulator, so it does not Have to be explicitly stated as an operand. One-address instructions are those that only require one operand. One address is also implied, meaning that the CPU knows that an ALU operation will be performed (by looking at opcode). Because Accumulator is always the first operand, it can be omitted without causing any confusion.

Instruction format

opcode

           Destination 

           mode

Example

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 * M[T]

STORE X M[X] = AC

Difference between 2-address instructions and 1-address instructions

1-address instructions

The One-Address Instruction format provides for a single instruction execution cycle. This is accomplished by allowing the implied ACCUMULATOR register to be either the source or destination of the operation. In most instances, the implied ACCUMULATOR is the operand that is already in the accumulator, so it does not have to be explicitly stated as an operand. One-address instructions are those that only require one operand. One address is also implied, meaning that the CPU knows that an ALU operation will be performed (by looking at opcode). Because Accumulator is always the first operand, it can be omitted without causing any confusion.

2-address instruction

Two-address instructions are a format of machine instruction in which one operand is a destination, and the other is a source. The two address fields differ from each other in their format and purpose. A two-address instruction specifies an operation (employing an opcode) on some data, which may be located either in a register or in memory. Two-address instructions specify the address of a memory location, either as a destination or as the source. These instructions have two Address fields: one is A constant that specifies an operand in memory, while the other is a general-purpose register or immediate value. The assembler automatically calculates the offset that considers any relevant addressing modes, such as indirect.

Conclusion

One address instructions save space and add clarity. The code gets more compact and easier to read. With one operand in the accumulator, there is no need to specify which operand it is, so it takes less space to write it. The programmer saves space which is further reduced by eliminating brackets and other symbols used to identify registers and memory locations. This results in bigger paychecks for people who write compilers, interpreters, or even larger per capita income for the nation if many people are employed to write programs (let’s not get carried away right now, but this may be true).

faq

Frequently asked questions

Get answers to the most common queries related to the NTA Examination Preparation.

Define 1-address instructions?

Ans. The One-Address Instruction format provides for a single instruction execution cycle. This is accomplished by a...Read full

Define 2-address instruction?

Ans. Two-address instructions are a format of machine instruction in which one operand is a destination, and the oth...Read full

Write an example for one address instructions?

Ans. LOAD A AC = M[A] ...Read full

What is the instruction format?

Ans. A field is a group of bits with different significance used at different places. Every field contains some info...Read full