IB COMPUTER SCIENCE | A1.1.1 Main CPU Components

Lesson objective

Describe the functions and interactions of the ALU, CU, registers and buses, and distinguish single-core, multi-core and co-processor arrangements.

Learn

A1.1.1 | MAIN CPU COMPONENTS

01 | ONE CALCULATION, SEVERAL DIFFERENT JOBS

When a program adds two scores, the CPU does not simply “know the answer”. It must obtain an instruction, interpret what that instruction asks, find the required values, perform the operation and keep or store the result. Different components have different jobs in this process.

The central processing unit (CPU) carries out program instructions and coordinates processing. A useful starting model has two main units: the control unit (CU) and arithmetic logic unit (ALU). Small storage locations called registers hold the information these units need immediately. Buses provide communication paths.

Imagine a running total of 7 and a new score of 5. The ALU can calculate 12, but that is only one part of the story. Something must direct the addition, identify where 5 is stored, transfer it into the CPU and retain the result. This lesson follows those relationships.

For this IB objective, describing a component means saying what it does. Describing an interaction means connecting its job to another component: what moves, where it goes and why.

02 | SEE THE COMPONENTS AS A SYSTEM

Main CPU components and their connections to memoryInside the CPU, the control unit coordinates operations, the ALU performs arithmetic and logic, and registers hold addresses, instructions and working values. Internal connections transfer information between them. An address bus selects a memory location; a data bus carries instruction and data values in either direction; a control bus carries read, write and status signals.CPU: SIMPLIFIED ONE-CORE VIEWCONTROL UNIT (CU)Decodes instructionsCoordinates operationsALUArithmetic and logicProduces resultsInternal control and value transfersREGISTERS: FAST WORKING STORAGEPC: address of the next instructionIR: the instruction being processedMAR: address for the memory accessMDR: value transferred to/from memoryAC: working value / ALU resultMAIN MEMORYInstructions and dataoutside this CPU core100: ADD 20101: STORE 2120: 521: 0 initiallyADDRESS BUSCPU selects a locationDATA BUSInstructions and data valuesCONTROL BUSRead/write and status
A teaching model, not a chip floor plan. Arrows represent functional communication. Modern processors may use caches and more complex interconnects, which are omitted here.

Read the diagram from the inside out. The CU, ALU and registers are inside the CPU. Main memory holds the example’s instructions and data. The three buses connect the CPU to memory in this simplified system.

A memory address identifies a location; its contents are the value stored there. Address 20 contains 5. Asking for location 20 does not mean the CPU is about to add the number 20. Keep “where?” and “what value?” separate as you follow each transfer.

03 | THE CONTROL UNIT: DIRECTING THE WORK

The CU coordinates the operations needed to carry out an instruction. It interprets the instruction held in the instruction register and generates control signals so the right transfers and operations occur.

Suppose the current instruction is ADD 20. In this teaching instruction set, ADD names the operation, and 20 identifies the memory location of the value to add. The CU interprets the instruction, arranges the memory read and directs the ALU to add the retrieved value to the working total.

An instruction’s operation part is called its opcode. An associated value or reference is its operand. Here ADD is the readable operation name and 20 is an address operand. Actual machine instructions are encoded in binary; these words make the example easier to follow.

The CU does not perform the arithmetic itself. It directs the activity. A precise interaction statement is: “The CU decodes the instruction in the IR and sends control signals that select the ALU operation.”

04 | THE ALU: CALCULATIONS AND LOGICAL OPERATIONS

The ALU performs arithmetic operations, such as addition, and logical operations, such as bitwise AND or comparisons supported by the processor. A comparison helps a program make a decision, for example whether a score has reached a target.

In our running-total example, the working value is 7 and the new operand is 5. Under CU control, the ALU computes 7 + 5. The result 12 is placed into the accumulator in this model, ready for a later instruction.

The ALU works on values made available inside the CPU. It does not decide which program instruction should be fetched next, and it does not independently choose a memory address by reading a high-level Python variable name.

