57
Combinational Logic Chapter 4

Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

  • View
    243

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

Combinational Logic

Chapter 4

Page 2: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

2

4.1 Combinational Circuits

Logic circuits for digital system Combinational circuits

the outputs are a function of the current inputs Sequential circuits

contain memory elements the outputs are a function of the current inputs and the

state of the memory elements the outputs also depend on past inputs

Page 3: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

3

A combinational circuits 2

n possible combinations of input values

Specific functions Adders, subtractors, comparators, decoders, encoders,

and multiplexers MSI circuits or standard cells

CombinationalLogic Circuit

n inputvariables

m outputvariables

Page 4: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

4

4-2 Analysis Procedure

A combinational circuit make sure that it is combinational not sequential

No feedback path derive its Boolean functions (truth table) design verification a verbal explanation of its function

Page 5: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

5

A straight-forward procedure F2 = AB+AC+BC

T1 = A+B+C

T2 = ABC

T3 = F2'T1

F1 = T3+T2

Page 6: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

6

F1 = T3+T2 = F2'T1+ABC = (AB+AC+BC)'(A+B+C)+ABC = (A'+B')(A'+C')(B'+C')(A+B+C)

+ABC = (A'+B'C')(AB'+AC'+BC'+B'C)+ABC = A'BC'+A'B'C+AB'C'+ABC

A full-adder F1: the sum

F2: the carry

Page 7: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

7

The truth tableA B C F2 F2‘ T1 T2 T3 F1

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

Page 8: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

8

4-3 Design Procedure

The design procedure of combinational circuits State the problem (system spec.) determine the inputs and outputs the input and output variables are assigned symbols derive the truth table derive the simplified Boolean functions draw the logic diagram and verify the correctness

Page 9: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

9

Functional description Boolean function HDL (Hardware description language)

Verilog HDL VHDL

Schematic entry Logic minimization

number of gates number of inputs to a gate propagation delay number of interconnection limitations of the driving capabilities

Page 10: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

10

Code conversion example

BCD to excess-3 code The truth table

A B C D w x y z0 0 0 0 0 0 1 10 0 0 1 0 1 0 00 0 1 0 0 1 0 10 0 1 1 0 1 1 00 1 0 0 0 1 1 10 1 0 1 1 0 0 00 1 1 0 1 0 0 10 1 1 1 1 0 1 01 0 0 0 1 0 1 11 0 0 1 1 1 0 0

Page 11: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

11

The maps

Page 12: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

12

The simplified functions z = D'

y = CD +C'D' x = B'C + B'D+BC'D'

w = A+BC+BD Another implementation

z = D' y = CD +C'D' = CD + (C+D)'

x = B'C + B'D+BC'D‘ = B'(C+D) +B(C+D)' w = A+BC+BD

Page 13: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

13

The logic diagram

Page 14: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

14

4-4 Binary Adder-Subtractor

Half adder 0+0=0 ; 0+1=1 ; 1+0=1 ; 1+1=10 two input variables: x, y two output variables: C (carry), S (sum) truth table

x y C S0 0 0 00 1 0 11 0 0 11 1 1 0

Page 15: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

15

S = x'y+xy' C = xy

the flexibility for implementation S=xy S = (x+y)(x'+y') S' = xy+x'y'

S = (C+x'y')' C = xy = (x'+y')'

Page 16: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

16

Page 17: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

17

Full-Adder The arithmetic sum of three

input bits three input bits

x, y: two significant bits z: the carry bit from the

previous lower significant bit Two output bits: C, S

x y z C S0 0 0 0 00 0 1 0 10 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 1

Page 18: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

18

Page 19: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

19

S = x'y'z+x'yz'+ xy'z'+xyz C = xy + xz + yz

S = xy'z'+x'yz'+xyz+x'y'z

= z'xy'+z'x'y+z((x'+y)(x+y'))

= z'(xy'+x'y)+z(xy'+x'y)'

= z (xy) C = xy'z+x'yz+xy =z(xy'+x'y)+xy

=z(xy)+xy

Page 20: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

20

Binary adder

Page 21: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

21

Carry propagation when the correct outputs are available the critical path counts (the worst case) (A1,B1,C1) > C2 > C3 > C4 > (C5,S4) > 8 gate levels

Page 22: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

22

Reduce the carry propagation delay employ faster gates look-ahead carry (more complex mechanism, yet

faster) carry propagate: Pi = AiBi

carry generate: Gi = AiBi

sum: Si = PiCi

carry: Ci+1 = Gi+PiCi

C1 = G0+P0C0

C2 = G1+P1C1 = G1+P1(G0+P0C0) = G1+P1G0+P1P0C0

C3 = G2+P2C2 = G2+P2G1+P2P1G0+ P2P1P0C0

Page 23: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

23

Logic diagram

Page 24: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

24

4-bit carry-look ahead adder propagation delay

Page 25: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

25

Binary subtractor

A-B = A+(2’s complement of B) 4-bit Adder-subtractor

M=0, A+B; M=1, A+B’+1

Page 26: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

26

Overflow The storage is limited Add two positive numbers and obtain a negative

number Add two negative numbers and obtain a positive

number V=0, no overflow; V=1, overflow

Page 27: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

27

4-5 Decimal Adder

Add two BCD's 9 inputs: two BCD's and one carry-in 5 outputs: one BCD and one carry-out

Design approaches A truth table with 2^9 entries use binary full Adders

the sum <= 9+9+1 = 19 binary to BCD

Page 28: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

28

The truth table

Page 29: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

29

Modifications are needed if the sum > 9 C = K+ Z8Z4 + Z8Z2

C = 1 K = 1 Z8Z4 = 1

Z8Z2 = 1

modification: -(10)d or +6

Page 30: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

30

Block diagram

Page 31: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

31

Binary Multiplier

Partial products – AND operations

Page 32: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

32

4-bit by 3-bit binary multiplier

Page 33: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

33

4-7 Magnitude Comparator

The comparison of two numbers outputs: A>B, A=B, A<B

Design Approaches the truth table

22n

entries - too cumbersome for large n use inherent regularity of the problem

reduce design efforts reduce human errors

Page 34: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

34

Algorithm -> logic A = A3A2A1A0 ; B = B3B2B1B0

A=B if A3=B3, A2=B2, A1=B1and A1=B1

equality: xi= AiBi+Ai'Bi'

(A=B) = x3x2x1x0

(A>B) = A3B3'+x3A2B2'+x3x2A1B1'+x3x2x1 A0B0'

(A>B) = A3'B3+x3A2'B2+x3x2A1'B1+x3x2x1 A0'B0

Implementation xi = (AiBi'+Ai'Bi)'

Page 35: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

35

Page 36: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

36

4-8 Decoder

A n-to-m decoder a binary code of n bits = 2

n distinct information

n input variables; up to 2n output lines

only one output can be active (high) at any time

Page 37: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

37

An implementation

Page 38: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

38

Combinational logic implementation each output = a minterm use a decoder and an external OR gate to

implement any Boolean function of n input variables

Page 39: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

39

Demultiplexers a decoder with an enable input receive information on a single line and transmits it

on one of 2n possible output lines

Page 40: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

40

Decoder/demultiplexers

Page 41: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

41

Expansion two 3-to-8 decoder: a 4-to-16 deocder

a 5-to-32 decoder?

Page 42: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

42

Combination Logic Implementation

each output = a minterm use a decoder and an external OR gate to

implement any Boolean function of n input variables

A full-adder S(x,y,x)=(1,2,4,7)

C(x,y,z)= (3,5,6,7)

Page 43: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

43

two possible approaches using decoder OR(minterms of F): k inputs NOR(minterms of F'): 2

n - k inputs

In general, it is not a practical implementation

Page 44: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

44

4-9 Encoders

The inverse function of a decoder

Page 45: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

45

An implementation

limitations illegal input: e.g. D3=D6=1 the output = 111 (¹3 and ¹6)

Page 46: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

46

Priority Encoder

resolve the ambiguity of illegal inputs only one of the input is encoded

D3 has the highest priority D0 has the lowest priority X: don't-care conditions V: valid output indicator

Page 47: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

47

Page 48: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

48

4-10 Multiplexers

select binary information from one of many input lines and direct it to a single output line

2n input lines, n selection lines and one output line

e.g.: 2-to-1-line multiplexer

Page 49: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

49

4-to-1-line multiplexer

Page 50: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

50

Note n-to- 2

n decoder

add the 2n input lines to each AND gate

OR(all AND gates) an enable input (an option)

Page 51: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

51

Page 52: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

52

Boolean function implementation

MUX: a decoder + an OR gate 2

n-to-1 MUX can implement any Boolean function

of n input variable

a better solution: implement any Boolean function of n+1 input variable

n of these variables: the selection lines the remaining variable: the inputs

Page 53: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

53

an example: F(A,B,C)=(1,2,6,7)

Page 54: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

54

Procedure: assign an ordering sequence of the input variable the rightmost variable (D) will be used for the input

lines assign the remaining n-1 variables to the selection

lines w.r.t. their corresponding sequence construct the truth table consider a pair of consecutive minterms starting

from m0

determine the input lines

Page 55: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

55

Page 56: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

56

Three-state gates

A multiplexer can be constructed with three-state gates

Output state: 0, 1, and high-impedance (open ckts)

Page 57: Combinational Logic Chapter 4. 2 4.1 Combinational Circuits Logic circuits for digital system Combinational circuits the outputs are a function of the

57