32
CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most primitive logic elements in digital circuits. In a combinatorial logic circuit the output at time t depends only on the input at time t.

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

Page 1: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

1

Chapter 2Combinatorial Logic Circuits

In this chapter we will discuss logic gates which is the most primitive logic elements in digital circuits. In a combinatorial logic circuit the output at time t depends only on the input at time t.

Page 2: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

2

Digital Design

The first step in the digital design process is to create a formal description of the requirements of the problem. This formal description is called a behavioral description because it defines precisely what the eventual circuit is supposed to do. The objective of a behavioral description is to provide a formal specification that satisfies the following:

• complete: All possible outputs are accounted for. That is, there is no input sequence for which we have not also identified the corresponding output.

• unambiguous: Each input sequence has a unique corresponding output sequence.

Page 3: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

3

Behavioral Description

A behavioral description specifies what a circuit does, but not how. Behavioral descriptions ALWAYS consist of two parts:

• An entity definition that identifies the signal lines that make up the inputs and outputs and the ports that interface the device with those signal lines. A signal line is any connection that can transmit one bit at a time. This will be discussed later in Chapter 3.

• A functional specification that specifies how the outputs are determined by the inputs. This information can be conveyed by a table, algebraically, or algorithmically. Initially the functional specification will be examined using function tables (truth-tables are a special case) and algebraic expressions (including Boolean expressions).

Page 4: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

4

Function Tables and Logic Operations

A function table or truth table is a listing of the output expected for every possible assignment of values to the inputs; that is, for every possible binary input sequence.

The three basic logical operations in the order of precedence are

i) NOT,

ii) AND,

iii) OR.

The truth tables of these logical operations are discussed in the next slide.

Page 5: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

5

Truth Tables for the basic logical operations

The truth tables and the logic diagrams for the binary operations are:

AND OR NOT

A B A.B A + B Ā

0 0 0 0 1

0 1 0 1 1

1 0 0 1 0

1 1 1 1 0

A

BA.B

A

B

A + B

A Ā

Note: NOT gates are often referred to as inverters.

See Figure 2-1 on page 32.

Page 6: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

6

Equivalency

When are two boolean functions equal? When are two logic circuit diagrams the same?

Two boolean functions are equal when to every instance of the input sequence they give the same output. Likewise two logic circuit diagrams are the same if to every instance of the same input, they give the same output.

Page 7: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

7

Boolean AlgebraThis is an algebra dealing with binary variables and logic operations. The alphabet on which a Boolean algebra is defined can have two or more elements. The three basic operations of this algebra are NOT, AND, OR. This algebra is useful in simplifying statement forms of complex logic circuits by using boolean identities given in Table 2-3 on page 35 of the text. As a result of which the complex expressions/forms are transformed into simpler ones which evidently makes our design more parsimonious.

The statement forms are referred to as multiple output boolean functions. A multiple output boolean function is a mapping from from each of the possible combinations of values 0 and 1 on the function variables to combinations of 0 and 1 on the function

outputs.

Page 8: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

8

Truth Tables of functions with n-input variables

A function using two input variables (binary functions) has 22 possible input sequences as shown in Slide 5 of this chapter. A function using n input variables has 2n possible input sequences. The table below shows the input sequence of a function using three input variables. a b c F(a, b, c)

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Note: There are 23 possible input sequences

Page 9: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

9

Duality PrincipleBy the dual of a boolean expression/form, we mean

expression obtained by substituting AND for OR, OR for AND, 0 for 1, and 1 for 0.

(i) The dual of A + B is A . B.

(ii) The dual of A . B is A + B.

(iii) The dual of Ā is Ā.

(iv) The dual of A + 0 is A . 1.

Duality is often used in finding the complement of a complex boolean expressions.

Page 10: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

10

Complementation using Duality

The following steps are used in finding the complement of a boolean expression, F.

Step 1: Find the dual of F.

Step 2: Complement each literal after finding the literal.

See examples on page 41 of the text.

Page 11: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

11

Sum terms and Product terms

Sum terms for 3-input boolean functions are of the form

G1 (a, b, c) = a + b + c,

G2 (a, b, c) = ā + b + c,

.

.

.

23 such functions.

Product terms for 3-input boolean functions are of the form

F1(a, b, c) = a . b . c,

F2 (a, b, c) = ā . b . c,

.

.

.

23 such functions.

Note: H(a, b, c) = ab+ bc + c is not a sum term example.

Page 12: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

12

Minterms and Maxterms

Minterms and Maxterms are special product and sum terms, respectively. In a minterm term of the type f(a, b, c) = a . b . c, a “1” appears exactly once in the truth-values of the function. In a maxterm term of the type g(a, b, c) = a + b + c, a “0” appears exactly once in the truth-values of the function. See Table 2-6, 2-7 on page 42-43.

a e F(a,e) = ā ē + a ē + ā e

0 0 1

0 1 1

1 0 1

1 1 0

The boolean expression in the table, F(a,e), is not a maxterm even though there is only one ”0” in the truth values because the terms contain more than one literal.

Page 13: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

13

Sum of productsFrom the values in a table we can obtain a boolean expression by obtaining the minterms and then summing them up. This process is called “Sum of Products.” This process can, also, be used identifying the rows containing a “1” with the corresponding minterm. For example, in the table shown below rows 1, 3, and 4 contain a “1”. These are the only rows one needs to consider in order to obtain the Boolean expression. Using these rows we obtain the minterms and then sum them up.

a e U(a,e) minterm

0 0 1 m0

0 1 0 m1

1 0 1 m2

1 1 1 m3

U(a,e) = m0 + m2 + m3 = ā ē + ā e + a e

Ū(a,e) = m1 = a ē

Page 14: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

14

Products of sumsFrom the values in a table we can obtain a boolean expression by obtaining the maxterms and then multiplying them up. This process is called “Product of Sums.” This process can, also, be used identifying the rows containing a “1” with the corresponding maxterm, and then taking the products.

“Product of Sums” can, also, be obtained for a “Sum of Products by taking the dual of each term, and then taking the complement of each literal.

Page 15: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

15

ImplicantsImplicants are product terms with special properties as they relate to a function F that we are trying to implement:

An implicant P of a function F is a product term P such that F = 1 whenever P = 1. An implicant P covers an implicant Q if P = 1 whenever Q = 1. That is, Q is an implicant of P. By definition, an implicant can cover itself. However a useful covering implicant has fewer literals than any implicant it covers.

A prime implicant P of F is any implicant that is not covered by any other implicant of F.

An essential prime implicant of a function F is one that covers a minterm of F not covered by any other prime implicant of F. Two implicants are adjacent if all but one of their literals are identical, and the differing literals consist of a variable in one implicant and its complement in the other.

Page 16: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

16

Cost EvaluationCost evaluation for a given statement form or a logic circuit

diagram is calculated as follows:

Find the sum of

(i) All the literals appearances,

(ii) The number of terms excluding terms that consist only of a single literal, and, optionally

(iii) The number of distinct complemented literals.

The function G = āb + cā + cda has 7 literals, 3 terms, and 1 distinct complemented literal. So cost value is 11.

Page 17: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

17

Karnaugh Maps (K-Maps)

This is a pictorial method for obtaining minimal sum-of-products. Algebraic determination of the prime implicants of a function is tedious for simple functions and impractical for more complex ones. Therefore alternate strategies are available that simplify the process of identifying prime implicants, such as the Tabulation or Karnaugh Map method:

The Karnaugh Map (K-Map) representation is a variation on function table representation where minterms are arranged so that adjacent minterms are next to each other, either vertically or horizontally in the K-Map table.

Page 18: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

18

Two Variable K-MapThis consists of a 2 by 2 table containing the minterms, m0, m2 , m3 , m4.

B

A 0 1

0m0 m1

1m2 m3

B

A 0 1

0 1 1

1

A B m0 m1 m2 m3

0 0 1 0 0 0

0 1 0 1 0 0

1 0 0 0 1 0

1 1 0 0 0 1

F(a,b) = ā

Two adjacent squares differing in one statement letter represents one literal

Page 19: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

19

Three Variable K-Map

This consists of a 3 by 3 table containing the minterms, m0 , m2 , m3 , m4 , m5 , m6, m7 , m8.

B C

A 00 01 11

10

0 1 1

1 1 1

F(a,b,c) = m2 + m3 + m4 + m5

Two adjacent squares differing in one statement letter represents one literal

F(a,b,c) = ā b

Page 20: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

20

FINDING PRIME IMPLICANTS FROM A K-MAP

1.) Enter a 1 in the appropriate position of the K-Map Table corresponding to each minterm that is present in the function to be minimized.

2.) Group into pairs any two 1’s that are side-by-side to produce 1x2 or 2x1 arrays of 1’s.

3.) Group into fours any two pairs that are side-by-side to produce 1x4, 4x1 or 2x2 arrays of 1’s.

4.) Group into eights any two fours that are side-by-side to produce 2x4 or 4x2 arrays of 1’s.

While every possible "group-of-one", pairing, group of four, and group of eight defines an implicant, the prime implicants are those groups that do not belong to any larger group.

Page 21: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

21

Optimization using Prime ImplicantsFor example to find the prime implicants of f(x,y,z) =m(1,3,6,7), the Karnaugh map of f is given by:

