3-bit Calculator

Start: November 2023

As a child, I always used to wonder how a bunch of electrical signals can do something as complex as displaying a beautiful website. Years later, I learnt how semiconductors worked. I took it a step further by learning how diodes and transistors worked. Then, around the same time, we were being taught about logic gates in the Computer Science class in high school. I thought to myself, "How about making logic gates with transistors?" But, before finding out the answer to that, I had to know which logic gates to use.

After some deliberation, I came up with a simple one-bit adder circuit using an AND and an OR gate.

Half-adder schematic (Download PDF)

I was quite happy with this. Now, the problem was, how do I create a chain of such binary adders? My first impulsive reaction was to just chain two of them to allow for a third bit, which could then be treated as a carryover input bit. But there was a shortcoming - the maximum sum of three bits is 1+1+1 = 11, whereas with the circuit, I was getting an output of 100! This was terrible! The truth table showed horrifying results:

Failed Attempt at Full Adder (Download PDF)


In_3In_2In_1OutExp
00000
0
0
1
1
1
0
1
0
1
1
0
1
1
10
10
1
0
0
10
1
1
0
1
11
10
1
1
0
11
10
1
1
1
100
11


I was distraught on seeing this disastrous result. Further research online told me about K-maps, a useful tool to find out the logic gates needed for any logical expression! Elated, I drew out a K-map for the circuit:

* it should be DeMorgan's laws, not De Moivre's theorem!

Similarly, on drawing a K-map for the carry over (O), I got O=AB+AC+BC. With this in mind, I constructed a full-bit adder circuit:

Full Adder Schematic (Download PDF)

Now, on chaining these 1-bit adders together, I created my 3-bit calculator on KiCad. Now, it was time to take my work into the real world. For simplicity's sake, I decided to use TTL Logic Gates. In this project, I used 74LS08, 74LS86, and 74LS32, which are the AND, XOR and OR gates respectively. The biggest problem I faced when making the calculator was that the outputs were not corresponding to the inputs - this is because the TTL ICs considered a negative voltage as a LOW output - which necessitated the use of pull-down resistors to force the input to negative when it was LOW.

Final Project (video demo)

One of the key takeaways from this project was learning the importance of applying a mathematical model and logical understanding before proceeding with the building of a project. It also emphasized the importance of gaining a vertical understanding of how things work - first going from the top to bottom to understand the basics and then building up all the way from the bottom by learning concepts. With respect to this paradigm, I need to still figure out how to make logic gates from transistors to fill in the missing piece in this puzzle.

As stated above, the goal of this project wasn't to just make a calculator. It was to understand how a computer system works, and this is not even 1% of it. In the future, I plan to build upon this project to make an 8-bit TTL computer, without any micro-controllers or a Raspberry Pi. As I wish to understand the working of the software side, once time permits, I plan to expand the computer's capabilities to that of a 32-bit, and make a 32-bit kernel & operating system for my computer.

Impact

  • Understanding the basics and reinforcing the concepts of how calculators work by building a working prototype from scratch.