The processor instruction set — AQA A-Level Computer Science
A processor instruction set is the complete collection of machine-language commands that a specific central processing unit can directly execute. It defines the operations, addressing modes, and machine code formats supported by the CPU hardware architecture.
The processor instruction set explained
An opcode, short for operation code, is the part of a machine code instruction that specifies which operation the processor should carry out, such as ADD, LOAD or STORE.
Read the full explanation
This statement tells you that you will not be asked to write a formal definition of the term. What you must be able to do is read an opcode that appears in a question, such as a binary value in an instruction or a mnemonic in a table, and work out what the processor will do. For example, if a question shows the instruction 0010 0101, you should recognise that the leading bits form the opcode and use the supplied instruction set table to identify the operation. Focus on applying the table to the instruction shown rather than memorising a definition.
Your focus
- Students will not be expected to define opcode, only interpret opcodes in the given context of a question.
The processor instruction set exam tips
Topic Overview
The processor instruction set is the foundational interface between hardware and software, detailing every primitive machine-level operation a CPU can execute natively. Each instruction consists of an opcode that specifies the operation and addressing mode, alongside one or more operands that supply or reference the necessary data.
Understanding instruction sets is vital for A-Level Computer Science students because it underpins the fetch-decode-execute cycle, assembly language programming, and low-level computer architecture. It reveals how high-level code translates into machine operations and highlights performance trade-offs across different processor designs.
Key Concepts
- →Opcode and Operand: An instruction is split into an operation code (opcode) specifying the operation to perform and operand(s) specifying the data or addresses.
- →Addressing Modes: Techniques such as immediate, direct, indirect, and indexed addressing dictate how the CPU interprets the operand bits to locate data.
- →Instruction Formats and Word Length: The fixed or variable allocation of bits within an instruction word limits the total number of unique opcodes and the directly addressable memory space.
- →Assembly Language Mapping: Assembly mnemonics have a direct one-to-one correspondence with binary machine code instructions in an instruction set.
Marking Points
- Identifies the opcode bits within an instruction using the field layout given in the question.
- Matches the opcode bits to the correct operation using the supplied instruction set table.
- Explains what the processor does for that operation in the context of the question.
- Uses the given context, not a memorised definition, to justify the chosen answer.
Examiner Tips
- 💡Read the instruction layout in the question first and mark which bits form the opcode.
- 💡Use the supplied table to translate the opcode bits into an operation rather than recalling one from memory.
- 💡Check whether the question's own context changes which bits are the opcode before selecting an answer.
- 💡Show clear binary-to-hexadecimal conversions when answering bit-allocation and decoding questions.
- 💡Use precise vocabulary when defining addressing modes: refer explicitly to 'operand field', 'memory address', and 'effective address'.
- 💡Remember that the number of bits allocated to the opcode determines the maximum number of distinct instructions (2^n instructions for n bits).
Common Mistakes
- Attempts to memorise a formal definition of opcode in place of reading the table provided.
- Assumes the whole instruction is the opcode rather than only the operation portion.
- Ignores the instruction set given in the question and relies on general assumptions about machine code.
- Believing all processors share the same instruction set; different CPU families (such as x86 and ARM) possess unique, incompatible instruction set architectures.
- Confusing indirect addressing with indexed addressing; indirect uses an address stored in memory as a pointer, whereas indexed adds an offset from an index register to a base address.
- Assuming immediate addressing reads from main memory; immediate addressing retrieves the value directly from the instruction register without an extra memory read cycle.
Revision Plan
- 1Week 1: Master the anatomy of an instruction, practicing splitting binary and hex words into opcode, addressing mode, and operand fields.
- 2Week 1 (End): Create comparative flashcards for each addressing mode (immediate, direct, indirect, indexed) illustrating register transfers.
- 3Week 2: Work through past AQA exam questions involving bit allocation, instruction set limits, and assembly-to-machine-code translations.
- 4Week 2 (End): Complete timed decoding questions under exam conditions and review mark schemes for exact phrasing.
Exam Question Types
- 📋Bit-field calculation: Determining maximum instructions or addressable memory space given instruction bit-length allocations.
- 📋Machine code decoding: Converting hex or binary machine instructions into opcode mnemonics, addressing modes, and operand values.
- 📋Comparative short-answer: Explaining the mechanics and use cases of distinct addressing modes.
Command Word Expectations (AQA)
Set out the causes, mechanisms, or principles clearly using precise technical terminology (e.g., explaining how indirect addressing resolves an effective address).
Perform mathematical determinations (e.g., addressable memory range or opcode limits), showing full working and final numerical answers with correct units.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: A 16-bit processor uses an instruction format where the first 6 bits represent the opcode, the next 2 bits denote the addressing mode (00 = Immediate, 01 = Direct), and the remaining 8 bits denote the operand. An instruction is represented in hexadecimal as 340F. Decode the instruction, identify the addressing mode, and explain what value will be loaded into the accumulator if the opcode represents a LOAD operation.
- 1.Step 1: Convert hexadecimal 340F to 16-bit binary. 3 = 0011, 4 = 0100, 0 = 0000, F = 1111, giving 0011 0100 0000 1111.
- 2.Step 2: Split the 16 bits according to the processor specification: Opcode = bits 15 to 10 (001101), Addressing mode = bits 9 to 8 (00), Operand = bits 7 to 0 (00001111).
- 3.Step 3: Determine the addressing mode: 00 corresponds to Immediate addressing.
- 4.Step 4: Evaluate the operand value: 00001111 in binary equals 15 in denary (or 0x0F in hex).
- 5.Step 5: Apply the addressing mode semantics: Because it is immediate addressing, the operand itself is loaded directly into the accumulator.
Question: Explain the difference between direct addressing and indirect addressing. Describe one scenario where indirect addressing is necessary.
- 1.Step 1: Define direct addressing. The operand field contains the memory address of the data to be used.
- 2.Step 2: Define indirect addressing. The operand field contains a memory address that holds another memory address, which points to the actual data location.
- 3.Step 3: State the scenario requiring indirect addressing. It is used when referencing dynamic data structures, passing parameters by reference, or accessing memory locations beyond the address range directly addressable within the fixed operand bit-width.