24
FUNCTION OPTIMIZATION Switching Function Representations can be Classified in Terms of Levels Number of Levels, k, is Number of Unique Boolean (binary) Operators EXAMPLES 1 1 2 3 f x x x 2 f abcd 3 f ab cd afe 4 ( )( ) f a b c b c d 5 f ab cd abc 6 [( )( )] ( ) f ab c cd e ab ce dc 1-Level 2-Level multi-level

FUNCTION OPTIMIZATION

  • Upload
    matia

  • View
    40

  • Download
    0

Embed Size (px)

DESCRIPTION

FUNCTION OPTIMIZATION. Switching Function Representations can be Classified in Terms of Levels Number of Levels, k, is Number of Unique Boolean (binary) Operators. EXAMPLES. 1-Level. 2-Level. multi-level. a. c. b. b. k -Level functions. - PowerPoint PPT Presentation

Citation preview

Page 1: FUNCTION OPTIMIZATION

FUNCTION OPTIMIZATION

• Switching Function Representations can be Classified in Terms of Levels

• Number of Levels, k, is Number of Unique Boolean (binary) Operators

EXAMPLES

1 1 2 3f x x x

2f abcd

3f ab cd afe 4 ( )( )f a b c b c d

5f ab cd abc

6 [( )( )] ( )f ab c cd e ab ce dc

1-Level

2-Level

multi-level

Page 2: FUNCTION OPTIMIZATION

k-Level functions• 22n

Possible Switching Functions of n Variables (actually much fewer types obtained by permuting and/or complementing input variables)

• 1-Level Forms– Cannot Represent all Possible Functions

• 2-Level Forms– Can Represent all Possible Functions

– With Additional Restrictions – CANONICAL

• k-Level Forms (k2)– Many Different Ways to Represent a Given Functions

• If a multi-input Gate Represents a (binary or greater) Boolean Operator– Expression can Represent a Netlist

– k Indicates “depth” of Netlist

EXAMPLES

1-Level

2-Level Multi-Level

f a b c ( )( )( )f a b b c a c d

a

cb

c

a

cb

cb

ab

e

d

a

f

bf

f

( )( )f a b c d e

Page 3: FUNCTION OPTIMIZATION

k-Level function properties• 1-Level Forms

– Due to Restriction of Representable Functions, Not as Useful

• 2-Level Forms– Can be Canonical

– Longest PI to PO Path is Always 2 Related to Delay

– Minimization Usually Means

1. Minimum Number of “Terms”

2. Minimum Number of “Literals” in Expression

• k-Level Forms (k2)– Many More Possible Representations

– Can be Optimized for Area

– Delay is More Complicated• False Path Problem

• Spatio-temporal Correlations

• Typically an Area versus Delay Tradeoff (e.g., Ripple versus CL Adder)

Page 4: FUNCTION OPTIMIZATION

Common Terms for 2-Level Minimization• Literal – A variable in complemented or uncomplemented form

• Product – The disjunction (AND) of a set of literals; also represents a cube

• Support Set – Set of all variables that define the domain of a switching function

• Minterm – A disjunction (AND) containing an instance of each literal corresponding to a variable in the support set that is in the on-set, fon,of a function

• Don’t Care – The absence of a supporting variable in a product term

• Implicant – A product term that covers one or more minterms in the on-set, fon, of a function

• Prime Implicant – An implicant in the on-set, fon, of a function such that it is not a subproduct of any other possible implicant in the set.

• Essential Prime Implicant – A prime implicant that covers at least one minterm NOT covered by any other implicant in the on-set, fon.

Page 5: FUNCTION OPTIMIZATION

SOP Minimization – Terms ExampleConsider: { , , , , , }onf b d abc bd acd abc bcd

• Each Element of fon is an Implicant• Prime Implicants are:

{ , , , , }b d abc bd acd abc

• abc is a Prime Implicant but NOT anEssential Prime Implicant

• bcd is an Implicant but NOT aPrime Implicant

• bd is an Essential Prime Implicant

• Product abc:– covers minterms: m4=abcd and m5=abcd – disjunction of literals a, b, c– variable d is a Don’t Care

• f Represented by fon has Support Set: {a, b, c, d}

Page 6: FUNCTION OPTIMIZATION

Karnaugh Map• Simplification Using Karnaugh Map

a) Use as “few loops” as possible

b) Use as “large loop” as possible

• Prime Implicant Corresponds to as “large loop” as Possible

• Karnaugh Map Simplification is Finding fon such that:

a) fon contains as few prime implicants as possible

b) fon must contain all essential prime implicants

c) fon contains NO implicants that are NOT prime

Page 7: FUNCTION OPTIMIZATION

