The Ember CPU — Initial Design Part 7: Interrupts

Tom Gambill
Project Ember

--

Woman Interrupts conversation to take call
Stefan Repka Tomasevic — Shutterstock

We only need a few more instructions to complete the basic ISA or Instruction Set Architecture for the Ember CPU. Rounding out those few remaining instruction types are interrupt handling instructions. Interrupts are a big topic, and while we can’t possibly cover every aspect of interrupts here, we can give a brief overview of the concept, and how it works at a high level for Ember.

Interrupt Handling

When a CPU is operating in a computer system, there are often things that need to be handled at regular intervals, or right away when they happen, like when the screen needs to be updated, a key is pressed on the keyboard or game controller, or a network packet arrives. These events are often handled with interrupts.

On a physical processor, there are typically special pins that when activated, cause the processor to stop the program it is executing, briefly switch to another routine to handle the interrupt, then finally it will go back to running the program it was originally working on. When these external interrupts occur, the CPU will typically signal the external device that it has handled the interrupt as well, most often by toggling another external pin. In some cases, the external device causing the interrupt can also send data to the CPU about the interrupt by putting data on the data and…

--

--

Tom Gambill
Project Ember

Software Engineer, Retro Hacker, World Traveler. And also: sailboats, fish tanks, nature, family, startups…