Not every instruction requires an arithmetic calculation. A load copies a value into working storage; a store transfers a value to memory. The CU still coordinates those actions even when the ALU is not adding two numbers.

05 | REGISTERS: SMALL STORAGE WITH SPECIFIC ROLES

A register is a very small, fast storage location inside the processor. Registers are not separate hard drives or whole RAM modules. They hold the addresses, instructions and working values involved in current processing.

Several registers may contain numbers, but the meaning of each number depends on the register’s job. A PC value of 100 means “the next instruction is at address 100”. An AC value of 7 is a working data value. Confusing these roles makes CPU diagrams much harder than they need to be.

RegisterFull nameWhat it holdsExample meaning
PCProgram counterAddress of the next instruction to fetch100 points to the instruction stored at address 100
IRInstruction registerThe instruction currently being processedADD 20 tells the CU which operation to direct
MARMemory address registerAddress of the memory location being accessed20 selects the location containing the new score
MDRMemory data registerValue being transferred to or from memory5 is the returned score, not its address
ACAccumulatorA working value or intermediate result7 before the addition; 12 afterwards

Some resources call the instruction register CIR, for current instruction register, and use ACC instead of AC. This page uses the IB guide’s IR and AC names. These are alternative labels for the corresponding roles in this simplified model.

06 | PC AND IR: NEXT ADDRESS, CURRENT INSTRUCTION

The PC helps the CPU keep its place in the program. Its value supplies the location of the next instruction to fetch. During a normal sequential fetch, it advances to the following instruction’s address. A branch instruction can change that sequence.

The IR holds the instruction being processed after it has been fetched. While the CU interprets ADD 20 in the IR, the PC can already point to the following instruction. The two registers therefore hold different kinds of information at the same time.

Our teaching memory uses one location per instruction, so 100 advances to 101. Real processors may use different instruction sizes and address conventions. The important principle is “next instruction address”, not that every physical CPU always adds one.

A useful check: if PC = 101 and IR = ADD 20, the CPU is processing ADD 20 while keeping address 101 ready for the next fetch. PC does not hold the whole ADD instruction.

07 | MAR AND MDR: WHERE AND WHAT

MAR identifies the location for a memory access. MDR holds the value transferred during that access. They cooperate but are not interchangeable.

For a read of the new score, MAR receives 20. The address bus carries that address, and a read signal requests the contents. Memory returns 5 along the data bus into MDR. The location is 20; the returned value is 5.

For a write of the total, MAR receives the destination address 21. MDR receives the value 12 to store. A write signal tells memory to accept that value at the selected location.

The MDR can carry an instruction as well as ordinary data. When address 100 is read, its contents are the encoded ADD instruction. Later, reading address 20 reuses MDR for the value 5. The IR keeps the current instruction while that reuse happens.

08 | THE THREE BUSES: ADDRESS, VALUE AND CONTROL

A bus is a communication pathway carrying related signals between components. The three-bus model separates the location being selected, the values being transferred and the signals coordinating the operation.

BusCarriesDirection in this CPU–memory modelDuring a read of location 20
AddressThe location to accessCPU to memoryAddress 20 selects the score location
DataInstructions and data valuesEither direction, depending on the transferThe value 5 travels from memory to CPU
ControlCoordination and status signalsSignals can travel in either directionCPU requests a read; memory can return status

During a write, the data bus carries the value from CPU to memory instead. The address bus still supplies the destination location. A write control signal distinguishes this from a read.

The control bus is not a second data bus. Its signals coordinate actions such as read and write and can include status or interrupt signals. The exact signals vary by system. A bus also does not permanently store its transferred value; that is the role of storage such as registers or memory.

09 | FOLLOW THE ADDITION AND STORE THE RESULT

Start with AC = 7, PC = 100, memory[20] = 5 and memory[21] = 0. Address 100 contains ADD 20; address 101 contains STORE 21. Our two-instruction program adds the score and then saves the result.

The notation memory[20] means “the contents at address 20”. ADD 20 uses that stored value, not the literal number 20. STORE 21 writes the accumulator’s value into address 21.

