This course is great for people that (like me) are self-taught developers and don’t have a traditional computer science background where you learn all the details of computer architecture.
Although I have read about it, the fact that computers take electricity and transform it into software was still a bit mysterious to me.
After taking this course, it’s not mysterious anymore, but fascinating! It’s almost like magic, but it’s all about physics and math.
The course will teach you how computers work from the very basic logic gates until assembly language, which is the first level of abstraction above binary machine code.
If you want to understand how computers work, I highly recommend this course.
Buying a course through these links won’t cost you extra, but it’ll help keep our site ad-free. Thanks for the support!
Do You Need To Know How To Code To Take This Course?
In theory, no, but be prepared for a steep learning curve.
You will code during the assignments in a language that is specific to the course. They teach you how to do it.
If you never coded, this will be challenging, but doable.
In some cases, it even helps, as you don’t bring unconscious habits when building the chips in the design language (HDL).
Knowing how to code makes things much simpler to understand and easier to complete the assignments.
Week 1: Overview And Boolean Logic
During the first week, you will get an overview of what the course is about and start studying Boolean logic.
The professors make it clear that we will start from logic gates, the level just above hardware physics.
So you will not study how to create electronic circuits or how to adjust voltages to make physical logic gates. This is work for electrical engineers and not computer scientists.
Still, if you are curious, they talk about a brief example of how a chip uses physics to do logical operations in one additional video.
The course uses a hardware simulator so we can build the chips without having to buy a breadboard and wires to do it physically.
I watched a few videos on Youtube of people building hobby 8-bit computers using breadboards and came to the conclusion that we could build a physical computer just like we do in the simulator.
In this week you will learn about and build very basic logic gates like AND, OR, Multiplexer, and Demultiplexer.
A tip for when you are building the chips is to google the logic gate diagrams. You don’t need to think about how to build them from scratch. Don’t try to reinvent the wheel.
To build more complex gates, think (and google) about reusing previous gates. For example, you can build the 8-way demux using a simple demux and 4-way demux. Look for “1:8 demux” and “1:8 demux from 1:4 demux”.
After doing a few you will get the pattern and do it without having to find a diagram.
A side effect is that you will learn how to read logic gate diagrams which can be useful even when reading neural network architecture diagrams.
One thing that was weird for me at first was the fact that the least-significant bit comes first in the binary sequence, but at the end of the course, I was much more comfortable with the idea.
Week 2: Boolean Arithmetic And CPU
How do we go from logic gates to arithmetic operations? With binary arithmetic!
You will learn much about binary arithmetic and how to do arithmetic operations with the logic gates we coded in the first week.
I am blown away by how one can implement binary arithmetic by using logic gates so “simply”.
Some brilliant people came up with these ideas and they enabled all the benefits of computing we have today.
I studied a bit of binary arithmetic a few years ago, but I never saw the connection between it and the logic gates implementation so clearly laid out.
The assignment is about implementing these more complex chips.
Implementing the adders is simple, you can look up diagrams on Google.
The ALU (Arithmetic Logic Unit) is more complicated (Github Copilot is surprisingly helpful).
The zero and negative gates are the ones that took most of my time because we only have 8-bit gates to compute the zero output bit (zg), so you have to read the sub-busing part of the HDL survival guide.
Week 3: How Computer Memory Works
Until now we worked with everything happening at the same time. We didn’t have the notion of time steps to execute computations. It was all instantly executed.
This week they introduce the concept of clocks and how a computer keeps itself working and remembering things (storing in memory) across time.
It can be confusing at first, but thinking about it as an “infinite” electrical loop that starts when we turn on the computer has helped me.
This and the next two weeks were the most challenging for me because they require you to adopt new mental frameworks when thinking about computers.
After you spend some time thinking and doing the assignments, you will see computers in a new light, which is very powerful!
Here are some tips for the assignment:
To implement “Bit”, from the forums:
- remember you can use multiple outputs in the chips, so you can store a copy of the output of DFF in multiple variables
- HDL is static and declarative, think about it as lego blocks instead of sequential instructions
The Program Counter was the hardest for me, although the code is simple. After a brief walk outside I came back and solved it. A tip is to remember you can use N-way muxers.
Week 4: Machine Language, Keyboard, and Monitor
Here we start understanding how we can make the computer process inputs from a keyboard and display things on a screen, tying together the CPU and Memory that we built in the past weeks.
You will be introduced to the assembly language. One step above the binary code we have been dealing with until now.
We will only build the assembler in the last week of the course, but this week will help us understand how it will fit into the big picture.
It’s scary and fascinating to think that computers (and all the software that powers the world, from our social media apps to nuclear power plants and airplanes) are basically a ton of lightning-fast binary operations powered by electricity.
The project of this week required a bit more brainpower to understand how to make for loops using only Assembly (jumps and labels). Definitely worth the time trying to solve it.
To do the “fill” assignment, I recommend you take a look at the Rectangle.asm script that is shown in video 4.5, you can take some ideas from it on how to fill the screen with black or white pixels.
And remember that Assembly is all about jumping around lines of code.
Don’t allow yourself to confuse the row labels with functions (my Python brain tried to trick me into thinking they defined scopes, but obviously they don’t, we can simply jump around to any line we want).
Week 5: Building the Computer
This week we see how all of the chips we built will fit together to become a computer according to the Von Neumann architecture.
Von Neumann came up with a practical implementation of computers based on Alan Turing’s work.
This is a quote that I like from Von Neumann: “Young man, in mathematics you don’t understand things. You just get used to them.”
So, if the guy that came up with the architecture of a modern computer had trouble understanding math, we can feel ok about our own difficulties.
One side-effect of the course is that I am getting more comfortable with using “infinite loops”
I found that “infinite loops” that have a termination condition (like a command or cutting power) and are intentional, and useful, are sometimes called “event loops” because they are not really infinite.
I always felt a bit weird about leaving a loop running forever waiting for events (like in a WebSocket feed or stream processor), but now I see it’s a very natural way of keeping stuff working.
In a computer, electricity keeps running until we power it off. So why can’t well-written software run for a long time too?
If we think about it, we are an infinite loop that starts running sometime during our mother’s pregnancy and keeps running for a long time (for one of my grandmas, it has been running for over 90 years!).
In this week’s assignment, we assemble our chips to build the CPU and the Memory. Then we put these pieces together to get the Hack computer!
A tip when implementing the CPU is to have the Hack Computer wiki page open where you can see the bits that correspond to the control and jumps in the instructions, so you don’t need to memorize or go back in the videos to find which bit corresponds to which signal.
Week 6: Building an Assembler
We learned about Assembly language in Week 4, and now we will build software to transform assembly instructions into machine language.
Creating the assembler is reasonably easy if you know how to code. You are basically parsing a text file with some dictionary/hash table lookups.
They have an option for non-programmers, where you parse the file by hand.
Github Copilot actually filled a lot of the code, which made me think about courses with coding assignments prohibiting its use in the future.
Conclusion
Teaching how a modern computer is built from scratch to a general audience is a very bold task. This course does a wonderful job.
I highly recommend you take it.
There is a second part, where we learn more about the software level: how to make a compiler and operating system. I still didn’t take it, but plan to!
For this course and any other, Github Copilot is your friend. Sometimes it gave me a starting idea of implementation, other times it helped to repeat the code for the multi-bit chip implementations.
Thanks, professors Shimon Schocken and Noam Nisan for such a wonderful learning experience.