Is there a way to find a logic gate or how to make a more complex gate / bit operator from a wanted truth table I wish to have this truth table :
0 0 = 1
0 1 = 1
1 0 = 0
1 1 = 1
CodePudding user response:
There is a formal way of doing this if you cannot see it from the table.
Write the sum of products
expression for the table.
If 0 0 = 1
, then A'B' is in the expression.
If 0 1 = 1
, then A'B is in the expression.
If 1 1 = 1
, then AB is in the expression.
Then, F = A'B' A'B AB
Now, simplify the expression:
F = A'B' A'B AB
F = A'(B' B) AB Distribution Law
F = A'(1) AB Complement Law
F = A' AB Identity Law
F = A'(B 1) AB Annulment Law
F = A'B A' AB Distribution Law
F = (A' A)B A' Distribution Law
F = (1)B A' Complement Law
F = B A' Identity Law
It is not(A) or B
.
You have to use a not
gate and an or
gate.
Alternative Solution
As pointed out in the comments, you can come up from the negated
version of the function.
If 1 0 = 0
, then F' = AB'
Simply, F = not(A and not(B))
. If you distribute the not
, then it will correspond to the same boolean expression as above.
Thanks to the comments for pointing out the shorter way.
CodePudding user response:
if your input is X1 and X2 and you want to have a 1 as output, you can look at the combination which is easy to define: threre is only one 0 - and then invert it
- the case for output 0: x1 and (not (x2) )
- invert the solution (de Mogan): not (x1 and (not (x2) )) = not(x1) or x2
You need 1 x not and 1 x or or you need 2 x not and 1 x and
CodePudding user response:
The truth table gives exactly one possibility for 0. This is the same pattern as with the OR operator (also one possibility for 0), except that the first operand should then be flipped. So it follows that the first operand should be negated to get the desired result:
NOT(A) OR B
This is actually the implication operator: the expression is false when and only if the first operand is true and the second not:
A => B
If we represent an operator with the 4 outcome bits for operands 00, 01, 10, and 11, then this operator has code 1101 (read the output column from top to bottom). For all possible operations we have this:
Output | Expression |
---|---|
0000 | FALSE |
0001 | A AND B |
0010 | A AND NOT(B) |
0011 | A |
0100 | NOT(A) AND B |
0101 | B |
0110 | A XOR B |
0111 | A OR B |
1000 | NOT(A OR B) |
1001 | A <=> B |
1010 | NOT B |
1011 | B => A |
1100 | NOT A |
1101 | A => B |
1110 | NOT(A AND B) |
1111 | TRUE |
There are many alternative ways to write these expressions, but as a rule of thumb: if you need three 1-outputs, look for an OR
operator where potentially one or both arguments need to be flipped. If you need one 1-output, do the same with an AND
operator. If you have two 1-outputs, do the same with a XOR
(or <=>
) operator, unless it is a trivial case where one of the operands determines the result on its own.