Tabulation Method - Notation• Consider Support Set of f: S={x1, x2, …, xn}

• xici denotes:

xi if ci = ‘1’xi if ci = ‘0’1 if ci = ‘-’

• If NO ci = -, then we have a minterm

– Can be Represented by Decimal Equivalent of ci

EXAMPLE (S={x1, x2, x3, x4})

x11x0

2x03x1

4 = m9, a minterm c1 c2 c3 c4 = 1001 = 9

x01x-

2x-3x0

4 = a 4-cube 0--0

Page 8: FUNCTION OPTIMIZATION

Cube Merging• Basic Operation in Tabulation Method

• 2 Cubes that Differ in a SINGLE ci can be Merged into a Single Cube

EXAMPLE

= 1-01 = 0-01

Merge and into

= --01

Page 9: FUNCTION OPTIMIZATION

Tabulation MethodInput: f on as a set of minterms

Output: f on as a set of 1. All Essential Prime Implicants

2. As Few Prime Implicants as Possible

Finding as few Prime Implicants as Possible is an NP-Hard Problem!!!!!

• Reduces to the “Set Covering” Problem for Unate Functions

Unate function – a constant or is represented by a SOP using either uncomplemented or complemented literals for each variable

• Reduces to the “Minimum Cost Assignment” Problem for Binate Functions (ex. EXOR)

This is 2-Level (SOP) Optimization (Minimization)

Page 10: FUNCTION OPTIMIZATION

Tabulation Method• STEP 1:

– Convert Minterm List (specifying f on) to Prime Implicant List

• STEP 2:– Choose All Essential Prime Implicants

– If all minterms are coveredHALT

ElseGO To STEP 3

• STEP 3:– Formulate the Reduced Cover Table Omitting the rows/cols of EPI

– If Cover Table can be Reduced using Dominance Properties, Go To Step 2

– Else Must Solve the “Cyclic Cover” Problem1) Use Exact Method (exponentially complex)2) Use Heuristic Method (possibly non-optimal result)

NOTE: “Quine-McCluskey” Refers to Using a “Branch and Bound” Heuristic

NOTE: “Petrick’s Method” is Exact Technique – Generates all Solutions Allowing the Best to be Used

Page 11: FUNCTION OPTIMIZATION

Tabulation Method – STEP 1

1. Partition Prime Implicants (or minterms) According to Number of 1’s

2. Check Adjacent Classes for Cube Merging Building a New List

3. If Entry in New List Covers Entry in Current List – Disregard Current List Entry

4. If Current List = New ListHALT

ElseCurrent List New ListNew List NULLGo To Step 1

Page 12: FUNCTION OPTIMIZATION

STEP 1 - EXAMPLE

f on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

Minterm Cube 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 8 1 0 0 0 3 0 0 1 1 5 0 1 0 1

10 1 0 1 0 11 1 0 1 1 13 1 1 0 1 15 1 1 1 1

Page 13: FUNCTION OPTIMIZATION

STEP 1 - EXAMPLE

f on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

Minterm Cube 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 8 1 0 0 0 3 0 0 1 1 5 0 1 0 1

10 1 0 1 0 11 1 0 1 1 13 1 1 0 1 15 1 1 1 1

Minterm Cube 0,1 0 0 0 - 0,2 0 0 - 0 0,8 - 0 0 0 1,3 0 0 - 1 1,5 0 - 0 1 2,3 0 0 1 -

2,10 - 0 1 0 8,10 1 0 - 0 3,11 - 0 1 1 5,13 - 1 0 1

10,11 1 0 1 - 11,15 1 - 1 1 13,15 1 1 - 1

Page 14: FUNCTION OPTIMIZATION

STEP 1 - EXAMPLE

f on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

Minterm Cube 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 8 1 0 0 0 3 0 0 1 1 5 0 1 0 1

10 1 0 1 0 11 1 0 1 1 13 1 1 0 1 15 1 1 1 1

Minterm Cube 0,1 0 0 0 - 0,2 0 0 - 0 0,8 - 0 0 0 1,3 0 0 - 1 1,5 0 - 0 1 2,3 0 0 1 -

2,10 - 0 1 0 8,10 1 0 - 0 3,11 - 0 1 1 5,13 - 1 0 1

10,11 1 0 1 - 11,15 1 - 1 1 13,15 1 1 - 1

Minterm Cube 0,1,2,3 0 0 - -

0,8,2,10 - 0 - 0 2,3,10,11 - 0 1 -

Page 15: FUNCTION OPTIMIZATION

STEP 1 - EXAMPLE

f on = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

Minterm Cube 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 8 1 0 0 0 3 0 0 1 1 5 0 1 0 1

