Resources | Subject Notes | Computer Science
The instruction set of a computer defines the set of instructions that the central processing unit (CPU) can understand and execute. These instructions are fundamental to how a computer performs tasks, from simple arithmetic to complex data manipulation. Understanding the instruction set is crucial for comprehending how computer programs work at a low level.
The ISA is the interface between the hardware and the software. It specifies the instructions a CPU can execute, the data types it can handle, and the addressing modes it supports.
Instructions are typically represented in binary format. A typical instruction consists of an opcode (operation code) and one or more operands (data or memory addresses).
The format of an instruction can vary depending on the architecture. Common formats include:
Instructions can be broadly categorized based on their function:
Here's a simplified table illustrating some common instruction types and their potential binary representations (note: actual representations vary by architecture).
Instruction Type | Operation | Example (Simplified Binary) |
---|---|---|
Addition | Add two numbers in registers | $0001\ 0010\ 0000$ |
Subtraction | Subtract one number from another | $0010\ 0010\ 0000$ |
Data Move | Move data from memory to a register | $1010\ 0001\ 0000$ |
Jump | Unconditionally jump to a different instruction | $0000\ 0000\ 1010$ |
Conditional Jump | Jump to a different instruction based on a condition | $1011\ 0000\ 1010$ |
Addressing modes specify how the operand in an instruction is located. Common addressing modes include:
The execution of an instruction typically involves the following steps:
Registers are small, high-speed storage locations within the CPU. They are used to hold operands, addresses, and temporary results during instruction execution. Different types of registers serve specific purposes, such as:
For a deeper understanding, explore different CPU architectures (e.g., RISC vs. CISC) and specific instruction sets like x86 or ARM.