Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

13/10/2020

Tutorial 2: Gate Level Minimization


and Combinational Logic

ENGG 2020

Outline
• Gate Level Minimization
• Minterm and Maxterm
• K-Map Method

• Combinational Logic
• Combinational logic circuit
• Adder and Subtractor
• Comparator
• Decoder and Encoder

1
13/10/2020

Outline
• Gate Level Minimization
• Minterm and Maxterm
• K-Map Method

• Combinational Logic
• Combinational logic circuit
• Adder and Subtractor
• Comparator
• Decoder and Encoder

Minterm and Maxterm


• Minterm
• If there are 2 variables x and y, there are 4 possible combinations: x’y’,
x’y, xy’, xy, each of these 4 AND terms is called a minterm
• If there are N variables, there are 2 minterms
• A symbol for each minterm is denoted as 𝑚 , where the subscript j
denotes the decimal, equivalent of the binary number of the minterm
designated

• Maxterm
• If there are 2 variables x and y, there are 4 possible combinations: x+y,
x+y’, x’+y, x’+y’, each of these 4 OR terms is called a maxterm
• If there are N variables, there are 2 maxterms
• A symbol for each maxterm is denoted as 𝑀 , where the subscript j
denotes the decimal equivalent of the binary number of the maxterm
designated

2
13/10/2020

Minterm and Maxterm


• A Boolean function can be expressed algebraically
in terms of either minterms or maxterms.
• Minterm
• 𝑓 = 𝑥 𝑦 𝑧 + 𝑥𝑦 𝑧 + 𝑥𝑦𝑧
=𝑚 +𝑚 +𝑚
= ∑𝑚(1, 4, 7)
• Maxterm
• 𝑓 = 𝑥+𝑦+𝑧 𝑥+𝑦 +𝑧
𝑥+𝑦 +𝑧 𝑥 +𝑦+𝑧
𝑥 +𝑦 +𝑧
=𝑀 𝑀 𝑀 𝑀 𝑀
= ∏ 𝑀(0, 2, 3, 5, 6)

Gate Level Minimization


• Gate-level minimization is the design task of finding
an optimal gate-level implementation of Boolean
functions describing a digital circuit.
• K-Map method provide a straightforward
procedure for minimizing Boolean functions.
• The simplified expressions are always in one of the
two standard forms:
• Sum of Products (SOP)
• Product of Sums (POS)

3
13/10/2020

K-Map Method
• General procedure
• Construct truth table.
• Draw K-Map.
• Use truth table to fill out K-Map.
• Find groups in K-Map and generate the minimal expressions.
• We are going to learn 7 rules on how to group adjacent cells
and so achieve complete simplification of terms

K-Map Rules of Grouping


1. Groups may not include any cell containing a zero.

B
A 0 1 B
A 0 1
0 0 0 0 0 0
c
1 1 1 1 1 c 1

wrong correct√

4
13/10/2020

K-Map Rules of Grouping


2. Groups may be horizontal or vertical, but not
diagonal.

B
A 0 1 A 0 1
B
0 0 1 0 0 1
c
𝑭=𝑨+𝑩
1 1 1 1 1 1

wrong correct√

K-Map Rules of Grouping


3. Groups may contain 2 cells. eg. 1, 2, 4, 8 etc cells.
A
BC 0 1
00 0 0 B
A 0 1

01 0 1 0 0 0

11 0 1 1 1 1

10 0 1
wrong (group of 3)
correct√ (group of 2)

10

10

5
13/10/2020

K-Map Rules of Grouping


4. Each group should be as large as possible resulting
in as few groups as possible.

BC
A 0 1 BC
A 0 1
00 0 1 00 0 1
01 0 1 01 0 1
11 1 1 11 1 1
10 1 1 10 1 1
wrong(Not minimal) correct√
𝑭 = 𝑨𝑩 + 𝑨𝑩 + 𝑨𝑩 𝑭=𝑨+𝑩
11

