Machine Instructions are commands or programs written in machine code of a machine (computer) that it can recognize and execute.
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
Example:
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:
Ques .1. Consider the sequence of machine instructions given below:
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
Ans: c
Solution:
CALL instruction is used to call a subroutine. Subroutines are often used to perform tasks that need to be performed frequently. The JMP instruction is used to cause the PLC (Programmable Logic Control) to skip over rungs.
The differences Between CALL and JUMP instructions are:
20 videos|86 docs|48 tests
|
1. What are machine instructions in computer science engineering? |
2. How are machine instructions different from high-level programming languages? |
3. What is the role of machine instructions in computer architecture? |
4. How are machine instructions executed by the CPU? |
5. Can machine instructions be directly understood by humans? |
20 videos|86 docs|48 tests
|
|
Explore Courses for Computer Science Engineering (CSE) exam
|