CAO ppt (1)
CAO ppt (1)
Supervised By
Daw Nu Nu Hlaing
GROUP MEMBERS
Machine instructions are the fundamental commands that a computer's processor can understand and
execute. These instructions are written in binary code, which is directly interpreted by the hardware.
Machine instructions serve as the lowest-level language that bridges the gap between high-level
programming languages and the physical hardware. Understanding the characteristics of machine
instructions is crucial in computer architecture and systems programming, as it provides insight into how
processors execute tasks efficiently.
Machine Instruction Characteristics
▪ Performance – Measured by speed (clock cycles, FLOPS, MIPS).
❖ Memory Organization – Hierarchical structure (Registers, Cache, RAM, ROM, Secondary Storage).
Opcodes (mnemonics):
• ADD — Add
• SUB — Subtract
• MUL — Multiply
• DIV — Divide
• LOAD — Load data from memory
• STOR — Store data to memory
❖ Logical Instructions: These perform logical operations, such as AND, OR, XOR, and
NOT. Examples include AND, OR, XOR.
❖ Data Transfer Instructions: These move data between registers, memory, and I/O devices.
Examples include MOV, PUSH, POP, LOAD, STORE. 4. Control Flow Instructions:
These alter the flow of execution based on conditions or unconditionally. Examples
include JUMP, CALL, RET, BRANCH, and conditional jumps like JZ (jump if zero).
Instruction Types (cont’d)
❖ Comparison Instructions: These compare two values and set flags based on the result (e.g., CMP, TEST).
❖ Input/Output Instructions: These are used to interact with external devices (e.g., IN, OUT, READ,
WRITE).
❖ Shift and Rotate Instructions:These manipulate data by shifting or rotating bits in a register. Examples
include SHL (shift left), SHR (shift right), ROL (rotate left), and ROR (rotate right).
❖ System Control Instructions: These manage the system's operation, such as halting execution, switching
modes, or handling exceptions. Examples include HALT, NOP (no operation), and INT (interrupt).
Unary (1 operand)
Binary (2 operands)
For an instruction to execute properly, it may need:
1.Three-Address Instructions
Two source operands
One destination operand
Example: ADD R1, R2, R3,this means R1 = R2 + R3
Requires more memory per instruction but reduces the number of instructions needed.
2.Two-Address Instructions
One operand acts as both a source and destination.
Example: ADD R1, R2,this means R1 = R1 + R2
Saves space but requires additional instructions for some operations.
3.One-Address Instructions
Uses an implicit accumulator register.
Example: LOAD A : AC = A
ADD : AC = AC + B
STORE C : C = AC , Simple but leads to more instructions in complex calculations.
4. Zero-Address Instructions
Used in stack-based architectures where all operations are performed on the stack. Operands are retrieved from
the stack and processed without relying on memory or registers.
Register Addressing Vs Memory Addressing
Register Addressing
Memory Addressing
❖ Instruction Format Defines instruction length, address count, and field structure.
❖ RISC (Reduced Instruction Set Computing) Fewer, simpler instructions for efficiency.
❖ Significance: Proper instruction set design ensures optimized performance, power efficiency, and compatibility
in modern processors.