14:332:231 DIGITAL LOGIC DESIGN Ivan Marsic, Rutgers University - - PDF document

14 332 231 digital logic design
SMART_READER_LITE
LIVE PREVIEW

14:332:231 DIGITAL LOGIC DESIGN Ivan Marsic, Rutgers University - - PDF document

14:332:231 DIGITAL LOGIC DESIGN Ivan Marsic, Rutgers University Electrical & Computer Engineering Fall 2013 Lecture #11: Encoders Encoders versus Decoders An encoder performs the inverse function as a decoder The simplest encoder


slide-1
SLIDE 1

1

14:332:231 DIGITAL LOGIC DESIGN

Ivan Marsic, Rutgers University Electrical & Computer Engineering Fall 2013

Lecture #11: Encoders

2 of 18

Encoders versus Decoders

  • An encoder performs the inverse function

as a decoder

  • The simplest encoder to build is a 2n-to-n

(binary encoder)

Decoder Encoder

slide-2
SLIDE 2

2

3 of 18

Example: A decimal-to-BCD encoder

  • A decimal-to-BCD encoder

– Inputs: 10 bits corresponding to decimal digits 0 through 9, (D0, …, D9) – Outputs: 4 bits with BCD codes – Function: If input bit Di is a “1”, then the output (A3, A2, A1, A0) is the BCD code for i

Encoder I9 I6 A3 A2 A0 A1 I0 I8 I7 D9 D8 D0 D7

Example: “7”, “3”, “8” “0111”, “0011”, “1000”

4 of 18

Truth table of the decimal-to-BCD encoder

  • From the truth table, encoder outputs:
  • We made use of the fact that only one input can be “1” at one time
  • Note that if none button is pushed, output is also “0000”
  • What if two buttons are pushed simultaneously? —E.g. D1 and D2

together: A0=A1=1 and A2=A3=0 (0011) which is the same as if D3 were pushed!

1 D8 1 D9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 A0 A1 A2 A3 D0 D1 D2 D3 D4 D5 D6 D7 Outputs Inputs

A3 = D8 + D9 A2 = D4 + D5 + D6 + D7 A1 = D2 + D3 + D6 + D7 A0 = D1 + D3 + D5 + D7 + D9

slide-3
SLIDE 3

3

5 of 18

Binary Encoders

Y0 = I1 + I3 + I5 + I7 Y1 = I2 + I3 + I6 + I7 Y3 = I4 + I5 + I6 + I7

Binary encoder I0 I1 I2 I2n–1 Y0 Y1 Yn–1 n outputs 2n inputs

Y0 Y1 Y2 I0 I1 I2 I3 I5 I6 I4 I7

■ General structure: ■ 8-to-3 encoder:

6 of 18

Priority Encoders

  • If more than one input value is “1”, then the encoder

just designed does not work properly

  • An encoder that can accept all possible combinations of

input values and produce a meaningful result is a priority encoder

  • Among the “1”s that appear, it selects the most

significant input position (or the least significant input position) containing a “1” and produces the corresponding binary code for that position

  • A system with 2n requestors and a “request encoder” that

indicates which request signal is asserted at any time:

Request encoder REQ1 REQ2 REQ3 REQN Requestor’s number Requests for service

slide-4
SLIDE 4

4

7 of 18

Exercise: Design a 4-input priority encoder with active low inputs

  • Highest priority is given to most significant input “1” present (I3 … I0)
  • Code outputs: A1, A0 and IDLE (indicates no input present)

Priority encoder I3 I0 A1 A0 IDLE I2 I1 ? 1 1 x x x 1 x x 1 1 x 1 1 1 1 1 1 x x 1 1 1 1 IDLE A0 A1 I0 I1 I2 I3 Outputs Inputs

Truth table:

H3 = I3 H2 = I2·I3 H1 = I1·I2·I3 H0 = I0·I1·I2·I3 A1 = H2 + H3 A0 = H1 + H3 IDLE = I3·I2·I1·I0

Intermediate variables: Encoder outputs:

8 of 18

