I first attempted this 7 years ago, after I graduated college. I got through the first 2 chapters. It was extremely rewarding. But regrettably, I abandoned it for other side projects.
I picked it up again 3 months ago, and it’s been a blast. I’m on chapter 8, having completed the logic gates, ALU, CPU, assembler, and half of the virtual machine.
Every chapter is overwhelming — in a good way. I keep thinking to myself, “how the hell is this going to work?” And when it does, it’s so satisfying.
As a side project, purely for educational purposes, it’s the most rewarding thing I’ve done. I’ve learned so much. It’s a damn good project. And I’m damn proud of myself for sticking with it.
Highly recommended.
How did you learn the prerequisite solid state physics knowledge in order to fully understand the background behind the first two chapters?
e.g. The actual mechanism by which an integrated circuit transforms input into useful output. I've never been able to find a solid explanation on how even the simplest real world integrated circuit, such as a TI SN7400, actually does that.
You're making a category error, I think. This books/course doesn't cover physics. It doesn't even cover signal stuff, like stuff about how fast the voltage levels stabilize, or even voltages at all.
It's not "silicon wafer to Tetris" or "pile of protons and neutrons to Tetris" or "transistors to Tetris". You start with nand gates (and later also you get flipflops for free).
This course would work equally well on nand gates made of carved wooden gears, or nand gates made with fluidic logic, or nand gates made by encoding the whole thing into O-gauge hobby railroads.
If that's the level of explanation you seek, this book is incredible.
That is a good point, I had just assumed that information was available somewhere online, but it doesn't seem likely.
Something like this will at least get you conversant. You only need the first few chapters, and can skip BJTs.
https://archive.org/details/microelectronicc00jaeg/page/n11/...
https://nandgame.com/ has a cmos level towards the end. It doesn’t explain the transistor-level physics but does let you play with things.
The art of electronics book might be a good place to start if you want to learn the physical/electrical layer.
Lower-level teaching resources definitely exist! Here are my favorites:
- The Zero to ASIC course (and Tiny Tapeout) [1] explains transistor circuits and teaches you an open source software stack---and you get a chip physically manufactured! You could make the Nand to Tetris computer in actual silicon (if you can get enough transistors).
- To learn how things are manufactured on silicon wafers, get textbooks on microfabrication. A decent starting point is [2]. There's also a good video series [3] for a quick overview.
- To understand how a single transistor or diode works, get textbooks on "semiconductor devices". A good starting point is the free online [4].
[1] https://www.zerotoasiccourse.com/ https://tinytapeout.com/
[2] "Introduction to Microelectronic Fabrication" by Jaeger
[3] https://siliconrun.com/our-films/silicon-run-1/
[4] "Modern Semiconductor Devices for Integrated Circuits" by Chenming Hu, https://www.chu.berkeley.edu/modern-semiconductor-devices-fo...
A “silicon to nand gate” would be a sweet complimentary course. However, probably more difficult to make hands on.
Followed by a prequel "Sand to ingot"
I vaguely remember someone trying to go the other direction, and teach "Tetris to Quake" but I can't find substantiation that course ever existed, and might have confused it with this article:
http://archive.gamedev.net/archive/reference/articles/articl...
I'd also be interested in anything that extends the stack from where nand2tetris left off, because, while I loved it[1], it felt unsatisfying that can't actually compile to usable binaries for the hardware -- your executable can't usually fit in memory and it doesn't teach you how swapping (or whatever) would get you to that point. It also doesn't cover more common hardware/OS issues like interrupts, or having juggle multiple running programs.
[1] most interesting technical project I've ever completed, with the possible exception of Microcorruption.com.
btw the sn7400 is already a fairly advanced ic; something like an uln2003 is closer to 'the simplest real world integrated circuit'
probably the best place to start for this, in a top-down sequence, is the art of electronics by horowitz and hill. it explains how transistors and diodes act in §1.6, §2, and §3, initially explaining transistors with the simplified 'current amplifier' model (which already goes beyond the 'transistor switch' model you're thinking of), then quantitatively with the ebers–moll model; they're focused on how to use this information to design working circuits from discrete components you can put together on a circuit board. camenzind's designing analog chips (available free online) goes into how to use this information to design actual chips (not only does nand2tetris get into things like metastability and noise margin, the authors seem to be confused about what a chip even is, thinking you can make a chip by assembling other chips)
but the ebers–moll model is still not solid-state physics knowledge. so far the best overview i've found of that is madou's 'fundamentals of microfabrication and nanotechnology' which has a couple of chapters about solid-state physics, going into the historical development of quantum mechanics. but it's not really a quantum mechanics textbook; it's just an overview that shows where quantum-mechanical knowledge fits into understanding solid-state physics
'the feynman lectures on physics' is the best quantum mechanics textbook i've found so far, but because my knowledge of quantum mechanics is even more minimal, please don't trust my recommendation on this
hope this helps. good luck in your learning voyage!
If the goal is to explain how logic is implemented in general, skipping bipolar transistors and TTL and jumping directly to MOS may be easier. The behavior of a FET is fairly easy to explain, especially if you don't care about the ohmic region (which you usually don't in logic ICs), and it's straightforward to step from there to a practical implementation of a simple gate like an unbuffered NAND -- the latter of which can be trivially assembled on a breadboard with as little as two FETs and a resistor for a NMOS implementation.
Some older parts are specifically made to make creating complex PCB-level CMOS gates easy. i.e. https://www.ti.com/lit/ds/symlink/cd4007ub.pdf
you have to care about the ohmic region to be confident you've safely steered clear of it; at least one fet moves through the ohmic region every time a mos gate's output transitions
rtl is the bipolar equivalent of nmos (see the analog simulation at http://tinyurl.com/ylnljbgz) but you do need base resistors if you're going to try to drive its inputs with voltage sources instead of the outputs of other rtl gates. but you can omit them when the inputs are connected to rtl outputs http://tinyurl.com/ywja8z28
the flip side of that is that, though you need a base resistor to provide a constant logic high to an rtl gate, you can provide a low just by leaving the input open, you don't even need a wire like you do for nmos
bipolar logic is also a lot harder for students to blow up if your lab power supply has a current limit on its output
I think pretty much every sophomore level microelectronics book starts at basic semiconductor physics, works that into pn junctions, then transistors, then amplifiers, then gates and sequential elements.
A typical choice is Sedra & Smith https://learninglink.oup.com/access/sedra8e
But there is no shortage of choices.
sedra & smith is widely considered an excellent recommendation, but on skimming it, it seems that it does not cover solid-state physics at all or even mention any quantum effects; madou does spend a few chapters on solid-state physics, and of course feynman covers elementary quantum mechanics quite comprehensively. sedra & smith does go into a lot more depth on some aspects of chip design than horowitz & hill or even camenzind. it gives the ebers–moll equation in table 6.2, just not by name, and describes the inner workings of transistors in considerably more detail than the other books
horowitz & hill, camenzind, and feynman are much better written than sedra & smith or madou. the quality of the writing in sedra & smith in particular is quite poor; it contradicts itself every few pages, and often says things that require great effort to interpret as a correct statement, at least in the 7th edition i'm looking at
horowitz & hill also have much nicer schematics than sedra & smith or, especially, camenzind
I have only faint memories of my beginner's course on this topic at university, and absolutely no knowledge.
Somehow I remember the word MOSFET.
I think the wikipedia articles about logic gates should provide all necessary cross references.
"Fully understand" is an elusive term though. How do you fully understand the solid-state physics of logic gates if you don't fully understand all of physics, chemistry, maybe even quantum mechanics...
Not meaning to be dismissive though! I love to try to fully understand things and hate having to accept black box logic. But I also have to admit that I've given up on this approach for many things a long time ago.
Skimming the course summary, it sounds as if this "Hardware Description Language" might mark the boundary of what this course is about.
Makes sense, it's not "from physics to NAND", it's "from NAND to Tetris" :)
As frustrating as it is to black-box certain domains of knowledge, it’s an incredibly useful mental shortcut when used judiciously.
It's also just plain necessary as human knowledge gets more and more complex. The more time you spend on learning, the less time you have to actually make use of that knowledge. Ars longa, vita brevis.
The term "hardware description language" still gives me nightmares 5 years after my only experience working with them. Was working on my master's in an interdisciplinary CS/MIS/CompEng program for Cybersecurity and needed an elective. "Fundamentals of Computer Architecture" sounded kinda cool.
I walk in on the first day not realizing that while I had done my undergrad in MIS (fun fact: this is a business degree), literally every person in the course was either on the last semester of their undergrad in CompEng or were grad students that already had a BS in CompEng (this school combined some undergrad/grad lectures).
Suddenly i hear the teacher say like "grad students will also need to use an HDL and design a processor compatible with the basic MIPS instruction set." I started at "what's HDL mean?" Teacher responds "If that's a real question then it means: Hurry and Drop this Lecture." Day 1 and I already have the wrong questions for the wrong reasons.
That was a really bad 3.5 months... But it's also proof that if you hate literally everything hard enough, then it is absolutely possible to pull a 100 day "zero to MIPS HDL prototyping" speedrun.
The book is a great example of how we do pretty much everything with computers today: abstraction. You can definitely learn how a transistor works but this book/course explicitly starts with "you've got a NAND chip - GO!"
The course explicitly states that it’s not a physics, or even really an electronics, course. It doesn’t go into the gritty details of how all this stuff works in the real world, just how once it does work you can string it all together to build a computer and then a virtual machine to run on it.
Ben Eater does have a handful of early videos on his YouTube page that gave me a much better understanding of what's happening down at the physical and particle level. But at the end of the day, to succeed with this material you just need to understand the theoretically digital function of a transistor, not the physical properties.
Aside from his basic 8-bit CPU, Ben Eater goes into how transistors work too: https://www.youtube.com/watch?v=DXvAlwMAxiA . Once you've got transistors, his videos walk you through making gates. Once you've got gates, he switches to the 74xx series and builds a CPU.
I've done this too, and it also took me multiple (3!) tries to get through the entire thing. I interleaved it last fall/winter with Ben Eater's amazing series on building an 8-bit computer on breadboards. I bought everything over several months from China, then built the subsystems as the parts arrived over the winter. You should do that next! Aside from being (maybe even more) rewarding, it looks damn impressive to see all the flashing LEDs and understand what's happening.
Yes! Ben eater’s content accompanies nand to Tetris so well.
I did the 6502 project in which you assemble a computer system on bread boards (wiring together the clock, cpu, ram, etc).
It helped solidify many of the concepts from nand2tetris. For some reason doing it all physically with real chips and wires made it all a bit more memorable.
I’d love to try his other bread board project in which you assemble all the inner workings of a cpu on bread boards as well — I think this is what you were referring to.
Hang on a second, does nand2tetris not involve real chips and wires?
No, nand2tetris is done in virtual environments.
This is largely about accessibility. If it’s tied to hardware, fewer people can do it. Additionally, real hardware means there’s additional opportunity for error due to faults in the hardware or environmental variables.
That said, Nand2Tetris could, in theory, be done with a bunch of 74xx NAND chips on a breadboard.
The Nand2Tetris computer is a bad fit for 74xx chips and breadboards. It's 16 bit, for one thing, which implies a lot of chips and a lot of wires on a lot of breadboards, and the usual current problems that come with that. Better have a good source and an oscilloscope nearby. Also, the virtual design sweeps a lot of important timing issues under the rug, so you need some EE chops to translate it correctly to real hardware.
I know of a few people who managed to get a working Nand2Tetris computer on breadboards, but it took a lot more time and money than they thought it would.
On FPGA, though, it works nicely.
Thanks for the recommendation. I'll definitely look into it!
This and books like Code give me such deep respect for the people who originally figured these things out.
I've read Code and most of Computer Systems, a Programmer's perspective, but doing something by hand would've still been better!!
We did the whole project as part of a class; it was one of the best classes I took in my CompSci program. It was excellent.