Designing a circuit to verify operation of an OR gate.

Consider the following image:

I need to design a circuit that verifies the logical operation of the OR gate. In the above image, the LED will be on (f = 1) if the or gate is working properly. I can make the assumption that when the OR gate is not working, it is generating 1's instead of 0's. Based on that information, I obtained the following truth table:

| a | b | x-good | x-bad |
+---+---+--------+-------+
| 0 | 0 |   0    |   1   |
| 0 | 1 |   1    |   0   |
| 1 | 0 |   1    |   0   |
| 1 | 1 |   1    |   0   |


But I am stuck trying to find a way to verify this. I know that if x is 0, then a and b should both be 0. Likewise, if x is 1, then a or b must be one.

In the first case, I can determine if a and b are 0 like this:

$F = !X && (!A && !B)$

In the second case, I can only think of a way to do it using an OR gate. The assignment doesn't state if we can or can't use another OR gate, but I'm afraid that defeats the purpose. What is the logic behind verifying an OR gate? Is there a completely different way to approach this? If anyone is able to help me find the boolean algebra function for verifying an OR gate, I can handle designing the circuit for it.

• It is not clear what you are trying to do. Are you trying to test for all inputs, or just a particular sort of fault? If not working implies that a 1 is generated instead of 0, then you need only check $a= b=0$ and if $f=1$ then the gate fails (since this is the only input combination that produces a 0). – copper.hat Jan 8 '15 at 17:57

you need to construct a function that has the following truth table

| a | b | x || f |
+---+---+---++---+
| 0 | 0 | 0 || 0 |
| 0 | 0 | 1 || 1 |
| 0 | 1 | 0 || 1 |
| 0 | 1 | 1 || 0 |
| 1 | 0 | 0 || 1 |
| 1 | 0 | 1 || 0 |
| 1 | 1 | 0 || 1 |
| 1 | 1 | 1 || 0 |


(just treat x as an extra imput signal)

GOOD LUCK

• Thank you! I spoke with the professor after class for suggestions, and this was the exact answer he gave me. – AdamMc331 Jan 9 '15 at 1:38

To test for the first case: you can use (in your notation) !A && !B && !X, since this will only be true if all A,B, and X are false. If you do this for the four cases and or them together, you'll end up with:

F = !A && !B && !X + !A && B && X + A && !B && X + A && B && X

This expression will be true if and only if at least one of the four terms is true. By construction, these four terms each represent one of the four possible cases for A and B. This checks that the output for X is what you hope it is. This expression can certainly be reduced so that it can be constructed easier, but it's more clear and works just fine from a theoretical standpoint.

I think that this problem is merely asking you to set up a way to test that specific OR gate, not to completely avoid using OR gates. If you don't want to use OR gates, you can logically represent one using a series of NAND gates, NOR gates, or any universal logic gate.

While Willemien's answer is the one I used to solve the problem, a class discussion brought up another solution. An OR gate such as the one shown in the question can be replaced by using a NAND gate on the inverted inputs. In other words:

!(!A && !B) = (A || B)


This can be found and verified using demorgan's theorem. So, if both functions listed produce the same output, then the gate is working. To see if two inputs are the same, one can use an XNOR gate.

To simplify, let's say that variable Y = !(!A && !B)

Then f, the output for the LED is:

!(X xor Y)