# 4-bit Gray-to-BCD code converter using 4:1 MUXs

#### huck

Joined Apr 30, 2011
4
Hello guys! This problem has me completely stuck:

Design a 4 bit Gray-to-BCD code converter circuit. The circuit has also a fifth output P (odd parity generator for the BCD code). Use 4-to-1 MUXs (multiplexers) and a gate minimum external logic.

I wrote down (using this guide) the truth table for the Gray code to BCD converter but I couldn't design 4:1 MUXs and a gate minimum external logic. How many 4:1 MUXs are there and what about the gate minimum external logic?

#### Georacer

Joined Nov 25, 2009
5,182
I 'm not aware of the theoretical background of your lesson, but I can give you an example of a MUX implementation for a boolean function.

In your link, look at the function X=A'B. Using a 4-to-1 MUX, you can connect the A and B variables with the select inputs and adjust the inputs so as to get the desired output. In your case, HIGH should be connected only to input 1 (from 0 to 3). The rest will be tied to LOW. In this way, the MUX will give 1 only when the input 01 is selected.

When you deal with more variables, you must connect variable combinations to the input pins.
For example, in Y=A'BC'+B'C, if you choose A and B to be the select inputs, C will affect the MUX line input. In this case C' will be connected to the 01 pin (as per A'B) and C to the 10 and 00 pins (as per the B' combination).

Does that give you a hint?

Last edited:
• huck

#### designnut

Joined Apr 21, 2011
33
I think a gate array is needed.

#### huck

Joined Apr 30, 2011
4
I 'm not aware of the theoretical background of your lesson, but I give you an example of a MUX implementation for a boolean function.
First of all, thanks for this useful post. The theoretical background of my lesson is Combinational Circuits: Decoder, encoder, comparator, multiplexer.

In your link, look at the function X=A'B. Using a 4-to-1 MUX, you can connect the A and B variables with the select inputs and adjust the inputs so as to get the desired output. In your case, HIGH should be connected only to input 1 (from 0 to 3). The rest will be tied to LOW. In this way, the MUX will give 1 only when the input 01 is selected.
Yes, I understood. However, there are some don't-care terms in the function X=A'B (e.g.: if A=1, B=0 then X = "don't-care"). How do I face these terms? And what about the truth table and the outputs? Is the function X=A'B a new function (thus, a new truth table) or it is based on the truth table of the guide?

When you deal with more variables, you must connect variable combinations to the input pins.
For example, in Y=A'BC'+B'C, if you choose A and B to be the select inputs, C will affect the MUX line input. In this case C' will be connected to the 01 pin (as per A'B) and C to the 10 and 00 pins (as per the B' combination).
Ok! I designed the truth table for the function Y=A'BC'+B'C=A'BC'+B'C(A+A')=A'BC'+AB'C+A'B'C (if A=0 and B=0 then Y=C, if A=0 and B=1 then Y=C', if A=1 and B=0 then Y=C, if A=1 and B=1 then Y=0). Now I can design the 4:1 MUX. Am I ok?

Also, how can I design a 4:1 MUX (or more) for the last function: Z = ABCD + BCD + AD + BCD + BCD ?

By the way, Georacer I'm from Greece. Your location is Greece, Athens. If you could help me in Greek, I would appreciate it.

#### Georacer

Joined Nov 25, 2009
5,182
Καλημέρα, huck.

As this is an international forum, we are obliged by the forum rules to speak in english. I 'll try to keep it simple though.

It is actually much easier if you ignore the Karnaugh Map and the final expression and focus to the truth table.

Check the truth table of the function Y:

• The first 2 columns correspond to the A and B inputs, your select inputs for your MUX. They take up 4 rows in the truth table for each combination of A and B. For example A=0 and B=0 take up the four first rows. Since those rows correspond to {AB}={00} they contain the input of the first MUX select pin, in terms of C and D. Notice that the output of Y is the same as C, and isn't affected by D. Thus we can say that when {AB}={00}, then Y=C.
• In the next four rows, we see that when {AB}={01} then Y=C'.
• The next four rows introduce the Don't Care terms. Since Don't Care means that you can see it either as a 1 or a 0, you will choose the most convenient result, in order to have an expression as simple as possible. Thus, we will turn Don't Care terms of rows 10 and 11 into 1s. This way, once again our result will be Y=C.
• For the final four rows, all of the output results are Don't Care. In this case you can connect anything you want to the fourth input pin of the MUX. You can leave it unconnected for all you care. It is a good practice to Ground it though.

You did a good job fitting the Y function into the MUX, with your way too.

Now let's take a look at the Z function:

The procedure is the exact same one as with Y:

• For the first four rows, we notice that Z=C'D+CD' (or C XOR D as it is also written)
• For the second four rows Z=CD+C'D' (or (C XOR D)')
• For the third four rows we will replace the two don't care terms with 1 and 0 in order to match the pattern of D, and we get Z=D.
• For the last four rows, we don't care what the input will be.

You could face the smaller groups of four rows as two-variable expressions that need to be simplified. You can even use a Karnaugh Map to simplify those functions of C and D.

It should be now obvious that when using a MUX to form a circuit from a boolean function, the truth table is much more helpful than the final, simplified expression.

Is everything clear?

ΥΓ. Σε ποια σχολή είσαι;

• huck

#### bertus

Joined Apr 5, 2008
21,319
Hello,

Please keep everything in english over here.
Here is a google translation of the greek text:
Hello, huck.
PS. What school are you?
Bertus

#### Georacer

Joined Nov 25, 2009
5,182
Correction: PS. In which college are you in?

#### huck

Joined Apr 30, 2011
4
As this is an international forum, we are obliged by the forum rules to speak in english. I 'll try to keep it simple though.
I apologize for the inconvenience. I meant that we can post personal messages (PM) in Greek. I sent you an email, using the email form of the forum.

Is everything clear?
Almost everything is clear. You solved my queries relevant to multiplexers and boolean functions. Thank you so much! I appreciate your time and consideration. In your way, I also used a MUX to form a circuit from the boolean function of the odd parity checker for the BCD code. Finally, I designed the whole circuit. I'll post a picture as soon as possible.

PS. In which college are you in?
Aristotle University of Thessaloniki, Computer Science Department. You?

Last edited:

#### Georacer

Joined Nov 25, 2009
5,182
National Technical University of Athens - For life (sentence)

With which software did you create your schematic?

Last edited:

#### huck

Joined Apr 30, 2011
4
With which software did you create your schematic?
Xilinx ISE Design Suite 13.1

Last edited:

#### abhipaceabhi

Joined Oct 30, 2011
1
If anybody still has a problem regarding this, you can read "Modern Digital Electronics" by R P Jain. The whole thing is given and explain in it.