You are on page 1of 70

Department Of Electronics & Communication

Engineering

Digital Electronics
Prof. Manjunath V Gudur
Department of Electronics and Communication
Module-4

Boolean Algebra and Logic Circuits:Binary numbers, Number Base


Conversion, octal & Hexa Decimal Numbers, Complements, Basic
definitions, Axiomatic Definition of Boolean Algebra, Basic Theorems
and Properties of Boolean Algebra, Boolean Functions, Canonical and
Standard Forms, Other Logic Operations, Digital Logic Gates (Text 3:
1.2, 1.3, 1.4, 1.5,2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7)

Combinational logic: Introduction, Design procedure, Adders- Half


adder, Full adder (Text 3:4.1, 4.2, 4.3)

Basic Electronics - ELN 2


Each number system is associated with a base or radix
Ø The decimal number system is said to be of base or radix 10.
Ø A number in base r contains r digits 0,1,2,...,r-1.

Basic Electronics - ELN 3


Counting/Quantities

Basic Electronics - ELN 4


• Number Conversions
• Arithmetic Operations
• Complements

Basic Electronics - ELN 5


Following are the possible conversions among bases

Basic Electronics - ELN 6


Absolute
Fraction
value
Decimal to Binary conversion
value
conversion

MSD ( Most Significant Digit ) is same as MSB ( Most Significant Bit )


LSD ( Least Significant Digit ) is same as LSB ( Least Significant Bit )
Fraction
Absolute value
value conversion
Decimal to Octal conversion

Convert (25)10 = (? )8 Convert (0.23)10 = ( ? )8

8 25
8 3 - 1 LSD

MSD

So (25)10 = (31)8

Basic Electronics - ELN 8


Fraction
Absolute value
value conversion
Decimal to Hexadecimal conversion

Convert (31)10 = (? )16 Convert (0.65)10 = ( ? )16

16 31
16 1 - F LSD

MSD

So (31)10 = (1�)16

Basic Electronics - ELN 9


Basic Electronics - ELN 10
Number: An-1.....A1A0 . A-1A-2....A-m

Basic Electronics - ELN 11


Basic Electronics - ELN 12
Binary to Decimal
(1101.101)2 = (?)10

(1101.101)2 = (13.625)10
Basic Electronics - ELN 13
Octal to Decimal
(5632.471)8 = (?)10

Basic Electronics - ELN 14


Hexa-decimal to Decimal

Basic Electronics - ELN 15


• O c ta l a n d h exa d e c i m a l n u m b e r syste m p ro v i d e s
convenient way of converting large binary numbers into
more compact and smaller groups.
• There are various ways to convert a binary number into
octal and hexadecimal number. You can convert using
direct methods or indirect methods.
• Binary to decimal and decimal octal/hexadecimal number
(indirect method)
• Direct method uses grouping.

Basic Electronics - ELN 16


OCT Binary Hex Binary Hex Binary

0 000 0 0000 8 1000

1 001 1 0001 9 1001

2 010 2 0010 A 1010

3 011 3 0011 B 1011

4 100 4 0100 C 1100

5 101 5 0101 D 1101

6 110 6 0110 E 1110

7 111 7 0111 F 1111


Basic Electronics - ELN 17
Ø Take binary number
Ø Separate the binary digits into groups of three bits from
binary point to the left for integer part and to the right for
fraction part.
Ø Then replace each group of binary number from its
equivalent octal digits. That will be octal equivalent of
given binary number.

Note that you can append any number of 0’s in leftmost bit (or before the
most significant bit) for integer part and append any number of 0’s after
the rightmost bit for fraction part for completing the group of 3 bits, this
does not change value of input binary number.
Basic Electronics - ELN 19
Octal to Binary
Binary to Octal

Convert (10101101.0111)2 to Octal Convert (125.62)8 to Binary

Basic Electronics - ELN 20


Ø Take binary number
Ø Separate the binary digits into groups of four bits from
binary point to the left for integer part and to the right for
fraction part.
Ø Then replace each group of binary number from its
equivalent hexadecimal digits. That will be hexadecimal
equivalent of given binary number.

Note that you can append any number of 0’s in leftmost bit (or before the
most significant bit) for integer part and append any number of 0’s after
the right most bit for fraction part for completing the group of 4 bits, this
does not change value of input binary number.
Basic Electronics - ELN 21
Binary to Hexadecimal Hexadecimal to Binary

