# How would I design a simple logic circuit for 3 input bits?

All -

Suppose I have 3 input bits

1. Bit #0
2. Bit #1
3. Bit #2

I need to design a logic circuit has follows:

Input: Bit #0 = 1, Bit #1 = 1, Bit #2 = 0 Output: 0

Input: Bit #0 = 1, Bit #1 = 0, Bit #2 = 1 Output: 1

Input: Bit #0 = 0, Bit #1 = 1, Bit #2 = 0 Output: 1

Input: Bit #0 = 0, Bit #1 = 0, Bit #2 = 1 Output: 0

I know it's going to be a combination of XOR gates, but I'm not able to construct something that works for all 4 cases above.

Is there any software that can generate a simple logic circuit that satisfy the input/output conditions above?

I would appreciate all / any help.

• No need to accept so quickly. Someone could still come along and tell you about Karnaugh maps. Oct 30, 2012 at 0:56
• Well, I'll give them points if they do, but I feel like you answered the question. Thanks! Oct 30, 2012 at 0:57

We normally present this kind of requirement in a truth table. I'll assume that for the input combinations you didn't specify in the question, you don't care what the output is. In the truth table, we'll represent this with an "X". Then you have a truth table like this:

IN2  IN1  IN0  |  OUT
---------------------
0    0    0   |   X
0    0    1   |   X
0    1    0   |   1
0    1    1   |   0
1    0    0   |   0
1    0    1   |   1
1    1    0   |   X
1    1    1   |   X


You can easily realize this truth table by simply XOR'ing bits 0 and 1, and ignoring bit 2.

• Thanks @DaveTweed, for the edit...my eyes were turning to cheese trying to read OP's presentation of the table (and SE's font doesn't help either). Oct 30, 2012 at 0:47

Entered by truthtable: F1 = A' B C' + A B' C;

Minimized: F1 = A' C' + A C;

• This answer would be more useful if you explained how you got it. Jul 22, 2014 at 13:54
• Actually, the answer is right (if assumptions are allowed as in the other answers.) I think some people were too hasty to give down-votes. Surely is out of carelessness rather than because of pure lack of understanding. Maybe an explanation is better but for me it is very simple. Jun 1, 2019 at 9:39

Logic problems can be viewed in a few different ways:

• As truth values: $\textsf{true}$ or $\textsf{false}$
• As bit values: $1$ or $0$
• As voltage levels: HIGH or LOW

Your problem boils down to the following sentence: "Output $1$ when you have the input pattern $(1, 0, 1)$ or $(0, 1, 0)$ and $0$ with input patterns $(1, 1, 0)$ or $(1, 0, 0)$." Naming the pattern as $(A,B,C)$, you can see that the first pattern $(1,0,1)$ corresponds to $A = 1$ and $B = 0$ and $C = 1$.

But thinking of them as truth values, that is the same as $A = \textsf{true}$, $B = \textsf{false}$ and $C = \textsf{true}$, or simply

$$A\;\textsf{and}\;\textsf{not}(B)\;\textsf{and}\;C = A\cdot\overline{B}\cdot C,$$

since Boolean "multiplication" corresponds to logical "and".

Adding in the second pattern, we get (Boolean $+$ is a logical "or"): $$Y = A\overline{B}C + \overline{A}B\overline{C}$$

However, because you haven't said anything about patterns $(0, 0, 0)$, $(0, 0, 1)$, $(1, 1, 0)$, $(1, 1, 1)$, there are many other solutions (15 more to be exact) that also work:

\begin{align} Y & = A\overline{B}C + \overline{A}B\overline{C} + \overline{A}\overline{B}\overline{C}\\ Y & = A\overline{B}C + \overline{A}B\overline{C} + \overline{A}\overline{B}C\\ Y & = A\overline{B}C + \overline{A}B\overline{C} + A B \overline{C}\\ Y & = A\overline{B}C + \overline{A}B\overline{C} + ABC\\ Y & = A\overline{B}C + \overline{A}B\overline{C} + \overline{A}\overline{B}\overline{C} + \overline{A}\overline{B}C\\ & \vdots \end{align}

We can pick any of these 16 equations, either would work. But in this case we have a particularly good choice: $$Y = A\overline{B}C + \overline{A}B\overline{C} + \overline{A}\overline{B}C + A B\overline{C} = (A+\overline{A})\overline{B}C + (A+\overline{A})B\overline{C} = \overline{B}C + B\overline{C}$$ This can be further reduced by using $\textsf{xor}$: $$Y = \overline{B}C + B\overline{C} = B \oplus C$$

There are a few ways of doing this math faster. Using Karnaugh maps is one method. The program "Logic Friday" is also very useful.