BinaryLogic
BinaryLogic
The two states are also known as LOGIC HIGH STATE and LOGIC LOW STATE, respectively.
In this binary world, everything must be in one of the two possible states {TRUE, FALSE}.
We can perform various logical operations on these two states, for example AND, OR, NOT.
The result of AND operation is TRUE if and only if both the operands (statements) are TRUE.
The result of OR operation is TRUE if and only if any of the two operands (statements) are TRUE.
That means
FALSE AND FALSE = FALSE FALSE OR FALSE = FALSE
FALSE AND TRUE = FALSE FALSE OR TRUE = TRUE
TRUE AND FALSE = FALSE TRUE OR FALSE = TRUE
TRUE AND TRUE = TRUE TRUE OR TRUE = TRUE
Symbols:
Denote TRUE with the symbols 1 and
FALSE with the 0.
Let x , y , z be binary variables which can take either of the two values: {TRUE, FALSE} i.e. {1,0}
Suppose z=¿ ( x , y )=( x∧ y )= ( x ⋅ y ) Suppose z=¿ ( x , y )=( x∨ y )= ( x + y )
z will be 1 if and only if both x and y are 1. z will be 1 if and only if at least one of x and y is 1.
We may summarize this using a table: We may summarize this using a table:
Arguments Result Arguments Result
x y z=( x ⋅ y ) x y z=( x + y )
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
This type of a table is known as a Truth Table This type of a table is known as a Truth Table
¿
{
1if all of x 1 , x 2 , x 3 , … , x n are1
0 if any of x 1 , x 2 , x 3 , … , x n is 0
x 1+ x2 + x 3 +…+ x n
¿∨( x 1+ x 2 + x 3 +…+ x n )
¿ x 1∨x 2∨x 3 …∨x n
¿ ( ( ( x 1∨x 2 )∨x 3 ) …∨x n)
¿
{
1if any of x 1 , x 2 , x 3 , … , x n are 1
0 if all of x 1 , x 2 , x 3 , … , x n is 0
x ⋅ ( y+ z ) =x ⋅ y + x ⋅ z
Proof:
One way to proof it is through a truth table
x y z x ⋅ ( y+ z ) x ⋅ y+ x ⋅ z
0 0 0 0 ⋅ ( 0+ 0 )=0 0 ⋅0+ 0⋅ 0=0
0 0 1 0 ⋅ ( 0+1 )=0 0 ⋅0+ 0⋅1=0
0 1 0 0 ⋅ ( 1+0 )=0 0 ⋅1+0 ⋅0=0
0 1 1 0 ⋅ ( 1+1 )=0 0 ⋅1+0 ⋅1=0
1 0 0 1 ⋅ ( 0+0 )=0 1 ⋅0+1 ⋅0=0
1 0 1 1 ⋅ ( 0+1 )=1 1 ⋅0+1 ⋅1=1
1 1 0 1 ⋅ ( 1+ 0 )=1 1 ⋅1+ 1⋅0=1
1 1 1 1 ⋅ ( 1+ 1 )=1 1 ⋅1+ 1⋅1=1
Last two columns are the same. That proves the statement.
Example: x + xy=x
Proof:
x + xy
¿ x ( y+ y )+ xy
¿ xy + x y + xy
¿ ( xy + xy ) + x y
¿ xy + x y
¿ x ( y+ y )
¿ x ⋅1
¿x
x + ( y ⋅ z ) =( x+ y ) ⋅ ( x + z )
Proof:
( x + y ) ⋅ ( x+ z )
¿ xx + yx + xz + yz
¿ ( x + xy ) + xz+ yz
¿ x + xz+ yz
¿ x + yz
De Morgan's laws:
Inputs Inputs
Output Output Input Output
z=¿ ( w , x , y ) z=¿ ( w , x , y )
¿ x ⋅ x =x ¿ x + x=x
Realizing a AND gate from NAND gates Realizing a AND gate from NOR gates
x⋅ y
¿ x⋅ y
¿ x⋅ y
x
¿ x+ y
¿ x⋅ y
y
Realizing a OR gate from NAND gates Realizing a OR gate from NOR gates
x
x+ y
¿ x+ y
¿ x+ y
¿ x⋅ y
¿ x+ y
y
x y x ⊕ y=x y + x y x y x ⊙ y=xy + x y
0 0 0 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
¿ x⊕ y ¿ x⊙ y
XOR ( x 1 , x 2 , x 3 , … , x n ) XNOR ( x 1 , x 2 , x3 , … , x n)
¿ x1 ⊕ x2 ⊕ x3 ⊕ … ⊕ xn ¿ x1 ⊕ x2 ⊕ x3 ⊕ … ⊕ xn
¿ ( ( x 1 ⊕ x 2) ⊕ x 3 ) … ⊕ x n ¿ x1 ⊙ x2 ⊙ x3 ⊙ … ⊙ xn
The result will be true iff odd number of ¿ ( ( x 1 ⊙ x 2) ⊙ x 3 ) … ⊙ x n
arguments are true. The result will be true iff even number of
(Justify using method of mathematical induction) arguments are false.
(Justify using method of mathematical induction)
Note
When n is odd When n is even
XOR ( x 1 , … , x n ) =1 XOR ( x 1 , … , x n ) =0 XOR ( x 1 , … , x n ) =1 XOR ( x 1 , … , x n ) =0
⇒ odd number of 1s ⇒ even number of 1s ⇒ odd number of 1s ⇒ even number of 1s
⇒ even number of 0s ⇒ odd number of 0s ⇒ odd number of 0s ⇒ even number of 0s
XNOR ( x 1 , … , x n ) =1 XNOR ( x 1 , … , x n ) =0 XNOR ( x 1 , … , x n ) =0 XNOR ( x 1 , … , x n ) =1
Binary logic is also known as the Boolean logic after the name of the mathematician George Boole.
x⋅x ⋅ y
¿ x+x⋅ y
x⋅ y
¿ ( x + xy ) ( xy + y )
¿ x y+ xy
¿ XNOR ( x , y )
x⋅ y⋅ y
¿ XOR (x , y)
¿ x ⋅ y+ y
x + x+ y
¿ x ⋅ (x + y )
¿x y
x+ y
¿ x y+ x y
¿ XOR ( x , y )
¿ XNOR (x , y )
x+ y+ y
¿ ( x + y )⋅ y
¿x y
Boolean functions
Suppose, w , x , y , and z are binary (Boolean) variables and z=( w+ x ⋅ y ) ⊕ ( x + y ). Here the value of z
depends on the values of w , x , and y . We say z is a Boolean function of w , x , and y . We may write
z=f ( w , x , y ).
For a particular set of values of the independent variables, exactly one minterm becomes 1, the remaining
𝑚1 𝑚3
minterms become zero. This becomes clear in the truth table of the minterms shown below:
w x y m0 m2 m4 m5 m6 m7
¿ w x y ¿ w x y ¿ w x y ¿ w xy ¿ w x y ¿ w x y ¿ wx y ¿ wxy
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
𝑦
w + x+ y w + x+ y w + x+ y w + x+ y w + x+ y w + x+ y
0 0 0 0 1 1 1 1 1 1 1
0 0 1 1 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 1 1
0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 1 1 1 0 1 1 1
1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 0
Please note the pattern below:
Dependent variables Which minterm is 1 ? Which Maxterm is 0 ?
/ inputs
w x y
0 0 0 m0=w x y M 0=w+ x + y
0 0 1 m1=w x y M 1=w + x+ y
0 1 0 m2=w x y M 2=w + x+ y
0 1 1 m3=w xy M 3=w+ x+ y
1 0 0 m4 =w x y M 4 =w+ x + y
1 0 1 m5=w x y M 5=w+ x + y
1 1 0 m6=wx y M 6=w+ x + y
1 1 1 m 7 =wxy M 7=w+ x + y
Truth table of an arbitrary Boolean function:
Consider any arbitrary Boolean function z=( w+ x ⋅ y ) ⊕ ( x + y )
We may tabulate the values of z for different values of w , x , and y in the form of a truth table:
We may also say
w x y z=( w+ x ⋅ y ) ⊕ ( x + y ) Thus z=1 when z=1 when
0 0 0 ( 0+ 0⋅ 0 ) ⊕ ( 0+0 ) =1 ((w=0) AND (x=0) AND (y=0)) w x y=1
0 0 1 ( 0+ 0⋅1 ) ⊕ ( 0+1 )=1 OR ((w=0) AND (x=0) AND (y=1)) OR w x y=1
0 1 0 ( 0+1 ⋅0 ) ⊕ ( 1+0 )=1 OR ((w=0) AND (x=1) AND (y=0)) OR w x y=1
0 1 1 ( 0+1 ⋅1 ) ⊕ ( 1+ 1 )=1 OR ((w=0) AND (x=1) AND (y=1)) OR w xy =1
1 0 0 ( 1+0 ⋅0 ) ⊕ ( 0+ 0 )=0
1 0 1 ( 1+0 ⋅1 ) ⊕ ( 0+1 )=1 OR ((w=1) AND (x=0) AND (y=1)) OR w x y=1
1 1 0 ( 1+1 ⋅0 ) ⊕ ( 1+ 0 )=0
1 1 1 ( 1+1 ⋅1 ) ⊕ ( 1+1 ) =0 Therefore,
z=w x y +w x y +w x y
+ w xy+ w x y
…(1)
z=w x y +w x y +w x y +w xy + w x y …(1)
This form of expressing a Boolean function is known as Sum Of Products (SOP) or Disjunctive Normal Form
(DNF).
w x y m0 m1 m2 𝑚 m5
The Boolean function in equation (1) You can verify that
can also be written as z=¿
z=w x y +w x y +w x y +w xy + w x y 3 m 0 +m 1 m 2+ m3 +m 5
+
¿ m0 +m1+ m2+ m3 +m5
… (2) 0 0 0 1 0 0 0 0 1
¿ ∑ (0 ,1 , 2 , 3 ,5) (in short) 0 0 1 0 1 0 0 0 1
m 0 1 0 0 0 1 0 0 1
0 1 1 0 0 0 1 0 1
1 0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 1 1
1 1 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0
In this way, any Boolean function can be expressed as a sum of the appropriate minterms.
Again
z=M 4 ⋅ M 6 ⋅ M 7=( w+ x+ y )( w+ x + y ) ( w+ x + y )
This form of expressing a Boolean function is known as Product Of Sums (POS) or Conjunctive Normal Form
(CNF).
The function z expressed in SOP form through equation (2) can be realized through the following logical
circuit
The function z expressed in POS form through equation (3) can be realized through the following logical
circuit
In this way, any Boolean function can be realized through AND, OR, and NOT gates. Thus these three types
of gates are said to be functionally complete.
Homework: Write the minterms and maxterms for four Boolean variables.
Literals: Input variables like w , x , y and their complements like w , x , y are called literals.
z=( w+ x ⋅ y ) ⊕ ( x + y ). This expression of z has 5 distinct literals: w , x , x , y , y
z=w x y +w x y +w x y +w xy + w x y .
This expression of z has 15 literals, out of which 6 are distinct literals: w , w , x , x , y , y
z=( w+ x + y ) ( w+ x + y ) ( w+ x + y ) .
This expression of z has 9 literals out of which 5 are distinct literals: w , x , x , y , y
z=w+ x y. This expression of z has 3 distinct literals: w , x , y
Often it is desired to simplify a Boolean function to have lesser number of literals.
Algebraic simplification of Boolean function is an art. Next, we shall learn Karnaugh’s map method of
Boolean function simplification which makes the procedure highly methodical.
Prepare a table with Fill the boxes with values Group the boxes with z=1 together.
of z corresponding to
rows representing values of x and We see z=1 in two adjacent locations.
different values of x and
columns representing values of y . y In these two locations, x=1 constant,
( y varies)
Thus, we write z=x .
Note the order in which different xy pairs are We find square/rectangular groups of 1, 2, 4, or 8 ONES.
organized. They are so ordered to ensure only
The red group has w=0 constant.
one bit is different between adjacent xy values.
The blue group has xy=01 constant
Thus, z=w+ xy .
These groups are called prime implicants
One may first write down the complete truth table – The shaded numbers indicate the positions of the
however that is not necessary. corresponding minterms. This helps in writing the K map
u v x y z Minterm without explicitly writing the truth table.
0 0 0 0 1 m0
0 0 0 1 0 m1 xy=00 x y=01 x y=11 x y=10
0 1 3 2
0 0 1 0 1 m2 uv=00
0 0 1 1 0 m3 1 0 0 1
4 5 7 6
0 1 0 0 0 m4 uv=01
0 1 0 1 0 m5 0 0 0 0
0 1 1 0 0 m6 12 13 15 14
uv=11
0 1 1 1 0 m7 1 1 1 1
m8 8 9 11 10
1 0 0 0 1 uv=10
1 0 0 1 1 m9 1 1 1 1
1 0 1 0 1 m10
1 0 1 1 1 m11
In red prime implicant u=1.
1 1 0 0 1 m12 In blue prime implicant has vy=00.
1 1 0 1 1 m13 Thus, z=u+ v y .
1 1 1 0 1 m14
1 1 1 1 1 m15
So far using K maps Boolean functions are simplified in SOP forms. Using K maps Boolean functions can also
be simplified in POS forms. Let us do that using the function in Example 6.
Truth table of Example 6 is The shaded numbers indicate the positions of the corresponding
reproduced here. Now we focus on maxterms.
where the function is ZERO. Now we focus on ZEROS (instead of ones)
u v x y z Maxterm
0 0 0 0 1 M0 x=0 , y=0 x¿ 0 , y=1 x¿ 1 , y=1 x=1 , y=0
M1 0 1 3 2
0 0 0 1 0 u=0 , v=0
0 0 1 0 1 M2 1 0 0 1
0 0 1 1 0 M3 4 5 7 6
u=0 , v=1
0 1 0 0 0 M4 0 1 0 0
0 1 0 1 0 M5 12 13 15 14
u=1, v=1
0 1 1 0 0 M6 1 1 1 1
0 1 1 1 0 M7 8 9 11 10
u=1, v=0
1 0 0 0 1 M8 1 1 1 1
1 0 0 1 1 M9
1 0 1 0 1 M 10 In red prime implicant corresponds to ( u+ v )=0 .
1 0 1 1 1 M 11 In blue prime implicant corresponds to ( u+ y ) =0.
1 1 0 0 1 M 12 [Note: When a variable is 1, we use its complemented form
1 1 0 1 1 M 13 and when a variable is 0, we use its uncomplemented form.]
1 1 1 0 1 M 14
M 15 Thus, z=( u+ v ) ⋅ ( u+ y ).
1 1 1 1 1
Think deeper and figure out why this approach works.
Inputs Outputs
Decimal b3 b2 b1 b0 a b c d e f g
Number
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
1 0 1 0 X X X X X X X
1 0 1 1 X X X X X X X
1 1 0 0 X X X X X X X
1 1 0 1 X X X X X X X
1 1 1 0 X X X X X X X
1 1 1 1 X X X X X X X
X in the above table indicates that we don’t care whether those outputs are 1 or 0 because we assume that
inputs 10 to 15 are never going to occur. And when inputs 10 to 15 occur by chance, we won’t complain
about which LED segments are glowing or not.
Truth table for a Truth table for b
a=b3 + b1+ b2 b0 +b 2 b 0 HW
HW HW
Truth table for e Truth table for f
HW HW
Truth table for g
K maps are not very convenient if the number of variables is more than 4.
For that we shall study Quine–McCluskey tabulation approach.
Quine–McCluskey tabulation approach for simplifying Boolean functions (Studied from the text book.)
f ( A , B ,C , D , E , F )=∑ ( 6 , 9 , 13 ,18 , 19 , 25 ,27 ,29 , 41 , 45 , 57 , 61 )
Step 5: Combine again the pair of minterms that differ in exactly one bit. Replace the differing bit with a
dash (-)
minterm A B C D E F Number
of ones
m9, m13, m25, m29 0 - 1 - 0 1
m9, m13, m41, m45 - 0 1 - 0 1
m9, m25, m13, m29 0 - 1 - 0 1
m9, m25, m41, m57 - - 1 0 0 1
m9, m41, m13, m45 - 0 1 - 0 1
m9, m41, m25, m57 - - 1 0 0 1
m13, m29, m57, m61 - - 1 1 0 1
m13, m45, m29, m61 - - 1 1 0 1
m25, m29, m57, m61 - 1 1 - 0 1
m25, m57, m29, m61 - 1 1 - 0 1
m41, m45, m57, m61 1 - 1 - 0 1
m41, m57, m45, m61 1 - 1 - 0 1
Step 6: Clean up by removing duplicate rows
minterm A B C D E F Number Is used in the
of ones next table?
m9, m13, m25, m29 0 - 1 - 0 1 2 ✓
m9, m13, m41, m45 - 0 1 - 0 1 2 ✓
m9, m25, m13, m29 0 - 1 - 0 1
m9, m25, m41, m57 - - 1 0 0 1 2 ✓
m9, m41, m13, m45 - 0 1 - 0 1
m9, m41, m25, m57 - - 1 0 0 1
m13, m29, m57, m61 - - 1 1 0 1 3 ✓
m13, m45, m29, m61 - - 1 1 0 1 3 ✓
m25, m29, m57, m61 - 1 1 - 0 1 3 ✓
m25, m57, m29, m61 - 1 1 - 0 1
m41, m45, m57, m61 1 - 1 - 0 1 3 ✓
m41, m57, m45, m61 1 - 1 - 0 1
Step 7: Combine again the pair of minterms that differ in exactly one bit. Replace the differing bit with a
dash (-). Clean up by removing duplicate rows
minterm A B C D E F
m9, m13, m25, m29, m41, m45, m57, m61 - - 1 - 0 1 CEF
m9, m13, m41, m45, m25, m29, m57, m61 - - 1 - 0 1
m9, m25, m41, m57, m13, m29, m57, m61 - - 1 - 0 1
m9, m25, m41, m57, m13, m45, m29, m61 - - 1 - 0 1
Step 8: The terms which cannot be combined any further are candidates for the final SOP expression.
Candidate m6 m9 m13 m18 m19 m25 m27 m29 m41 m45 m57 m61
implicants
A BC D E F ✓
A BC D E ✓ ✓
A BD E F ✓ ✓
A BC D F ✓ ✓
CEF ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
--------------------------------------------------------------------------------------------
You may study duality principle from the text book.