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.

Sincerely,

The Teahlab Team

Javascript is disabled on your browser. Please enable JavaScript or upgrade to a Javascript-capable browser.

THE BCD TO EXCESS 3 CODE CONVERTER
by Isai Damier

Introduction to Code Converters

If you kept a diary as a child, you probably used a secret language so to keep other people from reading
your private thoughts. Some kids invent an entirely new alphabet for their diary.
Some kids use numbers instead of letters. Some kids use code words. Whatever method you actually
used, you in effect encoded the information in your diary so that others would have a difficult time
trying to read what you wrote. If someone were to find the system you used to encode your diary,
however, that person could potentially decode what you wrote and learn a lot of secrets about you.

Code converters, more specifically encoders and decoders, have been used by children and adults alike
to protect private information. Indeed, code converters have proven to be so effective that the National
Security Agency (NSA) has made a career out of creating and breaking codes.

TRUTH TABLE

Input (BCD)

Output (Excess-3)

A

B

C

D

W

X

Y

Z

0

0

0

0

0

0

1

1

0

0

0

1

0

1

0

0

0

0

1

0

0

1

0

1

0

0

1

1

0

1

1

0

0

1

0

0

0

1

1

1

0

1

0

1

1

0

0

0

0

1

1

0

1

0

0

1

0

1

1

1

1

0

1

0

1

0

0

0

1

0

1

1

1

0

0

1

1

1

0

0

As you are about to find out, code converters are used for more than protecting private information.
Here is an illustration. You go to your fridge to get some ice cream and find a frozen mouse on the bowl,
with its tiny little teeth stuck in your ice cream. After taking a minute to catch your breath, you decide to
tell your friend about this unusual event. However, there is a problem: your friend lives in a different
zip-code half hour away. Consequently, you cant yell the information to your friend as if your friend
were in the next room; your voice will not carry that far (i.e., your voice is not portable over such
distance). So you use your cellular phone instead. When you speak into the cellular phone, an encoder
converts the sound of your voice into electrical signals — which can travel very fast over very long
distances. When the electrical signals get to your friends cellular phone, a decoder converts the
electrical signals back to the sound of your voice! So now you know: Code converters are used for more
than protecting private information from spies. They are also used to enhance data portability and
tractability.

Portability and tractability are not technical terms. They are mere English words. In our context
portability means the information can be transported from location to location, such as from your house
to your friends house. Tractability means the information can be easily managed, stored, used, etc. For
instance, if you have a comprehensive encyclopedia in paper book form at home, and I have the same
comprehensive encyclopedia in electronic book form on a thumb drive; not only can I carry mine in my
pocket whereas you cannot even lift yours off the table, I can also do a word search more quickly than
you can. Hence, my encyclopedia is more tractable than yours.

BCD TO EXCESS-3 CODE CONVERTER SYNTHESIS

We will complete our introduction to code converters by designing an Excess-3 Binary Coded Decimal
(BCD) circuit. The term BCD refers to representing the ten decimal digits in binary forms; which simply
means to count in binary; see Table 1 below. The Excess-3 system simply adds 3 to each number to
make the codes look different. We will not venture to discuss the importance of the Excess-3 BCD
system because the discussion would serve too great a distraction from our present purpose and the
cost would outweigh the benefit. Suffice it to say that the Excess-3 BCD system has some properties that
made it useful in early computers.

Decimal Numerals

Binary Numerals

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

Table 1: BCD

The Excess-3 BCD system is formed by adding 0011 to each BCD value as in Table 2. For example, the
decimal number 7, which is coded as 0111 in BCD, is coded as 0111+0011=1010 in Excess-3 BCD.

Our task now is to use the truth table to find four switching expressions: one for W, one for X, one for Y,
and one for Z. We have two choices: we can use Boolean algebraic manipulations, or we can use
Karnaugh Maps. For the sake of expediency we will solve for the variables using K-Maps. If you want to
see how to use Boolean algebraic manipulations, read the Boolean Algebra article.
In the four K-maps that follow, the xs are referred to as “ dont cares ”. These dont cares are available
because if you look at the truth table in Table 3, no WXYZ valuations exist for ABCD = 1010, ABCD =
1011, ABCD = 1100, ABCD = 1101, ABCD = 1110, and ABCD = 1111. As such, we evaluate WXYZ = xxxx for
each of these entries. And we are free to use these xs as we please (as 0s or as 1s where convenient)
since we cant really hurt anything.

For W:

Table 4: Karnaugh Map for W

W = A + BD + BC = A + B (D + C)

For X:

Table 5: Karnaugh Map for X

X = BCD + BD + BC = BCD + B (D + C)

For Y:

Table 6: Karnaugh Map for Y

Y = CD + CD

For Z:

Table 7: Karnaugh Map for Z

Z = D

Now we have all the four switching functions we need to build the Excess-3 circuit:

W

=

A + BD + BC = A + B (D + C)

X

=

BCD + BD + BC = BCD + B (D + C)

Y

=

CD + CD

Z

=

D

Here is how we will build the circuit. We will implement the circuit for output W first; only then will we
add the out for X; then for Y; then for Z. We use this one output at a time methodology to allow us to
test each output as it is built, so to catch errors early in the synthesis process.

Here is the interactive circuit for the output W. Play around with it to see that it works.

Circuit 1 — Play around with the circuit to see that it works.

Now we will add the output for X. Notice that X can be rewritten as X = B(C + D) + B (D + C). So all we
need is an XOR gate to combine B and (D + C). Test Circuit 2 below to see that it implements X = BCD + B (D + C).

Circuit 2 — Play around with the circuit to see that it works.

We will add the output for Y the same way. Y is simply the XNOR of C and D. Play around with Circuit 3
to see that it implements Y = CD + CD.

Circuit 3 — Play around with the circuit to see that it works.

The final step in our implementation is to add the output for Z, which is just D. Circuit 4 below is the
final circuit; it is the BCD to Excess-3 circuit.

Circuit 4 — Play around with the circuit to see that it works.

You probably noticed that Circuit 4 does not look like the interactive circuit at the top of this page. We
invite you to check that they perform the exact same function. We use two different implementations to
impress upon you that you are free to implement your circuits however best fits your resources.

The design process we use to synthesize the BCD to Excess-3 code converter is simple, and you should
use it to design your combinational circuits, whether they have a single output or multiple outputs.

Okay. Maybe we should tell you one special property of the Excess-3 system; just to give you a taste for
why we still use it. Here it is: In the Excess-3 BCD system, all pair of numbers that add up to 9 add up to
1111: