Skip to content
Sahithyan's S1
1
Sahithyan's S1 — Programming Fundamentals

CPU Instructions

The set of operations a CPU can perform. Varies with each CPU. Most operations fall into 4 categories.

Moves data from one place to another.

Examples:

  • LOAD: Read data into CPU from memory or IO
  • STORE: Write data from CPU to memory or IO

Examples:

  • ADD: Adds 2 values

Examples:

  • COMP: Compare 2 values

Examples:

  • JUMP: Jump to a program address
  • JUMPZ: Jump to a program address only if the last operation had a zero value
  • JUMPNZ: Jump to a program address only if the last operation had a non-zero value
  • NOP: Do nothing but spend some CPU time
    Used to keep the CPU idle while waiting for some data.

A coded value which tells what the instruction is supposed to do. Examples are mentioned above such as ADD and COMP.

Number and type of operations depend on the OpCode. Sometimes optional.

Can either be a:

  • Value
  • Memory address

A program is executed as a series of steps, which are called sub-cycles.

An instruction is loaded into the CPU from memory. A memory read cycle is executed. Common for all instruction.

Handled by CU. Binary pattern of the instruction and what action to take is decided. Common for all instruction.

If the operation requires operand(s), they are read from memory. Depends on the operation. Optional for some operations.

CU executes the instruction. CPU generates the signal for its internal circuits to carry out the operation. Depends on the operation.