Basic Electronics - ELN 22


Octal to Hexadecimal

Basic Electronics - ELN 23


Hexadecimal to Octal

Basic Electronics - ELN 24


Binary arithmetic is used in digital systems mainly because the
numbers are stored in binary format in most computer systems.

All arithmetic operations such as addition, subtraction, multiplication,


and division are done in binary representation of numbers.

•Binary Addition
• Binary Subtraction
• Binary Multiplication
• Binary Division

Basic Electronics - ELN 25


A B A+B A+B Sum Carry Out
0 0 0 0+0 0 0
0 1 1 0+1 1 0
1 0 1 1+0 1 0
1 1 10 1+1 0 1

A + B + Carry in Sum Carry Out


0+0+1 1 0
0+1+1 0 1
1+0+1 0 1
1+1+1 1 1
Basic Electronics - ELN 26
1. Add (60)10 with (42)10 using binary addition
Carry: 1 1 1
(6 0) 10 Augend 1 1 1 1 0 0
+ (4 2) 10 Addend 1 0 1 0 1 0
(1 0 2)10 Sum: 1 1 0 0 1 1 0

2. Add (11100)2 and (1110)2 using binary addition


Carry: 1 1 1
(2 8) 10 Augend 1 1 1 0 0
+ (1 4) 10 Addend 0 1 1 1 0
( 4 2)10 Sum: 1 0 1 0 1 0
Basic Electronics - ELN 27
3. Add (101.11)2 and (111.10)2 using binary addition

Carry: 1 1 1 1
(5 . 7 5) 10 equivalent decimal is 1 0 1 . 1 1
+ (7 . 5 0) 10 equivalent decimal is 1 1 1 . 1 0

(1 3 . 2 5)10 Sum: 1 1 0 1 . 0 1

Basic Electronics - ELN 28


Complements are used in the digital computers in order to simplify
the subtraction operation and for the logical manipulations.
For each radix-r system (base-r) there are two types of complements
they are,
1. r’s complement and
2. (r-1)’s complement.

Therefore for binary number system with r = 2, it has


1. 1’s complement and
2. 2’s complement.

Basic Electronics - ELN 29


Subtractions by 1’s Complement method:
The algorithm to subtract two binary numbers (i.e,A - B) using 1’s complement is explained as
follows:
Ø Take 1’s complement of ‘B’ subtrahend
Ø Result = ‘A’ (minuend) + 1’s complement of ‘B’ subtrahend.
Ø In step 2 if there is carry (1) out of MSB bit, then the result is positive and is in true form.
Add that carry to the least significant bit (LSB) of the above result to get final result.
Ø In step 2 if there is no carry out of MSB bit , then the result is negative and is in the 1’s
complement form. (To find the actual difference between ‘A’ and ‘B’ take 1’s complement
of this result and put minus sign infront of the number.)
(Note:
1. The 1's complement of a number is found by changing all 1's to 0's and all 0's to 1's. This is called as taking
complement or 1's complement.
2. Subtrahend is a number that to be subtracted from the another number, i.e., minuend.)

Basic Electronics - ELN 30


1. Perform (05)10 - (04)10 using binary 1’s complement subtraction.
we can write it as A + (-B) = 5 + (-4).
Now we have to represent +4 in binary and take 1’s complement of it to represent -4.

A = 05 = 1 0 1 (Minuend) ----------------------------------------------------> 1 0 1
- - - +
B = 04 = 1 0 0 (subtrahend) ----> 1’s complement of subtrahend ----> 0 1 1
01 EAC 1 000
+1
001
There is a carry out of MSB, the result is positive
and hence add this carry to LSB to get final result. The result is positive

Basic Electronics - ELN 31


2. Perform (05)10 - (04)10 using binary 1’s complement subtraction.
we can write it as A + (-B) = 5 + (-4).
Now we have to represent +4 in binary and take 1’s complement of it to represent -4.

A = 05 = 1 0 1 (Minuend) ----------------------------------------------------> 1 0 1
- - - +
B = 04 = 1 0 0 (subtrahend) ----> 1’s complement of subtrahend ----> 0 1 1
01 EAC 1 000
+1
001
There is a carry out of MSB, the result is positive
and hence add this carry to LSB to get final result. The result is positive

