Instruction sets

Instructions are decoded as a set of sequenced operations. These operations instruct the ALU and control unit inside the CPU.

curriculum-key-fact
Operations consist of a set of instructions and data. Operations are made up of opcodes and operands. The opcode performs an action on an operand.

Opcode

The opcode tells the processor the job that needs to be done. A simple operation might be 'add' or 'subtract'. If we use the analogy of a recipe, the opcode might be 'chop' or 'mix'.

Each opcode instruction is very limited in what it can tell the processor to do. A CPU's instruction set contains the opcodes that it will accept.

There are two types of opcode:

  • an opcode that tells the circuitry which operation to carry out
  • an opcode along with some data to be processed

Operand

The operand specifies the data that needs to be acted on. The operand can also refer to a place in memory, such as a register.

If we use the analogy of a recipe, an ingredient (eg an onion) is the thing being acted upon by the opcode. So the opcode 'chop' could act on the operand 'onion'. If the operand refers to a place in memory, this could be seen as the 'chopping board'. The operand (data) 'onion' could be in the memory location 'chopping board'. The instruction could be to chop the onion on the chopping board.