You are on page 1of 16

# Digital Logic & Design (Class work)

06CS36

Subject:

## Contents: Part One (Combinational Logic Design)

Chapter#1 Number systems and base conversion..Page3
Chapter#2. ...Boolean algebra and Logic GatesPage
Chapter#3 Minimization Techniques...Page
Chapter#4 Combinational Logic Design..Page

## Part (Sequential Logic Design)

Chapter#5 Flip-Flops....Page
Chapter#5 Counters..Page
Chapter#7 Registers..Page
Chapter#8 ..Page
Chapter#9 ..Page
Chapter#10 page

## Digital Logic & Design (Class work)

Chapter #1
Number Systems and base conversion
The number systems basically depend on the base. each number system has a particular
weight. With the help of the weights we can easily convert a number from one system to
another. Mostly four number systems we often use.
i.
Binary
ii.
Octal
iii.
Decimal
iv. Hexadecimal
Binary number system: -In this number system, only two digits (0 and 1) are used to
represent the numbers. The binary numbers has the base 2. The weight of binary number
system is 24,23,22, 21,20
Decimal number system: -Decimal number system is familiar system and is used
commonly. This system has a base 10. In this system, 10 digits(from 0 to 9)are used to
represent the numbers. The weight of decimal is 104,103,102,101,100
Octal number system: -Octal number system has a base 8.8 digits from 0 to 7 are used
to represent the numbers. The octal number system has a weight 83,82,81,80.
Hexadecimal number system: -Hexadecimal number system has a base 16.In this
number system ten digits (from 0 to 9)and 6 alphabets A,B,C,D,E and F are used to
represent the numbers Where A=10,B=11,C=12,D=13,E=14,and F=15.The weights are
164,163,162,161,160.
Comparison among the representation of number in different systems
Decimal
Binary
Octal
Hexadecimal
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
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

## Digital Logic & Design (Class work)

Base Conversion: Decimal to Binary: -A decimal number can be converted into binary number by repeated
division by 2 and write results from bottom to top.
for example: (79)10=(??)2

(79)10=(1001111)2
A fractional decimal number can be converted to binary number by repeated
multiplication by 2. Write results from top to bottom.
(61.125)10= (??)2

0.125 x 2=0.250
0.250 x 2=0.500
0.500 x 2=1.000
(61.125)10= (11101.001)2
Similarly any decimal number can be converted to any base number by repeated
division by base, write results from bottom to top and similarly the fractional part of a
decimal number can be converted to any base by repeated multiplication by base and
write results from top to bottom. One example each from remaining two number systems
(octal & hexadecimal) is given below.
Example: - Convert (426.123)10 to octal and hexadecimal.

## Digital Logic & Design (Class work)

0.123 x 8 =0.984
0.984 x 8 =7.872
0.872 x 8 =6.976
0.976 x 8 =7.808
(426.123)10= (652.0767)8
(ii)(426.123)10= (??)16

0.123 x 16=1.968
0.968 x 16=15.488
0.488 x 16=7.808
0.808 x 16=12.928
(426.123)10= (1AA.1F7C)16
Binary to Decimal: -A binary number can be converted to decimal by multiplying each
corresponding bit of binary number by base, increasing the power of base 0 to n-1 where
n is the total number of binary bits from right to left and sum up to get decimal
equivalent.
Example: convert the binary number 111011 to the decimal equivalent.
1x25+1x24+1x23+0x22+1x21+1x20
32+16+8+0+2+1=59
while converting the fractional part of a number just give the negative powers to
the base from left to right just as done in the next example.
Example: Convert 11011.001 to decimal equivalent.
1x24+1x23+0x22+1x21+1x20+.0x2-1+0x2-2+1x2-3
16+8+2+1+.1/8=27.0125
Similarly, number from any base can be converted to decimal equivalent by the
same procedure mentioned above i.e. by multiplying each corresponding digit of number
by base, increasing the power of base 0 to n-1 where n is the total number of digits from
right to left and sum up to get decimal equivalent. and of course for fractional part give
the negative powers to the base from left to right. It will be further clear by this example.
Example: convert (56)8 and (DF7)16 to decimal equivalent.
(i)
5x81+6x80
5x8+6
40+6=46
(ii)
Dx162+Fx161+7x160
13x256+15x16+7
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