Exercise: Design a 4-input priority encoder with active low inputs

  • Highest priority is given to most significant input “1” present (I3 … I0)
  • Code outputs: A1, A0 and IDLE (indicates no input present)
  • We could use a Karnaugh map to get equations, but can be read

directly from the truth table and manually optimized if careful:

Priority encoder I3 I0 A1 A0 IDLE I2 I1 ? 1 1 x x x 1 x x 1 1 x 1 1 1 1 1 1 x x 1 1 1 1 IDLE A0 A1 I0 I1 I2 I3 Outputs Inputs

Truth table:

A1 = I3·I2 + I3 = I2 + I3 A0 = I3·I2·I1 + I3 = I2·I1 + I3 IDLE = I3·I2·I1·I0

X·Y + X = [ (T2) X + 1 = 1 ] X·Y + X·(Y+1) = X·Y + X·Y + X = [ (T10) X  Y + X  Y = X ] Y + X

slide-5
SLIDE 5

5

9 of 18

8-input Priority Encoder

  • Logic symbol for a generic 8-input priority encoder

Priority encoder I7 I4 I2 A2 A1 IDLE A0 I0 I6 I5 I3 I1

10 of 18

A Generic 8-input Priority Encoder

  • Truth table

1 1 x 1 1 x x 1 1 1 x x x 1 1 x x x x 1 1 1 x x x x x 1 1 1 x x x x x x 1 1 1 1 x x x x x x x 1 1 IDLE A0 A1 A2 I0 I1 I2 I3 I4 I5 I6 I7 Outputs Inputs

Priority encoder I7 I4 I2 A2 A1 IDLE A0 I0 I6 I5 I3 I1

slide-6
SLIDE 6

6

11 of 18

Priority-Encoder Logic Equations

Define intermediate variables, s.t. Hi is “1” if and only if Ii is the highest-priority input: H7 = I7 H6 = I6 · I7 H5 = I5 · I6 · I7 ··· H0 = I0 · I1 · I2 · I3 · I4 · I5 · I6 · I7 Encoder outputs: A2 = H4 + H5 + H6 + H7 A1 = H2 + H3 + H6 + H7 A0 = H1 + H3 + H5 + H7 The IDLE output is “1” if no inputs are “1”: IDLE = (I0 + I1 + I2 + I3 + I4 + I5 + I6 + I7) = I0 · I1 · I2 · I3 · I4 · I5 · I6 · I7

Priority encoder I7 I4 I2 A2 A1 IDLE A0 I0 I6 I5 I3 I1 12 of 18

74x148 8-input Priority Encoder

  • Active-low I/O
  • EI = Enable Input
  • GS = Group Select (“Got Something”, as opposed to IDLE=“Got Nothing”)

– One or more of the request inputs are asserted and EI is asserted

  • EO = Enable Output

– No request input is asserted and EI is asserted (corresponds to IDLE)

Generic priority encoder I7 I4 I2 A2 A1 IDLE A0 I0 I6 I5 I3 I1

6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

slide-7
SLIDE 7

7

13 of 18

Truth Table for a 74x148 Encoder

1 1 x x x x x x x I1_L 1 x x x x x x x x I0_L 1 EI_L 1 1 1 1 1 1 A0_L 1 1 x x x x 1 1 1 1 x x x 1 1 1 1 1 x x 1 x x x x x 1 1 1 1 1 1 x 1 1 1 1 1 1 1 1 1 GS_L 1 1 1 1 A1_L 1 1 1 1 A2_L 1 1 1 x I4_L 1 1 1 x I3_L 1 1 1 x I2_L 1 1 1 1 1 1 1 1 1 1 1 1 x x x EO_L I7_L I6_L I5_L Outputs Inputs selected pass

6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

14 of 18

74x148 Logic Circuit

  • 74x148:

– Enable Input (EI) must be asserted for any output to be asserted – Group Select (GS) is asserted if ≥1 inputs are asserted and EI is asserted – Enable Output (EO) is asserted if no input is asserted and EI is asserted

