Machine Instructions
Unique OPcode
Operation |
OPcode |
Addition |
000 |
Subtraction |
001 |
Multiplication |
010 |
Division |
011 |
Module |
100 |
Complement |
101 |
Bitwise AND |
110 |
Bitwise OR |
111 |
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.
0 Comments