embedded hardware systems design - cfaed › files › images › people...© akash kumar rules for...

69
LOGIC MINIMIZATION – I Akash Kumar EMBEDDED HARDWARE SYSTEMS DESIGN

Upload: others

Post on 26-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

LOGIC MINIMIZATION – I

Akash Kumar

EMBEDDED HARDWARE SYSTEMS DESIGN

Page 2: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Outline

¨ Logic Synthesis¨ Derivation of logic expressions¨ Minimization using algebraic transformations¨ Minimization using Karnaugh-maps

¤ Upto 5 variables

2

Page 3: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Logic synthesis

3

Page 4: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Logic Synthesis

¨ It is a process by which an abstract form of desired circuit behavior (typically RTL) is turned into a design implementation in terms of logic gates given a standard-cell library and certain design constraints.

¨ Standard Library or Technology Library¤ It can have basic logic gates like and, or etc.

¤ It can have macro cells like adders, mux, flip flops, etc¤ For FPGAs, it has LUTs, logic elements, etc.

¨ Design constraints can be timing, area, power, and testability

4

Page 5: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

architecture MLU_DATAFLOW of MLU is

signal A1:STD_LOGIC;signal B1:STD_LOGIC;signal Y1:STD_LOGIC;signal MUX_0, MUX_1, MUX_2, MUX_3: STD_LOGIC;

beginA1<=A when (NEG_A='0') else not A;B1<=B when (NEG_B='0') else not B;Y<=Y1 when (NEG_Y='0') else not Y1;

MUX_0<=A1 and B1;MUX_1<=A1 or B1;MUX_2<=A1 xor B1;MUX_3<=A1 xnor B1;

with (L1 & L0) selectY1<=MUX_0 when "00",

MUX_1 when "01",MUX_2 when "10",MUX_3 when others;

end MLU_DATAFLOW;

HDL descriptionCircuit netlist

Logic Synthesis5

Page 6: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Steps in Logic Synthesis

1. Parsing and translating the input HDL, and generate internal data structures, e.g. Karnaugh map, prime implicants.

2. Logic minimization: tries to find a minimum cover for the function, i.e. the smallest number of the largest possible circles to cover all the ‘1’. (exploiting the don’t cares condition)

3. Logic optimization: uses a series of factoring, substituting, and elimination steps to simplify the equations.

6

4. Technology decomposition: builds a generic network from the optimized logic network. The generic technology independent network is usually simple NAND/INV gates.

5. Finally, technology (logic) mapping: implements the technology independent network by matching pieces of the network with the logic cells that are available in a technology-dependent cell library. While performing technology mapping, the algorithm attempts to minimize area, while meeting other user constraints.

Page 7: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

(b) Minimal-cost realization

FB A

F

(a) Canonical sum-of-products A B

Logic Minimization and Optimization7

BABABAF ... ++=

BAF +=

Page 8: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Logic optimization

8

Page 9: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Logic Optimization

¨ Broadly divided into various categories based on:¨ Circuit representation

¤ Two-level logic optimization¤ Multi-level logic optimization

¨ Circuit characteristics¤ Combinational logic optimization

n Outputs dependent only on current input¤ Sequential logic optimization

n Outputs dependent on both past and presentinputs

9

173

Page 10: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Two-level Optimization

¨ Uses Minimum sum of products (MSOP) or Minimum product of sums (MPOS) expressions

¨ Refers to flattened view of the circuit.¨ Most applicable to PLA (programmable logic array)

implementation – uses MSOP expression.¨ In general, the more optimized the design is, the smaller

is the required area for the design.¨ Forms the basis of most synthesis programs.

10

Page 11: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumarf1

P1

f2

x1 x2 x3

OR plane

Programmable

AND plane

connections

P2

P3

Gate-level Diagram of a PLA11

Page 12: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Two-level vs Multi-level

¨ If we have two functions F1 and F2

¤ F1 = AB + AC + AD

¤ F2 = A’B + A’C + A’E

¨ The default two-level representation takes 6 AND and 4 OR operations.

¨ A functionally equivalent representation can be

¤ P = B + C¤ F1 = AP + AD¤ F2 = A’P + A’E

