Instruction set

Comprehensive study notes, diagrams, and exam preparation for Instruction set.

Instruction Set

Definition

An instruction set is a fundamental collection of commands that a Central Processing Unit (CPU) understands and can execute. It serves as the interface between the software (the programs written by humans) and the hardware (the electronic circuits of the computer), defining all the operations the processor can perform.


Main Content

1. Classification of Architectures (CISC vs. RISC)

  • CISC (Complex Instruction Set Computer): Designed to complete complex tasks with a single instruction. It emphasizes hardware efficiency, meaning the CPU performs many micro-operations to execute one instruction. Example: Intel x86 processors.
  • RISC (Reduced Instruction Set Computer): Focuses on a smaller, highly optimized set of instructions. Each instruction performs a simple operation, allowing the CPU to execute them very quickly (usually in one clock cycle). Example: ARM processors used in smartphones.

2. Instruction Format

  • Opcode (Operation Code): The specific part of the instruction that tells the CPU which operation to perform, such as ADD, SUB, or LOAD.
  • Operands: The data or memory addresses upon which the operation is performed. An instruction may have zero, one, two, or three operands depending on the architecture.

3. Types of Instructions

  • Data Transfer: Instructions that move data between registers, memory, and I/O devices (e.g., MOV, PUSH, POP).
  • Arithmetic and Logical: Instructions that perform mathematical calculations (ADD, MUL) or logical comparisons (AND, OR, NOT).
  • Control Flow: Instructions that change the sequence of execution, such as jumps, branches, and calls (e.g., JMP, CALL, RET).

Working / Process

1. Fetching

  • The CPU fetches the instruction from the main memory (RAM) based on the address stored in the Program Counter (PC).
  • The instruction is transferred into the Instruction Register (IR) for processing.

2. Decoding

  • The Control Unit analyzes the opcode to determine what operation is required.
  • It translates the instruction into control signals that prepare the necessary internal components (like the ALU or specific registers).

3. Execution

  • The CPU performs the actual operation requested by the instruction.
  • The results are stored back into the appropriate registers or written to memory.
[PC] --> [Memory] --> [Instruction Register]
                            |
                     [Control Unit]
                            |
                   [ALU / Data Path]

Advantages / Applications

  • Hardware abstraction: Allows programmers to write software without needing to know the complex physical wiring of the CPU.
  • Performance optimization: Different instruction sets are optimized for specific tasks, such as low-power mobile computing (ARM) or high-performance desktop computing (x86).
  • Software Compatibility: Standardized instruction sets enable different compilers and operating systems to run on the same hardware architecture.

Summary

The instruction set is the vital bridge that allows software to communicate with computer hardware by providing a list of actionable commands. It dictates the CPU's capability, speed, and efficiency through either complex or simplified command structures.

  • Key point 1: Instruction sets define the vocabulary of a processor.
  • Key point 2: The process follows a Fetch-Decode-Execute cycle.
  • Key point 3: Architectures vary between RISC (simple) and CISC (complex).
  • Important terms to remember: Opcode, Operand, Program Counter, ALU, Register, Micro-operations.