Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

Computer Architecture and Organisation (CAO) - Notes & all

Computer Science Engineering (CSE) : Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

The document Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev is a part of the Computer Science Engineering (CSE) Course Computer Architecture and Organisation (CAO) - Notes & all.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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.

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

  • 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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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 Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

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

 Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

Offer running on EduRev: Apply code STAYHOME200 to get INR 200 off on our premium plan EduRev Infinity!

Dynamic Test

Content Category

Related Searches

mock tests for examination

,

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

,

shortcuts and tricks

,

Free

,

Semester Notes

,

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

,

Viva Questions

,

video lectures

,

past year papers

,

Instruction Formats - Computer Organization and Architecture Computer Science Engineering (CSE) Notes | EduRev

,

study material

,

practice quizzes

,

MCQs

,

Important questions

,

Exam

,

Objective type Questions

,

Sample Paper

,

Previous Year Questions with Solutions

,

pdf

,

Summary

,

Extra Questions

,

ppt

;