Hey There!

Hope you find these contents helpful. If you have any questions hit us up with an email.

We are looking to get 20,000 downloads for our app Prefies. Prefies lets you share, discover and find great products. If each one of you download & share Prefies, we will have reached our goal in 1 minute. Help us meet our goal. Prefies is now in the app stores.

You Rock!

– Teahlab Team

Java Circuit Simulation Workaround ▾

Due to recent changes by Oracle, java applets have become difficult to run in the browser. To mitigate the troubles, Oracle has provided the following websites to help users troubleshoot: http://java.com/en/download/help/enable_browser.xml and https://www.java.com/en/download/mac_download.jsp

Even after following the above instructions, loading applets may still show warning concerning “unsigned application” and “unknown publisher”. For Teahlab in particular, these warnings are due to the fact that we have opted not to pay a third party such as Verisign to sign our applets. Any warning that comes up when you try to run our applets should emphasize that our applets will always run with “limited access”, which is Oracle’s way of letting you know that teahlab doesn’t do anything on your computer except running the circuits you see: in other words, our applets are safe to run.


The Teahlab Team

by Isai Damier

interactive half adder digital logic circuit with boolean algebra equation and truth table


The Half-Adder is the basic building block of all arithmetic circuits. Every microchip or machine that can perform addition, subtraction, multiplication, or division has Half-Adder blocks inside. Because the Half-Adder is so material to our ability to do math on computers, this article will show you how to design the Half-Adder from scratch.

Input Output
A B Cout Sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0


There are three steps to designing a digital circuit:

Step 1.   Convert the problem description into a truth table.
Step 2.   Find a switching function defined by the truth table.
Step 3.   Use the logic of the function to build the circuit.

Truth Table

If you think back a little, you will remember that back in grade school you did a lot of homework converting English statements into algebraic expressions. As an instance, for Angie is eight years older than Dina, you had to write
A= 8+D. Converting a problem description into a truth table is a lot easier than that.

For our purpose, we need to design a circuit that is capable of adding two single-bit binary numbers. Hence, our circuit should be able to perform the following four possible calculations:

0 0  1  1
+ 0 +1 + 0 + 1
 0   1  1 10

And this line of four operations is essentially your truth table! All that's left is to make it look like a table, with labels. So first you rotate the line of operations from the current horicontal position to a vertical position, and then you label each column. In addition, since one of the result is two bit, we turn all the answers into two-bit format —like below:

0 0 00
0 1 01
1 0 01
1 1 10

Now for the finishing touch. Every bit in a truth table must have its own label. So you must split the result column in two and label the first bit C and the second bit S. (Of course you can label them whatever you want!)

0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0

Voila! This is the Half-Adders's truth table!

Switching Function

We label each bit of the truth table to make it easy to use the labels to create a switching function. Instead of trying to solve for two or more bits at once, we can solve one bit at a time. For example, notice that the relationship between inputs A and B and output C describes an AND gate. This quick observation is easy because we label the leading bit C. Notice further that the relationship between the inputs A and B and output S describes the XOR gate. Hence, the compound function that defines the Half-Adder is

C = A • B
S = A Xor in interactive half adder digital logic circuit B.
Of course, extracting a switching function from a truth table is not always so easy. So we will illustrate a more systematic approach. We start by pretending that you don't know what the XOR truth table looks like (it's on the XOR gate page). Consequently we will form the S bit switching function as follows: for every row where S = 1, we will write the relationship between the inputs A, B and the S bit—like below.

0 0 0
0 1 1 A • B
1 0 1 A •B
1 1 0

Then we add the terms to get S=A • B + A • B. If you checkout the XOR gate page, you will learn that
A Xor in half adder digital logic circuit B= A • B + A • B.


Based on the compound function C = A • B and S = A Xor in half adder digital logic circuit B, we have two input signals (A, B), two output signals (C, S) and we need two gates: an AND gate and an XOR gate. Go back to the top of this page to see the Half-Adder.