Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

Instruction and its Type in Computer Architecture Based Study Material to gate Computer Science Exam

Author: Manoj Kumar
by Manoj Kumar
Posted: Sep 11, 2017

Objective of this gate study material for computer science is to understand the concepts of instructions and its types. Instructions are the commands given to the computer to perform a task. Computer instructions are some time also known as machine instruction. Machine Instructions are commands or programs written in machine code of a machine (computer) that it can recognize and execute the machine instruction.

In general an instruction has the following features:

a) A machine instruction consists of several bytes in memory. This part of instruction is known asopcode that tells the processor about the operation to be performed.

b) A special register "program counter" holds the address of next instruction to be execute. The processor looks at machine instructions in main memory one after another, and performs one machine operation for each machine instruction.

c) Set of instruction in main memory is known as Instruction Set of simply program. Machine code or machine language is a set of instructions executed directly by a computer’s central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.

Example:

MOV R5,#25H

In the given instruction we are loading the value 25 in register R5.

Types of instruction: Sometime in gate exam several questions are asked from the this section. Generally in exam for a given expression we have to write the program in machine language. To

write that program it is necessary that we have knowledge about different types of instruction. In this gate study material for computer science here we are telling about different types of instruction.

1. Data transfer instructions: Data transfer instructions are basically used to move the data from memory to register, register to memory and register to register. Move, load, exchange, input, output are some example of data transfer instructions.

? MOV :Move byte or word to register or memory.

? IN, OUT: Input byte or word from port, output word to port.

? LEA: Load effective address

? LDS, LES Load pointer using data segment, extra segment.

? PUSH, POP: Push word onto stack, pop word off stack.

? XCHG: Exchange byte or word.

? XLAT: Translate byte using look-up table.

2. Arithmetic instructions – These instruction are used to perform arithmetic operation like add, subtract, increment, decrement, convert byte/word and compare.

? ADD, SUB: Add, subtract byte or word

? ADC, SBB :Add, subtract byte or word and carry (borrow).

? INC, DEC: Increment, decrement byte or word.

? NEG: Negate byte or word (two’s complement).

? CMP: Compare byte or word (subtract without storing).

? MUL, DIV: Multiply, divide byte or word (unsigned).

? IMUL, IDIV: Integer multiply, divide byte or word (signed)

? CBW, CWD: Convert byte to word, word to double word

? AAA, AAS, AAM,AAD: ASCII adjust for add, sub, mul, div.

? DAA, DAS: Decimal adjust for addition, subtraction (BCD numbers)

3. Logic instructions – These Instruction are used to perform Bitwise AND, OR, exclusive OR,shift/rotate operation.

? NOT : Logical NOT of byte or word (one’s complement)

? AND: Logical AND of byte or word

? OR: Logical OR of byte or word.

? XOR: Logical exclusive-OR of byte or word

? TEST: Test byte or word (AND without storing).

? Shift, rotate instruction- SHL, SHR Logical shift left, right byte or word? by 1or CL

? SAL, SAR Arithmetic shift left, right byte or word? by 1 or CL

? ROL, ROR Rotate left, right byte or word? by 1 or CL.

? RCL, RCR Rotate left, right through carry byte or word? by 1 or CL.

4. Control transfer instructions – conditional, unconditional, call subroutine and return from subroutine.

? JMP:Unconditional jump.it includes loop transfer and subroutine and interrupt instructions.

5. Loop control instructions-

? LOOP: Loop unconditional, count in CX, short jump to target address.

? LOOPE (LOOPZ): Loop if equal (zero), count in CX, short jump to target address.

? LOOPNE (LOOPNZ): Loop if not equal (not zero), count in CX, short jump to target address.

? JCXZ: Jump if CX equals zero (used to skip code in loop).

? Subroutine and Intrrupt instructions-

? CALL, RET: Call, return from procedure (inside or outside current segment).

? INT, INTO: Software interrupt, interrupt if overflow. IRET: Return from interrupt.

About the Author

Author is a professional technical trainer, technical content writer in the field of Computer Science and Engineering. He loves to read and writes the content on the topic to be asked in Gate Computer Science Exam.

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: Manoj Kumar

Manoj Kumar

Member since: Sep 11, 2017
Published articles: 2

Related Articles