Hacker News new | ask | show | jobs
by knowknow 489 days ago
Having done nand2tetris before doing various digital logic courses, I feel like the first portion falls a little short of its tagline of making a computer from modern first principles. It focuses too much on the specific implementation of its own architecture rather than giving the tools needed to create the architecture from scratch.

It doesn’t teach things such as product of sums and kmaps which allows you to methodically find the Boolean equation for any arbitrary output. I spent most of my time during the architecture implementation finding the correct expressions, while it becomes trivial if you learn how to do it systematically.

It’s lacking in teaching how state works, mostly because it passes over flipflops and their applications. It also doesn’t teach finite state machines (FSM), which was the single most important thing for me in understanding how to actually implement an architecture. This is because the concept of FSMs abstracts most of the logic and focuses on the behavior, and once you design the behavior you can then methodically implement the logic with the previously mentioned techniques.

3 comments

> It doesn’t teach things such as product of sums and kmaps which allows you to methodically find the Boolean equation for any arbitrary output

This is useful beyond low-level work. Every now and then I review code where the author has a complicated boolean condition (often in combination with auth and caching) and there's a much simpler way to write it -- that also has a more intuitive interpretation!

The same thing goes for finite state machines, of course, but the refactorings suggested are often trickier to apply in a late-stage code review.

These things used to be the basis of CS education 20 years ago. Are they not today?
Why do you assume that OP has a computer science degree?

IT has always been a sector where you can have a degreeless career. Moreover, plenty of IT degrees are not computer science (data science degrees, to take a popular example)

I did a bachelors degree in Electronics and Communication engineering. It was standard to watch things go from a diode, to transistor, to a flip flop, to a register, then 8/16/32 bit adders- Once here subtraction is just addition in 2's compliment. Multiplication is repeated addition, and division being repeated subtraction.

After this you immediately go and learn 8085, and then 8086

Pretty sure they are not anymore, when I was majoring in cs the deepest I was taught was assembly and architecture at a high level. I then switched to computer engineering and that’s where digital logic was a mandatory class.
Do you have a recommendation for a book or course that teaches these things better? In particular FSMs.
Structure and interpretation of computer programs is a better nand2tertis. The issue is that it contains about 10x the information, assumes what an undergrad science student in 1980 would have known, has problems that are entire chapters of nand2tertis and uses scheme.

And it's not until the end of the last chapter that you build a stack machine in about 40 pages from memory.

I can't see how SICP is better than Nand2Tetris. To be clear: none of them are better than the other simply because these are two completely different books, both in their approach style how explain things and their contents. You are basically comparing apples to oranges. If you know nothing about computers Nand2Tetris and Code by Charles Petzold are two books that will make you clearly understand how a computer works in a constructively way. SICP starts with an already running Scheme, so the computer and the language are already there.
Read chapter 5 of SICP.

Whenever I talk to people who rave about SICP I get the feeling they never made it to chapter 4 and beyond.

> In this chapter we will describe processes in terms of the step-by-step operation of a traditional computer. Such a computer, or register machine, sequentially executes instructions that manipulate the contents of a fixed set of storage elements called registers. A typical register-machine instruction applies a primitive operation to the contents of some registers and assigns the result to another register. Our descriptions of processes executed by register machines will look very much like ``machine-language'' programs for traditional computers.

https://mitp-content-server.mit.edu/books/content/sectbyfn/b...

The transistor level simulation happens in 3.3.4 "A Simulator for Digital Circuits".

Soo, maybe go nand2tetris and then SICP?
I really liked this book https://www.goodreads.com/en/book/show/2558730.Digital_Desig...

It teaches the basics and then how to build a MIPS processor.

I know that's only part of what nand 2 tetris aims for. But still good.

I would really recommend Digital Design and Computer Architecture, I’ve got the ARM edition. I believe it covers everything OP mentioned, and I know it covers FSMs. It’s a great read if you want the tools to design your own architectures.
This Youtube channel has amazing explanations, starting with:

How Transistors Run Code?

https://www.youtube.com/watch?v=HjneAhCy2N4

there is “switching theory and finite automata” by zvi-kohavi, one of my prized possessions from an era long past.