Select Next step to follow one transfer at a time. Pink highlights show registers changed by the latest step. The memory table shows when the saved value changes. This is an illustrative order of operations, not a clock-accurate simulation of a real chip.

Example main memory
AddressContents
100ADD 20
101STORE 21
205
210

Previous step replays earlier model state. It does not reverse a physical CPU.

10 | CONNECT THE JOBS IN YOUR OWN WORDS

Part of the exampleComponents interactingA precise description
Obtain the instructionPC, MAR, buses, memory, MDR, IRThe PC supplies an address; the read transfers the instruction through MDR to IR.
Interpret itIR and CUThe CU decodes the instruction in IR to determine the required operation.
Read the scoreCU, MAR, buses, memory, MDRThe CU coordinates a read of the location selected by MAR, returning its contents to MDR.
AddCU, ALU and ACUnder CU control, the ALU combines the working value and new operand, placing 12 in AC.
SaveAC, MAR, MDR, buses and memoryAC supplies 12 to MDR; MAR selects 21; a write stores 12 at that location.

The fetch, decode and execute cycle is studied in detail in A1.1.5. Here it gives context for the components. Focus on explaining why each transfer is needed, rather than memorising an arrow sequence without knowing what the values mean.

11 | SINGLE-CORE AND MULTI-CORE PROCESSORS

A processor core is an instruction-processing engine within a processor. A single-core processor has one such core; a multi-core processor has more than one. Each core has execution and control resources and its own processing state, although the exact resources and sharing arrangements vary by design.

In a single-core system, several applications can appear active because the operating system switches between tasks. That is not the same as two cores carrying out work simultaneously. A multi-core processor can execute suitable work on different cores at the same time.

For example, one thread might process a frame of a simulation while another handles a different part of the workload. A thread is a sequence of execution within a program. Software and its dependencies determine which work can actually run in parallel.

Four cores do not automatically make every program four times faster. If each step requires the result of the previous step, it cannot simply be split four ways. Coordination and shared-memory access also take time.

Do not confuse “multi-core” with the ALU and CU being two cores. Those are components that cooperate within a core, not two separate complete instruction-processing engines.

SINGLE-CORE

CORE 1
Control + execution + registers

One core executes the scheduled work.

MULTI-CORE

CORE 1
Its own execution state
CORE 2
Its own execution state

Suitable work can run concurrently on separate cores. Some resources may be shared.

12 | CO-PROCESSORS: SPECIALISED HELP

A co-processor assists the main processor with a particular kind of work. The CPU coordinates the wider program while suitable specialist operations are delegated to that processing resource. Depending on the design, the specialist unit may be integrated with or separate from the main processor.

A graphics processing unit can serve as a co-processor for graphics or suitable parallel calculations. Other examples include specialist mathematical or cryptographic processing units. A co-processor is defined by its supporting role, not simply by being “the second CPU core”.

Consider a visual simulation. The CPU can handle program decisions and prepare work while a graphics processor performs suitable graphics calculations. Inputs or commands must be supplied to the specialist, and its results or completion must be coordinated with the rest of the program.

This differs from multi-core processing: multiple general-purpose cores provide additional instruction-processing engines, whereas a co-processor provides specialist assistance. Not every task benefits from delegation because transfer and coordination have costs. A1.1.2 explores the GPU in more detail.

13 | AVOID THESE COMMON CONFUSIONS

ConfusionCorrection
The CU calculates the sum.The CU coordinates; the ALU performs the arithmetic.
MAR holds the value read from RAM.MAR holds the address; MDR holds the transferred contents.
PC holds the current instruction.PC holds the next instruction address; IR holds the current instruction.
The data bus carries only ordinary program data.Instructions also travel on it.
A result in AC is automatically saved in main memory.A suitable store operation is needed to write it to memory.
A multi-core CPU guarantees proportional speed-up.The workload, dependencies and coordination limit the benefit.
A co-processor is another name for an extra general-purpose core.It assists with a specialist class of work.

