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: and

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 (Let's connect on twitter @isaidamier )

The basic logic XOR gate circuits: an interactive XOR logic circuit where you see its function.

The XOR gate is an electronic circuit that performs exclusive disjunction. The output of the XOR Boolean operator is true when precisely one of the two inputs is true. Otherwise, the output is false.

Input Output Comment
A B Out
0 0 0 Low
0 1 1 High
1 0 1 High
1 1 0 Low
The word XOR is not used in everyday English conversations. So we will use the pair either…or to demonstrate the meaning of XOR.

Consider the following scenario. You come to class without writing instruments, and so your good but very sensitive friend makes you an offer: you may have either the pen or the pencil. Clearly your friend is not meaning to offer you both the pen and the pencil. Your friend, too, must write. Hence, you really may only have one of them, not both. Table 1 lists the possible situations that may arise from your choices.

You take the PenYou take the PencilYour friend is happyCOMMENT
FALSE TRUE TRUE Friend is happy
TRUE FALSE TRUE Friend is happy
TRUE TRUE FALSE Friend is angry

Table 1: Truth Table of situations

Observe that because your friend is a sensitive person, you are essentially required to take one of the offers; otherwise, your friend’s feelings will be hurt. If you refuse to take one, your friend will think you are upset and so will be sad. If you take both, your friend will think you are inconsiderate and so will be angry. You must take one, and only one. Such is the XOR function.

It is typical in engineering to use 1 instead of TRUE and 0 instead of FALSE. Therefore we rewrite the data from Table 1 in Table 2 accordingly.

You take the PenYou take the PencilYour friend is happyCOMMENT
0 0 0 Friend is sad
0 1 1 Friend is happy
1 0 1 Friend is happy
1 1 0 Friend is angry

Table 2: TRUE = 1; FALSE = 0

For greater detail on the logic significance of the XOR function, read the Boolean algebra article.

Physical Implementation

In order to apply the principles of Boolean algebra to create real machines that can think and make decisions, we have had to find ways to physically implement the logic operators AND, OR, NOT, etc. To that end, modern day engineering uses transistor networks called logic gates. Hence, a logic gate is actually a group of transistors so arranged as to behave as a Boolean operator. Figure 1 below shows a transistor circuit that implements the XOR logic function on its input signals.

Figure 1: Interactive transistor circuit of the XOR logic operator


The use of transistors to build logic gates is quite modern. Before transistors we used other devices, such as vacuum tubes (aka thermionic valves). And very soon we may use DNA, or some other abundant material. There are many types of transistors. Our circuit in Figure 1, for example, uses complementary metal–oxide semiconductor (CMOS) technology. Our choice of CMOS is arbitrarily based on the fact that CMOS is by far the dominant technology in use today. The dominance is due to how well CMOS performs in all the important categories: fabrication cost, packing density, loading capacity (i.e. fan–out), operational speed (i.e. propagation delay), noise margin, and power dissipation (i.e. green technology).

There is of course more to transistors than can be presented here; especially since transistors are used for more than just digital systems. And so we refer you to any good micro–electronics textbook.

Alternate Design

Below we show four additional typical constructions of the XOR gate. Each of the constructions presents specific conveniences to designers. If you are very new to digital systems design, you may not understand the importance of the figures below. Still, we include them in this article for the people who may need them.

Figure 2: XOR gate implemented with four NAND gates

Interactive XOR gate implemented with five NOR gates digital logic circuit with boolean algebra equation and truth table
Figure 3:XOR gate implemented with five NOR gates

Interactive XOR gate implemented with a 2X1 Mux digital logic circuit with boolean algebra equation and truth table
Figure 4: XOR gate implemented with a 2X1 Mux

Interactive Min-term and Max-term XOR gate digital logic circuit with boolean algebra equation and truth table
Figure 5:Minterm and Maxterm XOR gate implementation