AQA AS Level Computer Science: The Processor Instruction Set

Page 1: Course Overview and Unit Context

This material forms part of the AQA AS Level Computer Science curriculum for Paper 2.

  • Unit: Unit 5 – Computer Organisation and Architecture
  • Topic: The Processor Instruction Set
  • Curriculum Body: AQA
  • Publishing Partner: PG ONLINE

Computer organisation and architecture investigates the fundamental engineering principles governing how processor hardware operates, stores data, interprets machine-level programs, and executes instructions at the circuit level.

Page 2: Learning Objectives

The principal learning goals for this unit are structured around three fundamental competencies:

  • Role of the Instruction Set: Describe and define the precise role that an instruction set plays within central processing units (CPUs).
  • Instruction Format and Components: Explore the detailed internal format of processor instructions, analyzing the mechanical role performed by each distinct bit field and component.
  • Addressing Modes Comparison: Formulate a direct comparison between direct addressing and immediate addressing modes within the execution cycle of processor instructions.

Page 3: Natural Language Analogy for Processor Instructions

To understand how computer processors interpret machine instructions, consider how human languages convey procedural commands.

Comparative Commands Across Natural Languages
  • English: "Walk forward 10 steps, turn right 90 degrees"
  • French: "Avancez 10 marches, tournez à droite à 90 degrés"
  • Spanish: "Caminar hacia adelante 10 pasos, gire a la derecha 90 grados"
  • Mandarin Chinese: "向前走10步,向右转90度"
Structural Analysis
  • Commonalities: All four expressions convey the exact same underlying semantic meaning, algorithmic procedure, and operational parameters: moving forward by a magnitude of 1010 units, followed by an axial rotation of 90∘90^\circ to the right.
  • Differences: Each statement uses entirely different vocabularies, grammatical structures, phonetics, and symbolic character encodings tailored to its specific linguistic system.
  • Architectural Analogy: In computer architecture, different central processing units feature their own proprietary syntaxes and operational encodings, yet they perform fundamentally identical mathematical and logical operations.

Page 4: Role and Definition of the Processor Instruction Set

  • Processors have unique, specialized methods of expressing instructions governed by their internal electronic designs.
  • Definition of an Instruction Set: An instruction set is the complete, definitive collection of all commands and operations that a specific central processing unit is physically wired to execute.
  • Hardware Dependency: Different processor architectures (such as x86, ARM, or MIPS) possess their own distinct instruction sets. While two completely different processors may carry out identical logical operations (such as loading data from memory or adding numbers), the binary representation and execution mechanics of those instructions often differ substantially.

Page 5: Functional Categories and Types of Instructions

A processor instruction set consists of six major functional groups of operations:

  1. Data Transfer: Operations responsible for moving data between registers and main memory locations.
    • Examples: LOAD (read data from memory into a register), STORE (write data from a register into memory).
  2. Arithmetic Operations: Basic mathematical calculations carried out within the Arithmetic Logic Unit (ALU).
    • Examples: ADD (addition), SUBTRACT (subtraction).
  3. Comparison Operations: Instructions designed to evaluate two distinct operands against each other (e.g., testing if values are equal, greater than, or less than one another) to set processor status register flags.
  4. Logical Operations: Boolean bitwise manipulations evaluated inside the ALU.
    • Examples: AND, OR, NOT.
  5. Branch Instructions: Operations that alter the sequential flow of program execution by updating the Program Counter (PC).
    • Conditional Branches: Execution path changes only if specific status register flag conditions are satisfied (e.g., branch if equal to zero).
    • Unconditional Branches: Execution path changes unconditionally under all circumstances.
  6. Shift Operations: Operations that shift the binary bits within a register to the left or to the right.
    • Logical and arithmetic shifts serve diverse functional purposes, such as rapid binary multiplication or division by powers of 22, as well as isolating specific bits.

Page 6: Machine Code Representation and Word Length

  • The processor instruction set dictates every valid instruction pattern and its corresponding binary encoding.
  • Processor instructions exist exclusively as patterns of binary digits (11s and 00s).
  • Word Length: The total quantity of binary bits allocated to encode an individual instruction depends directly on the native word length of the processor architecture.
  • Definition of Machine Code: Machine code is the lowest-level programming representation consisting solely of binary digits. It represents the only language that the physical processor circuitry can natively decode and execute without prior compilation or translation.

Page 7: Basic Machine Code Instruction Set Architecture

In a processor architecture, each valid operation is paired with an immutable binary machine code bit pattern.

Single-Byte Instruction Set Example

Consider a theoretical, basic processor featuring a single-byte (8-bit8\text{-bit}) instruction word length. In this implementation, the byte is divided into a 4-bit4\text{-bit} opcode and a 4-bit4\text{-bit} operand:

Machine codeInstructionExample Assembly Syntax
0000 1111STORESTO 15
0010 1111LOADLDA 15
0100 1111ADDADD 15
1000 1111SUBSUB 15
1111 0000HALTHALT