10 1 0 1 0 11 1 0 1 1 13 1 1 0 1 15 1 1 1 1

Minterm Cube 0,1 0 0 0 - 0,2 0 0 - 0 0,8 - 0 0 0 1,3 0 0 - 1 1,5 0 - 0 1 PI=D 2,3 0 0 1 -

2,10 - 0 1 0 8,10 1 0 - 0 3,11 - 0 1 1 5,13 - 1 0 1 PI=E

10,11 1 0 1 - 11,15 1 - 1 1 PI=F 13,15 1 1 - 1 PI=G

Minterm Cube 0,1,2,3 0 0 - - PI=A

0,8,2,10 - 0 - 0 PI=C 2,3,10,11 - 0 1 - PI=B

f on = {A,B,C,D,E,F,G} = {00--, -01-, -0-0, 0-01, -101, 1-11, 11-1}

Page 16: FUNCTION OPTIMIZATION

STEP 2 – Construct Cover Table

• PIs Along Vertical Axis (in order of # of literals)

• Minterms Along Horizontal Axis

0 1 2 3 5 8 10 11 13 15 A x x x x B x x x x C x x x x D x x E x x F x x G x x

NOTE: Table 4.2 in book is incomplete

Page 17: FUNCTION OPTIMIZATION

STEP 2 – Finding the Minimum Cover

• Extract All Essential Prime Implicants, EPI

• EPIs are the PI for which a Single x Appears in a Column

0 1 2 3 5 8 10 11 13 15 A x x x x B x x x x C x x x x D x x E x x F x x G x x

• C is an EPI so: f on={C, ...}

• Row C and Columns 0, 2, 8, and 10 can be Eliminated Giving Reduced Cover Table

• Examine Reduced Table for New EPIs

Page 18: FUNCTION OPTIMIZATION

STEP 2 – Reduced Table

0 1 2 3 5 8 10 11 13 15 A x x x x B x x x x C x x x x D x x E x x F x x G x x

1 3 5 11 13 15 A x x B x x D x x E x x F x x G x x

Essential row

Distinguished Column

•The Row of an EPI is an Essential row

•The Column of the Single x in the Essential Row is a Distinguished Column

Page 19: FUNCTION OPTIMIZATION

Row and Column Dominance

• If Row P has x’s Everywhere Row Q Does Then Q Dominates P if P has fewer x’s

• If Column i has x’s Everywhere j DoesThen j Dominates i if i has fewer x’s

• If Row P is equal to Row Q and Row Q does not cost more than Row P, eliminate Row P, or if Row P is dominated by Row Q and Row Q Does not cost more than Row P, eliminate Row P

• If Column i is equal to Column j, eliminate Column i or if Column i dominates Column j, eliminate Column i

Page 20: FUNCTION OPTIMIZATION

STEP 3 – The Reduced Cover Table

• Initially, Columns 0, 2, 8 and 10 Removed

1 3 5 11 13 15 A x x B x x D x x E x x F x x G x x

• No EPIs are Present

• No Row Dominance Exists

• No Column Dominance Exists

• This is Cyclic Cover Table

• Must Solve Exactly OR Use a Heuristic

Page 21: FUNCTION OPTIMIZATION

The Cyclic Cover Table• For now, we Arbitrarily Choose a PI

• Later we will Study Exact and Heuristic Methods

1 3 5 11 13 15 A x x B x x D x x E x x F x x G x x

• Arbitrarily Choose F so: fon={C, F, ...}This Choice May Lead to a Non-Optimal

Result!!!!

• Form Reduced Cover and Go To Step 2

Page 22: FUNCTION OPTIMIZATION

STEP 3 – Dominance

• Initially, Reduced Table has Columns 11 and 15 Removed

1 3 5 13 A x x B x D x x E x x G x

• G is Dominated by E

• B is Dominated by A

• Form Reduced Cover Table and Go To Step 2

Page 23: FUNCTION OPTIMIZATION

STEP 2 – The Reduced Cover

• Initially, Table has Rows G and B Removed

1 3 5 13 A x x D x x E x x

• Secondary EPIs – A and E

• All Columns Covered

• Eliminate D

• fon={C, F, A, E}

Page 24: FUNCTION OPTIMIZATION

Result Check

Initial Minterm Listfon = {m0, m1, m2, m3, m5, m8, m10, m11, m13, m15} = (0, 1, 2, 3, 5, 8, 10, 11, 13, 15)

Final Resultf on={A, C, E, F}

1

1

1

1

00 01 11 10

00

01

11

10

abcd

11

11

1

1

1

1

1

1

00 01 11 10

00

01

11

10

abcd

11

11

1

1