Basic Electronics - ELN 32


3. Subtract 1000.012 from 1011.102 using binary 1’s complement subtraction.

A = 1011.10 = 11.50 --------------------------------------------------> 1 0 1 1 . 1 0


- - +
B = 1000.01 = 08.25 ---> 1’s complement of subtrahend ---> 0 1 1 1 . 1 0
03.25 1 0011.00
+ 1
0011.01
There is a carry out of MSB, the result is positive
and hence add this carry to LSB to get final result.

Basic Electronics - ELN 33


Basic Electronics - ELN 34
Subtractions by 2’s Complement method:
The algorithm to subtract two binary numbers (i.e,A - B) using 2’s complement is explained as
follows:
Ø Take 2’s complement of ‘B’ subtrahend.
Ø Result = ‘A’ (minuend) + 2’s complement of ‘B’ subtrahend.
Ø In step 2 if there is carry (1) out of MSB bit then the result is positive and is in true form. in
this case carry is discarded..
Ø In step 2 if there is no carry out of MSB bit , then the result is negative and is in the 2’s
complement form. (To find the actual difference between ‘A’ and ‘B’ take 2’s complement
of this result)
Note:
Ø 2’s complement = 1’s complement+1
Ø Adding end-around carry-bit occurs only in 1’s complement arithmetic operations but not in 2’s complement
arithmetic operations
Basic Electronics - ELN 35
1. Perform (5)10 - (4)10 using binary 2’s complement subtraction.

A = 05 = 1 0 1 (Minuend) To get 2’s complement of subtrahend:


- - -
B = 04 = 1 0 0 (subtrahend) --------------------> 1’s complement------> 0 1 1
01 +1
2’s complement of subtrahend: 100

Now add Minuend with 2’s complement of subtrahend to get the result:
101
+
100
There is a carry out of MSB, discard
the carry and the result is positive. 1 00 1
Final Result = 001
Basic Electronics - ELN 36 36
2. Perform (04)10 - (05)10 using binary 2’s complement subtraction.

A = 04 = 1 0 0 (Minuend) To get 2’s complement of subtrahend:


B = 05 = 1 0 1 (subtrahend) --------------------> 1’s complement---> 010
- 01 +1
2’s complement of subtrahend: 011

Now add Minuend with 2’s complement of subtrahend to get the result:
There is no carry out of MSB, result is 100
+
negative. To get the actual difference 011
take the 2’s complement of the result.
111

Now take 2’ complement of 111 = 000+1= -001.


Basic Electronics - ELN 37
3. Perform 2810 - 1910 using 2’s complement method.

Basic Electronics - ELN 38


4. Subtract 1000.012 from 1011.102 using binary 2’s complement subtraction.

A = 1011.10 (Minuend) To get 2’s complement of subtrahend:


- -
B = 1000.01 (subtrahend) ----------------> 1’s complement----------> 0 1 1 1 . 1 0
+ 1
2’s complement ----------> 0 1 1 1 . 1 1

Now add Minuend with 2’s complement of subtrahend to get the result:
1011.10
There is a carry out of MSB, discard +
the carry. Result obtained is positive. 0111.11
10011.01

Basic Electronics - ELN 39


Complements are used in the digital computers in order to simplify
the subtraction operation and for the logical manipulations.
For each radix-r system (base-r) there are two types of complements
they are,
1. r’s complement and
2. (r-1)’s complement.

Therefore for Decimal number system with r = 10, it has


1. 9’s complement and
2. 10’s complement.

Basic Electronics - ELN 40


Complements are used in the digital computers in order to simplify the subtraction operation and for
the logical manipulations.
For each radix-r system (base-r) there are two types of complements they are,
1. r’s complement and
2. (r-1)’s complement.

Therefore for binary number system with r = 2, it has


1. 1’s complement and
2. 2’s complement.
Subtractions by 9’s Complement method:
The algorithm to subtract two numbers (i.e,M - N) using 9’s complement is explained as
follows:
Ø Take 9’s complement of ‘N’ subtrahend
Ø Result = ‘M’ (minuend) + 9’s complement of ‘N’ subtrahend.
Ø In step 2 if there is carry (1) out of MSD digit, then the result is positive and is in true form.
Add that carry to the least significant digit (LSD) of the above result to get final result.
Ø In step 2 if there is no carry out of MSD digit , then the result is negative and is in the 9’s
complement form. (To find the actual difference between ‘M’ and ‘N’ take 9’s complement
of this result and put minus sign infront of the number.)

