ALU - Nand2Tetris
The brain of a computer.
2 min read
Some of the quotes and information are part of the Nand2Tetris course available on Coursera.
Von Neumann Architecture
Von Neumann Architecture is the crux of any computer. Of course, the design goals and the type of designs change a lot. If you study networking then you could say that the Von Neumann Architecture is to Computer as the TCP/IP model is to networking. Not so standardized but gets you moving and helps you to understand what's going on.
Now when we talk about ALU, we may go ahead and implement every operation that we want using it, like Addition, Comparison, Subtraction, Multiplication, Division, etc. In fact, modern Microprocessors implement very specific types of things at a hardware level. For instance, SoCs like Apple Silicon M1 Pro and Max have a media engine that natively encodes and decodes the ProRes video codec. This is because the transcoder is not implemented at a software level but rather it's moved to a Hardware level.
Efficiency While Adding Numbers
Now the computer that I am building (Of course it's a virtual computer) uses a rather inefficient technique to implement an Adder. The carry bit is passed from one FullAdder to the another but in the real world, that's a lot of gates and will lead to a significant loss in time.
We have to remember that an Adder is supposedly the most fundamental part of a computer and it is necessary that we build it as efficiently as possible. Introducing a much more efficient Adding method, Carry Look Ahead.
it does exactly what it says, instead of having a carry while adding each set of bits, we prematurely calculate the carry bit as a separate set of operations to the bit addition. Here is a good explanation for it.
By the way, the Virtual Machine that I am building is a 16-bit computer. So, the word length is 16 bits. Modern computers like the phone or laptop or whatever the screen you are reading this blog on are usually 32-bit or 64-bit.
PS: For readers who speak Telugu
What is an ALU? ALU ante... ALU sir. : )
(If you know, you know)