Open In App

Machine Instructions

Machine Instructions are commands or programs written in the machine code of a machine (computer) that it can recognize and execute. A machine instruction consists of several bytes in memory that tell the processor to perform one machine operation.

The processor looks at machine instructions in main memory one after another and performs one machine operation for each machine instruction. A machine language program is the collection of machine instructions in the main memory.



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. The general format of a machine instruction is

A machine language program is the collection of machine instructions in the main memory.

Example:



Here: MOV R5,#25H;load 25H into R5

Machine Instructions Used in 8086 Microprocessor

1. Data transfer instructions– move, load exchange, input, output.

2. Arithmetic instructions – add, subtract, increment, decrement, convert byte/word and compare.

3. Logic instructions

– AND, OR, exclusive OR, shift/rotate and test

4. String manipulation instruction – load, store, move, compare and scan for byte/word

5. Control transfer instructions

– conditional, unconditional, call subroutine and return from subroutine.

 6. Loop control instructions-

7. Processor control instructions-

Flag manipulation:

Sample GATE Question

Q.1: Consider the sequence of machine instructions given below: [GATE CSE 2015]

  MUL R5, R0, R1
  DIV R6, R2, R3
  ADD R7, R5, R6
  SUB R8, R7, R4

In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the Result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________

(A) 11

(B) 12

(C) 13

(D)14

Solution: Correct Answer is (C).

Explanation:

 1   2   3   4   5   6   7   8   9   10   11   12   13
  IF  OF  PO  PO  PO  WB
      IF  OF          PO  PO  PO  PO  PO   WB
          IF          OF                   PO   WB
              IF          OF                    PO   WB

FAQs on Machine Instructions

Q.1: What is termed as Opcode in Machine Instructions?

Answer:

Opcode (Operation Code) specifies the operation or action to be performed, such as addition or subtraction. It is a part of machine instruction.

Q.2: How machine instructions are executed by CPU?

Answer:

Machine Instructions are executed by CPU in following manner: CPU fetches, decodes, and executes machine instructions sequentially from memory as part of its instruction cycle.


Article Tags :