11-dec - 9/21/09 Decoding ECE2030 Introduction to Computer...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 9/21/09 Decoding ECE2030 Introduction to Computer Engineering Lecture 10: Combinational Logic 1 2 •  Decoding - the conversion of an n-bit input code to an m-bit output code with n ≤ m ≤ 2n such that each valid code word produces a unique output code •  Circuits that perform decoding are called decoders •  Here, functional blocks for decoding are •  called n-to-m line decoders, where m ≤ 2n, and •  generate 2n (or fewer) minterms for the n input variables 1-to-2-Line Decoder 0 D0 1 0 1 1 0 N-to-M-Line Decoder (2 ≥ M) D0 A0 A1 D1 D2 D3 A1 0 0 1 1 A0 D3 D2 D1 D0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 N A D1 3 4 1 9/21/09 2-to-4-Line Decoder A1 A1 A0 D0 2-to-4-Line Decoder w/ Enable D1 0 1 0 0 D0 1 0 0 0 A0 A1 En D0 D1 D2 D3 0 0 1 0 En A1 A0 D 3 0 1 1 1 1 X 0 0 1 1 X 0 1 0 1 0 0 0 0 1 D 2 0 0 0 1 0 D 1 0 0 1 0 0 D 0 0 1 0 0 0 A0 0 1 0 1 D3 0 0 0 1 D2 0 0 1 1 D2 D1 D3 How about if no one should be enabled ? 5 6 2-to-4-Line Decoder w/ Enable En A1 A0 D0 3-to-8-Line Decoder Truth Table A2 0 0 0 0 1 1 A1 0 0 1 1 0 0 1 1 A0 0 1 0 1 0 1 0 1 D 7 0 0 0 0 0 0 0 1 D 6 0 0 0 0 0 0 1 0 D 5 0 0 0 0 0 1 0 0 D 4 0 0 0 0 1 0 0 0 D 3 0 0 0 1 0 0 0 0 D 2 0 0 1 0 0 0 0 0 D 1 0 1 0 0 0 0 0 0 D 0 1 0 0 0 0 0 0 0 En A1 A0 D 3 0 1 1 D1 D 2 0 0 0 1 0 D 1 0 0 1 0 0 D 0 0 1 0 0 0 X 0 0 1 1 X 0 1 0 1 0 0 0 0 1 1 1 D2 D3 1 1 7 8 2 9/21/09 3-to-8-Line Decoder Truth Table A2 0 0 0 0 1 1 1 1 A1 0 0 1 1 0 0 1 1 A0 0 1 0 1 0 1 0 1 D 7 0 0 0 0 0 0 0 1 D 6 0 0 0 0 0 0 1 0 D 5 0 0 0 0 0 1 0 0 D 4 0 0 0 0 1 0 0 0 D 3 0 0 0 1 0 0 0 0 D 2 0 0 1 0 0 0 0 0 D 1 0 1 0 0 0 0 0 0 D 0 1 0 0 0 0 0 0 0 3-to-8-Line Decoder A0 A1 A2 D0 A0 A1 En D1 D2 D3 D0 D1 D2 D3 A2 0 0 0 0 A1 0 0 1 1 0 0 1 1 A0 0 1 0 1 0 1 0 1 D7 0 0 0 0 0 0 0 1 D6 0 0 0 0 0 0 1 0 D5 0 0 0 0 0 1 0 0 D4 0 0 0 0 1 0 0 0 D3 0 0 0 1 0 0 0 0 D2 0 0 1 0 0 0 0 0 D1 0 1 0 0 0 0 0 0 D0 1 0 0 0 0 0 0 0 D0 A0 A1 En D1 D2 D3 D4 D5 D6 D7 1 1 1 1 9 10 Implementing Logic w/ Decoder BCD-to-7-Segment Decoder •  Another kind of decoder D0 A0 A1 A2 D1 D2 D3 D4 D5 D6 D7 BCD-to-7Segment Decoder a b c d e f g 11 12 3 9/21/09 BCD-to-7-Segment Decoder •  Another kind of decoder a b BCD-to-7Segment Decoder c d e f g d e f BCD-to-7-Segment Decoder •  Decode “2” and show a b 0 0 1 1 0 BCD-to-7Segment Decoder 1 1 0 1 a b c d e f g e f a b g c g c 1 0 d 13 14 BCD-to-7-Segment Decoder •  Decode “4” and show 0 1 0 1 0 0 0 1 1 BCD-to-7Segment Decoder 0 0 1 1 a b c d e f g d e f a b g c 2 3 4 5 6 7 8 9 >10 15 16 BCD-to-7-Seg. Decoder Truth Table A 0 0 0 0 0 0 0 0 1 1 B 0 0 0 0 1 1 1 1 0 0 C 0 0 1 1 0 0 1 1 0 0 D 0 1 0 1 0 1 0 1 0 1 a 1 0 1 1 0 1 0 1 1 1 0 b 1 1 1 1 1 0 0 1 1 1 0 c 1 1 0 1 1 1 1 1 1 1 0 d 1 0 1 1 0 1 1 0 1 0 0 e 1 0 1 0 0 0 1 0 1 0 0 f 1 0 0 0 1 1 1 0 1 1 0 g 0 0 1 1 1 1 1 0 1 1 0 All other inputs 4 9/21/09 Design Each Output Individually “a” A 0 1 2 3 4 5 6 7 8 9 >10 17 Design Each Output Individually “b” A B 0 0 0 0 1 1 1 1 0 0 C 0 0 1 1 0 0 1 1 0 0 D 0 1 0 1 0 1 0 1 0 1 b 1 1 1 1 1 0 0 1 1 1 0 AB CD 00 1 1 0 1 01 1 0 0 1 11 1 1 0 0 10 1 0 0 0 B 0 0 0 0 1 1 1 1 0 0 C 0 0 1 1 0 0 1 1 0 0 D 0 1 0 1 0 1 0 1 0 1 a 1 0 1 1 0 1 0 1 1 1 0 18 0 0 0 0 0 0 0 0 1 1 AB CD 00 1 0 0 1 01 0 1 0 1 11 1 1 0 0 10 1 0 0 0 0 1 2 3 4 5 6 7 8 9 >10 0 0 0 0 0 0 0 0 1 1 00 01 11 10 00 01 11 10 All other inputs All other inputs Encoding •  Encoding - the opposite of decoding - the conversion of m discrete inputs to a n-bit output code with n ≤ m ≤ 2n such that each of the inputs produces a unique output code •  Circuits that perform encoding are called encoders •  An encoder has 2n (or fewer) input lines and n output lines which generate the binary code corresponding to the input values •  Typically, an encoder converts a code containing exactly one bit that is 1 to a binary code corres -ponding to the position in which the 1 appears. •  Two types - inputs mutually exclusive or not 19 20 Encoder Example •  A decimal-to-excess 3 BCD encoder •  Inputs: 10 bits corresponding to decimal digits 0 through 9, (D0, …, D9) •  Outputs: 4 bits with excess 3 BCD codes •  Function: If input bit Di is a 1, then the output (A3, A2, A1, A0) is the excess 3 BCD code for i Di A3 A2 A1 A0 0 1 2 3 4 5 6 7 8 9 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 5 9/21/09 Encoder Example (continued) •  Input Di is a term in equation Aj if bit Aj is 1 in the binary value for i. •  Equations: A3 = D5 + D6 + D7 + D8 + D9 A2 = D1 + D2 + D3 + D4 + D9 A1 = D0 + D3 + D4 + D7 + D8 A0 = D0 + D2 + D4 + D6 + D8 M-to-N-Line Encoder (M≤2 ) N D0 A0 A1 En D1 D2 D3 D0 D1 D2 D3 Ac A0 A1 •  Note that if none of the inputs are asserted the output = "0000" (invalid excess 3 code) 21 22 4-to-2 Encoder D1 D0 00 D3 D2 00 D3 0 0 0 1 D2 0 0 1 0 D1 0 1 0 0 D0 1 0 0 0 A1 0 0 1 1 A0 0 1 0 1 01 11 10 X 0 X 1 For A0 01 0 X X X 11 X X X X 10 1 X X X D7 0 0 0 0 0 0 8-to-3 Encoder D6 0 0 0 0 0 0 1 0 D5 0 0 0 0 0 1 0 0 D4 0 0 0 0 1 0 0 0 D3 0 0 0 1 0 0 0 0 D2 0 0 1 0 0 0 0 0 D1 0 1 0 0 0 0 0 0 D0 1 0 0 0 0 0 0 0 A2 0 0 0 0 1 1 1 1 A1 0 0 1 1 0 0 1 1 A0 0 1 0 1 0 1 0 1 D1 D0 00 D3 D2 00 01 11 10 X 1 X 1 For A1 01 0 X X X 11 X X X X 10 0 X X X 0 1 Since Dx=1 only in one column at a time A0 = D1 + D3 A1 = D2 + D3 Since Dx=1 only in one column at a time A0 = D1 + D3 + D5 + D7 A1 = D2 + D3 + D6 + D7 A2 = D4 + D5 + D6 + D7 23 24 6 9/21/09 Priority Encoder •  If more than one input value is 1, then the encoder just designed does not work. •  One encoder that can accept all possible combinations of input values and produce a meaningful result is a priority encoder. •  Among the 1s that appear, it selects the most significant input position (or the least significant input position) containing a 1 and responds with the corresponding binary code for that position. Priority Encoder Example •  Priority encoder with 5 inputs (D4, D3, D2, D1, D0) - highest priority to most significant 1 present - Code outputs A2, A1, A0 and V where V indicates at least one 1 present. No. of Min -terms/Row 1 1 2 4 8 Inputs D4 0 0 0 0 0 D3 0 0 0 0 1 D2 0 0 0 1 X D1 0 0 1 X X D0 0 1 X X X A2 X 0 0 0 0 Outputs A1 X 0 0 1 1 A0 X 0 1 0 1 V 0 1 1 1 1 16 1 X X X X 1 0 0 1 •  Xs in input part of table represent 0 or 1; thus table entries correspond to product terms instead of minterms. The column on the left shows that all 32 minterms are present in the product terms in the table 26 25 Priority Encoder Example (continued) •  Could use a K-map to get equations, but can be read directly from table and manually optimized if careful: A2 = D4 A1 = D4 D3 + D4D3 D2 = D4 F1, F1 = (D3 + D2) A0 = D4 D3 + D4 D3D2 D1 =D4 (D3 + D2 D1) V = D4 + F1 + D1 + D0 Example 1 of an Encoder Only point to one single reading at a time. 27 28 7 9/21/09 Example 2 of an Encoder Amy Brian Cathy Dave Ellen Frank Gina Hugh 29 8-to-3 Priority Encoder D7 D6 0 0 0 0 0 0 0 1 D5 0 0 0 0 0 0 1 D4 0 0 0 0 0 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A2 0 0 0 0 0 1 1 1 1 A1 0 0 0 1 1 0 0 1 1 A0 0 0 1 0 1 0 1 0 1 Active 0 1 1 1 1 1 1 1 1 0 0 0 D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 Ac 0 ? 1 0 ? 1 0 ? 0 0 0 0 0 0 1 Active or not 0 1 30 4-to-2 Priority Encoder D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A1 0 0 0 1 1 A0 0 0 1 0 1 Active 0 1 1 1 1 4-to-2 Priority Encoder 10 0 1 1 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A1 0 0 0 1 1 A0 0 0 1 0 1 Active 0 1 1 1 1 D1 D0 00 D3 D2 00 01 11 10 0 1 1 1 For A1 01 0 1 1 1 11 0 1 1 1 D1 D0 00 D3 D2 00 01 11 10 0 0 1 1 For A0 01 0 0 1 1 11 1 0 1 1 10 1 0 1 1 Or using simplification property Or using simplification property 31 32 8 9/21/09 4-to-2 Priority Encoder D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A1 0 0 0 1 1 A0 0 0 1 0 1 Active 0 1 1 1 1 4-to-2 Priority Encoder Schematic D3 A1 D2 D1 D0 00 D3 D2 00 01 11 10 0 1 1 1 For Active 01 1 1 1 1 11 1 1 1 1 10 1 1 1 1 A0 D1 Active D0 33 34 8-to-3 Priority Encoder (A2) D7 0 0 0 0 0 0 0 0 1 D6 0 0 0 0 0 0 0 1 D5 0 0 0 0 0 0 1 D4 0 0 0 0 0 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A2 0 0 0 0 0 1 1 1 1 A1 0 0 0 1 1 0 0 1 1 A0 0 0 1 0 1 0 1 0 1 Active 0 1 1 1 1 1 1 1 1 8-to-3 Priority Encoder (A1) D7 0 0 0 0 0 0 0 0 1 D6 0 0 0 0 0 0 0 1 D5 0 0 0 0 0 0 1 D4 0 0 0 0 0 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A2 0 0 0 0 0 1 1 1 1 A1 0 0 0 1 1 0 0 1 1 A0 0 0 1 0 1 0 1 0 1 Active 0 1 1 1 1 1 1 1 1 35 36 9 9/21/09 8-to-3 Priority Encoder (A0) D7 0 0 0 0 0 0 0 0 1 D6 0 0 0 0 0 0 0 1 D5 0 0 0 0 0 0 1 D4 0 0 0 0 0 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A2 0 0 0 0 0 1 1 1 1 A1 0 0 0 1 1 0 0 1 1 A0 0 0 1 0 1 0 1 0 1 Active 0 1 1 1 1 1 1 1 1 8-to-3 Priority Encoder (All) D7 0 0 0 0 0 0 0 0 1 D6 0 0 0 0 0 0 0 1 D5 0 0 0 0 0 0 1 D4 0 0 0 0 0 1 D3 0 0 0 0 1 D2 0 0 0 1 D1 0 0 1 D0 0 1 A2 0 0 0 0 0 1 1 1 1 A1 0 0 0 1 1 0 0 1 1 A0 0 0 1 0 1 0 1 0 1 Active 0 1 1 1 1 1 1 1 1 37 38 10 ...
View Full Document

Ask a homework question - tutors are online