Live data from Hacker News

Building a Modern Computer from First Principles

nand2tetris.org

41–50 of 84 posts

Re: Building a Modern Computer from First Principles

#41
post #24

I going to come across as defensive here, but I'm actually in a Computer Engineering program (not Computer Science). This book purports to cover as much material as 8 undergrad courses, I feel like it must skimp on depth to (for example) condense all of 'compilers' into two weeks. Compilers are a very large topic, a single undergrad course isn't even sufficient to really understand a real world project like GCC. Like…

The hardware content in this book is not sufficiently detailed for computer engineering. It's really for CS students who want to understand roughly how computers are made. (This is evident by counting pages in the book: the first 5 chapters are the hardware chapters and they span only 100 pages. The remaining 200 pages cover the software stack from assembly up.) For example, one of the assignments is to design a 16-b…

The things you list are pretty much some of the base fundamentals of circuit design. I can't imagine that this curriculum is of much use without them.

Also, I seriously doubt that it covers the entire breadth of information required to create, from scratch, the entire video subsystem required for displaying graphics. Or anything like that.

Re: Building a Modern Computer from First Principles

#42
post #32

It's an amazing book and doing all the projects is really fun. However keep in mind that the computer you build is really simple and in my opinion maybe a little bit too simple. In particular there is no decent IO model and reading from the keyboard is simply done by busy waiting and writing to the screen is done by writing to a special region in memory. This is ok, as the book covers many topics, but I would enjoy f…

Historically, writing to the screen was done by writing either ASCII or pixel values to a special region in memory (e.g. Apple II, IBM PC). I'm not sure what you're suggesting the book should do instead? Use a serial port and terminal? Implement a GPU? (I'm not being sarcastic, just looking for clarification.)

My point is that after reading the book I kind of knew how I could implement a simple CPU in real HW (with ALU, memory, etc.) but it was not clear to me how the IO part (kbd, screen) would work. Is the kbd connected directly to a certain place of memory? How is this implemented? Would there be some screen/gpu HW that is directly connected to the memory region? How is the CPU clock involved?

E.g. if you press a key, hold it and then release it, it is possible that this event gets missed as it was too short and the key press method did not check the memory region at the right point of time. For me their implementation enforces this bogus "I am in total control of everything that happens feeling" which often leads to bad design as it ignores the messy real world. I would have appreciated something more sophisticated and generic there which would work for different kinds of HW. Maybe I am missing some simple bus-system one might say ...

Nevertheless it is a wonderful book and I had lots of fun with it! :)

Re: Building a Modern Computer from First Principles

#43

Yes, good approach. It would be very cool to build this from real hardware instead of an VM, now that we have Arduinos and RPI's.

You could convert their custom HDL to Verilog, for programming an FPGA. I've thought about doing it before, but I've never seen enough support to do it myself.

Re: Building a Modern Computer from First Principles

#44
I actually started writing my own hardware test runner[0] to more imitate a spec/unit test runner, and because I really wanted just a folder, a NAND gate, and a DFF. I found the built-in components confusing, because I would not implement parts, and yet the tests would still pass.

Also, the source (thousands of lines of decent Java) is available at the bottom of the download page[1].

[0] https://github.com/Jared314/n2trunner

[1] http://www.nand2tetris.org/software.php

Re: Building a Modern Computer from First Principles

#45

Question to those that already have this book - is the book full of diagrams? I ask because I could get this on kindle instantly (but diagrams suffer) or in paperback in a week or so. Is it worth getting the physical book over the e-book for this?

Several of the chapters are available as pdfs from the site

Re: Building a Modern Computer from First Principles

#46
Re the complaints about how idealized the hardware chapters are: http://www.amazon.com/Computation-Structures-Electrical-Engi... also covers the full stack from transistors to operating systems, but with much more depth on the lower levels. It's pretty old, though.

Re: Building a Modern Computer from First Principles

#47
Another book in the same space is "Understanding Digital Computers, by Forrest Mims, originally sold by Radio Shack. It's dated, written in 1978, but the basics are still relevant, taking the reader from the definition of a bit, though binary numbers, Boolean logic and eventually to a complete microcomputer and its programming.

I read this book as a teenager and I remember it giving me my first "aha!" moment of understanding how computers really work. In my experience, the prerequisites for understanding the book are pretty low, but the knowledge within is sophisticated.

Re: Building a Modern Computer from First Principles

#48

I going to come across as defensive here, but I'm actually in a Computer Engineering program (not Computer Science). This book purports to cover as much material as 8 undergrad courses, I feel like it must skimp on depth to (for example) condense all of 'compilers' into two weeks. Compilers are a very large topic, a single undergrad course isn't even sufficient to really understand a real world project like GCC. Like…

Just as meaningful as a full course. This is just a "depth first search" thru the content, getting from top to bottom in one pass; you're complaining its not a "breadth first search" covering everything on one level. Done this way, you get the gist of how it all does, in fact, go from NAND gate to games - yes a lot is glossed over or missed, but once the student sees the vertical structure he can see how each layer c…

This is actually closer to breadth-first (since the alternative is an 'in-depth' course) in my mind, but I get your meaning. The thing is, do you actually take anything away? If you don't talk about caching in the CPU, scheduling in the OS, or propagation delay in the gates, how does that help your understanding of how to write software?

I'd be curious to know a) how deep your education actually went (since you've implied it was broad, from logic gates up to OSes and high-level programming) b) what you actually do day-to-day that you think this high level overview is indispensible.

Re: Building a Modern Computer from First Principles

#50

I pointed this out above, but this is really a course for CS people that glosses over a lot of computer engineering topics that you need to, say, design your own processor. It's definitely a tremendous accomplishment, but let's keep our pants on here.

Such as? Does it skip over K-maps or something?
Post reply on HN