Example instruction set showing machine code, instruction names, and assembly language examples

Bitwise Breakdown of Examples
  • 0000 1111: Opcode 0000 designates the STORE command, and operand 1111 refers to memory address 1515 (since 11112=15101111_2 = 15_{10}).
  • 0010 1111: Opcode 0010 designates the LOAD command, and operand 1111 targets memory address 1515.
  • 0100 1111: Opcode 0100 designates the ADD command, adding the contents of memory address 1515 to the accumulator.
  • 1000 1111: Opcode 1000 designates the SUB command, subtracting the value held at memory address 1515 from the accumulator.
  • 1111 0000: Opcode 1111 designates the HALT command, which terminates execution; the operand bits 0000 remain unused.

Page 8: Core Components of Processor Instructions

An instruction word is structurally divided into two primary sections: the Operation Code (Opcode) and the Operand(s).

1. Operation Code (Opcode)

The opcode provides all operational instructions to the CPU control unit and is subdivided into two distinct functional segments:

  • Basic Machine Operation: The fundamental command the processor must execute (e.g., ADD, SUB, LOAD, STORE).
  • Addressing Mode: A dedicated bit field indicating how the operand field must be interpreted by processor circuitry (e.g., determining whether the operand holds direct raw numerical data, a memory location, or a register designation).
2. Operand(s)

The operand field contains one or more data references required to carry out the instruction. Depending on the addressing mode, the operand may contain:

  • A literal data value.
  • A specific main memory (RAM) address.
  • A specific CPU register identifier.

Page 9: 16-Bit Instruction Format and Bit Allocation

The distribution of bits between the opcode and operand depends on the hardware architecture and native word length of the system.

Bit Layout of a 16-Bit Word Instruction

Below is an architectural configuration for a processor operating with a 16-bit16\text{-bit} instruction word:

SectionOperation Code (Opcode)Operation Code (Opcode)Operand(s)
SubdivisionBasic machine operationAddressing modeOperand data / reference
Bit Width6 bits6\text{ bits}2 bits2\text{ bits}8 bits8\text{ bits}
Bit IndicesBits 1515 down to 1010Bits 99 and 88Bits 77 down to 00
Sample Bits0 1 1 1 0 10 10 0 0 0 0 1 0 1

16-bit instruction format layout with opcode, addressing mode, and operand

Functional Decomposition of the Sample Bits
  • Basic Machine Operation (011101): Represents the operation identifier in 6 bits6\text{ bits}. A 6-bit6\text{-bit} field can represent up to 26=642^6 = 64 distinct machine operations.
  • Addressing Mode (01): Represents the addressing mode via a 2-bit2\text{-bit} code, permitting 22=42^2 = 4 unique addressing modes.
  • Operand (00000101): Represents an 8-bit8\text{-bit} address or value, corresponding to decimal 55 (000001012=51000000101_2 = 5_{10}).

Page 10: Operand Interpretations and Addressing Mode Roles

The operand specifies the target data of an operation. It is interpreted in one of three ways depending on the addressing mode bits:

  1. Literal Value: The operand holds the actual raw data value to be used directly in the calculation.
  2. Memory Address: The operand holds the pointer/address identifying the exact memory cell where data resides.
  3. Register Reference: The operand specifies a internal CPU register where the data is located.
Addressing Mode Bits

A dedicated 2-bit2\text{-bit} addressing mode field within the opcode informs the instruction decoder which interpretation must be applied during the decode-execute phases.

Page 11: Immediate Addressing Mode Mechanics and Limitations

Under immediate addressing, the operand does not refer to a storage address; instead, the operand field contains the actual numerical data value.

Immediate Addressing Bit Pattern Example
FieldBasic Machine OperationAddressing ModeOperand(s)
Binary Value1 0 1 1 0 10 00 0 0 0 1 1 0 0
Field DescriptionBasic machine commandImmediate addressing indicator (00)Literal integer value: 1212

Immediate addressing mode instruction diagram

  • Addressing mode code 00 explicitly indicates that the operand is a literal constant value.
  • The operand bits 0000 1100 evaluate to:

8+4=128 + 4 = 12

  • The processor directly executes the operation using the constant integer 1212.
Limitation of Immediate Addressing
  • Range and Magnitude Constraints: The maximum integer value that can be specified is strictly constrained by the total number of bits allocated to the operand field. In an 8-bit8\text{-bit} unsigned operand space, values are limited to the range 00 to 255255 (28−12^8 - 1). For two's complement signed integers, the range is limited to −128-128 through +127+127.
  • Static Nature: Data cannot be modified dynamically at runtime. Because the value is hardcoded directly into the instruction word itself, it cannot dynamically reflect changing program state without rewriting code memory.

Page 12: Direct Addressing Mode Mechanics and Operations

Under direct addressing, the operand represents the specific memory address of the storage cell in main memory where the target data is held.