3328+240+7=3575
Binary to Octal: - To convert a binary number to octal number, separate the binary
number into groups of three starting from the right and then translate each group into its
octal equivalent. Zeros may be added to the left of the binary number to complete a group
of three For example, to translate the number 11010 to octal, the formula would be as
follows
Binary
011
010
Formula
011=3
010=2
Octal
=32
Binary to Hexadecimal: -To convert a binary number to a hexadecimal number, separate
the binary number into groups of four starting from the right and then translate each
group into its hexadecimal equivalent. Zeros may be added to the left of the binary
number to complete a group of four. For example, to translate the number 11010 to
hexadecimal, the formula would be as follows
Binary =11010
0001
1010
Formula
0001=1
1010=A
Hexadecimal=1A
Octal to Hexadecimal: - Octal to hexadecimal conversion is not normally or directly
possible. Following procedure is applied when converting octal to hexadecimal.
First convert the octal number into equivalent binary number and then convert the binary
number into hexadecimal by making the groups of four bits from right to left. Same
procedure is applied to convert a hexadecimal number to octal instead that you have to
make the groups of three bits.
Binary operations: Binary numbers can be manipulated with the same familiar operations used to
calculate decimal numbers, but using only zeros and ones. To add two numbers there are
only four rules to remember.
0+0=0
0+1=1
1+0=1
1+1=10
And for subtraction,
0-0=0
1-0=1
0-1=1 (by taking borrow from next higher digit)
1-1=0
For multiplication,
00=0
01=0
01=0
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

11=1
Example: Addition.
101101
+100111
1010100
Subtract, using borrow.
101101
- 100111
000110
Example Multiplication
1011
11__
1011
1011__
100001

Complements
The complement of a number is the number which when added to the original will make it
equal to a multiple of the base number system.
The complement of a number can be used as a representation of that number as a negative
- moreover, as a positive number representing a negative! It is really a bit of a trick, which
we can use to make subtraction easier for machines.
In a computer the representation and manipulation of negative numbers is usually
performed using complements
Complements for a radix come in two forms
1. rs complement
2. (r-1)s complement
rs

complement

Given a positive number N that has n digit integer part, the rs complement of N is
defined as
r n - N for N 0 ,zero otherwise.
10s

Complement
10s complement of (37218)10 = 10 5 - 37218 = 62782
10s complement of (0.12345) 10 = 10 0 - 0.12345 = 0.87655
2s Complement

1. Reverse the value of the bits in the binary number; i.e. change all the 0 bits to 1 and
change 1s to 0.
2. Add 1 to the result.
2s complement of (101110)2 = 2 6 - (101110) = 010010
2s complement of (0.0110) 2 = 2 0 - (0.0110) = 0.1010

(r-1)s Complement
Given a positive number N with integer part n bits, fractional part m bits, the (r-1)s
complement is defined as,
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

(r n - n -m -N)
A simple procedure to obtain the 9s, 7s and 15s complement is that subtract
each digit of the number from 9,7, and 15 respectively.
9s complement (r = 10)
9s complement of (37218)10 = 10 5 - 1 - 37218 = 62781=99999-37218
9s complement of (0.12345)10 = (10 0 - 10 -5 - 0.12345)= 0.99999 - 0.12345 = 0.87654
9s complement 0f (25.639)10 = (10 2 - 10 -3 - 25.639) = 99.999 - 25.639 = 74.360
1s complement (r = 2)
To obtain 1s complement of a binary number, simply change the 1s to 0s and 0s to 1s.
1s complement of (101100)2 = 2 6 - 1 - (101100)= 111111 - 101100 = 010011
1s complement of (0.0110) 2 = 2 0 - 2 -4 - (0.0110)= 0.1111 -0.0110 = 0.1001

Subtracting using Complements: Using (r-1)s complement: Following procedure is applied to perform subtraction using (r-1)s complement.
Step 1. Find the (r-1)s complement of the subtrahend.
Step 2. Add (r-1)s complement of the subtrahend to the minuend.
Step 3. Check the end around carry
(a) If there is carry, result will be positive, add that carry to the result.
(b) If there is no carry, result will be negative. Find the (r-1)s complement of the
result and put minus sign.
Example
Using (r)s complement: Step 1. Find rs complement of the subtrahend.
Step 2. Add rs complement of the subtrahend to the minuend.
Step 3. Check end around carry.
(a) If there is carry result will be positive. Discard the carry.
(c) If there is no carry result is negative, find rs complement of the result and put
negative sign.

