Presentation is loading. Please wait.

Presentation is loading. Please wait.

Instructor: Alexander Stoytchev CprE 281: Digital Logic.

Similar presentations


Presentation on theme: "Instructor: Alexander Stoytchev CprE 281: Digital Logic."— Presentation transcript:

1 Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ CprE 281: Digital Logic

2 Code Converters CprE 281: Digital Logic Iowa State University, Ames, IA Copyright © Alexander Stoytchev

3 Administrative Stuff HW 7 is out It is due next Monday (Oct 19) @ 4pm

4 Administrative Stuff The second midterm is in 2 weeks.

5 Administrative Stuff Midterm Exam #2 When: Friday October 30 @ 4pm. Where: This classroom What: Chapters 1, 2, 3, 4 and 5.1-5.8 The exam will be open book and open notes (you can bring up to 3 pages of handwritten notes).

6 Midterm 2: Format The exam will be out of 130 points You need 95 points to get an A It will be great if you can score more than 100 points.  but you can’t roll over your extra points 

7 Quick Review

8 Decoders

9 2-to-4 Decoder (Definition) Has two inputs: w 1 and w 0 Has four outputs: y 0, y 1, y 2, and y 3 If w 1 =0 and w 0 =0, then the output y 0 is set to 1 If w 1 =0 and w 0 =1, then the output y 1 is set to 1 If w 1 =1 and w 0 =0, then the output y 2 is set to 1 If w 1 =1 and w 0 =1, then the output y 3 is set to 1 Only one output is set to 1. All others are set to 0.

10 Truth Table and Graphical Symbol for a 2-to-4 Decoder [ Figure 4.13a-b from the textbook ]

11 Truth Logic Circuit for a 2-to-4 Decoder [ Figure 4.13c from the textbook ]

12 Adding an Enable Input [ Figure 4.13c from the textbook ] En

13 Truth Table and Graphical Symbol for a 2-to-4 Decoder with an Enable Input [ Figure 4.14a-b from the textbook ]

14 Truth Table and Graphical Symbol for a 2-to-4 Decoder with an Enable Input [ Figure 4.14a-b from the textbook ] x indicates that it does not matter what the value of these variable is for this row of the truth table

15 Graphical Symbol for a Binary n-to-2 n Decoder with an Enable Input [ Figure 4.14d from the textbook ] A binary decoder with n inputs has 2 n outputs The outputs of an enabled binary decoder are “one-hot” encoded, meaning that only a single bit is set to 1, i.e., it is hot.

16 w 2 w 0 y 0 y 1 y 2 y 3 w 0 En y 0 w 1 y 1 y 2 y 3 w 0 y 0 w 1 y 1 y 2 y 3 y 4 y 5 y 6 y 7 w 1 A 3-to-8 decoder using two 2-to-4 decoders [ Figure 4.15 from the textbook ]

17 A 4-to-16 decoder built using a decoder tree [ Figure 4.16 from the textbook ]

18 Let’s build a 5-to-32 decoder

19 Let’s build a 5-to-32 decoder y 0 – y 15 y 16 – y 31 En

20 Let’s build a 5-to-32 decoder y 0 – y 15 y 16 – y 31 En w4w4 w0w0 w1w1 w0w0 w1w1 w2w2 w3w3 w2w2 w3w3

21 Demultiplexers

22 1-to-4 Demultiplexer (Definition) Has one data input line: D Has two output select lines: w 1 and w 0 Has four outputs: y 0, y 1, y 2, and y 3 If w 1 =0 and w 0 =0, then the output y 0 is set to D If w 1 =0 and w 0 =1, then the output y 1 is set to D If w 1 =1 and w 0 =0, then the output y 2 is set to D If w 1 =1 and w 0 =1, then the output y 3 is set to D Only one output is set to D. All others are set to 0.

23 A 1-to-4 demultiplexer built with a 2-to-4 decoder [ Figure 4.14c from the textbook ]

24 A 1-to-4 demultiplexer built with a 2-to-4 decoder [ Figure 4.14c from the textbook ] output select lines the four output lines data input line D

25 Multiplexers (Implemented with Decoders)

26 w 1 w 0 w 0 En y 0 w 1 y 1 y 2 y 3 w 2 w 3 f s 0 s 1 1 A 4-to-1 multiplexer built using a 2-to-4 decoder [ Figure 4.17 from the textbook ]

27 Encoders

28 Binary Encoders

29 2 n inputs w 0 w 2 n 1– y 0 y n1– n outputs A 2 n -to-n binary encoder [ Figure 4.18 from the textbook ]

30 (b) Circuit w 1 w 0 y 0 w 2 w 3 y 1 0 0 1 1 1 0 1 w 3 y 1 0 y 0 0 0 1 0 w 2 0 1 0 0 w 1 1 0 0 0 w 0 0 0 0 1 (a) Truth table [ Figure 4.19 from the textbook ] A 4-to-2 binary encoder

31 (b) Circuit w 1 w 0 y 0 w 2 w 3 y 1 0 0 1 1 1 0 1 w 3 y 1 0 y 0 0 0 1 0 w 2 0 1 0 0 w 1 1 0 0 0 w 0 0 0 0 1 (a) Truth table [ Figure 4.19 from the textbook ] A 4-to-2 binary encoder ?

32 (b) Circuit w 1 w 0 y 0 w 2 w 3 y 1 0 0 1 1 1 0 1 w 3 y 1 0 y 0 0 0 1 0 w 2 0 1 0 0 w 1 1 0 0 0 w 0 0 0 0 1 (a) Truth table [ Figure 4.19 from the textbook ] A 4-to-2 binary encoder It is assumed that the inputs are one hot encoded

33 Priority Encoders

