Teaching Year 10 How CPUs Work

I recently led a 2 hour class for twenty 14 year olds and this is what I taught them

Warming Up

The opportunity came about through the 1851 Royal Commission, who support the London Wonder outreach initiative led by the Big Ideas charity. They let me take charge of a 2 hour class, containing 20 year 10 students (usually 14 or 15 years old). Along for the ride we had one Big Ideas co-ordinator, Hayley, and my colleague from UCL Ralph Sarkis.

To start with I shared a little background about how I got into computer chips and why they should care about them (5 mins). Before they got too bored we did a quick 3 question quiz that got them debating with each other.

  1. Best selling phone ever? (iPhone 6 or Nokia 1100)
  2. What did Nintendo originally make? (Playing cards or Welly Boots)
  3. What has more computing power? (iPhone 15 or Apollo 11)

To settle back down, we then did a quick run through of how the CPU is like the computer’s brain that runs on some form of clock (5 mins). This led us nicely into the activity!

The Interactive Activity

How do you make CPUs fun? The advice from Big Ideas was it has got to be interactive but not cost a fortune…

My solution, students would form teams of 5, each working for one of the big chip design companies, and nominate one student to be a CPU. The remaining team members would then write out instructions on sticky notes at each clock cycle and hand them to their CPU to execute. Of course, CPUs can only execute specific instructions, so I devised a custom instruction set architecture (ISA). Specifically, the goal was to produce a bottle of salty squash from a starting bottle containing just water. Their goal was to get as close, in terms of squash colour and salanity, to the target bottle which we showed them right at the start then hid away, in as few cycles as possible.

So what instructions was the CPU allowed to execute:

  1. Collect ?? ml/grams of squash/salt [2 cycles]
  2. Remove/Replace bottle lid [1 cycle]
  3. Add squash/salt [1 cycle]
  4. Shake bottle [2 cycles]
  5. Test colour/salinity [2 cycles]
  6. Submit [1 cycle]
Ralph frantically measuring salt and squash to fulfill the CPU's requests.

Once all teams had execute their submit instruction they were ranked from 1st to 4th in three categories.

Judging of bottle squash colour and final scores.

This worked rather nicely. Some teams didn’t spend cycles testing their bottle, letting them submit their result much faster. Whilst other teams did spend cycles testing and refining the mixture in their bottles to get a more accurate result. This gave them a bit of a demonstration of the typical accuracy vs performance tradeoffs we experience all the time when designing code/chips.

The great thing about this setup is that we can make a natural progression, just as university students do when they are taught about these concepts. In round 2, teams elected two CPUs and had to produce two bottles of salty squash. This gave them a chance to appreciate parallelism, where they could write instructions for the second CPU whilst their first was busy. In round 3 (which we ran out of time for), we move to compilation, where students need to write out all their instructions ahead of time.

The Good

The Bad

Conclusions

I was really worried this wouldn’t work, but was shocked when the students really engaged. My favourite student comment overheard by Hayley, “I thought this was going to be dead, but it was actually pretty lit”. Not every student engaged, but at least 15 out of the 20 got really into the activity and seemed to take away something from it. So it was far from perfect, but with some refinement I think the core concept is pretty ideal! Huge thanks to Ralph, Hayley and Sam from Big Ideas who helped make it happen.

You can find the slides here in case any teachers or engineers want to try out the activity in a classroom.