Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE) PDF Download

Instruction Formats
The computer can be used to perform a specific task, only by specifying the necessary steps to complete the task. The collection of such ordered steps forms a ‘program’ of a computer. These ordered steps are the instructions. Computer instructions are stored in central memory locations and are executed sequentially one at a time. The control reads an instruction from a specific address in memory and executes it. It then continues by reading the next instruction in sequence and executes it until the completion of the program.

A computer usually has a variety of Instruction Code Formats. It is the function of the control unit within the CPU to interpret each instruction code and provide the necessary control functions needed to process the instruction. An n bit instruction that k bits in the address field and m bits in the operation code field come addressed 2k location directly and specify 2m different operation.

  • The bits of the instruction are divided into groups called fields.
  • The most common fields in instruction formats are:
    • An Operation code field that specifies the operation to be performed.
    • An Address field that designates a memory address or a processor register.
    • A Mode field that specifies the way the operand or the effective address is determined.

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

The operation code field (Opcode) of an instruction is a group of bits that define various processor operations such as add, subtract, complement, shift etcetera. The bits that define the mode field of an instruction code specify a variety of alternatives for choosing the operands from the given address. Operation specified by an instruction is executed on some data stored in the processor register or in the memory location. Operands residing in memory are specified by their memory address. Operands residing in processor register are specified with a register address.

Question for Instruction Formats
Try yourself:
Which field in an instruction format specifies the operation to be performed?
View Solution

Types of Instruction

  • Computers may have instructions of several different lengths containing varying number of addresses.
  • The number of address fields in the instruction format of a computer depends on the internal organization of its registers.
  • Most computers fall into one of 3 types of CPU organizations

 Single accumulator organization:- All the operations are performed with an accumulator register. The instruction format in this type of computer uses one address field. For example: ADD X, where X is the address of the operands .

General register organization:- The instruction format in this type of computer needs three register address fields. For example: ADD R1,R2,R3

Stack organization:- The instruction in a stack computer consists of an operation code with no address field. This operation has the effect of popping the 2 top numbers from the stack, operating the numbers and pushing the sum into the stack. For example: ADD

Computers may have instructions of several different lengths containing varying number of addresses. Following are the types of instructions.

1. Three address Instruction With this type of instruction, each instruction specifies two operand location and a result location. A temporary location T is used to store some intermediate result so as not to alter any of the operand location. The three address instruction format requires a very complex design to hold the three address references.
Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

  • ADVANTAGE: It results in short programs when evaluating arithmetic expressions.
  • DISADVANTAGE: The instructions requires too many bits to specify 3 addresses.

2. Two address instruction
Two-address instructions are the most common in commercial computers. Here again each address field can specify either a processor register, or a memory word. One address must do double duty as both operand and result. The two address instruction format reduces the space requirement. To avoid altering the value of an operand, a MOV instruction is used to move one of the values to a result or temporary location T, before performing the operation.
Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

3. One address Instruction 
It was generally used in earlier machine with the implied address been a CPU register known as accumulator. The accumulator contains one of the operand and is used to store the result. One-address instruction uses an implied accumulator (Ac) register for all data manipulation. All operations are done between the AC register and a memory operand.
We use LOAD and STORE instruction for transfer to and from memory and Ac register.
Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Question for Instruction Formats
Try yourself:
What is the instruction format used in a single accumulator organization computer?
View Solution

4. Zero address Instruction
It does not use address field for the instruction like ADD, SUB, MUL, DIV etc. The PUSH and POP instructions, however, need an address field to specify the operand that communicates with the stack. The name “Zero” address is given because of the absence of an address field in the computational instruction.
Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Example: To illustrate the influence of the number of address on computer programs, we will evaluate the arithmetic statement X=(A+B)*(C+D) using Zero, one, two, or three address instructions.

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

It is assumed that the computer has two processor registers R1 and R2. The symbol M[A] denotes the operand at memory address symbolized by A.

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

Here, T is the temporary memory location required for storing the intermediate result.

 Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

The document Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Computer Architecture & Organisation (CAO).
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
20 videos|86 docs|48 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Instruction Formats - Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

1. What are the different types of instruction formats?
Ans. There are mainly three types of instruction formats: 1. Register-based: In this format, the instruction specifies one or more registers as operands. 2. Immediate: In this format, the instruction specifies a constant value as an operand. 3. Memory-based: In this format, the instruction specifies a memory address as an operand.
2. What is the purpose of an instruction format?
Ans. The purpose of an instruction format is to define how the instruction is represented in the machine language. It specifies the number and types of operands, the opcode, and the order in which the operands appear. The instruction format is essential for the processor to decode and execute the instruction.
3. What is the difference between RISC and CISC instruction formats?
Ans. RISC (Reduced Instruction Set Computing) and CISC (Complex Instruction Set Computing) are two different types of instruction formats. RISC uses a small set of simple instructions, each of which can be executed in a single clock cycle. CISC, on the other hand, uses a large set of complex instructions that can take multiple clock cycles to execute. RISC instruction formats are simpler and more efficient, while CISC instruction formats are more powerful and flexible.
4. How are instruction formats related to CPU performance?
Ans. The instruction format has a significant impact on CPU performance. A simpler instruction format means that the CPU can decode and execute instructions more quickly, which results in faster overall performance. On the other hand, a more complex instruction format can slow down the CPU, as it takes more time to decode and execute each instruction.
5. Can instruction formats be changed or updated?
Ans. Instruction formats are typically fixed and cannot be easily changed or updated. Any change to the instruction format would require a significant redesign of the CPU architecture, which is not practical. However, new instructions can be added to the existing instruction set to provide additional functionality without changing the existing instruction format. This is known as instruction set extension.
20 videos|86 docs|48 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Objective type Questions

,

past year papers

,

mock tests for examination

,

Sample Paper

,

MCQs

,

Exam

,

pdf

,

practice quizzes

,

video lectures

,

Previous Year Questions with Solutions

,

Semester Notes

,

Important questions

,

Viva Questions

,

shortcuts and tricks

,

Free

,

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

,

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

,

study material

,

Instruction Formats | Computer Architecture & Organisation (CAO) - Computer Science Engineering (CSE)

,

Summary

,

Extra Questions

,

ppt

;