Binary Codes: Decimal numbers are coded using binary bit patterns. Binary codes for decimal digits
require a minimum number of four bits. Numerous different codes can be obtained by
arranging four or more bits in ten distinct possible combinations. A few codes are shown
in Table-2
Numbers are represented in digital computers either in binary or decimal form
through a binary code. The decimal numbers are stored internally in the computer by
means of decimal code. Each decimal digit requires at least four storage elements. The
decimal numbers are converted into binary when arithmetic operations are done
internally in computer with numbers represented in binary. It is also possible to perform
the arithmetic operations directly in decimal with all numbers left in a coded form
throughout. For example, the decimal number 395, when converted into binary, it is
equivalent to 110001011 and consists of nine binary digits. The same number, when
represented internally in the BCD code, occupies the four bits for each decimal digit, for
a total of 12 bits;0011 1001 0101. The first four bits represented a 3 the next four a 9, and
a last four a 5.
It is worthwhile to note the difference between the coding and conversion of a
binary number. In either case the result is the series of bits. The bits obtained from

## Digital Logic & Design (Class work)

conversion are binary digits. Bits obtained from coding are combination of 1s and 0s
arranged according to the rules of the code used. Therefore it is extremely important to
realize that a series of 1s and 0s in a digital system may some times represent a binary
number and at other times represent some other discrete quantity of information as
specified by a given binary code. The BCD code for example, has been chosen to be both
a code and a direct binary conversion as long as the decimal
Table-2
Table of various binary codes for decimal digits
Decimal
0
1
2
3
4
5
6
7
8
9

8421 (BCD)

84-2-1

2421

Excess-3

Gray

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

0000
0111
0110
0101
0100
1011
1010
1001
1000
1111

0000
0001
0010
0011
0100
0101
0110
0111
1110
1111

0011
0100
0101
0110
0111
1000
1001
1010
1011
1100

0000
0001
0011
0010
0110
0111
0101
0100
1100
1101

Binary coded decimal (BCD): The BCD is a straight assignment of binary equivalent.
Each decimal digit is represented by a 4-digit binary number; e.g. (7 4 3)10 = (0111 0100 0011)BCD.
2421 and 84-2-1: - 2421 and 84-2-1 are weighted codes. The latter is convenient for 9s
complement operations
Excess-3: - Excess-3 is BCD plus 3. It is convenient 9s complement operations. Excess3 code was used in older computers. This is an unweighted code, it code assignment is
obtained from the corresponding value of the BCD after addition of 3.
Gray code: - In Gray code consecutive digits differ only by one bit. Useful for
mechanical position decoding.
Example: represent the decimal number (567)10 in the following codes
(i)BCD
(ii)2421
(iii)5421
(iv)Excess-3
Answer: Decimal
BCD
2421
5421
Excess-3
567
0101 0110 0111 0101 1110 1101 1000 1001 1010
1000 1001 1010
Binary -to-Gray Conversion: Following steps are applied to convert a binary number into Gray number.
Step 1: - The MSB of Gray number remains the same as the MSB of the binary number.
Step 2: - Start from left to right and add each adjacent pair of binary bits to obtain new
gray- code bit. Discard the carries.
Example: - Convert (101100101)2 into Gray
(101100101)binary=(111010111)Gray
Answer.

10

## Digital Logic & Design (Class work)

11

