Instruction Sets
- An instruction set is a list of all the commands that can be processed by a CPU
- Each command has a unique binary code
- The table below shows an example instruction set. Each instruction has a mnemonic that indicates what the instruction does alongside a corresponding binary code
|
|
ADD |
10100001 |
SUB (subtract) |
00100010 |
LDA (load) |
10111111 |
STR (store) |
01100000 |
BRA (branch) |
01011010 |
- After an instruction is decoded into an opcode and an operand, the CPU finds the opcode in the processor’s instruction set. It then knows what operation to perform when executing the instruction
Worked example
Using the instruction set in the table above what would be the operation if the instruction was 00100010 00000010?
[1]
Either of:
- The operation would be SUB [1]
- If the operand was raw data the complete instruction would be to subtract 2 from the value in the accumulator [1]
- Instruction lists are machine-specific
- This means a program created using one computer’s instruction set would not run on a computer containing a processor made by a different manufacturer
- For example, a computer program created using Intel’s instruction set would not run on a device containing an ARM processor