Basic Electronics - ELN 44


Subtractions by 10’s Complement method:
The algorithm to subtract two numbers (i.e, M - N) using 10’s complement is explained as
follows:
Ø Take 10’s complement of ‘N’ subtrahend
Ø Result = ‘M’ (minuend) + 10’s complement of ‘N’ subtrahend.
Ø In step 2 if there is carry (1) out of MSD digit, then the result is positive and is in true form.
disacrd the carry.
Ø In step 2 if there is no carry out of MSD digit , then the result is negative and is in the 10’s
complement form. (To find the actual difference between ‘M’ and ‘N’ take 10’s complement
of this result and put minus sign infront of the number.)

Basic Electronics - ELN 45


Subtract 72532 - 3250 using 10’s complement method.

Solution: Given M=72532 and N=03250


9’ s complement of N = 99999-03250 = 96749
10’s complement = 9’s complement + 1 = 96749+1 = 96750

The carry out of MSD should be


discarded and the result
obtained is positive
Basic Electronics - ELN 46
Subtract 3250 - 72532 using 10’s complement method.

Solution: Given M=03250and N=72532


9’ s complement of N = 99999-72532 = 27467
10’s complement = 9’s complement + 1 = 27467+1 = 27468

Basic Electronics - ELN 47


Basic Electronics - ELN 48
• The basis for all digital circuits is Boolean algebra. It is use to
simplify, design and analysis digital circuits.
• Developed by English Mathematician George Boole in between
1815 - 1864.
• It is described as an algebra of logic or an algebra of two values
i.e True or False.
• The term logic means a statement having binary decisions i.e
True/Yes or False/No.
• In digital computer True represent by ‘1’ (high volt) and False
represent by ‘0’ (low volt).
• A variable whose value can be either 1 or 0 is called a Boolean
variable.

Basic Electronics - ELN 49


Boolean
Boolean or Logical operators:
The fundamental logical or boolean operators are:
1. AND (conjunction)
2. OR (disjunction)
3. NOT (negation/complement)
Boolean expressions are created by performing operations on
Boolean variables.

Basic Electronics - ELN 50


Boolean Algebra
AND operator
It performs logical multiplication and denoted by (.) dot. AND is true only if
both inputs are true.
Boolean Expression/Logical expression:
A B Y = A.B Y=A.B
0 0 0 Truth Table:
Truth table is a table that contains all possible
0 1 0
values of a logical variables/statements in a
1 0 0 Boolean expression.
1 1 1 No. of possible combinations = 2n
Truth table , where n=number of variables used in
a Boolean expression.
Basic Electronics - ELN 51
Boolean Algebra
OR operator
It performs logical addition and denoted by (+) plus.OR is true if
either inputs are true.
A B Y = A+B
0 0 0 Boolean Expression/Logical expression:
0 1 1 Y=A+B
1 0 1
1 1 1
Truth table

Basic Electronics - ELN 52


Boolean Algebra
NOT operator

It performs logical negation and denoted by (- bar). It operates on single variable.


NOT inverts the bits.
Boolean Expression/Logical expression:
A Y=�
0 1 Y=�
1 0
Truth table

Basic Electronics - ELN 53


Boolean Algebra
Write the truth table for following boolean expression or
function,
F(X,Y,Z) = X + ��

The order of evaluation is:


1. Parentheses
2. NOT
3. AND
4. OR

Basic Electronics - ELN 54


• Digital computers contain circuits that implement
Boolean functions.
• The simpler that we can make a Boolean function,
the smaller the circuit that will result.
– Simpler circuits are cheaper to build, consume
less power, and run faster than complex circuits.
• With this in mind, we always want to reduce our
Boolean functions to their simplest form.
• There are a number of Boolean theorems/identities
that help us to do this.

Basic Electronics - ELN 55


Basic Electronics - ELN 56
Proof of Commutative law

Inputs Outputs
A B A+B B+A
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1
Basic Electronics - ELN 57
Inputs Outputs
A B C A.B (A.B).C B.C A.(B.C)
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 1 0
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 1 0 0 0
1 1 1 1 1 1 1

Basic Electronics - ELN 58


