Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Machine Instructions

Machine Instructions

Machine Instructions


A CPU is a semiconductor integrated circuit chip that contains a large number of transistors. In personal computers, CPU is also known as microprocessor. Each CPU is capable of executing certain instructions (known as machine instructions). Modern CPUs have built-in logic to execute 400–550 machine instructions. Machine instructions represent the processing capability of a CPU. Each processor is capable of performing certain functions. An instruction represents a function that can be directly executed by the processor. Complete instructions that can be directly executed by the processor through the logic in the hardware make up the processor's instruction set. An instruction tells the processor what task to perform and what micro-operations to complete to complete the task. Each instruction must execute a set of arithmetic and logical operations (micro-operations). The size and shape of instructions varies with different processors.

Each instruction consists of two parts: opcode and operand. The opcode specifies which operation to perform, and the operand provides the operation data. To understand the concept of instruction more clearly, let us take a simple hypothetical computer that is capable of performing eight different operations. Each function is represented by a unique opcode.

Unique OPcode

Operation

OPcode

Addition

000

Subtraction

001

Multiplication

010

Division

011

Module

100

Complement

101

Bitwise AND

110

Bitwise OR

111


Suppose our computer can process only two-digit decimal numbers, that is, there can be at most two operands, each containing at most two digits. Thus the computer can add or subtract a maximum of two digit numbers. So a simple instruction can be written as a combination of opcode and associated functions. An opcode is represented by its unique binary code. Operands are decimal digits, so they must also be converted to binary code to pass them to the processor as operands. Suppose BCD code is used to represent operations. Some examples of valid instructions in the app include:

Instruction.                                   Effect

0001001001100100101              93 + 25

10110000101.                           Complement 85

0110010010100000101.             25 / 05


In the first instruction, the first three bits represent the opcode and the remaining sixteen bits represent a two-digit decimal number expressed using BCD notation. The opcode for addition is 000 and the BCD codes for 9,3,2 and 5 are 1001, 0011, 0010 and 0101 respectively as described in the table. Thus the instruction 0001001001100100101 represents 93 + 25. Similarly, in the second instruction, the first three bits represent the opcode and the remaining eight bits represent the movement to perform the operation. However, this is the case of a very simple hypothetical computer. Real-world processors are more complex and are capable of executing more than 500 machine instructions. And they can carry out their tasks in several ways: directly, from registers, from memory, etc. Also, modern processors can perform calculations on large numbers. So an instruction on a modern CPU can easily contain more than 50 bits.


Executing a machine instruction in a modern processor involves a complex set of operations consisting of many cycles. An instruction cycle typically includes a fetch, encode, execute, and write cycle. Instructions are retrieved from memory during the fetch cycle. During the decode cycle, the instruction is processed by the CPU's control unit, which generates a set of micro-operations and timing signals necessary to execute the instruction. Micro-operations are then executed during the execute cycle to complete the instruction and any results are written to memory during the write cycle. An instruction cycle may also contain one or more execute and fetch cycles. The control unit is responsible for the coordination of the overall control and instruction function. It performs a set of micro-operations with the help of hard-wired logic or microprogram sequencer.


Post a Comment

0 Comments