NTA UGC NET 2023 » NTA Study Materials » Computer Science » Machine Instruction: Types and More

Machine Instruction: Types and More

Types of machine instruction are commands or a program written in the machine code of a machine (computer) that it recognizes and executes. It is a series of bytes.

For computer micro-operations, a binary code is used. The machine code recognizes and executes commands and programs written in its machine code. A machine instruction is a simple program instruction in binary form. It comprises several bytes in memory that tells the processor how to perform one machine operation. The microprocessor decodes and executes  Types of machine instruction without further processing. In each instruction, a specific task is performed on a data unit in a CPU register or memory, such as a load, a jump, or an ALU operation. A CPU directly executes a program made up of such instructions.

Machine Instruction Definition

The CPU is instructed to perform a specific operation using a group of bits. This is called binary instruction coding.

An operation code is associated with each instruction code, which identifies the overall purpose of the Types of machine instruction. How many instructions the architecture can depend on the number of bits allocated for the opcode. Instruction sets are groups of machine language commands for a CPU—a subset of instructions designed to enhance the performance of a machine depending on the situation. The central processing unit (CPU) follows an instruction cycle from boot-up until the computer has shut down, also known as the fetch-decode-execute cycle. This is all about the machine instruction definition.

Machine Instruction Format – Types

Instructive codes include operands that are used in conjunction with these operation codes. Instruction formats support bit-based instruction design. Operands, addressing mode, and opcode fields are contained in the instruction. The Types of machine instruction lengths are usually expressed in multiples of 8 bits, a character length. When the instruction length is permanent, several bits are assigned to opcodes, operands, and addressing modes. The following elements can be interpreted as the function of allocating bits in the instruction: −

Amount of modes of addressing:

  • Operand number

  • Register count

  • Sets of registers

  • Lines of addresses

Intel’s most outstanding microprocessors use the IA-32 instruction format. This instruction format will find four fields, including opcodes, addressing modes, displacements, and immediate. Each opcode field contains one or two bytes. There is also an addressing mode field. If only one register is used to generate the effective address of an operand, an Type of machine instruction only needs one byte in the addressing mode field. Next comes the displacement field. When the displacement value is used to compute an effective address for a memory operand, it uses either one or four bytes to encode it. Operands located in the immediate field appear either one or four bytes thick. The most common address-instruction formats are three-, two-, one-, and zero-address-instruction.

Machine Instruction Types

Based on the type of data transfer instruction, the data manipulation instruction and the program control instruction, Types of machine instruction are grouped into three groups. The categories are:

Data Transfer Instructions

Transfer instructions allow data to be transferred from one place to another without altering its content. A shared transfer may occur between the memory and processor registers or between the processor registers and input/output.

LOAD:  Transfer of data from memory into the register.

IN:  Receives data from an input device.

MOVE:  Data transfer between registers.

OUT:  Outputs data from the register.

PUSH:  Pushes data from a register towards the top of the stack.

STORE:  Transfer of data from the register to the memory.

POP:  Fetches top data from register or stack memory.

XCHG:  Transfers information between registers and memory.

Instructions for Data Manipulation

The Data manipulation elements of machine instruction

Arithmetic Instructions 

Calculated by adding, subtracting, multiplying, dividing, incrementing and decrementing. 

For instance, ADD, INC, MUL, DEC, SUB, DIV, etc.

Logical and Arithmetic Instructions

The function performs arithmetic + shift left and arithmetic + shift right. 

Logical Instructions

Bit-wise operations like AND, NOT, Exclusive-OR, OR, shift, and rotate are performed. 

Example: NOT, AND, ROL,  XOR, OR, SHL, ROR SHR, etc.

Instructions for Program Control 

A program control instruction specifies a condition that affects the program counter, while a data transfer and manipulation Type of machine instruction specifies a condition for data processing operations. A program counter’s value can change over time. 

A break in the instruction execution sequence occurs when a program control instruction is executed.

Examples: 

Name

Mnemonic

BRANCH

BR

SKIP

SKP

CALL

CALL

TEST

TST

Program Interrupt

Interrupts are used to solve problems that occur outside of normal program sequences. When an external or internal element of machine instruction is generated, a program interrupt is used to transfer program control from one service program to another.

After the service program is executed, control returns to the original program. There are two types of interrupts: maskable interrupts and non-maskable interrupts.

Depending on the device, there can be external, internal, or software interrupts. 

Conclusion

Addressing modes describes how the operand of a type of machine instruction is specified—addressing mode specifies how to interpret or modify an instruction’s address field before the operand is executed. Memory-based addressing modes and transfer control addressing modes are two types of addressing modes. These instructions make up every program directly executed by a CPU. A machine instruction is generally formatted as follows. A Label identifies an instruction by assigning the address of the first byte of that instruction. It is followed by “:”.

faq

Frequently asked questions

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

How do interrupts of machine instruction define?

Ans. There are two types of interrupts based on masking and devices. In addition to massed interrupts, there are non...Read full

Can deep learning and machine learning be applied to AI and Big Data?

Ans. Models are built to make decisions in AI, ML, and DL. In addition to model building, data science involves the ...Read full

Which addressing modes do you use?

Ans. Generally, register-based addressing relies on registers and content contained in those registers, whether it i...Read full

How does direct addressing work?

Ans. This mode is called absolute addressing or direct addressing. An instruction here includes the address of the m...Read full

What is said to be data manipulation?

Ans. An example of data manipulation is changing data in order to make it easier to read or more organised. An alph...Read full