Building a Modern Computer from First Principles
171 points by josh-wrale 8 years ago | 26 comments- seibelj 8 years agoI recommend the associated book[0] to everyone who asks me about programming book recommendations. The book arrives, and you are shocked at how small it is, just a few hundred pages. If you follow all of the exercises, you get an understanding of how logic works inside of processors (logic gates, adders, etc.), how machine code drives them, how assembly maps to machine code, how a basic virtual machine language (like the JVM) can compile to assembly, then how a higher level language is designed and compiled to the VM.
After doing all of this, you make Tetris in the high level language. It's a badass book, super well-written, and what I consider an essential text.
[0] https://www.amazon.com/Elements-Computing-Systems-Building-P...
- bhrgunatha 8 years agoThe authors also created a course on Coursera [1] which is also worth a look. Although it only covers the first half of the book (up to Assembler Language.) The authors have promised part 2 but it hasn't been released yet.
- anton_gogolev 8 years agoHaven't read the book you're recommending, but I feel it's more or less close to Code[0] by Charles Petzold, which in itself is a fascinating read.
[0]: https://www.amazon.com/Code-Language-Computer-Hardware-Softw...
- GrumpyYoungMan 8 years agoThe two are not at all similar. Petzold's "Code" is good but is aimed at non-technical readers while "The Elements of Computing Systems" is more or less a textbook that encapsulates a longitudinal slice of a 4-year computer engineering program, complete with exercises. It's really quite impressive in what it manages to cover (although the massive amount of material glossed over or omitted does make me wince).
- lukeck 8 years agoI read both books a long time ago. My recollection is that Code spends more time building context and explaining why something works as it does. "Elements of Computing Systems" gives more detail on how to implement many of the same concepts in a simple way. Both are great books.
- GrumpyYoungMan 8 years ago
- mavelikara 8 years ago+1. This is also my default recommendation for people from other disciplines who want to get in to professional programing. This is a great intro to understanding how everything hangs together, before going on to learn the framework flavor of this month.
- josh-wrale 8 years agoThanks! I bought the book earlier today and am looking forward to it. One of the things I'm interested in is how to construct gate-level emulation in software. I saw a video about 6502 hardware emulation where the guy said his was half-cycle complete. Looking forward to understanding all of that.
- clevernickname 8 years ago> I saw a video about 6502 hardware emulation where the guy said his was half-cycle complete. Looking forward to understanding all of that.
To give you a little head start on that, where many digital circuits are clocked (or make one step) on just the rising edge of a clock cycle (where it transitions from low-to-high), the 6502 clocks on both the rising and falling edges; certain parts (like the hardware that initiates a memory access) will fire on the rising edge, then the part that needed that information will fire on the rising edge half a cycle later (like making the ALU start adding the value that was just fetched from memory to the accumulator)[1].
If you've ever heard someone say that a 6502 of one speed is roughly equivalent to a Z80 clocked at twice the speed, now you know why: the internal logic is essentially clocked twice as fast as the input clock.
[1] IIRC this isn't completely correct, and external memory is allowed to take up to 3/4ths of a cycle to perform a memory access to accommodate slower ROMs, but you get the idea.
- vardump 8 years ago> If you've ever heard someone say that a 6502 of one speed is roughly equivalent to a Z80 clocked at twice the speed, now you know why: the internal logic is essentially clocked twice as fast as the input clock.
1 MHz 6502 is about as fast as 3 MHz Z80. Although your mileage my vary, some say up to 4 MHz Z80.
- Narishma 8 years agoIs the 6502 unique in working that way? If so, why didn't other processors use the same technique?
- vardump 8 years ago
- clevernickname 8 years ago
- Animats 8 years agoNote that the book is from 2005.
- seibelj 8 years agoThat makes absolutely no difference. Nothing about the fundamentals of computer systems has changed significantly in 30 years let alone 11
- seibelj 8 years ago
- bhrgunatha 8 years ago
- jpochtar 8 years agoI can't recommend this book enough. I read it around 9th grade and I've never looked at computers the same. It gives the reader confidence in understanding how these magical machines work from top to bottom. I am seriously emphatic about this book whenever friends ask about how computers work in the slightest. I'm so glad to see it frontpaging HN because of what this book taught me; I hope others will see it here and find it as great as I did
- Osiris30 8 years agoPrevious discussion from a few years back: https://news.ycombinator.com/item?id=5888705
- amelius 8 years agoDoes this course include semiconductor physics?
- adrianN 8 years agoTo make an Apple pie from scratch you first have to create the universe...
- abecedarius 8 years agoNo, it takes nand gates and clocked flip-flops as primitive.
- adrianN 8 years ago
- josh-wrale 8 years agoBTW: Just saw this was a duplicate by clicking 'past'. I had searched by URL and turned up 0 results. Next time, I'll try to remember to search by page name.
- secoif 8 years agoDid this as a course on Coursera with a group of friends. Highly recommended.
- brainary 8 years agoIt's a nice book, and you learn alot. Quite fun too.
Just ignore the religious stuff.
- pjc50 8 years agoWhat religious stuff?
- barking 8 years agoGod created the nand and the flipflop? -everything else you make
- quantumhobbit 8 years agoThe sounds more like a joke than "religious stuff". Acknowledging the cultural existence of religion is very different from proselytizing.
- quantumhobbit 8 years ago
- barking 8 years ago
- pjc50 8 years ago
- smnplk 8 years agothank you, thank you , thank youuuuuuuuu!!!!!