Direct Addressing Bit Pattern Example
FieldBasic Machine OperationAddressing ModeOperand(s)
Binary Value1 0 1 1 0 10 10 0 0 0 1 1 0 0
Field DescriptionBasic machine commandDirect addressing indicator (01)Memory address reference: Address 1212

Direct addressing mode instruction diagram

  • Addressing mode code 01 signals to the CPU memory controller that the operand represents a memory location.
  • The operand bits 0000 1100 refer to memory address 1212.
  • The processor places the address value 1212 onto the memory address bus, reads the contents stored at that physical location in RAM, and uses the retrieved data in the operation.

Page 13: Classification and Context of Advanced Addressing Modes

While processor architectures utilize several addressing techniques—such as indirect addressing, indexed addressing, register direct addressing, and relative addressing—they represent advanced concepts beyond the scope of this unit.

Page 14: Practical Exercises – Worksheet 3 Overview

Worksheet 3 consists of two primary practical tasks designed to reinforce instruction set design concepts:

  • Task 1: Instruction identification, opcode extraction, and addressing mode verification.
  • Task 2: Architectural bit budget calculations, including total operation capacities and operand ranges.

Page 15: Worksheet 3 Task 2 – Bit Allocation and Capacity Calculations

In a fixed-width processor architecture with a total word length of 16 bits16\text{ bits}, altering the bit distribution between the opcode and the operand involves engineering trade-offs.

Mathematical Principles
  • If nn bits are allocated to the basic machine operation, the maximum number of distinct operations supported is:

Number of possible operations=2n\text{Number of possible operations} = 2^n

  • If mm bits are allocated to an unsigned operand, the maximum integer value that can be represented is:

Maximum value available for operand=2m−1\text{Maximum value available for operand} = 2^m - 1

  • Total word width equation (16-bit16\text{-bit} standard system):

Bits for Opcode+Bits for Addressing Mode+Bits for Operand=16\text{Bits for Opcode} + \text{Bits for Addressing Mode} + \text{Bits for Operand} = 16

Architectural Trade-off Table
Bits used for opcodeNumber of possible operationsBits used for addressing modeBits used for operandMaximum value available for operand
2222=42^2 = 4221212212−1=40952^{12} - 1 = 4095
4424=162^4 = 16221010210−1=10232^{10} - 1 = 1023
5525=322^5 = 32229929−1=5112^9 - 1 = 511
6626=642^6 = 64228828−1=2552^8 - 1 = 255
7727=1282^7 = 128227727−1=1272^7 - 1 = 127
1010210=10242^{10} = 1024224424−1=152^4 - 1 = 15
1212212=40962^{12} = 4096222222−1=32^2 - 1 = 3
Key Architectural Trade-Off

Allocating more bits to the opcode increases the instruction vocabulary of the processor, allowing more distinct operations. However, this reduces the bits available for the operand, severely restricting both the maximum immediate integer value and the total direct addressable memory space.

Page 16: Low-Level vs. High-Level Programming Languages

Computer languages exist along a spectrum of abstraction relative to physical processor hardware.

Machine Code
  • Composed entirely of binary sequences (11s and 00s).
  • Highly difficult for human programmers to author, comprehend, or debug.
  • Requires zero translation; executed natively by hardware.
Assembly Language
  • Uses short character abbreviations called mnemonics to represent machine operations (e.g., LDA for load accumulator, ADD for addition, MOV for register transfer).
  • Classified alongside machine code as a low-level language because of its one-to-one correspondence with underlying machine instructions.
  • Significantly easier to write than raw binary machine code, yet still requires explicit manual management of registers, memory addresses, and execution flags.
High-Level Languages
  • Examples: Python, Delphi.
  • Provide total abstraction from the underlying machine architecture, registers, and memory busses.
  • Feature natural syntax, mathematical expressions, and high-level control structures (such as while loops and functions).
  • Require translation into machine code using compilers or interpreters before the processor can execute them.

Pages 17–18: Summary Assessment and Plenary Knowledge Review

Plenary Review Exercise
  • The format of instructions is determined by the processor instruction set.
  • This defines what the machine code instructions mean and how the processor should execute them.
  • Instructions are made up of two parts: opcode (which includes the addressing mode) and operand.
  • The addressing mode determines how data used by the instruction can be found.
  • Immediate addressing means the operand is the actual value to be used in the instruction.
  • Direct addressing indicates that the operand is the address of the data to be used.

Page 19: Copyright and Licensing Framework

  • Copyright Holder: © 2016 PG Online Limited.
  • Scope of Protection: All unit resources—including worksheets, slide decks, teacher guides, and digital courseware—are protected by international copyright laws.
  • Licensing Restrictions: Materials are licensed exclusively for educational use within a single licensed institution at a single geographical site.
  • Explicit Prohibitions: Distribution to third parties, transfer across multi-site institutions, public internet transmission, electronic resale, and unauthorized copying are strictly prohibited under the terms of the end-user licensing agreement.