Decoders

38
DECODER and ENCODERS

description

DLD logic control based decoders

Transcript of Decoders

Page 1: Decoders

DECODER and ENCODERS

Page 2: Decoders

QUICK RECAP

Page 3: Decoders

WHY THIS QUIZ IS IMPORTANT

Page 4: Decoders

DECODER

• N input and M Out put• M=2n

MAIN DECODER HONN=2

M=2n

M=22=4

Page 5: Decoders

3x___ Decoder

MAIN DECODER HONN=3

M=2n

M=23=8

Page 6: Decoders

• As its name indicates, a decoder is a circuit component that decodes an input code

• each output line equals 1 at only one input combination but is equal to 0 at all other combinations

• In other words, each decoder output corresponds to a minterm of the n input variables

Page 7: Decoders

DESIGN 2x$

A B O1 O2 03 04

0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1

A’B’A’B

AB’AB

Page 8: Decoders

THE CIRCUIT

LETS TRY TO GENERATE TABLE

A B

0 00 11 01 1

o1 o2 o3 o4

Lets try for 000 0

0

0

0

1

1

1

0

0

11

1

1 AND 1=1

11 AND 0=0=

0

1 AND 0=0

0

0 AND 0=0

0

Page 9: Decoders

The “enable” input in decoders

• If the enable “E” – is zero, then all outputs are zero regardless of the

input values. – is one, then the decoder performs its normal

operation.

Page 10: Decoders

If E=1

1

1

1

1

Page 11: Decoders

If E=0

0

0

0

0

Page 12: Decoders
Page 13: Decoders

13

Decoder

ABC ABC ABC ABC ABC ABC

ABC ABC

3:8 dec

O0 O1

O2

A

B

C

Enb

S2

S1

S0

O3

O4

O5

O6

O7

A B C O0 O1 O2 O3 O4 O5 O6 O7

0 X X X 0 0 0 0 0 0 0 0

0 0 0 1 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0 0 0 0

0 1 0 0 0 1 0 0 0 0 0

0 1 1 0 0 0 1 0 0 0 0

1 0 0 0 0 0 0 1 0 0 0

1 0 1 0 0 0 0 0 1 0 0

1 1 0 0 0 0 0 0 0 1 0

1 1 1 0 0 0 0 0 0 0 1

E

1

1

1

1

1

1

1

1

• 2-to-4,• 3-to-8,• …• n-to-2n

Page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decoder design with NAND gates

• Some decoders are constructed with NAND rather than AND gates.

• In this case, all decoder outputs will be 1’s except the one corresponding to the input code which will be 0.

Page 19: Decoders
Page 20: Decoders

Design example: addition

• Let’s make a circuit that adds three 1-bit inputs X, Y and Z.

• We will need two bits to represent the total; let’s call them C and S, for “carry” and “sum.” Note that C and S are two separate functions of the same inputs X, Y and Z.

• Here are a truth table and sum-of-minterms equations for C and S.

Page 21: Decoders

X Y Z C S

0 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 1 + 1 + 1 = 11

0 + 1 + 1 = 10 C(X,Y,Z) = m(3,5,6,7)S(X,Y,Z) = m(1,2,4,7)

Page 22: Decoders

• Here, two 3-to-8 decoders implement C and S as sums of minterms.

• The “+5V” symbol (“5 volts”) is how you represent a constant 1 or true in LogicWorks. We use it here so the decoders are always active.

Decoder-based adder

C(X,Y,Z) = m(3,5,6,7)S(X,Y,Z) = m(1,2,4,7)

Page 23: Decoders

•Design a two bit comparator , using suitable decoder which provides 1 as output only if

A=BA>B

Page 24: Decoders

A B A=B A>BA1 A2 B1 B20 0 0 0 1 00 0 0 1 0 00 0 1 0 0 00 0 1 1 0 00 1 0 0 0 10 1 0 1 1 00 1 1 0 0 00 1 1 1 0 01 0 0 0 0 11 0 0 1 0 11 0 1 0 1 01 0 1 1 0 01 1 0 0 0 11 1 0 1 0 11 1 1 0 0 11 1 1 1 1 0

A=B(A,B) = m(0,5,10,15)

A>B(A,B) = m(4,8,9,12,13,14)

Page 25: Decoders

Design Using Decoder

• F1 = A' B C' D + A' B' C D + A B C D• F2 = A B C' D' + A B C• F3 = (A' + B' + C' + D')

Page 26: Decoders

A ‘B’C’D’ A ‘B’C’D A ‘B’CD’A ‘B’CD A ‘BC’D’ A ‘BC’D A ‘BCD’ A ‘ BCD A B’C’D’ A B’C’D A B’CD’ A B’CD

A B C’D’A B C’D A B C D’ A B C D

A1

A2

B1

B2

`

0 1 2 3 4 5 6 7 8 9

10 1 1 12 13 14 15

4:16 dec

Enb

A=B(A,B) = m(0,5,10,15)

Page 27: Decoders

Encoders

• An encoder performs the inverse operation of a decoder,

• It has 2n inputs, and n output lines. • Only one input can be logic 1 at any given time

(active input). All other inputs must be 0’s.

Page 28: Decoders
Page 29: Decoders

Example

3:8 decoder

O0 O1

O2

A

B

C

S2

S1

S0

O3

O4

O5

O6

O7

8:3 encoder

I0 I1

I2

A

B

C

Z2

Z1

Z0

I3

I4

I5

I6

I7

Page 30: Decoders

30

Encoder Circuit Design• Example:

– 8-3 Binary Encoder

A0 = D1 + D3 + D5 + D7

A1 = D2 + D3 + D6 + D7

A2 = D4 + D5 + D6 + D7

Page 31: Decoders

• Note that not all input combinations are valid. • Valid combinations are those which have

exactly one input equal to logic 1 while all other inputs are logic 0’s.

• Since, the number of inputs = 8, K-maps cannot be used to derive the output Boolean expressions.

Page 32: Decoders

32

Application

The number of inputs: large

fewer lines

Page 33: Decoders

Limitations• Only one input can be active at any given time• Can we Design a Circuit which can have two ones

as input

Page 34: Decoders

Priority Encoders

• Use a Priority Encoder which produces the output corresponding to the input with higher priority.

• In the example, if E3 = E6 = 1, the output corresponding to E6 will be produced since E6 has higher priority than E3.

Page 35: Decoders

I1 i2 i3 i4 o1 o2

Page 36: Decoders
Page 37: Decoders
Page 38: Decoders