Instructions are represented using an opcode and operand. These tell the computer which instructions to carry out and what to carry them out on.
Opcode is short for operation code. The opcode is what tells the CPU which operation it needs to carry out. For example, it could tell the CPU to add, subtract, move, copy, delete etc. It is the instruction part.
The operand is the data that the opcode needs to work on. It can be a specific file directory or some numbers or something on the CPU’s register. It is the data part.
An instruction could look like this:
1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
This instruction will then comprise of two parts, the operator and operand:
1 | 0 | 0 | 1 | --- | 1 | 0 | 1 | 1 |
Operator/Opcode | --- | Operand |
---|
The opcode represents an operation that will be done to the operand, such as ADD, which may be represented as 1001.
The operand represents the data that the operator will use such as the number 11, which may be added to another value.
The accumulator is a special division of the CPU which is used to store the results of any given calculation. The CPU cannot distinguish data and instructions and simply deals with operands in whichever way it sees fit.