Table of contents
1.
Introduction
2.
Types of Basic Computer Instructions
2.1.
Memory Reference Instruction
2.2.
Register Reference Instruction
2.3.
Input/Output Instruction
3.
Frequently Asked Questions
3.1.
What is an Instruction and Its Types?
3.2.
What Are the Instruction Sets of a Computer?
3.3.
What is Instruction Format?
3.4.
What is the need of using various types of instructions in computer architecture?
4.
Conclusion
Last Updated: Jul 25, 2024
Medium

Computer Instructions

Author Urwashi Priya
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Instructions are the order which is given by the user to the computer to perform some specific function desired. Mostly the codes of the instruction are written in binary language, i.e: 0’s and 1’s. ADD, JUMP, LOAD, etc are some of the instructions used in processors.

INSTRUCTIONS TYPES

In this blog, we will discuss the Instructions Types. They are classified into three types:

  1. Memory reference instruction
  2. Register reference instruction
  3. Input Output instruction 
Instructions

Types of Basic Computer Instructions

Memory Reference Instruction

These instructions are mainly used to perform operations on operands that are located in memory.

From bit 0 to bit 11, represent the address field that specifies the operand's address. From bit 12 to bit 14 represent the opcode field which consists of 7 operations as 3 bits are used to specify it. The 15th bit specifies the indirect bit. If I=0, this means direct address and I = 1 means indirect address. (figure a).

Below are the memory reference instructions.

Instruction I=0 I=1 Description
AND 0XXX 8XXX Performs AND operation between memory and accumulator.
ADD 1XXX 9XXX Performs add operation between memory and accumulator.
LDA 2XXX AXXX Load accumulator in memory
STA 3XXX BXXX Store accumulator in memory
BUN 4XXX CXXX Branch unconditionally
BSA 5XXX DXXX Branch and save return address
INC 6XXX EXXX Increment 

Address is written in hexadecimal notation.

Memory Refrence Instructions

AND instruction is executed when decoder output is D0 and timing signal is T4.

To perform AND operation, we transfer the memory content to the data register, and in the next clock, the operation is performed on the data register and accumulator.

D0T4: DR←M[AR]

D0T5: AC Ʌ DR, SC←0

ADD instruction is executed when decoder output is D0 and timing signal is T5.

To perform ADD operation, we transfer the memory content to the data register, and in the next clock, the operation is performed on the data register and accumulator.

D1T4: DR←M[AR]

D1T5: AC ← AC+DR, E←Cout, SC←0

LDA instruction is executed when decoder output is D2 and timing signal is T4.

To perform the LDA operation, we transfer the content of memory to the data register, and in the next clock, the contents of the data register are transferred to the accumulator.

D2T4: DR←M[AR]

D2T5: AC ← DR, SC←0

STA instruction is executed when decoder output is D3 and timing signal is T4.

To perform the STA operation, we transfer the content of the accumulator to memory.

D3T4: M[AR]←AC, SC←0

BUN instruction is executed when decoder output is D4 and timing signal is T4.

To perform the BUN operation, we transfer the content of the address register to the program counter.

D4T4: PC←AR, SC←0

BSA instruction is executed when decoder output is D5 and timing signal is T4.

To perform the BSA operation, we transfer the program counter to memory. Increase the value of the address register. Load address register to program counter.

D5T4: M[AR]←PC, AR←AR+1

D5T5: PC←AR

Read About - Shift Registers in Digital Electronics

Register Reference Instruction

These instructions are mainly used to perform operations on registers. Operands are not required here.

From bit 0 to bit 11 specifies register operation. Here opcode value always remains 111, and the value of the indirect bit is always 0. (figure b).

Register reference instructions are executed when decoder output is D7 and timing signal outputs T3.

 

Instructions

Input/Output Instruction

These instructions are mainly used to perform operations on input and output related registers.

From bit 0 to bit 11 specifies input output operation. Here opcode value always remains 111 and value of indirect bit is always 1. (figure c)

Whenever we type any character with the help of keyboard then, the transmitted interface transmits that character to a input register, called as INPR. An input flag called as FGI is maintained. If a character is contained then FGI=1 else 0. Next input register passes the character to the accumulator. Output register receives the information from the accumulator. At output register, an output flag called FGO is maintained. Initia value of FGO is 1. If output register contains a character, then FGO will be set to 0. We have receiver interface which receives the character from output register and provides it to the monitor. In this way, transmission is done.

Input-Output Instructions

Read about Instruction Format in Computer Architecture

Frequently Asked Questions

What is an Instruction and Its Types?

An instruction is a command given to a computer to perform a specific task. It can be broadly categorized into data movement, arithmetic/logical operations, control flow, and input/output operations.

What Are the Instruction Sets of a Computer?

Instruction sets are collections of commands understood by a CPU. They include arithmetic, logical, control, and data movement operations. Each CPU architecture has its own unique set of instructions.

What is Instruction Format?

Instruction format defines the structure of machine instructions. It typically includes fields for opcode (operation code), operands (data on which the operation acts), and sometimes addressing modes for effective execution by the CPU.

What is the need of using various types of instructions in computer architecture?

To perform coprocessor instruction, control flow operation, arithmetic and logic operation, data handling and memory operations concurrently, and properly we need to classify various instruction format.

Conclusion

In this article, we have discussed instructions types. Computer instructions form the fundamental language that enables CPUs to execute tasks. Understanding their types, sets, and formats provides insight into how computers process information efficiently and perform a wide range of functions essential to modern computing. 

If you want to test your competency in coding, you may check out the Mock Test Series and participate in the Contests organized on Coding Ninjas Studio! But if you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc; you must look at the Problems, Interview Experiences, and Interview Bundle for placement preparations.

Nevertheless, you may consider our Courses to give your career an edge over others!

Do upvote our blog to help other ninjas grow. 

Happy Coding!    

Live masterclass