
From Nand to Tetris: Building a Modern Computer from First Principles - craftyguy
https://www.nand2tetris.org/
======
sfifs
I just completed part 1 building a computer from gates and writing an
assembler and am in the middle of part 2 where you develop compilers and a
stack based virtual machine.

For someone like me who did not study computer science but has been a self
taught programmer in the Analytics spacefor over a decade, this has been a
tremendously useful and accessible introduction to basic CS concepts and very
eye opening in terms of what's actually happening under the hood. This course
is highly recommended if you've not studied CS though be aware the second part
of the course where you develop compilers is quite intense though being an
online course, you can pick your pace.

I wonder if there are similar courses on CS algorithms for people who didn't
study CS in college.

~~~
barry-cotter
[https://www.edx.org/micromasters/ucsandiegox-algorithms-
and-...](https://www.edx.org/micromasters/ucsandiegox-algorithms-and-data-
structures)

Comprises the following courses

Algorithmic Design and Techniques Data Structures Fundamentals Graph
Algorithms NP-Complete Problems String Processing and Pattern Matching
Algorithms Dynamic Programming: Applications In Machine Learning and Genomics
Graph Algorithms in Genome Sequencing Algorithms and Data Structures Capstone

~~~
tankenmate
Very little of which is communicated in any way to help someone learn how
compilers work.

In the actual history of computing very few good compilers were ever written
by algorithm and data structures professors; most were written by people who
had a pragmatic drive to get something done. Theory is good but without
practice it is little more than navel gazing. Theory and practice need each
other.

The reason that nand2tetris works so well as a course is that it gives you a
concrete example of how all these algorithms and data structures are combined
in order to turn an abstract description (the source code) into a running
program that also includes how that computing is achieved through compiler,
assembler, linker, run time, operating system, isa, and finally in
transistors.

The true issue it gets to is that most programmers have very little
understanding of how computers _actually_ work, and when things break they
just do high order _guessing_ to get things working again rather than truly
understanding what went wrong.

~~~
madengr
As an EE undergrad, I had to design a TTL based processor, program the
microcode, etc. I have no idea how a compiler works, or anything above
assembly.

------
sergex
I made a small game inspired by the first lessons in the course:
[http://nandgame.com/](http://nandgame.com/)

~~~
mrunkel
This is really awesome.. I too love the book Code by Petzold. I was wondering
if I could help translate this into German? I have some work colleagues that
could really benefit, but I think it would be easier if the explanatory text
was German.

~~~
sergex
That would be really cool. I need to refactor a bit to allow different
translations of the text, but I can get back to you when it is possible.

------
JoeSmithson
I really cannot recommend this course enough, I find myself referring back to
it in so many different fields (security, debugging, programming language
design)

When I finished school, I was fairly knowledgeable about physics, including
logic gates and electronics, and I was a fairly good programmer, but I had no
idea how that virtual world arose from the physical.

When I type on a keyboard, what is _physically happening in the universe_?

This course helped me understand that question.

~~~
neuralzen
Well said, this pilgramage is definitely a worthwhile one.

------
Cyphase
Previous discussions:

[https://news.ycombinator.com/item?id=13209452](https://news.ycombinator.com/item?id=13209452)

[https://news.ycombinator.com/item?id=14526344](https://news.ycombinator.com/item?id=14526344)

------
userbinator
If you would like to start at a slightly lower level, Charles Petzold has
written a great book on the subject:

[https://www.amazon.com/Code-Language-Computer-Hardware-
Softw...](https://www.amazon.com/Code-Language-Computer-Hardware-
Software/dp/0735611319)

~~~
WalterGR
_Using everyday objects and familiar language systems such as Braille and
Morse code, author Charles Petzold weaves an illuminating narrative for anyone
who’s ever wondered about the secret inner life of computers and other smart
machines.

... cleverly illustrated and eminently comprehensible story ... No matter what
your level of technical savvy, CODE will charm you—and perhaps even awaken the
technophile within._

 _Code_ doesn’t sound “slightly lower level”.

~~~
mrunkel
I think you and the GP are using "lower level" in different ways. GP means
with a lower barrier to entry, you mean "closer to the electrons" if I
understand both of you correctly.

------
leowoo91
I wish that existed as a last year course in college. It has a lot of recap on
the parts that creates a modern day computer and likely gives you
understanding where imperative languages come from.

~~~
sfifs
I believe several college CS courses globally use this in year 2 or year 3.

------
gmiller123456
They mentioned at the end about actually implementing the CPU in hardware with
an FPGA. Just curious if anyone has actually tried that?

~~~
stefanpie
A quick google search yielded this:

[http://excamera.com/sphinx/fpga-cpu.html](http://excamera.com/sphinx/fpga-
cpu.html)

------
jpochtar
Once you’ve learned programming, this book is maybe the perfect survey course
to understand systems. It gave me a framework for understanding all the layers
from CPU to ReactJS that 4+ years of college never could so concisely

------
ASipos
The title of the course is misleading, as it suggests that NAND gates are the
only required primitive, whereas the course later introduces DFF gates,
without which you cannot escape the parallelism of chips.

~~~
tankenmate
And one thing that is said even less is why NAND? You can do it all with NOR
gates as well if you want. The reason for NAND has to do with the switching
speed, pMOS switches quicker in parallel (either transistor can get the
current flowing) and nMOS switches quicker in series (either transistor can
stop the current flowing); this is how a NAND gate is wired. NOR gates on the
other hand have the worst of both.

The fact that nMOS switches off quicker is why the most common form of dynamic
logic (as opposed to static logic) implements, in effect, the bottom half of
the CMOS in nMOS and the upper half using a capacitor; which holds the charge
and hence pull up for the length of the clock cycle (which is why dynamic
logic CPUs can't be single stepped in hardware, the clock speed is too low to
hold a charge).

~~~
all2
During my intro to computer engineering course, lectures touched on why NAND
gates, and the conclusion was that you can build anything you need in a basic
computer using NAND gates. It boils down to expense. A BOM (bill of materials)
with fewer line items tends to be cheaper.

This doesn't really hold in today's world of silicon prints, but at the start
I think it was price that drove the decision.

~~~
tankenmate
Actually if you take an XOR gate with a naive translation into NAND gates you
would use 20 transistors, but if you don't need a large fan out from the
output you can actually do it with 6 transistors using a pass gate layout
(which is neither NAND nor NOR). So typically you don't use NAND vs NOR
because of transistor count.

~~~
all2
Oh! Good to know. Thank you!

------
kyberias
The font on that site looks absolutely horrible on Windows 10+Chrome.

