An instruction set is a group of commands for a CPU in machine language. The term can refer to all possible instructions for a CPU or a subset of instructions to enhance its performance in certain situations.
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
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.