11

K-Map Rules of Grouping


5. Each cell containing a one must be part of group
as possible.

BC
A 0 1 A 0 1
BC
00 0 0 00 0 0
01 0 0 01 0 0
11 0 1 11 0 1
10 1 1 10 1 1
wrong(Not minimal) correct√
12

12

6
13/10/2020

K-Map Rules of Grouping


6. Groups can overlap.

BC
A 0 1 A 0 1
BC
00 0 1 00 0 1
01 0 1 01 0 1
11 1 1 11 1 1
10 1 1 10 1 1
wrong
(Not overlapping so not minimal)
correct√
13

13

K-Map Rules of Grouping


7. Groups can wrap around the table.

BC
A 0 1
00 1 1
01 0 0 𝑭=𝑪
11 0 0
10 1 1

14

14

7
13/10/2020

K-Map Rules of Grouping


7. Groups can wrap around the table.

BC
A 0 1
00 0 1
01 0 0 𝑭 = 𝑨𝑪
11 0 0
10 0 1

15

15

K-Map Rules of Grouping


1. Not zeros allowed.
2. No diagonals.
3. Only power of 2 number of cells in each group.
4. Groups should as large as possible.
5. Every one must be in at least one group.
6. Overlapping allowed.
7. Wrap around allowed.

16

8
13/10/2020

K-Map Example : Four Variables


• 𝑓 𝐴, 𝐵, 𝐶, 𝐷 = ∑𝑚(0, 1, 2, 6, 8, 9, 10)
= 𝐴 𝐶𝐷 + 𝐵 𝐷 + 𝐵 𝐶′

AB
CD
00 01 11 10
00 1 1
01 1 1
11
10 1 1 1

17

K-Map Example : Five Variables


• Find a minimum SOP expression for the following function:
𝑓 𝐴, 𝐵, 𝐶, 𝐷, 𝐸 = 𝑚(0,2,4,7,10,12,13,18,23,26,28,29)
• K-map
Mirror
ABC
DE 000 001 011 010 110 111 101 100
00 0 4 12 8 24 28 20 16
01 1 5 13 9 25 29 21 17
11 3 7 15 11 27 31 23 19
10 2 6 14 10 26 30 22 18

Adjacent

18

9
13/10/2020

K-Map Example : Five Variable


• Find a minimum SOP expression for the following function:
𝑓 𝐴, 𝐵, 𝐶, 𝐷, 𝐸 = 𝑚(0,2,4,7,10,12,13,18,23,26,28,29)
• K-map

Mirror
ABC
DE 000 001 011 010 110 111 101 100
00 0 4 12 8 24 28 20 16
01 1 5 13 9 25 29 21 17
11 3 7 15 11 27 31 23 19
10 2 6 14 10 26 30 22 18

Adjacent

19

19

K-Map Example : Five Variable


• Find a minimum SOP expression for the following function:
𝑓 𝐴, 𝐵, 𝐶, 𝐷, 𝐸 = 𝑚(0,2,4,7,10,12,13,18,23,26,28,29)
• K-map
Mirror
ABC
DE 000 001 011 010 110 111 101 100
00 0 4 12 8 24 28 20 16
01 1 5 13 9 25 29 21 17
11 3 7 15 11 27 31 23 19
10 2 6 14 10 26 30 22 18

Adjacent Adjacent

20

20

10
13/10/2020

K-Map Example : Five Variable


• Step 1: Find all the positions of minterms.
𝑓 𝐴, 𝐵, 𝐶, 𝐷, 𝐸 = 𝑚(0,2,4,7,10,12,13,18,23,26,28,29)

10
ABC
DE 000 001 011 010 110 111 101 100
00 1 1 1 1
01 1 1

11 1 1
10 1 1 1 1

21

21

K-Map Example : Five Variable


Step 2: Identify all the entries that are mirror symmetric
(prime implicants).
𝑓 𝐴, 𝐵, 𝐶, 𝐷, 𝐸 = 𝑚(0,2,4,7,10,12,13,18,23,26,28,29)

ABC
DE 000 001 011 010 110 111 101 100
00 1 1 1 1
01 1 1
11 1 1
10 1 1 1 1

22

22

11
13/10/2020

K-Map Example :Don’t Care Items


• 𝑓 𝐴, 𝐵, 𝐶, 𝐷 = ∑𝑚 0, 1, 2, 6, 8, 9 with 𝑚 , 𝑚
and are “don’t care” iterms.
𝑓 𝐴, 𝐵, 𝐶, 𝐷 = 𝐵 𝐶′ + 𝐴 𝐷

AB
CD 00 01 11 10
00 1 x 0 1
01 1 0 0 1
11 x 0 0 0

10 1 1 0 0

23

Exercises
Using K-Map to simplify the following logical functions
with Sum-of-Product (SOP) forms.

1. 𝑓 𝐴, 𝐵, 𝐶, 𝐷 = ∏ 𝑀(0, 2, 7, 8, 10, 15) [In-Class]

2. 𝑓 𝐴, 𝐵, 𝐶, 𝐷 = ∑𝑚(6, 9, 12, 13, 14) with 𝑚 , 𝑚 , 𝑚 ,


𝑚 and 𝑚 are “don’t care” iterms. [Take-Home]

3. 𝑓(𝐴, 𝐵, 𝐶, 𝐷, 𝐸) =
∑𝑚(0, 2, 4, 6, 9, 13,21, 23, 25, 29, 31) [Take-Home]

24

12
13/10/2020

Answer: Exercise 1
• 𝑓 𝐴, 𝐵, 𝐶, 𝐷 = ∏ 𝑀(0, 2, 7, 8, 10, 15).

𝑓 𝐴, 𝐵, 𝐶, 𝐷 = 𝐵𝐶 + 𝐵𝐷 + 𝐵 𝐷 or
𝑓 𝐴, 𝐵, 𝐶, 𝐷 = 𝐶 𝐷 + 𝐵𝐷 + 𝐵 𝐷

AB AB
CD 00 01 11 10 CD 00 01 11 10
00 0 1 1 0 00 0 1 1 0
01 1 1 1 1 01 1 1 1 1
11 1 0 0 1 11 1 0 0 1

10 0 1 1 0 10 0 1 1 0

25

Outline
• Gate Level Minimization
• Minterm and Maxterm
• K-Map Method

• Combinational Logic
• Combinational logic circuit
• Adder and Subtractor
• Comparator
• Decoder and Encoder

26

13
13/10/2020

Combinational Circuit
• A combinational circuit consists of input variables,
logic gates, and output variables
• Combinational logic gates react to the values of the
signals at their inputs and produce the value of the
output signal

27

Example: BCD-to-Excess3
• Truth table

28

14
13/10/2020

Example: BCD-to-Excess3
• Since we have 4 inputs and
4 outputs, 4x 4-variable K-
maps are constructed for w,
x, y, and z
• Some of cells are X (i.e.
“Don’t Care”)

29

Take Home Exercise


• BCD-to-Seven-Segment Decoder
• Input: A 4-bit binary value that is a BCD coded input.
• Outputs: 7 bits, a through g for each of the segments of
the display.
• Operation: Decode the input to activate the correct
segments.

30

15
13/10/2020

Half Adder (FA)


• A half adder is a 1-bit adder which do not take
carry-in into consideration
• With two one bit numbers we have 4 distinct cases:
• 0 + 0 = 0 with no carry
• 0 + 1 = 1 with no carry
• 1 + 0 = 1 with no carry
• 1 + 1 = 0 with a carry
• The Boolean functions of HA:
• 𝑆 = 𝐴𝐵 + 𝐴 𝐵 = 𝐴⨁𝐵
• 𝐶 = 𝐴𝐵