34 d 0 0 1 0 1 0 w 0 y 1 d y 0 11 0 1 1 1 1 z 1 x x 0 x w 1 0 1 x 0 x w 2 0 0 1 0 x w 3 0 0 0 0 1 [ Figure 4.20 from the textbook ] Truth table for a 4-to-2 priority encoder

35 Code Converter (Definition) Converts from one type of input encoding to a different type of output encoding.

36 Code Converter (Definition) Converts from one type of input encoding to a different type of output encoding. A decoder does that as well, but its outputs are always one-hot encoded so the output code is really only one type of output code. A binary encoder does that as well but its inputs are always one-hot encoded so the input code is really only one type of input code.

37 [ Figure 4.21 from the textbook ] A hex-to-7-segment display code converter

38 [ Figure 4.21 from the textbook ] A hex-to-7-segment display code converter

39 [ Figure 4.21 from the textbook ] A hex-to-7-segment display code converter

40 [ Figure 4.21 from the textbook ] A hex-to-7-segment display code converter

41 [ Figure 4.21 from the textbook ] A hex-to-7-segment display code converter

42 What is the circuit for this code converter? x 3 x 2 x 1 x 0

43 What is the circuit for this code converter? x 3 x 2 x 1 x 0 f(x 1, x 2, x 3, x 4 ) = Σ m(0, 2, 3, 5, 6, 7, 8, 9, 10, 12, 14, 15)

44 What is the circuit for this code converter? 1 0 0 1 1 1 1 1 1 0 1 1 1 1 0 1 x 3 x 2 x 1 x 0 f(x 1, x 2, x 3, x 4 ) = Σ m(0, 2, 3, 5, 6, 7, 8, 9, 10, 12, 14, 15)

45 What is the circuit for this code converter? x 3 x 2 x 1 x 0

46 What is the circuit for this code converter? 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 x 3 x 2 x 1 x 0 f(x 1, x 2, x 3, x 4 ) = Σ m(0, 2, 3, 5, 6, 8, 9, 11, 12, 13, 14)

47 Arithmetic Comparison Circuits

48 Truth table for a one-bit digital comparator [http://en.wikipedia.org/wiki/Digital_comparator]

49 [http://www.personal.psu.edu/users///c/w/cwb5096/Old%20Site/index_files/cmpenlab4.htm] A one-bit digital comparator circuit

50 Truth table for a two-bit digital comparator [http://en.wikipedia.org/wiki/Digital_comparator]

51 [http://forum.allaboutcircuits.com/showthread.php?t=10561] A two-bit digital comparator circuit

52 [ Figure 4.22 from the textbook ] A four-bit comparator circuit

53 Example Problems from Chapter 4

54 Example 1: SOP vs Decoders Implement the function f(w 1, w 2, w 3 ) = Σ m(0, 1, 3, 4, 6, 7) by using a 3-8 binary decoder and one OR gate.

55 w3w3 w2w2 w1w1 w2w2 w1w1 w0w0 1En y0y0 y1y1 y2y2 y3y3 y5y5 y4y4 y6y6 y7y7 [ Figure 4.44 from the textbook ] Solution Circuit f(w 1, w 2, w 3 ) = Σ m(0, 1, 3, 4, 6, 7)

56 Example 2: Implement an 8-to-3 binary encoder [ Figure 4.45 from the textbook ]

57 Example 2: Implement an 8-to-3 binary encoder [ Figure 4.45 from the textbook ] y 2 = w 4 +w 5 + w 6 + w 7 y 1 = w 2 + w 3 + w 6 + w 7 y 0 = w 1 + w 3 + w 5 + w 7

58 Example 3:Circuit implementation using a multiplexer Implement the function f(w 1, w 2, w 3, w 4, w 5 ) = w 1 w 2 w 4 w 5 + w 1 w 2 + w 1 w 3 + w 1 w 4 + w 3 w 4 w 5 using a 4-to-1 multiplexer

59 Some Boolean Algebra Leads To w 1 w 2 w 4 w 5 + w 1 w 2 + w 1 w 3 + w 1 w 4 + w 3 w 4 w 5 w 1 w 4 (w 5 w 2 ) + w 4 (w 3 w 5 ) + w 1 (w 2 + w 3 ) + w 1 w 4 (1) w 1 w 4 (w 5 w 2 ) + ( w 1 +w 1 )w 4 (w 3 w 5 ) + w 1 ( w 4 +w 4 ) (w 2 + w 3 ) + w 1 w 4 (1) w 1 w 4 (w 5 w 2 ) + w 1 w 4 (w 3 w 5 ) + w 1 w 4 (w 2 + w 3 ) + w 1 w 4 ( w 3 w 5 + (w 2 +w 3 ) + 1) w 1 w 4 (w 5 w 2 ) + w 1 w 4 (w 3 w 5 ) + w 1 w 4 (w 2 + w 3 ) + w 1 w 4 (1) Note that the split is by w 1 and w 4, not w 1 and w 2

60 [ Figure 4.46 from the textbook ] Solution Circuit

61 Some Final Things from Chapter 4

62 [ Figure 4.50 from the textbook ] A shifter circuit

63 0

64 0

65 0 w3w3 w2w2 w1w1 w0w0 No shift in this case.

66 A shifter circuit 1

67 1

68 1 0 w3w3 w2w2 w1w1 Shift to the right by 1 bit

69 A shifter circuit 1 0 w3w3 w2w2 w1w1 Shift to the right by 1 bit w0w0

70 [ Figure 4.51 from the textbook ] A barrel shifter circuit

71 Questions?

72 THE END


Download ppt "Instructor: Alexander Stoytchev CprE 281: Digital Logic."

Similar presentations


Ads by Google