Bee Unit 3 Cse Gates, Boolean, Codes
Bee Unit 3 Cse Gates, Boolean, Codes
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
Quantities/Counting (2 of 2)
Hexa-
Decimal Binary Octal decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Positive Powers of 2
• Powers of 2
Exponent Value Exponent Value
0 1 11 2,048 2 K
1 2 12 4,096 4 K
2 4 13 8,192 8 K
3 8 14 16,384 16 K
4 16 15 32,768 = 215 = 25 x 210 = 32 K
5 32 16 65,536 64 K
6 64 17 131,072 128 K
7 128 18 262,144 256 K
8 256 19 524,288 512 K
9 512 20 1,048,576 1 M
10 1024 1 K 21 2,097,152 2 M
Binary Numbers:
Special Powers of 2
9 is called Most Significant digit (Left most digit) (Has high positional value)
927 = 9 x 102 + 2 x 101 + 7 x 100
From right to left positional value increases by 10 times
Decimal Number system
Ex: 328.4
1010
This number consists of four bits. Each bit has
positional weightage of power of 2.
Right most binary digit or bit has least weightage
, hence it is called LSB (Least Significant Bit)
Left most binary digit or bit has highest
weightage , hence it is called MSB (Most
Significant Bit)
Binary Number system
0+0=0
0+1=1
1+0=1
1+1=10 (0 is sum and carry or carry forward is 1)
1+1=0
EXAMPLE
0 - 0= 0
0 - 1= 11 (1 is subtraction and borrow is 1
0 - 1= 1
1 - 0= 1
1 - 1= 0
EXAMPLE
Decimal Octal
Binary Hexadecimal
Conversion of Decimal number to any Radix number.
conversion
1.Decimal to Binary
• Technique
–Divide by two, keep track of the
remainder
–First remainder is bit 0 (LSB, least-
significant bit)
–Second remainder is bit 1
–Etc.
Example
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1
12510 = 11111012
Example
• Decimal to binary .14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001...
etc.
2.Decimal to Octal
• Technique
–Divide by 8
–Keep track of the remainder
Example
123410 = ?8
8 1234 LSB
154 2
8
19 2
8
8 2 3
0 2
MSB
123410 = 23228
Example
Convert 658.82510 = ?8
658.82510 =1222.6468
3.Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder
Example 123410 = ?16
16 1234
77 2
16
4 13 = D
16
0 4
123410 = 4D216
Example
Convert (8765.025)10 to hexadecimal
1.Binary to Decimal
• Technique
Multiply each bit by 2n, where n is the
“weight” of the bit
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Example
1000102to Base 10
1000102 => 0 x 20 = 0
1 x 21 = 2
0 x 22 = 0
0 x 23 = 0
0 x 24 = 0
1 x 25 = 32
3410
Example
• Binary to decimal
• Technique
–Multiply each bit by 8n, where n is the
“weight” of the bit
–The weight is the position of the bit,
starting from 0 on the right
–Add the results
Example
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Example
4328 To Base 10
2 x 80 = 2
3 x 81 = 24
4 x 82 = 256
28210
3.Hexadecimal to Decimal
• Technique
–Multiply each bit by 16n, where n is
the “weight” of the bit
–The weight is the position of the bit,
starting from 0 on the right
–Add the results
Example
A5D16 to Base 10
D x 160 =13 x1 = 13
5 x 161 = 5x16 = 80
A x 162=10x256 = 2560
265310
4.Octal to Binary
• Technique
7058 = ?2
7 0 5
7058 = 1110001012
Example
2148 = ?2
2 1 4
2148 = 0100011002
5.Hexadecimal to Binary
• Technique
10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
Example
3A9E.B0D16 = ?2
3 A 9 E . B 0 D
3A9E.B0D16 =
0011101010011110.1011000011012
Binary to Octal
• Technique
– Group bits in threes, starting on right
– Convert to octal digits
Example
10110101112 = ?8
1 011 010 111
1 3 2 7
10110101112 = 13278
a) 110101.1010102 = ?8
110101.1010102 =65.528
b) 10101111001.01112 = ?8
10101111001.01112 =2571.348
Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
Example
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
Convert
01011111011.0111112 =?16
01011111011.0111112
=2FB.7C?16
Octal to Hexadecimal
• Technique
– Use binary as an intermediary
Example
10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
756.6038 = ?16
756.6038 =1EE.C1816
Example
10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
Hexadecimal to Octal
• Technique
– Use binary as an intermediary
Example
1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
Logic Gates
A Logic Gate is an Digital electronic circuit which has one or
more inputs and single output.
Logic Gates are the basic building blocks any digital system
A B Y = A.B
0 0 0
0 1 0
1 0 0
Outputs of AND Gate will be 1 when all the inputs
1 1 1 are 1
OR Gate
An OR gate is a digital circuit that has two or more
inputs and produces an output, which is the logical
OR of all those inputs
+ Symbol
Truth Table
A B Y=A+B
0 0 0
0 1 1
1 0 1
The output of an OR gate will be ‘1’,
1 1 1
when at least one of those inputs is ‘1’.
NOT Gate
An OR gate is a digital circuit that has one input and one output.
The output of NOT Gate is the logical inversion of input.
Hence NOT Gate is called as an Inverter.
A Y = A’
0 1
1 0
0 0 1
0 1 1
1 0 1
1 1 0
NOR Gate
NOR gate is a digital circuit that has two or
more inputs and produces an output, which
is the inversion of logical OR of all inputs.
A B Y = A+B
0 0 1
0 1 0
1 0 0
1 1 0
SPECIAL Gates
1) Ex – OR
2) Ex – NOR
Ex – OR Gate
The full form of Ex-OR gate is Exclusive-OR gate.
0 1 1
1 0 1
1 1 0
Ex – NOR
The full form of Ex-NOR gate is Exclusive-NOR gate.
Its function is same as that of NOR gate except for some cases.
the output of Ex-NOR gate is ‘1’, when both inputs are same. And
it is zero, when both the inputs are different.
A B Y = A⊙B
0 0 1
0 1 0
1 0 0
1 1 1
Alternative Gate representation
Bubbled NOR gate is nothing but AND gate
0+0=0
0+1=1
1+0=1
1+1=0 with carry 1.
Binary Arithmetic
Binary Substraction
The four possible elementary operations are
0-0=0
0-1=1 with borrow 1.
1-0=1
1-1=0
Binary Arithmetic
Binary Multiplication
The four possible elementary operations are
0*0=0
0*1=0
1*0=0
1*1=1
Binary Arithmetic
Binary Division
The two possible elementary operations are
0/1=0
1/1=1
1’s complements:
(a) 00010101 (b)10000001 (c)11111110 (d)01111111
2’s complement :
(a) 00010110 (b)10000010 (c)11111111 (d)10000000
Binary Subtraction using 1’s Complement
Method
In this method Operation A-B is performed using following
Steps.
Take 1’s complement of B.
Result=A+1’s complement of B.
If carry is generated then the result is +ve and add carry
to the result to get the final answer.
If carry is not generated then the result is -ve and for
final result find the 1’s complement of the intermediate
results.
Binary Subtraction using 2’s Complement
Method
In this method Operation A-B is performed using following
Steps.
Take 2’s complement of B.
Result=A+2’s complement of B.
If carry is generated then the result is +ve and add Ignor
the carry.
If carry is not generated then the result is -ve and for
final result find the 2’s complement of the intermediate
results.
Decimal Number System
9’s and 10’s Complements
9’ Complement:
The 9’s complement of the decimal number is obtained by
subtracting each digit of that decimal number from 9.
10’ Complement:
The 10’s complement of the decimal number is obtained by
adding a1 to its9’s complement
9’s Complement of subtraction
If carry doesn't present, then the answer is –ve . place –ve
sign before the answer and find its 9’complement.
10’s Complement of subtraction
If carry doesn't present, then the answer is –ve . place –ve
sign before the answer and find its 10’complement.
Representation of sign numbers using 1’s and 2’s
complement method.
64
Subtraction with Complements
Example
Codes
Codes:
In unit-
distancecode
bit patterns
for two
consecutive numbers
differ is only one bit
position.
To correct the invalid sum, add 6(0110) to the four bit sum.
If a carry results from this addition, add it to the next higher
order BCD digit.
BCD Subtraction using 9’s complement
If carry is not generated the result is –ve and find the 9’
complement of the results, otherwise result is +ve and add
carry to the results.
BCD Subtraction using 10’s complement
If carry is not generated the result is –ve and find the 10’
complement of the results, otherwise result is +ve and ignore
the carry.
Reflective property of 2-4-2-1 code.
1 0001
1110 8
2 0010
1101 7
3 0011
1100 6
4 0100
1011 5
Excess-3 code.
The Excess-3 code can be derived from the natural BCD code
by adding 3(0011) to each coded number.
Decimal Excess-3 code
0 0000+0011 0011 3
1 0001+0011 0100 4
2 0010+0011 0101 5
3 0011+0011 0110 6
4 0100+0011 0111 7
5 0101+0011 1000 8
6 0110+0011 1001 9
7 0111+0011 1010 10
8 1000+0011 1011 11
9 1001+0011 1100 12
Advantage of Excess-3 code.
In Excess-3 code we get 9’s complement of a number by just
complementing each bit.
These codes are also called “cyclic codes. And the gray code
is also called as reflected code.
1. A 1-bit Gray code has two code words, 0 and 1.
2.The first 2n code words of an (n+1)-bit gray code equal the code words of
an n-bit gray code,written in order with a leading 0 appended.
3.The last 2n code words of an (n+1)-bit Gray code equal the code words of
an n-bit gray code, but written in reverse order with a leading 1 appended.
The MSB of the gray code is the same as the MSB of the
binary code. So write down as it is
0 - 48
1 - 49
2 - 50
3 - 51
4 - 52
5 - 53
6 - 54
7 - 55
8 - 56
9 - 57
Note:
Ans:
(a) No. of 1‘s in the word is even is 6 so word has error
(b) No. of 1‘s in the word is even is 4 so word has error
(c) No. of 1‘s in the word is odd is 5 so there is no error
Hamming Code
6 0 1 10 0 1 10 1 10
7 0 1 1 1 0 1 1 1 1 1 1
8 1 0 0 0 1 0 0 0
9 1 0 0 1 1 0 0 1
10 1 0 1 0 1 0 1 0
11 1 0 1 1 1 0 1 1
12 1 1 0 0 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
7-bit Hamming code:
To transmit four data bits, 3 parity bits located at positions 20 21 22 from left are
added to make a 7-bit code word which is then transmitted.
The word format
P1 P2 D3 P4 D5 D6 D7
D—Data bits P- Parity bits
Bits 1,3,5,7 (C1 1001) →no error →put a 0 in the 1‘s position→C1=0
Bits 2, 3, 6, 7(C2 0001)) → error →put a 1 in the 2‘s position→C2=1
Bits 4,5,6,7 (C4 1001)) →no error →put a 0 in the 4‘s position→C3=0
12-Bit Hamming Code: It transmit 8 data bits, 4 parity bits located at position 20 21 22 23
Word format is
P1 P2 D3 P4 D5 D6 D7 P8 D9 D10 D11 D12
Axiomatic definition of Boolean
algebra
• Boolean algebra is an algebraic structure defined by a set of
elements, together with two binary operators + and . ,
provided that the following postulates are satisfied.
Boolean laws
Postulate : Closure Property
• Closure(a):
when two binary elements are operated by operator +
the result is a unique binary element
OR operator (plus/Addition)
• Closure(b):
When two binary elements are operated by operator
.(dot),the result is a unique binary element
(a) A + A = A (b) A . A = A
Proof: Proof:
A + A = (A + A) . 1 A.A=A.A+ 0
= (A + A). (A + A’)
= A . A + A .A’
= AA + AA’+ AA + AA’
= A ( A + A’)
= AA+ AA’
=A+ 0 =A. 1
=A =A
Perfect Induction Method
• (a) A + 1 = 1 (b) A . 0 = 0
Proof: Proof:
A + 1 = 1 . (A + 1)
= (A + A’) (A + 1) 0.0=0
= A.A + A.1 + A’ .A + => A . 0 = 0
A’.1 1.0=0
= A +A+ 0 + A’
= A + A’
=1 A . 0 = 0 by the duality
theorem
Theorem 2: Involution
• A’’ = A
• Proof:
0’’ = 0
=> A’ = A
1’’ = 1
Theorem 3 : Absorbtion
x y x.y x y x+y x x’
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
x.(y+z) = (x.y)+(x.z)
x y z y+z x.(y+z) x.y x.z (x.y)+x.z
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
Definitions
Literal: A variable or its complement
Ex: AB+AB+AB+AB+AB=AB
Look for variable and its negation in the same term, this
term can be dropped.
Ex: 1. A.BB’=A.0=0
2. ABCC’=AB.0=0
Look for pairs of terms that are identical except for one
variable which may be missing in one of the terms, the
large term can be dropped.
Ex: ABC’D’+ABC’= ABC’(D’+1)= ABC’.1= ABC’
Look for pairs of terms which are having the same
variables, with one or more variables complemented. If
variable in one term of such a pair is complemented while
in the second term it is not, such terms can be combined
in to a single term with that variable dropped.
x y z G
0 0 0 0
0 0 1 0 G = xyz + xyz’ + x’yz
0 1 0 0
0 1 1 1
1 0 0 0 G = m7 + m6 + m3 = Σ(3, 6, 7)
1 0 1 0
1 1 0 1
1 1 1 1
Conversion Between Canonical Forms
● Easy to convert between minterm and maxterm
representations
● For maxterm representation, select rows with 0’s
f(A,B,C)=(A+B’)C
Or
f=(A+B’)C
Boolean Functions are represented in two forms.
Ex: f(A,B,C)=ABC+AB’C’
Ex: f(P,Q,R,S)=P’Q+QR+RS
Product Of Sum forms (POS):
A product of sum form is a group of sum terms AND ed
together.
Ex: f(A,B,C)=(A+B).(B’+C)
Ex: f(P,Q,R,S)=(P+Q).(R+S’).(P+S)
Canonical forms(Standard SOP and POS forms):
Ex: f(A,B,C)=AB’C+ABC+A’BC’
Standard POS form or Maxterm canonical form:
If each term in POS form contains all the literals or
variables then the POS form is known as Standard or
Canonical POS form.
Each individual term in the Standard POS form is called
“Maxterm”.
Ex: f(A,B,C)=(A+B+C).(A+B’+C).(A’+B’+C’)
Steps to convert SOP to Standard SOP form.
Find the missing literal in each product term if any.
Sol: f(A,B,C)=m0+m1+m3+m6
=Σm(0,1,3,6)
Σ=Sum of product terms
Ex: Write the shorthand notation for the following
Boolean function.
f(A,B,C)=(A+B+C’)(A+B’+C’)(A’+B’+C)
Sol: f(A,B,C)=M1 M3 M6
=ΠM(1,3,6)
Π =Product of sum terms
Conversion from min to Max & Max to min:
Ex: Convert the following min terms to max terms
f(A,B,C)=m0+m1+m3+m4+m6+m7.
Sol: f(A,B,C)=m0+m1+m3+m4+m6+m7
=Σm(0,1,3,4,6,7)
=ΠM(2,5)
Ex: Convert the following max terms to min terms
f(A,B,C,D)=M1 M3 M5 M7 M9 M11 M13 M15.
=ΠM(1,3,5,7,9,11,13,15)
=Σm(0,2,4,6,8,10,12,14
Ex: Simply the following three variable expression
using Boolean algebra.
Y=Σm(1,3,5,7)
Sol:
Y=A’B’C+A’BC+AB’C+ABC
=A’C(B’+B)+AC(B’+B)
=A’C(1)+AC(1)
=C(A’+A)
=C
Ex: Convert the expression given below in to min
terms using complementary property and simply
the expression using Boolean algebra.
Y=ΠM(3,5,7)
Sol: Y=Σm(0,1,2,4,6)
=A’B’C’+A’B’C+A’BC’+AB’C’+ABC’
=A’B’C’+AB’C’+A’BC’+ABC’+A’B’C
=B’C’(A’+A)+BC’(A’+A)+A’B’C
=B’C’+BC’+A’B’C
=C’(B’+B)+A’B’C
=C’+A’B’C A+A’B=A+B
=C’+A’B’