Skip to topic
    ← Back to course topics

    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

    1. 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
    1. 1Week 1: Master the anatomy of an instruction, practicing splitting binary and hex words into opcode, addressing mode, and operand fields.
    2. 2Week 1 (End): Create comparative flashcards for each addressing mode (immediate, direct, indirect, indexed) illustrating register transfers.
    3. 3Week 2: Work through past AQA exam questions involving bit allocation, instruction set limits, and assembly-to-machine-code translations.
    4. 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)
    Explain

    Set out the causes, mechanisms, or principles clearly using precise technical terminology (e.g., explaining how indirect addressing resolves an effective address).

    Calculate

    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)
    Pitfall: Confusing the opcode with the operand when explaining machine code instruction format.
    ❌ Weak Answer (Loses Marks):The opcode is the data being used and the operand tells the processor what calculation to do.
    Example improved answer:An instruction is split into an opcode and one or more operands. The opcode defines the specific operation to be executed (and the addressing mode), whereas the operand holds either the actual data or the memory address/register reference of the data on which the operation is performed.
    Examiner Tip: Always specify that the opcode represents the operation/instruction to perform, while the operand represents the data or address.
    Pitfall: Vaguely defining addressing modes, particularly immediate versus direct addressing.
    ❌ Weak Answer (Loses Marks):Immediate addressing gets the number immediately, while direct addressing goes directly to the memory.
    Example improved answer:In immediate addressing, the operand field contains the actual datum to be used in the computation. In direct addressing, the operand field contains the memory address where the required datum is stored.
    Examiner Tip: Explicitly distinguish whether the operand field holds the 'value itself' (immediate) or the 'memory address of the value' (direct).
    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. 1.Step 1: Convert hexadecimal 340F to 16-bit binary. 3 = 0011, 4 = 0100, 0 = 0000, F = 1111, giving 0011 0100 0000 1111.
    2. 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. 3.Step 3: Determine the addressing mode: 00 corresponds to Immediate addressing.
    4. 4.Step 4: Evaluate the operand value: 00001111 in binary equals 15 in denary (or 0x0F in hex).
    5. 5.Step 5: Apply the addressing mode semantics: Because it is immediate addressing, the operand itself is loaded directly into the accumulator.
    Final Answer: The addressing mode is Immediate addressing (code 00). The value 15 (denary) / 0x0F (hex) 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. 1.Step 1: Define direct addressing. The operand field contains the memory address of the data to be used.
    2. 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. 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.
    Final Answer: Direct addressing points straight to the data location, while indirect addressing points to a memory location containing the target address. Indirect addressing is necessary for implementing pointers, dynamic data structures, or expanding the addressable memory space beyond operand bit limits.
    Active Recall Memory Test
    What are the two primary components of a machine code instruction?
    Key Fact: Opcode (operation code) and operand.
    If an instruction set dedicates 7 bits to the opcode, how many distinct instructions can be encoded?
    Key Fact: 128 distinct instructions (2^7 = 128).
    How does indexed addressing determine the effective memory address of data?
    Key Fact: It adds the operand value (base address) to the contents of the Index Register (IX).
    What is the key advantage of immediate addressing over direct addressing in terms of execution speed?
    Key Fact: It avoids an additional memory access cycle because the operand data is already fetched inside the instruction register.
    Frequently Asked Questions
    Why do different processor architectures have different instruction sets?
    Different processor families are engineered with different internal architectures, register layouts, and design priorities. For example, RISC processors like ARM use smaller sets of simple, fixed-length instructions for energy efficiency, whereas CISC processors like x86 use larger, variable-length instruction sets to carry out complex operations per instruction. Because machine code directly drives hardware logic gates, an instruction set designed for one microarchitecture cannot run natively on another.
    What is the difference between direct and indirect addressing?
    In direct addressing, the operand field holds the exact memory address where the target data is located. In indirect addressing, the operand field points to an intermediate memory location that contains the target address of the actual data. Indirect addressing requires an extra memory access cycle to resolve the pointer, but it enables access to a larger memory address space than would normally fit in the operand field.
    How does instruction length affect processor design?
    Instruction length establishes a trade-off between processor versatility and hardware complexity. A longer instruction length allows for more bits to encode a wider array of opcodes, larger addressable memory spaces, and multiple operands, but it requires wider data buses and more fetch cycles or cache space. Fixed-length instructions simplify pipelining and decoding hardware, whereas variable-length instructions optimize memory usage at the cost of complex decoder units.
    What is indexed addressing and when is it used in programming?
    Indexed addressing calculates the effective address of an item by adding the base address specified in the operand to the offset value stored in an Index Register (IX). The contents of the Index Register can then be incremented systematically on each loop iteration. This makes indexed addressing ideal for iterating sequentially through contiguous memory blocks, such as arrays or lists.