3 HN users recommended this tutorial3 months2017–2023score 3.5
Years with an HN recommendation, 2007–2026
Recommended as the key video for understanding control logic and microcode.
Ben Eater writes a program in a made-up machine language and walks through the control logic an 8-bit breadboard CPU needs to execute it. It is part of his build-an-8-bit-computer series.
“If you only have a limited amount of time I would highly recommend the control logic video” (HN, 2017)
This is really amazing. In addition to the interesting project this individual has a great gift for articulating everything in a concise manner and with a very pleasant cadence. What a great teacher. Thanks for sharing. I'm looking forward to seeing the rest of this series. If you only have a limited amount of time I would highly recommend the control logic video: [this video]
Control logic video is the one to watch if short on time
I found these Ben Eater YouTube videos very useful to understanding what microcode is and how it works: 8-bit CPU control logic [this video] 8-bit CPU reprogramming microcode [link] In short, the microcode instructions are a bunch of flags that enable different parts of the processor during that clock cycle (eg is data being loaded off the bus into a register? Is the adder active? Etc), so to implement an instruction that says add value from memory a to value from memory b and store in memory c, the microcode might be: copy memory a onto bus, store bus to register, copy memory b to bus, store b to register, add both register and put result online bus, store value on bus to memory c. (In a hypothetical simple cpu like the one Ben built, a real one is obviously much more sophisticated). So in Ben’s toy CPU, the instructions are just indices nto an EEPROM that stored the control logic but pattern “microcode” for each instruction, and IIRC each instruction takes however many cycles the longest instruction requires (in real life that would be optimised of course). This is also how some processors like the 6502 have “undocumented” instructions: they’re just bit patterns enabling parts of the processor that weren’t planned or intended. So you can see that it may be possible to fix a bug in instructions by changing the control logic in this way, even though the actual units being controlled are hard wired. I guess it very much depends on what the bug is. Of course I only know how Ben’s mi
Ben Eater on YouTube has recreated an 8-bit computer on breadboards. [this video] That is the start of the videos where the control logic gets microcoded. Its pretty basic but over the next few videos he comes up with about 10 different OPCODES and programs their microcode (a series of control logic activations). Its pretty amazing to see it all come together and work in the end.
Start of series where control logic is microcoded on breadboards
Yeah, it was my understanding that the opcodes directly encoded what we would nowadays call microcode, that is, bits which selected which CPU component acted on which data[1], so these illegal instructions are just unused bit patterns that select various operations just by having those bits set, not something that was ever intended to be actually used. So it would make sense that they're not documented, since they're entirely incidental. [1] [this video]
Video list and Hacker News comment labels from HackerTube (prompted by @karpathy), released under ODC-By 1.0, built on the open-index/hacker-news archive. Hacker News data is provided by Y Combinator; comments remain the work of their authors. Video titles, channel names and thumbnails belong to their creators and are shown via YouTube. HackerTube Watch is an unofficial edition. Data export of 2026-10-31.
4 Hacker News comments
From the HN archive; up to 20 kept per video, favoring different commenters. Recommendations first.
Read more
Citations, criticism and jokes