Chapter # 2
Boolean Algebra and Logic Gates
In 1854 George Boole introduced a systematic treatment of logic and developed
Boolean algebra. Boolean algebra is the set of rules, laws and theorems by which logic
circuits are represented mathematically. It is convenient tool for expressing and analyzing
the logical behavior of digital systems.
Boolean algebra operations: -Basically there are three basic operations in Boolean
algebra that are applied on the variables, AND, OR and NOT (or sometimes called as
complement operation).
AND operation: -AND operation represents the logical multiplication. Its symbol is
.(Dot) which is placed between the variables that are to be multiplied. In logic circuits,
AND operation is performed with the AND gate. For example
0.0 = 0
1.0 = 0
0.1 = 0
1.1 = 1
OR operation: -OR operation represents the logical addition. Its symbol is +(Plus
sign). This operation is performed by the OR gate.
0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 1
NOT operation (Complement operation): -NOT operation performs the complement
operation. In other words, it complements or inverts the input, for instance,
A=1
=0
Boolean Function: - A Boolean function is a function that is represented by two binary
operators, AND and OR and one unary operator NOT, Binary variables, (), and equal
sign. For example
F (A, B)= AB+AB
Truth Table: -A truth table is a table that describes the logic behavior of the Boolean
function of logic circuit. It shows all the inputs combinations with corresponding outputs.
To represent any function in terms of truth table, we need 2n input combinations from 0 to
2n-1, where n is the number of input variable. For example the truth table for And
operation is given below. Here we use two input variables named as A and B because
AND operation requires at least two variables, and the output of function as F. With two
variables we have 4 input combinations.
Truth Table for AND operation
A
B
F
0
0
1

0
1
0

0
0
0

1
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

12

Rules of Boolean algebra: Boolean algebra has some rules, which are useful for minimizing the Boolean
expression and Boolean function.
1. A+A = A
2. A.A = A
3. A+1 = 1
4. A+0 = A
5. A+A = 1
6. A.0 = 0
7. A.A = 0
8. A =A
9. A+AB = A
10. A+AB = A+B
11. (A+B) = A. B
12. (A.B) = A+B
13. A+B = B+A
14. A.1 = A
15. A. (B.C) = A.B+A.C
Laws of Boolean algebra: -Boolean algebra has the three basic laws:
1. Commutative Law: i.
A+B = B+A
ii.
A.B = B.A
Truth table for (i)
A B
A.B B.A
0 0
0
0
0 1
0
0
1 0
0
0
1 1
1
1

## 2. Associative Law: The law states

order in which variables
when performing OR or
operation makes no difference
i.
(A+B)+C = A+(B+C)
ii.
(A.B).C = A.(B.C)
Truth table for proof
A
B
C
A+B
(A+B)+C B+C
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
3. Distributive Law: -

A B
A+B B+A
0 0
0
0
0 1
1
1
1 0
1
1
1 1
1
1

that the
are grouped
AND

A+C
0
1
1
1
1
1
1
1

## Digital Logic & Design (Class work)

13

This law states that ORing several variables and multiplying with single variable is
equivalent to multiplying single variable with all variables and performing OR operation.
i.
A.(B+C) = A.B + A.C
ii.
A+ (BC) = (A+B) . (A+C)
Truth Table for proof
A
B
C
BC L.H.S A+B A+C R.H.S
A+BC
(A+B).(A+C)
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
L.H.S = R.H.S
De Morgans Theorem: This law states that complement of Sums equal to products of complements.
(i) (A+B) = A. B
Generally,
(x1+x2+x3+x4++xn) = x1.x2.x3.x4.xn
And,
Complement of product is equal to sum of the complements.
(ii) (AB) = A+B
Generally,
(x1.x2.x3.x4.xn) = x1+x2+x3+x4+xn
Truth Table for proof
A B
C
A+B+C
L.H.S
A
B
C
R.H.S
(A+B+C)
A.B.C
0 0
0
0
1
1
1
1
1
0 0
1
1
0
1
1
0
0
0 1
0
1
0
1
0
1
0
0 1
1
1
0
1
0
0
0
1 0
0
1
0
0
1
1
0
1 0
1
1
0
0
1
0
0
1 1
0
1
0
0
0
1
0
1 1
1
1
0
0
0
0
0
L.H.S = R.H.S
Boolean Expression: It is short hand way to describe the logic circuit in terms of Boolean expression.
The result of the Boolean expression is true, high, or 1 or it may be 0, low or false. There
is no third possibility between 1 and 0.The Boolean expression describes the logic actions
performed by a circuit. Boolean expressions are basically two forms.
1. Canonical form
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

14