31

Full Adder (FA)


• When the operations require more than 1 bit, HA is
not useful
• By extending the HA, one can implement a full
adder (FA) which takes a carry-in bit as an extra
input
• FA is the basic unit for a multiple-bit adder

32

16
13/10/2020

Full Adder (FA)

33

Full Adder

34

17
13/10/2020

Subtractor
• Subtractor is similar to adder, except that it takes a
borrow-in bit into consideration.
• Truth table:
Full Subtractor (FS)

Half Subtractor (HS)

35

Example:Four-bit adder–subtractor
• Four-bit adder–subtractor (with overflow detection)

36

18
13/10/2020

Four-bit adder
• 1001 + 0101
0 1 1 0 0 0 1 1

S3 S2 S1 S0 C4 C3 C2 C1 C0 V
1 1 1 0 0 0 0 1 0 0

37

Four-bit subtractor
• 0011 – 1010 = 0011 + 0101 + 1
1 0 0 0 1 1 0 1

S3 S2 S1 S0 C4 C3 C2 C1 C0 V
1 0 0 1 0 1 1 1 1 1

38

19
13/10/2020

In Class Exercise 2
• 1010 + 0010
1 0 0 0 1 1 0 0

S3 S2 S1 S0 C4 C3 C2 C1 C0 V

39

Answer: In-Class Exercise 2

• 1010 + 0010
1 0 0 0 1 1 0 0

S3 S2 S1 S0 C4 C3 C2 C1 C0 V
1 1 0 0 0 0 1 0 0 0

40

20
13/10/2020

Take Home Exercise


• 0101 – 1001 = 0101 + 0110 + 1
1 0 0 1 0 0 1 1

S3 S2 S1 S0 C4 C3 C2 C1 C0 V

41

Comparator
• Consider a 4-bit comparator to compare the
magnitude of two 4-bit binary numbers, A and B
• After comparison, only one of the following three
outputs will be HIGH
• D1: A = B
• D2: A > B
• D3: A < B

42

21
13/10/2020

Comparator

43

Comparator

44

22
13/10/2020

Decoder and Encoder


• A decoder is a combinational circuit that has 𝑛 input and to
a maximum 𝑚 = 2 outputs, each valid input code word
produces a unique output code
• The truth table of a 2-bit decoder:

• For each combination of X0 and X1, there is only one Active-


HIGH output

45

Decoder

Logit Circuit 𝐴 = 𝑋1 𝑋0′


𝐵 = 𝑋1 𝑋0
𝐶 = 𝑋1𝑋0′
𝐷 = 𝑋1𝑋0

46

23
13/10/2020

Encoder
• Encoder is a combinational circuit which is designed
to perform the inverse operation of the decoder.
• By changing the input/output directions, we have
the truth table of 3x8 decoder and 8x3 encoder

47

Encoder
• Logic Circuit of 8x3 Encoder

48

24
13/10/2020

Example: BCD to Decimal Decoder


• Combinational logic circuits are often used to
convert data coded in one scheme into another
format.
• BCD to decimal, excess-3 to decimal, binary to excess-3

Figure: BCD to decimal decoder.


(a) Logic symbol.
(b) BCD codes and decimal digits.

49

Design of BCD to Decimal Decoder


• K-map
• A k-map for each of the 10 outputs
• Each k-map contains exactly
• One minterm (the decimal number of that output)
• Six don’t care terms (10 to 15 don’t exist in BCD code)

50

25
13/10/2020

Design of BCD to Decimal Decoder


• K-map (cont.)
Figure: K-maps for outputs 0, 5, and 9 of a BCD to decimal code converter.
(a) Decimal 0 = 𝐷𝐶̅ 𝐵𝐴̅. (b) Decimal 5 = C𝐵𝐴. (c) Decimal 9 = DA.

Complete set of logic equations that


decribe the BCD decoder:

51

Thanks

52

26

You might also like