Week 3 · Lesson 1 · 55 minutes

CPU parts and buses

I can explain the job of each part in a simple CPU model.

Planned lesson. Follow your teacher’s teaching order.

Source workbook pages: 18.

Resources

Vocabulary

Vocabulary
register: a small fast storage location in a processor; bus: a path used to carry signals between components
55-minute lesson sequence
  1. 0–5 · Retrieve a logic operation.
  2. 5–15 · Model the named parts using the CPU reference diagram.
  3. 15–25 · Guide the address 12 memory read without introducing instruction details.
  4. 25–45 · Students draw and explain their own labelled model.
  5. 45–50 · Partner points to one register; the other gives its job in this operation.
  6. 50–55 · Collect the address/data exit distinction.

See it

CPU parts, memory and the three busesCPUControl unitALURegistersPCMARMDRIRACPC: next instruction address · IR: current instructionMAR: address in use · MDR: value moving · AC: resultMemory01234Address busData busControl bus
The address bus selects a location, the data bus carries the value, and control signals say whether to read or write. Each register has one job.

Watch

Watch a simple CPU being put together from a control unit, an ALU, registers and memory. Its register names differ a little from our model.

The Central Processing Unit (CPU): Crash Course Computer Science #7CrashCourse

Open on YouTube

The video is on YouTube, which needs a VPN on most networks in mainland China. It is extra: the lesson works without it.

Try before notes

What operation could an ALU perform using logic gates?

Build the idea

A CPU contains units that do different jobs. The control unit coordinates steps. The ALU performs arithmetic and logic. Registers hold small amounts of immediately needed information. These parts cooperate; the CPU is not just the ALU.

Separate an address from the value stored there. MAR holds the memory address being accessed. MDR holds the instruction or data moving to or from that address. PC holds the next instruction address, while IR holds the current instruction.

An address bus selects a location. A data bus carries the value. Control signals specify operations such as read or write. In a memory read the requested value travels from memory toward the CPU.

CPU [CU | ALU | registers]
   address → MEMORY
   data    ↔ MEMORY
   control ↔ MEMORY

See the method

The control unit coordinates work. The ALU performs arithmetic and logic. PC holds the address of the next instruction. MAR holds a memory address. MDR holds data transferred to or from memory. IR holds the current instruction. AC holds a working result in this model. Address, data and control buses have different jobs.

Predict then reveal

Memory location 30 contains 84. A read is requested. What do MAR and MDR hold once the read completes?

Reveal reasoning

MAR=30 identifies the location. MDR=84 contains the value returned. The data bus carried 84; the address bus selected 30.

The current instruction is ADD 9 and the next instruction is at address 6. Which belongs in IR and which in PC?

Reveal reasoning

IR holds ADD 9, the current instruction. PC holds 6, the address of the next instruction. Neither description says that PC contains the instruction itself.

Work one step together

Read the first task. Each learner predicts the first step privately. Compare the method, then complete one intermediate row or one code iteration together. Do not display a finished workbook answer.

Practice

  1. A CPU needs the value at memory address 12. Name the register that holds 12 and the register that receives the value. Explain the address, data and control bus roles in this read.

Your turn

Complete the remaining steps of task 1 alone, then the next tasks. Predict before running code. Save your own evidence before comparing.

Practice

  1. A CPU needs the value at memory address 12. Name the register that holds 12 and the register that receives the value. Explain the address, data and control bus roles in this read.
  2. Draw CPU and main memory. Inside CPU label CU, ALU, PC, MAR, MDR, IR and AC. Add the three bus labels and arrows for a memory read. Use the diagram to explain one addition.

Check and explain

A register name identifies its job, not a kind of value that is interchangeable with every other register.

Point to the first step, row, condition or requirement that supports your answer. If results differ, find the first different state and repair one cause.

Show what you know

How does a memory address differ from the data at that address?

HL challenge when ready

Compare a single core, multiple cores and a co-processor.

Week 3 homework

Show working. Keep code and output. Stop at 25 minutes and mark where you reached.

  1. In the toy machine PC=4. Memory 4 contains LOAD 20 and memory 20 holds 9. Trace the fetch and execute.
  2. Explain why cache, RAM and SSD are not interchangeable. Use one job for each.
  3. Six independent instructions use F,D,E,W with no stalls. Find the ideal cycles and compare with no overlap. Write ideal_cycles(n) in Python for n >= 1. Test n = 1, 4 and 6.
  4. Retrieve logic: simplify (A AND B) OR (A AND NOT B). Give one proof step.

Source workbook pages: 23.

Weekly homework (Word)

Python practice · two short prompts

Spend about 3 minutes on each during practice time. Predict, run, change one thing, then explain. These prompts do not add homework.

A starter is runnable code to explore or complete. If the playground restores your saved code, the linked starter is selected in Example: use Load example when ready. Download your work before confirming replacement.

Prompt 1

Model reading an addressed memory location into a register. Change the address.

No imports needed.

Hint and starter code

A register is a small CPU storage location; the list is only a memory model.

# A register is a small CPU storage location; the list is only a memory model.
memory = [10, 20, 30]
address = 1
register = memory[address]
print(address, register)
Open this starter in Python playground →
Prompt 2

Print how many different addresses 3, 4 and 8 address bits can represent.

No imports needed.

Hint and starter code

This counts addresses, not automatically bytes; bytes per address must be specified.

# This counts addresses, not automatically bytes; bytes per address must be specified.
for width in [3, 4, 8]:
    print(width, 2 ** width)
Open this starter in Python playground →