Instruction Set Notes
Machine Instruction Characteristics
The processor's operation is determined by machine instructions. The instruction set is the collection of instructions a processor can execute.
Elements of a Machine Instruction
Each instruction contains information for execution:
Operation code (Opcode): Specifies the operation (e.g., ADD, I/O) using a binary code.
Source operand reference: Input operands for the operation.
Result operand reference: Output produced by the operation.
Next instruction reference: Location of the next instruction to fetch.
Source and result operands can reside in:
Main or virtual memory: Requires memory address.
Processor register: Processor's internal registers.
Immediate: Operand value within the instruction.
I/O device: Specifies I/O module and device.
Instruction Representation
Instructions are represented by bit sequences, divided into fields. Opcodes are represented by mnemonics (e.g., ADD, SUB, MUL, DIV, LOAD, STOR).
Instruction Types
Instructions can be categorized as:
Data processing: Arithmetic and logic instructions.
Data storage: Data movement to/from memory/registers.
Data movement: I/O instructions.
Control: Test and branch instructions.
Number of Addresses
Instructions commonly have one, two, or three operand addresses. Examples:
Three-address: ,
Two-address: ,
One-address: ,
Instruction Set Design
Design considerations include:
Operation repertoire: Number and complexity of operations.
Data types: Types of data operated on.
Instruction format: Length, number of addresses, field sizes.
Registers: Number and use of processor registers.
Addressing: Modes for specifying operand addresses.
Types of Operands
Common data types:
Addresses
Numbers: Binary integer/fixed point, binary floating point, decimal.
Characters: ASCII, EBCDIC
Logical data: Bits representing true/false.
x86 and ARM Data Types
x86: 8-bit (byte), 16-bit (word), 32-bit (doubleword), 64-bit (quadword), 128-bit (double quadword).
ARM: 8-bit (byte), 16-bit (halfword), 32-bit (word), supporting unsigned and two’s complement signed integers. Floating-point arithmetic is often implemented in software.
Types of Operations
Common operation types:
Data transfer: Moving data between locations. Specifies source, destination, and data length.
Arithmetic: Add, subtract, multiply, divide, absolute, negate, increment, decrement.
Logical: AND, OR, NOT, XOR, shifts, rotates.
Conversion: Changing data format.
I/O: Input/output operations.
System control: Privileged instructions for OS use.
Transfer of control: Branch, skip, procedure call.
Transfer of Control
Branch (Jump): Changes the execution flow to a specified address. Can be conditional or unconditional.
Skip: Skips the next instruction.
Procedure Call: Invokes a self-contained program (procedure) and returns after execution.
x86 and ARM Operation Types
x86: Complex instruction set with specialized instructions, including those for procedure calls (CALL, ENTER, LEAVE, RETURN), memory management, and SIMD (MMX) for multimedia tasks.
ARM: Load/store architecture with load and store instructions for memory access. Includes branch, data-processing, multiply, parallel addition/subtraction, extend, and status register access instructions.