¨ This requires only 4 AND and 3 OR operations¤ However, this takes three levels!

12

Page 13: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Derivation of logic expressions

13

Page 14: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Deriving Logic Expressions From Truth Tables

14

¨ What is the Boolean expression for Z?

Light must be ON when both switches A and B are OFF, or when both of them are ON.

Logic FunctionSW.A

SW.BZ (light)

Truth Table:

A B Z

0 0 1

0 1 0

1 0 0

1 1 1

Page 15: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Deriving Logic Expressions From Truth Tables

¨ Two equivalent logic expressions can be derived from Truth Tables:

1. Sum-of-Products (SOP) expressions:¤ Several AND terms OR’d together, e.g.

2. Product-of-Sum (POS) expressions:¤ Several OR terms AND’d together, e.g.

15

ABCCBACBA ++

))(( CBACBA ++++

Page 16: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Rules for Deriving SOP Expressions

1. Find each row in TT for which output is 1 (rows 1 & 4)

2. For those rows write an AND term of all input variables. For variables with value 0, apply complements: ( and ). These are called minterms (mintermscontain all input variables exactly once).

3. OR together all minterms found in 2): Such an expression is called a Canonical SOP

16

ABBAZ +=

BA AB

A B Z

0 0 1

0 1 0

1 0 0

1 1 1

Page 17: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Rules for Deriving POS Expressions

1. Find each row in TT for which output is 0 (rows 2 & 3)

2. For those rows write an OR factor of all input variables. For variables with value 1, apply complements: & These are called maxterms (maxterms contain all input variables).

3. AND together all maxterms found in 2): Such an expression is called a Canonical POS.

