Main Content

Have you wondered how computers compute things at the hardware level? I was curious so I made a binary calculator using only transistors.

I always was curious about how computers worked at a hardware level. When I finally learned about the principle of operation while studying Digital Logic Course while doing my Engineering degree in Electronics. I finally had an answer to my question. However I always wanted to use this knowledge to design and build my own logic circuits not by using gates but by using discrete transistors themselves. This is similar to how the early computers were made when each transistor was discrete and integrated circuit technology didn’t exist yet. These themselves were a huge improvement over the vacuum tube computers which were much bulkier and were unreliable.

I have to admit that to make transistorized computing devices are much easier to make nowadays with SMD transistors and cheap PCB manufacturing and assembly services in china. I got my board manufactured, assembled and shipped to me within 7 days for little over 50 USD for 5 pieces, pretty sweet!Let’s take a look at the final result.

So how does it work? If you look at the PCB closely you can see 4 separate circuits each of which is a full-binary adder. A full binary adder just means that it can provide the sum of two 1-bit numbers A and B it also take into account CARRY IN from the previous digit. As it’s output we have the resulting SUM and the CARRYOUT. You can cascade these full bit adders by connecting the carry out of the first bit to the carry in of the next bit and have a circuits that can add arbitrarily large N-bit numbers. In our case this number is 4. These circuits can The way the addition is performed is actually very similar to the way we humans compute the sum of two numbers. We add the numbers and write the sum and if there is a carry we propagate it to the next digit. When we calculate the sum of the next digit we consider the carry that we propagated earlier. The only difference is that we perform the calculator in decimal numbers (0..9) while the computer perform the operation in binary. The image below show the interconnections of the adder.

Now let’s talk about the full-adder circuit individually. The circuit has three inputs and 4 outputs and we can therefore tabulate a truth table for that. We show the table below.

Let me quickly describe the logic behind this. Binary numbers behave a lot like decimal numbers so with addition the same logic applies. When we run out of symbols to count up to we carry it forward to the next digit. For binary numbers we have only two symbols 0 and 1. So when we add 1 to 0 we get 1. But now when we want to add one more to that we don’t have any more symbols to represent that so we have to carry forward it to the next digit. If you think about this logic you will see that the truth-table above makes sense.

So what kind of circuit do we need to make this? Well, we can use logic gates. As a matter produce a circuit for any possible truth table by combining logic gates in specific ways. The circuit for the truth table above is this.

Now we can implement this logical circuit using transistors. Here is my design.

Actually we can apply the same procedure to make all kinds of logical circuits including subtractors, multiplicators, multiplexers etc. These are the essential parts of any CPU and we can expand this approach to make our own rudimentary CPU.”

Link to article