DEV Community


Posted on • Originally published at on

How a CPU really works

Let’s go right inside a CPU and watch it execute code at the transistor level!

As a programmer I have often wondered exactly what the CPU is doing when I give it some code. Being a computer science teacher I know all about the fetch-execute cycle and what is supposed to be inside a CPU but what it actually does is glossed over.

So I set about finding out using the Visual6502project’s simulation of the Zilog Z80.

This is not an emulator of the chip like you might be used to. This simulates the actual physical layout of the chip down to the wiring and transistors. It’s possible to step through the chip’s sequencing logic and watch parts of it switch on and off. It’s completely fascinating.

And once you figure out what’s going on, it’s possible to watch the CPU work.

This deep dive into the inner workings of the Z80 was inspired by one of my students asking me the innocent question of “how does a CPU work?” and then being persistent in wanting to know what it actually does.

I had no idea and I had to find out.

This video is the result.

Related posts:

  1. How I Became a better Computer Science teacher
  2. BBC Micro – Computer Literacy 1980s
  3. Quazar Graphic OLED Display – Real Pixels for your RC2014

Top comments (0)