Get the top HN stories in your inbox every day.
meter
wintogreen74
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.
sunday_serif
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.
nvy
>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.
Hang on a second, does nand2tetris not involve real chips and wires?
meter
Thanks for the recommendation. I'll definitely look into it!
shostack
This and books like Code give me such deep respect for the people who originally figured these things out.
Lamad1234
I've read Code and most of Computer Systems, a Programmer's perspective, but doing something by hand would've still been better!!
MichaelZuo
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.
jholman
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.
SilasX
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.
_fizz_buzz_
A “silicon to nand gate” would be a sweet complimentary course. However, probably more difficult to make hands on.
MichaelZuo
> It's not "silicon wafer to Tetris"...
That is a good point, I had just assumed that information was available somewhere online, but it doesn't seem likely.
undefined
moritzwarhier
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" :)
froggit
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.
FredPret
As frustrating as it is to black-box certain domains of knowledge, it’s an incredibly useful mental shortcut when used judiciously.
1000100_1000101
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.
jon-wood
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.
wintogreen74
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!"
cdcarter
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.
kragen
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!
duskwuff
> btw the sn7400 is already a fairly advanced ic; something like an uln2003 is closer to 'the simplest real world integrated circuit'
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.
throwaway3090
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.
superfunny
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.
emschwartz
I loved this course and would strongly recommend it to anyone who works with computers that hasn't taken low-level CS classes.
This course does an exceptional job of giving you an intuitive understanding of some critical parts of how a computer works that affect higher-level programs and programming languages (for me the biggest aha! was grokking the difference between the stack and the heap). It is also incredibly fun to appreciate how magical it is that these complicated machines we use are just built from these simple circuits that you keep building up and building up through the course. Finally, the teachers did a fantastic job of simplifying what could be multiple semesters worth of material to quickly give you the gist of things like assembly languages, without oversimplifying.
Really can't recommend this enough if you have the time to do it. FWIW, the first part of the course (from NAND gates to building a CPU) is very fun and fairly easy. The second part (going from a computer to a full operating system) is quite a bit more work.
CWIZO
Is the online course and the book the same material? Trying to figure out if I need both or either.
aleph_minus_one
The two online courses at Coursera are based on the First Edition of "The Elements of Computing Systems: Building a Modern Computer from First Principles": https://www.amazon.com/Elements-Computing-Systems-Building-P...
The most recent edition of this book is the Second Edition: https://www.amazon.com/dp/0262539802/
To quote from the Preface concerning what the difference between these two editions is:
"The Second Edition
Although Nand to Tetris was always structured around two themes, the second edition makes this structure explicit: The book is now divided into two distinct and standalone parts, Part I: Hardware and Part II: Software. Each part consists of six chapters and six projects and begins with a newly written introduction that sets the stage for the part’s chapters. Importantly, the two parts are independent of each other. Thus, the new book structure lends itself well to quarter-long as well as semester-long courses.
In addition to the two new introduction chapters, the second edition features four new appendices. Following the requests of many learners, these new appendices give focused presentations of various technical topics that, in the first edition, were scattered across the chapters. Another new appendix provides a formal proof that any Boolean function can be built from Nand operators, adding a theoretical perspective to the applied hardware construction projects. Many new sections, figures, and examples were added.
All the chapters and project materials were rewritten with an emphasis on separating abstraction from implementation—a major theme in Nand to Tetris. We took special care to add examples and sections that address the thousands of questions that were posted over the years in Nand to Tetris Q&A forums."
brailsafe
I'd recommend watching the course material and reading each chapter. It depends on a little luck which material clicks and how quickly, for me it varied from chapter to chapter whether or not I could get by with just the videos.
molly0
Im currently taking this course without having the book and it works great. I might buy the book later but for me it’s important to have the imposed weekly deadlines in order to not just drift away and do something else instead.
emschwartz
I did the course without the book. I haven’t actually looked through the book, but the Coursera class was definitely enough on its own.
weiliddat
I first tried the course many years back, and didn't complete it (not necessarily only because it was in course form). Last year I bought the 2nd edition book, and found it more accessible, as a do it on your own time type of project, and as a reference while implementing the parts.
firesofmay
I highly recommend this course/book. It's extremely rewarding once you go through it.
Semitangent
I found nand2tetris a very natural progression for me after finishing Ben Eater's great 8bit computer series (https://eater.net/8bit/). It just makes you grok so many basic concepts of computer design which are quite often glossed over. A perfect project to start over the holidays!
Night_Thastus
Second recommending Ben Eater. I love his videos. Two of my favorites are the introduction of loops, and the introduction of interrupts. Seeing the code he wrote re-written using these to be so much more elegant was very satisfying.
jameshart
For me the 'aha' moment was the microcode section of the 8-bit computer project. Just the physical understanding of how it can take a different number of clock cycles to execute an 'instruction' - and how (in this architecture) every instruction cycle has to start with the memory address switching to the current program counter, and the data from that address being loaded into a register.
I haven't gone as far as actually building a breadboard CPU, but I was able to apply what Ben teaches to build several functional microprocessors in https://www.falstad.com/circuit/circuitjs.html, starting with basically reimplementing the breadboard model he built out.. but then after watching the 6502 series, going back and being able to see and even implement some of the things that implies about the internals of a 6502 processor.
JKCalhoun
Did Ben Eaters 6502 computer this past summer. Can also recommend.
Guess I'll have to look into NAND to Tetris now.
captn3m0
I did nand2tetris during my time at Recurse, and I spent a lot of time watching Ben Eater those days. They paired nicely.
mikpanko
Here is a fun Nand game inspired by the course: https://nandgame.com/
AlchemistCamp
Here’s an even more fun one with overwhelmingly positive Steam reviews! https://store.steampowered.com/app/1444480/Turing_Complete/
artsi0m
I played both of them. Turing complete has a more non-linear arcade mode. I mean that you can choose which level you want to complete first.
There is also soundtrack and a little bit of story line present. There is also gog version of this game.
I feel that I learned almost no new skills this semester, but I remember asking my circuit design lecturer questions about this game (in particular, about the possibility of constructing full-adder with fewer elements). That was fun
You can stick to nandgame, if you don't want to pay, you loose almost nothing, but playing Turing Complete is more handy because it keeps progress on your computer and/or on the steam account. So, if you clean cookies every time you restart your browser, when using ungoogled-chromium for example, you better play Turing complete.
Also one internet friend advised me to play incredible pm https://incredible.pm/
It is a similar game, but the main theme is proofs rather than digital circuits. Hasn't played yet, unfortunately.
SilasX
I've completed both nand2tetris and Turing Complete. A note about differences:
- TC only goes up to the level of writing programs in assembly, while nand2tetris has you build layers of abstraction on top of that so you can program in a Java-like language. In fact, TC doesn't give you "assembly code" at all, you just implement binary instructions, and they leave it to you to decide your own mnemonics for each byte of the 4-byte instructions (on the second computer you implement).
- TC lets you make more of the decisions yourself regarding architecture, like how to address memory.
One thing I didn't like about TC is that, when doing the projects to build the (second) computer, it doesn't regression test. When you implement new opcodes, you can be credited for completing the level, even though you broke the previous ones you implemented, and you might not realize it until several projects later, when your computer doesn't work.
geoelectric
Turing Complete is a great game. Finishing it was a major sense of accomplishment for me, particularly since I rarely complete games (though Zachlikes are a common exception).
This is from my Steam review (one of two ever, I liked it so much):
> Man, what a trip. I’ve played the NAND game and MRHD, among others, but never quite got to the “build a computer” endgame. I did with this one. At this point I’ve built a 256-byte RAM system that does six math instructions, six conditional jumps, and subroutine calls using its own stack—then developed my own assembly language for it which I'm now using in the endgame to solve more traditional programming puzzles.
> And I designed and built the entire architecture for it myself. The initial levels are mostly "one solution only" problems that each results in you designing a component. But by the time you're at midgame, all the decisions are yours as long as the output is correct. Previous problems tend to hint towards partial solutions of later problems, but very little is given to you outright. That gives you an incredible sense of accomplishment for what you put together.
That said, unless they improved the bit where wiring tends to merge together and virtually short out during edits, it can be a little frustrating once things get very complex. It's not enough for me to not recommend it, but there was a point where I felt like I was having to master the tricky interface quirks as much or more than the logic. Shenzen IO did that part much better.
aleph_minus_one
Here is another game on steam that is nearer to the first part of "From Nand to Tetris":
MHRD
vintermann
While we're recommending programming games, I think Virtual Circuit Board is a bit underappreciated. It's a pure sandbox, not a game, so you have to bring the ideas yourself, but it hits a really sweet spot somewhere between Minecraft redstone and Logisim.
You just draw traces and add gates on a grid, with a few special IO components like the Nand2Tetris course. But there's some kind of compilation of the circuit, and simulation can be blazing fast, way faster than other programming games/programming friendly sandbox games.
NanoCoaster
Definitely recommend Turing Complete. I've been playing it off and on over the last few weeks, just finished the first working CPU. It includes small hints and solutions for most levels, so if you get stuck, you'll always have a way forward. The interesting thing is, for a lot of levels, you can just google the component you're trying to build and use actual logic diagrams as guidance.
The game makes the whole topic a bit easier to grok with its visuals and the ability to step through your circuits when they're running. So, great fun. But beware, if you've been bitten by Factorio addiction, you might be in danger of missing a lot of sleep :)
Also, as some other comments mentioned, I highly recommend the Zachtronics games. Exapunks is amazing. But they're quite different, they're more like puzzle games about programming.
Night_Thastus
It's a bit different, but I also recommend both TIS-100 and Shenzhen IO. Both of them involve writing in an assembly-esque language, and it's very fun to learn!
captn3m0
I gave up early on TOS-100, but that was before I did nand2tetris. I did Nand2tetris before Shenzhen-IO and really enjoyed it.
Yet to finish Shenzhen IO, but I blame it on me stupidly doing premature optimisation.
Night_Thastus
Both TIS and Shenzhen are cases where I'd say make something ugly that works, then go back and fix it hours later when you have new tools and experience.
IE, the very first puzzle gets an easier solution once you learn about a hidden command.
There's satisfaction to leaving a solution to come back days later and go "whoah, this better solution is so obvious" which is easy to miss when you're stuck on it for hours.
shpx
I can also recommend the Digital Design and Computer Architecture lectures from ETH Zürich if you're trying to understand computers at a lower level:
https://www.youtube.com/playlist?list=PL5Q2soXY2Zi-EImKxYYY1...
naitgacem
this is a gold mine! I've taken an introductory course on computer architecture, unfortunately we didn't get far and definitely didn't touch on anything about out-of-order execution or the similar magic CPUs do nowadays. this'll playlist will be my holidays theme
thanks for sharing!
AlecSchueler
Great memories of this book, and of the period of my life I picked it up in. I was at coffee with my girlfriend saying I'd read you could make all the logic gates using only NANDs, so we got curious and wrote NAND on a bunch of napkins to see if we could figure them all out.
We did and it was great fun. For each gate we figured it with NANDs we would write the name of the new gate on a napkin.
We took the napkins and the joy of it home and sheet a few days we started combining those gates up as well, trying to eventually figure out an entire ALU. And so along came multiplexors and a bunch of other fascinating stuff.
Eventually we got stumped, but I'd heard about this book and we decided to order it. The rest of the chapters really did help us get an understanding of the low level that had always been mysterious to me as someone with software experience only.
Can't say I ever did make it all the way through in terms of building around, though. Once it got more into the low software levels I felt I already had enough of an understanding that the work didn't seem so appealing, but the read was still fantastic.
pythops
There is also this repo from george hotz, very interesting ! https://github.com/geohot/fromthetransistor
jpcfl
I wasn't sure what I was looking at at first, since there's no material, just a rough outline of a hypothetical course. The initial commit makes it a little clearer:
> Wrote this a few years ago, wanted to put it online. Hiring is hard, a lot of modern CS education is really bad, and it's so hard to find people who understand the modern computer stack from first principles. Maybe if I ever get 12 free weeks again I'll offer this as a play at home course. I want to play too.
slalomskiing
It’s funny he says a lot of modern CS education is bad
I did Computer Engineering rather than CS for undergrad and we covered like 80% of the topics in that list
Had multiple courses in Verilog/OS and worked a lot with microcontrollers/FPGAs. Building a CPU in verilog then writing an assembler/compiler was definitely the highlight.
Was a hard program but I felt like I had a really good understanding of the full stack coming out of it.
Maybe he just isn’t familiar with CE?
throwaway17_17
Where I’m did you do undergrad. My son is not having much success finding a college to shoot for in terms of having a goal. I think a curriculum like you describe would at least show him some options that exist.
bhasi
Gatech, UPenn, U Colorado Boulder all have great CompE programs at both undergrad and graduate levels.
Jtsummers
Georgia Tech has (when I was there at least) a good CMPE program.
jholman
Seems to me that CE covers sections 1, 2, 3, 7, and a bit of 5, and CS covers 4, 5, and 6. A traditional CS education should teach 3, even though doing 3 is absolutely not the job of CS grads.
elevaet
I wonder if the prequel "sand2nand" would be possible as a DIY project?
samvher
cjpearson
> Native oxide is stripped off the wafer with a quick dilute HF dip and then they are extensively cleaned in Piranha solution (H2SO4:H2O2), RCA 1 (H2O:NH3:H2O2), RCA 2 (H2O:HCL:H2O2), followed by another dilute HF dip.
Fascinating project, but I'm not going to try this one at home
Two9A
Oh goodness, this is the kind of thing I've been trying to find for years now: some method of making a computer from scratch, as in from raw materials.
Will have to look into your progress, thanks.
partomniscient
The Great Tinkertoy Computer [1] is made from raw materials, although its specific rather than a general purpose computer, and had computer aided design although back in the day it was via a PDP-10.
[1] https://www.computerhistory.org/collections/catalog/X39.81
samvher
Just to clarify, not my project! :)
yoyohello13
I took this course on a lark when I was working as a data analyst. It inspired me to change careers. Absolutely excellent course. Definitely do it if you've got the time.
hnthrowaway0328
Congratulations! Did you switch to a lower level programming career path?
yoyohello13
I'm making apps for a local company now. Still valuable info though. I use the text parsing knowledge I gained from this course quite a bit.
hnthrowaway0328
That's pretty good. I'm glad that you made the switch you wanted.
cushychicken
Does this still use a custom hardware description language?
The curriculum here is very solid - my only critique is that it uses a custom HDL instead of Verilog, VHDL, or SystemVerilog.
It wouldn’t have been a huge stretch to do that, and make the skills taught that much more real as a result. Without the practical aspect of exposure to real HDLs, it seems more like a toy than a tool.
bmitc
I don't think there's anything to be gained by switching to VHDL or Verilog. Their custom HDL is a fine HDL for the uses of the course. There's so much commonality that they're effectively interchangeable syntactically. If the idea was to use VHDL or Verilog such that one could actually make the CPU on silicon or an FPGA, then that opens up a whole can of worms that is well beyond the scope of the course. I do think it would be awesome if they had a sequel that did this, but I think it doesn't make sense in the context of the existing course.
warkanlock
Knowing Verilog, I must disagree. Although it would be more beneficial if the book focused on hardware, its primary goal is to teach something other than hardware-specific definitions. HDL serves as a bridge to illustrate communication with predefined logic gates.
The book should include a mention or an appendix to clarify its real-world applications. By the end of chapter five, I was dissatisfied, feeling a lack of control over the crucial aspects of the hardware I just built. However, a book can only do justice to some of the missing pieces of information we have.
brailsafe
I found Chapter 5 to be quite challenging, largely because it took a while to understand the combinatorial way in which any of the chip parts would get new inputs and so on, especially coming from a traditional sequential programming background.
What specifically did you feel like you were lacking from the language?
sweetjuly
This was my experience with the course as well. It was fun but not useful.
Learning Verilog later really opened the world of digital design for me and has let me build actually useful things. It's probably a non-goal though for this coarse to turn people into digital designers, this seems more aimed at people with a passing interest in HW as opposed to those who really want to go deep.
Kortaggio
This was an amazing course and is one of the most rewarding computer science courses I've taken! I loved that there was nothing left to "magic" and it was the first time I felt like I understood the "full stack" of the Java-like code I was writing right down to the transistors.
Self-plug for a full-blown minesweeper game I made for the final project: https://github.com/billmei/nand2minesweeper It's a complete game with a tutorial, custom RNG, and unit tests, using their hardware simulator.
mentos
How many hours/weeks would you estimate it took you to complete the course?
Kortaggio
Part 1 was significantly easier than Part 2; Part 1 (the hardware part) only took 2 weekends for me, but every assignment on Part 2 took several weekends each. Granted, this was also because I was learning about operating systems and compilers at the same time; if you're already familiar you could considering skipping Part 2 altogether, or otherwise you might have an easier time than I did.
Get the top HN stories in your inbox every day.
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.