yz

x 00 01 11 10

0 1 1

1 1 1

Three prime implicants are identified, along with four additional implicants corresponding to the minterm 1’s. To identify an algebraic representation for each implicant, construct a product term that includes a literal for each variable, if that variable does not change value for any minterm within the group representing the implicant.

In the example above, the prime implicants are x’z, yz, and xy. Of these, x’z and xy are essential prime implicants.

Page 22: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

22

To construct a minimal sum-of-products representation for a function:

1.) Choose all the essential prime implicants. These have to be included since by definition they are the only prime implicants that cover certain minterms.

2.) If such a choice does not cover all the minterms of the function, then choose the smallest number of remaining prime implicants possible so as to cover all the remaining minterms of the function.

3.) The required sum-of-products is obtained by "summing" all selected prime implicants.

Page 23: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

23

Optimization using Don’t Care Conditions

In many design problems there exists certain conditions which are impossible or for which no requirement is made. These are referred to as Don’t Care Conditions.The boolean functions of these circuits have unspecified outputs and are called incomplete specified functions.The Don’t Care Conditions are the unspecified minterms of the functions.

Page 24: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

24

Multilevel Optimization Transformations

The following transformations can be used in cost optimization.

(i) Factoring,

(ii) Decomposition,

(iii) Extraction,

(iv) Substitution,

(v) Elimination.

See description and details on page 67 of text.

Page 25: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

25

Entity DiagramsEntity Diagram are of the type:

A

B

f

g

a

b

c

f

g

The input/output ports correspond to external signal lines of the logic diagram that provide the input and output values. There are combinations of logic circuits connected within these rectangles.

Page 26: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

26

Entity diagrams in digital systems

We determine the behavioral descriptions of all components. We begin with components whose inputs are only connected to external signal lines which determine the output from each component for each row of the function table according to the behavioral description of the component. This may determine additional columns in the function table corresponding to values on internal signal lines for each input assignment. We construct a column in the function table for each internal signal line or external output signal line from each component as soon as the values of all inputs to the component have been defined. When all external output signals have been defined, the function table is complete.

Page 27: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

27

Example of an entity diagram

a

b

x t

D1

y s

x t

y s

u1

D2 x

D3

y z

u2

u3

m

nc

Page 28: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

28

Behavioral description of the entity diagram

u1 c u2 m n

x y s(x,y) t(x,y) z(x,y)0 0 0 0 0

0 1 0 1 1

1 0 0 1 1

1 1 1 0 1 a m

b

n

c

Entity definition for this logic diagram

Page 29: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

29

OTHER TYPES OF GATES

The laws of Boolean Algebra provide an effective means for transforming algebraic representations of circuits into other representations that define different but equivalent circuits. However, the transformation rules are applicable only to expressions that employ the AND and OR operations. Four other important binary operations, called NAND, NOR, XOR, and XNOR, have useful applications even though do not define boolean algebras and therefore may not satisfy a given tranformation rule. To manipulate expressions that employ these operators, it is necessary to reduce Boolean expressions that include these functions to ones that use only AND, OR, and NOT. Reduction Rules for achieving this can be obtained by obtaining a minimal sum-of-products rerepsentation from the function tables for each operation.

See Diagrams on Pages 72-73 of text.

Page 30: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

30

Odd Functions

A function, f(x,y,z) is odd, if f(x,y,z) = 1 whenever x = 1, y = 1, or z = 1, exclusively. In a more generalized form we can say that for any n-ary function, the number of 1’s in any input sequence must be odd.

B C

A 00 01 11

10

0 1 1

1 1 1

f(x,y,z) = x y z

Page 31: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

31

BuffersA buffer produces the logical function Z = X, since the binary value of the output is equal to the binary value of the input. This circuit is used primarily to amplify an electrical signal to permit more gates to be attached to the output or to decrease the time it takes for signals to propagate through the circuit.

X Z

F = X

X F

0 0

1 1

Page 32: CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU 1 Chapter 2 Combinatorial Logic Circuits In this chapter we will discuss logic gates which is the most

CMPT 150, Chapter 2, Tariq Nuruddin, Fall 06, SFU

32

The 3-State BuffersThe 3-state (buffer) logic output exhibits three distinct states. Two of the “states” are the logic 1 and logic 0 of conventional logic. The third “state” is the high impedance, Hi-Z value, that, for three-state logic, is referred to as Hi-Z state.

IN

Enable Input, EN

OUTEN IN OUT

0 X Hi-Z

1 0 0

1 1 1

If EN = 1, OUT is equal to IN, behaving like a normal buffer. The only time we get high impedance output is when EN = 0.