EO_L GS_L A0_L A1_L A2_L I0_L EI_L I2_L I3_L I4_L I5_L I6_L I7_L I1_L

(10) (11) (12) (13) (1) (2) (3) (4) (5) (15) (14) (9) (7) (6)

slide-8
SLIDE 8

8

15 of 18

Example 74x148 Outputs

■ 74x148 the A0_L output: A0_L = 0 for I7_L, I5_L, I3_L, I1_L A0_L = (EI·I7 + EI·I6_L·I5 + EI·I6_L·I4_L·I3 + + EI·I6_L·I4_L·I2_L·I1) ■ 74x148 the A1_L output: A1_L = 0 for I7_L, I6_L, I3_L, I2_L A1_L = (EI·I7 + EI·I6 + EI·I5_L·I4_L·I3 + + EI·I5_L·I4_L·I2)

16 of 18

Cascading Priority Encoders

■ 32-input priority encoder using four cascaded 74x148s

REQ31_L REQ30_L REQ29_L REQ28_L REQ27_L REQ26_L REQ25_L REQ24_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ23_L REQ22_L REQ21_L REQ20_L REQ19_L REQ18_L REQ17_L REQ16_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ15_L REQ14_L REQ13_L REQ12_L REQ11_L REQ10_L REQ9_L REQ8_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ7_L REQ6_L REQ5_L REQ4_L REQ3_L REQ2_L REQ1_L REQ0_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO RA2

4 2 1 6

U6

5

74x00 RA3

5 4 6

U5 74x00 RA4

2 1 6

U5 74x00 RA1

11 10 9 8

U6

13

74x00 RA0

4 2 1 6

U7

5

74x00 RGS

12 10 9 8

U7

13

74x00 U4 U3 U2 U1 G3A2_L G3A1_L G3A0_L G3GS_L G3EO_L G2EO_L G1EO_L G2A2_L G2A1_L G2A0_L G2GS_L G1A2_L G1A1_L G1A0_L G1GS_L G0A2_L G0A1_L G0A0_L G0GS_L

slide-9
SLIDE 9

9

17 of 18

Cascading Priority Encoders

■ EO_L is used for cascading to Enable Input

  • f a lower-priority 74x148

■ If none of the requests

  • n the highest priority

encoder is asserted (i.e., it’s IDLE), the next decoder in the cascade is enabled, etc. ■ RA4-RA0 encode the highest-priority requestor

REQ31_L REQ30_L REQ29_L REQ28_L REQ27_L REQ26_L REQ25_L REQ24_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ23_L REQ22_L REQ21_L REQ20_L REQ19_L REQ18_L REQ17_L REQ16_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ15_L REQ14_L REQ13_L REQ12_L REQ11_L REQ10_L REQ9_L REQ8_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO

REQ7_L REQ6_L REQ5_L REQ4_L REQ3_L REQ2_L REQ1_L REQ0_L 6 11 12 13 1 2 3 4 5 9 7 10 15 14

74x148 A2 A1 A0 EI I7 I6 I5 I4 I3 I2 I1 I0 GS EO RA2

4 2 1 6

U6

5

74x00 RA3

5 4 6

U5 74x00 RA4

2 1 6

U5 74x00 RA1

11 10 9 8

U6

13

74x00 RA0

4 2 1 6

U7

5

74x00 RGS

12 10 9 8

U7

13

74x00 U4 U3 U2 U1 G3A2_L G3A1_L G3A0_L G3GS_L G3EO_L G2EO_L G1EO_L G2A2_L G2A1_L G2A0_L G2GS_L G1A2_L G1A1_L G1A0_L G1GS_L G0A2_L G0A1_L G0A0_L G0GS_L

18 of 18

Some outputs of the four 74x148 cascade

  • RA3 is “1” when 8–15 and 24–31 lines are

requesting

RA3 = G1·GS + G3·GS

  • RA1 is “1” when the second digit of the

request is “1”

RA1 = G0·A1 + G1·A1 + G2·A1 + G3·A1

  • RCS is “1” when there is a request

RGS = G0·GS + G1·GS + G2·GS + G3·GS