2. Standard Form
1. Canonical form: This form of a Boolean expression is obtained directly from the truth table of the
function. In this form of Boolean expression all variables must be present in the
expression. It is not a simplified form. Canonical form has two types.
i. Sum of min terms
ii. Product of max terms
Min term: - A min term is a product term in which each variable must exist either in
complemented (normal) or un complemented form. The variable will be in complemented
form, if the bit corresponding to it in the truth table is zero, and variable will be in un
complemented form if the corresponding bit is one.
A min term id represented by mj where j is the decimal representation of the
binary number in the input combination.
Max term: - A max term is a sum term in which each variable must exist either in
complemented (normal) or un complemented form. The variable will be in complemented
form, if the bit corresponding to it in the truth table is one, and variable will be in un
complemented form if the corresponding bit is zero.
A max term is represented by Mj where j is the decimal representation of the
binary number in the input combination. It is worthwhile to note that Sum of min term is
when complemented produces the Product of max term expression and vice versa. A
function has min terms as well as max terms equal to number of input combinations.
A B
C
Min terms
mj
Max terms Mj
0 0
0
ABC
m0
A+B+C
M0
0 0
1
ABC
m1
A+B+C
M1
0 1
0
ABC
m2
A+B+C
M2
0 1
1
ABC
m3
A+B+C
M3
1 0
0
ABC
m4
A+B+C
M4
1 0
1
ABC
m5
A+B+C
M5
1 1
0
ABC
m6
A+B+C
M6
1 1
1
ABC
m7
A+B+C
M7
(i) Sum of Min term Boolean expression: The Sum of min term Boolean expression is derived from truth table by writing
all min terms whose output is equal to one and then sum the min terms.
(ii) Product of max term Boolean expression: - Product of max term Boolean
expression is derived from truth table by writing all Max terms whose out put is zero and
then take the product.
Example: -Write Sum of min terms and product of max terms Boolean expression of a
circuit of three inputs and one output. The circuit produces a high out put when ever their
inputs have more ones than zeros. Other wise the output of the function is zero.
Truth Table
A B
C
Output (F)
Min terms Max terms
0 0
0
0
ABC
A+B+C
0 0
1
0
ABC
A+B+C
0 1
0
0
ABC
A+B+C
0 1
1
1
ABC
A+B+C
By: -Muhammed Asif Raza(06CS36).

## Digital Logic & Design (Class work)

15

1 0
0
0
ABC
A+B+C
1 0
1
1
ABC
A+B+C
1 1
0
1
ABC
A+B+C
1 1
1
1
ABC
A+B+C
Sum of min terms Boolean expression for F
= ABC+ ABC+ ABC+ ABC
Product of max terms Boolean expression for F=(A+B+C)(A+B+C)(A+B+C)(A+B+C)
Standard Form: - The standard form of a Boolean expression is a minimized form of a
Sum of min terms Boolean expression or Product of max terms Boolean expression. This
form of a Boolean expression is used to draw logical diagram of circuits because this is a
minimized form and requires less number of logic gates as compared to canonical form.
Like canonical form, it has also two types.
i.
Sum of products
ii.
Product of Sums
It is worthwhile to note that Sum of min terms Boolean expression can be called as
Sum of product and Product of max terms Boolean expression can be called Product of
Sums because min term is a product term and max term is a sum term. But Sum of
product or product of Sums cannot be denoted as Sum of min terms Boolean expression
or Product of max terms Boolean expression because they dont contain min terms or
max terms but they contains simple products or sums with lesser variables than canonical
form expressions.

Logic Gates: Logic gates are the physical components through which the logical operations are
performed. There are eight logic gates, which perform different logical operations, and
the each has their own characteristics and as well as inputs and outputs. Normally logic
gates have only one output.
1. NOT Gate (Inverter): -The NOT gate has only one input and one output. NOT
gate performs the complement operation. Whenever the input is high output will be
the low and whenever the input is low the output will be the high.
A Y
0 1
1 0
Y=A

Logical symbol

2.AND Gate: -The AND-Gate performs the logical multiplication. This gate has two or
more than two inputs and only one output. The output will be high if inputs are high and
the output will be low if any of the input is low.
Truth Table
A B
Y
0
0
0

## Digital Logic & Design (Class work)

16
0
1
1

1
0
1

0
0
1

Y=A.B

Logical symbol

3. OR gate: -OR gate has two or more than two inputs and one output. Or gate
performs the logical addition. The output will be high when ever any of the input
is high and output will be low if all inputs are low.
Truth Table
A B
Y
0 0
0
0 1
1
1 0
1
1 1
1
Y=A+B

Logical symbol