14 | DESCRIBE THE INTERACTION, NOT JUST THE NAME

If asked to describe the components, give a clear account of their functions. If the question also asks about interactions, link them with specific transfers and operations. Naming PC, MAR and MDR without saying what they do is incomplete.

A useful response pattern is: component → value or action → destination or purpose. For example: “The MAR holds the selected memory address, which is sent along the address bus so the required location can be accessed.”

For the addition, extend beyond “the ALU adds”: “The CU directs the operation, the operand is read from memory through MDR, and the ALU adds it to the working value, leaving the result in AC.”

Try drawing the CPU, memory and buses from memory. Label every arrow with either an address, a value or a control action. Then explain the difference between a second core and a specialist co-processor to a partner.

MATCH THE CPU COMPONENT TO ITS ROLE

Terminology

Terminology

CPU

The central processing unit carries out program instructions and coordinates processing.

ALU

The arithmetic logic unit performs arithmetic and logical operations.

CU

The control unit decodes instructions and coordinates component operations using control signals.

Register

A very small, fast storage location within the processor.

IR

The instruction register holds the instruction currently being processed.

PC

The program counter holds the address of the next instruction to fetch.

MAR

The memory address register holds the address of the memory location being accessed.

MDR

The memory data register holds a value being transferred to or from memory.

AC

The accumulator holds a working value or intermediate operation result in this model.

Address

An identifier selecting a location in memory, distinct from its contents.

Address bus

Carries the address of the location selected by the CPU in this model.

Data bus

Carries instructions and data values between CPU and memory in either direction.

Control bus

Carries coordination and status signals such as read and write controls.

Instruction

An encoded operation for the processor to carry out.

Opcode

The part of an instruction specifying its operation.

Operand

A value or reference associated with an operation; its interpretation depends on the instruction.

Core

An instruction-processing engine within a processor.

Single-core processor

A processor containing one processing core.

Multi-core processor

A processor containing multiple cores that can execute suitable work concurrently.

Co-processor

A processing resource assisting the main processor with a specialist class of work.

Thread

A sequence of execution within a program.

Parallel processing

Carrying out suitable work simultaneously using multiple processing resources.

Questions

Questions

CHECK YOUR UNDERSTANDING

Select all correct choices. Each exact set earns one point.

1. Which statements describe the CU?
2. MAR = 20 and memory[20] = 5. What returns through MDR on a read?
3. Which pairings are correct?
4. Which values can travel on the data bus?
5. Which details describe STORE 21 after AC becomes 12?
6. Why retain the instruction in IR?
7. Which statements about cores are correct?
8. What distinguishes a co-processor in this lesson?
9. Which statement explains an interaction?
10. Which are correct for the simplified two-instruction example?

EXPLAIN AND COMPARE

Write your answers before revealing each sample.

1. Describe the functions of the CU and ALU and how they interact.

2. Describe how PC and IR can hold different information during the same instruction.

3. Describe the roles of MAR and MDR when reading memory[20] = 5.

4. Describe how a value of 12 in AC can be written to address 21.

5. Describe why the data bus is required when fetching an instruction.

6. Describe the distinction between a single-core and a multi-core processor.

7. Explain why a four-core processor might not run a program four times faster.

8. Describe the role of a co-processor using an example.

9. Distinguish the memory address 20 from the value 5 stored there.

10. Describe how the components cooperate to add a stored score to a running total.

DRAW AND DESCRIBE

Draw a CPU and main memory. Include CU, ALU, PC, IR, MAR, MDR and AC, then label the address, data and control buses. Use a new example with AC = 9 and memory[20] = 4. Describe how the system adds the value and stores 13 at address 21.

Flashcards

Flashcards

Click to flip. Select the ideas you need to revisit.

0 cards selected for revision.

    Selections are kept while this page is open.

    Workbook

    Workbook

    COMING SOON

    The workbook for A1.1.1 Main CPU Components is coming soon. Complete the matching task and written questions in your exercise book.