17

)( BA+ )( BA+

))(( BABAZ ++=

A B Z

0 0 1

0 1 0

1 0 0

1 1 1

Page 18: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

CSOP and CPOS

¨ Canonical SOP:¨ Canonical POS:¨ Since they represent the same truth table, they should be

identical

¨ CPOS and CSOP expressions for the same TT are logically equivalent. Both represent the same information.

18

))(( BABAZ ++=

Verify that ))(( BABAABBAZ ++º+=

ABBAZ +=

Page 19: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Simplifying Logic Equations

¨ Simplifying logic expressions can lead to using smaller number of gates (parts) to implement the logic expression

¨ Can be done by hand using¤ Boolean Identities (algebraic)

¤ Karnaugh Maps (graphical)

¨ A minimum SOP (MSOP) expression is one that has no more AND terms or variables than any other equivalent SOP expression. (Note: There may be several MSOPs of an expression)

¨ Substitute OR factors for AND terms in above to apply to MPOS

19

Page 20: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Minimization using algebraic transformation

20

Page 21: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

1

23456789101112

13

Boolean Identities

¨ Useful for simplifying logic equations.

21

Duals

Page 22: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Boolean Identities

Identities Property

1-5 Single variable, foundations of Boolean manipulation

6 Commutative

7 Associative

8 Distributive

9 De Morgan’s

10 Combining

11 Absorption

13 Consensus

22

Page 23: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Boolean Identities

¨ The right side is the dual of the left side

1. Duals formed by replacing

2. The dual of any true statement (axiom or theorem) in Boolean algebra is also a true statement.

23

AND OROR AND0 11 0

Page 24: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Using Boolean Identities – 1

¨ Find an MSOP for

24

)( WXYZYWXF +++=

YWX

ZYZWX

WXZYZYWX

+=

+++=

+++=

)1()1(

Page 25: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Using Boolean Identities – 2

¨ Find an MSOP for

25

)!(tricky!

)(

][)(

][))((

)(

VYZXWVY

ZXWVY

BABAAXWZXWVY

XWXWXWZXWVY

ZXWZXWVY

YZXVVWYZXYWVF

+=

+=

+=++=

=+++=

++=

++=

Page 26: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Simplifying Logic Equations

¨ Remarks:

¨ For complicated expressions, the use of Boolean identities for simplification may not be obvious:¤ Where to begin?

¤ How to proceed?

¤ Do we have a minimum expression?

¨ Better suited for simple expressions

¨ Karnaugh Maps provide a systematic graphical way to minimize expressions – easier to visualize and work with

26

Page 27: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Karnaugh maps

27

Page 28: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Karnaugh Maps

¨ K-Maps are a convenient way to simplify Boolean Expressions

¨ They can be used for up to 4 or 5 variables¤ For >5 variables, need to use a computer

¨ They are a visual representation of a truth table¨ Expression are most commonly expressed in sum of

products (SOP) form¨ SOP was formed using minterms

28

Page 29: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Minterms: Recall

¨ Minterms contain each input variable exactly once¨ A function with n variables has 2n minterms – exactly equal

to the number of rows in truth table¨ A three-variable function, such as f(x, y, z), has 23 = 8

minterms (Note: )

¨ Each minterm is true for exactly one combination of inputs

29

x’y’z’ x’y’z x’yz’ x’yzxy’z’ xy’z xyz’ xyz

XX ='

Page 30: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Minterms: Recall30

¨ All 8 minterms for a 3 variable function

x y z MintermsShortnotation

0 0 0 x’y’z’ m(0)0 0 1 x’y’z m(1)0 1 0 x’yz’ m(2)0 1 1 x’yz m(3)1 0 0 xy’z’ m(4)1 0 1 xy’z m(5)1 1 0 xyz’ m(6)1 1 1 xyz m(7)

x’yz = 1 when x=0, y=1 and z=1

Page 31: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Karnaugh Map31

¨ A two-variable function has four possible minterms. We can represent these mintermsin a Karnaugh map.

¨ Now we can easily see which minterms contain common literals.¤ Minterms on the left and right sides contain y’ and y respectively.

¤ Minterms in the top and bottom rows contain x’ and x respectively.

x y minterm0 0 x’y’0 1 x’y1 0 xy’1 1 xy

Y

0 10 x’y’ x’y

X1 xy’ xy

Y

0 10 x’y’ x’y

X1 xy’ xy

Y’ YX’ x’y’ x’yX xy’ xy

Page 32: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Karnaugh Map Simplifications – 1

¨ Imagine a two-variable sum of minterms: x’y’ + x’y¨ Both of these minterms appear in the top row of a

Karnaugh map, which means that they both contain the literal x’.

¨ What happens if you simplify this expression using Boolean algebra?

32

x’y’ + x’y= x’(y’ + y) [ Distributive ]= x’ • 1 [ y + y’ = 1 ]= x’ [ x • 1 = x ]

Yx’y’ x’y

X xy’ xy

Page 33: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Karnaugh Map Simplifications – 2

¨ Another example expression is x’y + xy.¤ Both minterms appear in the right side, where y is

uncomplemented.¤ Thus, we can reduce x’y + xy to just y.

¨ How about x’y’ + x’y + xy?¤ We have x’y’ + x’y in the top row, corresponding to x’.¤ There’s also x’y + xy in the right side, corresponding to y.¤ This whole expression can be reduced to x’ + y.

33

Yx’y’ x’y

X xy’ xy

Yx’y’ x’y

X xy’ xy

Page 34: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Truth Table to Karnaugh Map34

A B P0 0 10 1 11 0 01 1 1

BA 0 1

0 1 1

1 0 1

The expression is:

A.B + A.B + A.B

Page 35: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

2-Variable Groupings

BA 0 1

0 1 11 1

35

¨ Adjacent 1’s can be “paired off” ¨ Pairs may be adjacent horizontally or vertically¨ Any variable which is both a 1 and a zero in this pairing

can be eliminated

B is eliminated, leaving A as the term A is eliminated,

leaving B as the term

The expression becomes A + B

a pairanother pair

Page 36: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

2-Variable Groupings36

Page 37: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-variable Karnaughmap

37

Page 38: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-Variable Karnaugh Map

¨ Note the ordering for BC – grey coding¤ Adjacent cells differ in exactly one bit

38

A B C Z

0 0 0 00 0 1 00 1 0 10 1 1 01 0 0 11 0 1 01 1 0 11 1 1 0

BCA 00 01 11 10

0 0 0 0 1

1 1 0 0 1

A.B.C + A.B.C + A.B.C

Page 39: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-Variable Karnaugh Map

¨ Shorthand notation only use minterms¤ m(i) indicates ith minterm (see slide 21)

39

A B C Z

0 0 0 00 0 1 00 1 0 10 1 1 01 0 0 11 0 1 01 1 0 11 1 1 0

A.B.C + A.B.C + A.B.C

å=++=

)6,4,2()6()4()2(

mmmmZ

Page 40: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-Variable Groupings40

BCA 00 01 11 10

0 1

1 1 1

equates to B.C as A is eliminated.

Here, we can “wrap around” and this pair equates to A.C as B is eliminated.

Our truth table simplifies

to A.C + B.C

Page 41: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-Variable Groupings41

n Three Variable K-Map

n Extreme ends of same row considered adjacent

A BC 00 01 11 10

0

1

A.B.C A.B.C A.B.C A.B.C

A.B.C A.B.C A.B.C A.B.C

0010A.B.C

A.B.C

A.B.CA.B.C

Page 42: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Grouping Rules

¨ Only group adjacent cells¤ Two cells are adjacent if exactly one variable is different

¨ Group-size is always a power of 2 – 2, 4, 8 or 16¨ Grouped squares must be rectangular¨ Simplified expression results by retaining inputs that

don’t change value¤ Drop inputs whose values change

42

Page 43: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

3-Variable Groupings (4 cells)

¨ Note the gray coding on BC

43

CBCCB

ABCBCACBACBAZ

+

+++=

Page 44: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

More 3-Variable Groupings44

Page 45: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

More 3-Variable Groupings

¨ Grouping 8 cells eliminates 3 variables

45

Page 46: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Invalid Groupings

¨ The following groupings are invalid

46

Page 47: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-variable Karnaughmap

47

Page 48: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-Variable Karnaugh Map

ABCD

00 01 11 10

00 0 4 12 8

01 1 5 13 9

11 3 7 15 11

10 2 6 14 10

48

n Note the gray codes on both axesn The location of minterms are shown in the above tablen All adjacent minterms differ exactly in a power of 2 (WHY?)

Minterms formed using the order ABCD

Page 49: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-Variable Karnaugh Map

ABCD

00 01 11 10

00 0 0 0 0

01 0 1 0 0

11 0 1 0 0

10 0 0 0 0

49

n Note the gray codes on both axesn C changes value – therefore it is eliminated

å=+= )7,5(mDCBABCDAZ

BDAZ =

Page 50: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-Variable Groupings

¨ Input variables arranged so that for any 2 physically adjacent squares, only one of the input variables has a different value.

50

Note: If only one variable has a different value, then the 2 squares are adjacent (even if they are not physically adjacent).Figure: Adjacent squares

Page 51: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-Variable Groupings

¨ Four Variable K-Map

¤ Four corners adjacent

51

AB CD 00 01 11 10

00

01

11

10

A.B.C.D A.B.C.D A.B.C.D A.B.C.D

A.B.C.D A.B.C.D A.B.C.D A.B.C.D

A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D

A.B.C.D

A.B.C.D

A.B.C.D

A.B.C.D

Page 52: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

4-Variable Groupings52

D DB

Page 53: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MSOPs from K-Maps

¨ Circle every 1 at least once¨ Circle a 1 more than once if it helps to make larger

groupings. But do not circle any more times than necessary to circle all 1’s

¨ Make groups as large as possible¨ Use no more groups than necessary

¨ Start with 1’s that can be circled only once. They must occur in MSOP. In general, start with 1’s that are most difficult.

53

Page 54: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MSOPs from K-Maps54

A B C Z

0 0 0 10 0 1 10 1 0 00 1 1 11 0 0 11 0 1 01 1 0 11 1 1 0

ABC

0 1

00 1 1

01 1

11 1

10 1

CACA ,Essential prime implicants:

BACACA

CBCACAZ

++=

++=

Two groupings are possible for CBA

Page 55: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MSOP Exercises

ABCD

00 01 11 10

00 1 0 0 1

01 1 0 1 1

11 1 1 1 1

10 1 1 1 1

55

ABCD

00 01 11 10

00 1 1 0 1

01 1 1 0 0

11 0 0 1 0

10 1 1 0 1

Page 56: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MPOSs from K-Maps

¨ Circle 0’s instead of 1’s¨ Form OR factors instead of AND terms¨ Complement variables that have 1 values, and don’t

complement variables with 0 values¨ Guidelines for forming MPOS’s from K-maps similar to

MSOP’s¨ Which to use, MSOP or MPOS?

¤ solve for both, and use the one that is easily implemented with available gates

56

Page 57: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MPOSs from K-Maps57

A B C Z

0 0 0 10 0 1 10 1 0 00 1 1 11 0 0 11 0 1 01 1 0 11 1 1 0

ABC

0 1

00

01 0

11 0

10 0

)).(( CBACAZ +++=

Page 58: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Obtaining MPOS Exercises

ABCD 00 01 11 10

00 1 0 0 1

01 1 0 1 1

11 1 1 1 1

10 1 1 1 1

58

ABCD

00 01 11 10

00 1 1 0 1

01 1 1 0 0

11 0 0 1 0

10 1 1 0 1

Page 59: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Don’t Care Conditions

¨ Sometimes, input variables cannot take values corresponding to all combinations in a truth table¤ For these combinations we don’t care what the output value is¤ For example, input > 9 in a 7-segment display

¨ In a K-map, the don’t care values are denoted by X’s¨ For minimization, we can choose either X = 1 or X = 0,

the value that is most advantageous for minimization

59

Page 60: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Don’t Care Conditions60

ABC

0 1

00

01 1 X

11 1

10 X

ABC

0 1

00

01 1 1

11 1

10 0

å å+=

+++=

)5,2()7,1()2()5()7()1(

dmddmmZ

Page 61: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-variable Karnaughmap

61

Page 62: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map (3-D view)62

A=1

A=0

BCDE

BCDE

Page 63: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map

¨ 5-variable K-map constructed in 3-dimension by placing one 4-variable K-map on top of another

¨ Imagine two different planes¤ The top plane indicates values when A=1¤ The bottom plane corresponds to A=0

¨ Every minterm on the top plane differs by 16 from the corresponding minterm on the bottom plane

63

Page 64: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map

BCDE 00 01 11 10

0016 20 28 24

0 4 12 8

0117 21 29 25

1 5 13 9

1119 23 31 27

3 7 15 11

1018 22 30 26

2 6 14 10

64

A

10

Page 65: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map

¨ 2-D representation: divide each square in a 4-variable K-map with a diagonal line

¨ Place terms in the top layer above the line and the terms in the bottom layer below the line

¨ Terms in the bottom or top layer combine just like in a 4-variable K-map

¨ In addition, terms in the same square separated by the diagonal line differ in exactly one variable¤ Therefore, they can be combined

65

Page 66: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map

¨ Some physically adjacent cells may not be grouped, e.g. 0 and 20. ¤ They differ in two variables¤ They appear in a different column and different layer

¨ 5-variables = 5-bits; exactly 1 bit different implies adjacency

¨ Each term can be adjacent to 5 different terms¤ Four in the same layer and one in different layer

66

Page 67: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

5-Variable Karnaugh Map

BCDE 00 01 11 10

001 1 1

1 1 1

011 1

11

101 1

1 1

67

A

10

DBA

EDB

EC

Page 68: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Summary

¨ Derivation of logic expressions¨ Minimization using algebraic transformations¨ Minimization using Karnaugh-maps¨ 5 variables is the maximum that you can easily see using

K-maps¤ For larger variables, a systematic approach needed that is

suitable for computer programs

68

Page 69: EMBEDDED HARDWARE SYSTEMS DESIGN - cfaed › files › Images › people...© Akash Kumar Rules for Deriving SOP Expressions 1. Find each row in TT for which output is 1 (rows 1 &

© Akash Kumar

Science Pillars of Fame!

¨ Augustus de Morgan¨ Born in India, 1806¨ B.A, from Cambridge in 1828¨ Appointed Mathematics Professor at 22 years of age in

London University¨ Made ample contributions in the field of algebra and

trigonometry

70