Distributive Law Proofs:
b.
RHS = (A+B).(A+C)
=A.A + A.C+B.A+B.C
=A + A.C + A.B + B.C
=A.(1+C+B) + B.C
=A.1 + B.C
=A + B.C
=A+BC = LHS
c.
LHS= A+A’B
=A+AB+A’B
=A+B(A+A’)
=A+B
Basic Electronics - ELN 59
T10: DE-Morgan’s Theorem:
a. (A.B)’=A’+B’
b. (A+B)’=A’.B’

Basic Electronics - ELN 60


De-Morgan’s First theorem states that when two (or more) input variables
are AND’ed and negated, they are equivalent to the OR of the
complements of the individual variables.
OR
Complement of product of two or more variables is equal to the sum of
complement of variables.

i. (A.B)’=A’+B’

It is proved using
following truth table.

Verifying Demorgan first theorem using truth table


Basic Electronics - ELN 61
De-Morgan’s Second theorem proves that when two (or more) input
variables are OR’ed and negated, they are equivalent to the AND of
the complements of the individual variables.
OR
Complement of sum of two or more variables is equal to the product of
complement of variables.

ii. (A+B)’=A’.B’
It is proved using
following truth table.

Verifying DeMorgan second theorem using Truth Table

Basic Electronics - ELN 62


Logic gates are abstractions of electronic circuit
components that operate on one or more input signals
to produce an output signal.
Logic gates are the building blocks of any digital system.
We can classify these Logic gates into the following
three categories.
• Basic gates
• Universal gates
• Special gates

Basic Electronics - ELN 63


Basic Logic Gates
AND Gate:
The AND gate is an electronic circuit that gives a high output (1) only if
all its inputs are high. A dot (.) is used to show the AND operation i.e.
(A.B). This dot is sometimes omitted i.e. (AB).

Logic Diagram: Logic / Boolean expression: Truth Table:

Y = A.B = AB

Basic Electronics - ELN 64


Basic Logic Gates
OR Gate:
The OR gate is an electronic circuit that gives a high output (1) if
one or more of its inputs are high. A plus (+) is used to show the
logical OR operation.

Logic Diagram:
Logic / Boolean expression: Truth Table:

Y=A+B

Basic Electronics - ELN 65


Basic Logic Gates
NOT Gate:
A NOT gate is a digital circuit that has single input and single
output. The output of NOT gate is the logical inversion of input.
Hence, the NOT gate is also called as inverter.

Logic Diagram: Logic / Boolean expression: Truth Table:

Y = A’ or
Y=�

Basic Electronics - ELN 66


Universal Gates
NAND & NOR gates are called as universal gates. Because we can
implement any Boolean function using only NAND or only NOR gates.
NAND Gate:
This is a NOT-AND gate which is equal to an AND gate followed by a
NOT gate. The outputs of all NAND gates are high if any of the inputs
are low. The symbol is an AND gate with a small circle on the output.
The small circle represents inversion.
Logic Diagram: Logic / Boolean expression: Truth Table:

Y = (AB)’ = ��

Basic Electronics - ELN 67


Universal Gates
NOR Gate:
This is a NOT-OR gate which is equal to an OR gate followed by a
NOT gate. The outputs of all NOR gates are low if any of the inputs
are high.
The symbol is an OR gate with a small circle on the output. The small
circle represents inversion.

Logic Diagram: Logic / Boolean expression: Truth Table:

Y = (A+B)’ = � + �

Basic Electronics - ELN 68


Special Gates
XOR Gate:
The 'Exclusive-OR' gate is a circuit which will give a high output if
either, but not both, of its two inputs are high in case of 2 input XOR
gate.
The output of Ex-OR gate is ‘1’, when odd number of ones present at
the inputs. Hence, the output of Ex-OR gate is also called as an odd
function.
Logic Diagram: Logic / Boolean expression: Truth Table:

Basic Electronics - ELN 69


Special Gates
XNOR Gate:
The 'Exclusive-NOR' gate circuit does the opposite to the XOR gate. It
will give a low output if either, but not both, of its two inputs are high.
The output of Ex-NOR gate is ‘1’, when even number of ones present
at the inputs. Hence, the output of Ex-NOR gate is also called as an
even function.

Logic Diagram: Logic / Boolean expression: Truth Table:

Basic Electronics - ELN 70

You might also like