Presentation 2
Presentation 2
Instructions tell the computer what actions to Instructions are executed in a specific order,
perform, like moving data, performing arithmetic dictated by the program's logic, ensuring the
operations, or making decisions. computer performs the desired sequence of steps.
Essential Instruction
Types: The Building Blocks
3 Control Flow
Low-Level Human-Readable
A single operand is specified, typically Two operands are specified, often Three operands are specified, enabling
residing in a register. This simplifies residing in registers or memory operations involving multiple data
instruction format but might require locations. This allows more complex sources. This enhances flexibility and
multiple instructions for complex operations in a single instruction, reduces the number of temporary
operations. improving efficiency. storage locations needed.
ADD R1, #5 ; Add 5 to register R1 ADD R1, R2 ; Add the contents of ADD R3, R1, R2 ; Add the contents
R2 to R1, storing the result in R1 of R1 and R2, storing the result in
R3
Instruction Types: Loading, Storing, Arithmetic,
and Movement
1 Fetch
2 Decode
3 Execute
4 Store
Flexibility
Looping
The "branch target" is the specific instruction address or memory location that the program jumps to
when a conditional jump is taken. This target instruction will be executed next instead of the subsequent
sequential instruction.
Precisely defining the branch target is crucial for the correct execution of branched code.
Branching, using conditional jumps and branch targets, allows for loops (repeating code blocks until a
condition is met), significantly impacting program efficiency and dynamism.
Condition Code Flags: Capturing Results
1 2
Zero Negative
Indicates if the result of the previous operation was zero. Indicates if the result of the previous operation was negative.
3 4
Carry Overflow
Indicates if a carry occurred during the previous operation (often Indicates if the result of the previous operation exceeded the
relevant for unsigned arithmetic). maximum value representable by the register (often relevant for
signed arithmetic).
Conclusion