Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 151: Digital Design Chapter 3 3-8: Encoding. CS 151 Encoding Encoding - the opposite of decoding - the conversion of a maximum of 2 n input code to.

Similar presentations


Presentation on theme: "CS 151: Digital Design Chapter 3 3-8: Encoding. CS 151 Encoding Encoding - the opposite of decoding - the conversion of a maximum of 2 n input code to."— Presentation transcript:

1 CS 151: Digital Design Chapter 3 3-8: Encoding

2 CS 151 Encoding Encoding - the opposite of decoding - the conversion of a maximum of 2 n input code to an n-bit output code such that each valid code word produces a unique output code. Circuits that perform encoding are called encoders. An encoder has 2 n (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 corresponding to the position in which the 1 appears.

3 CS 151 Encoder Example-1 Octal-to Binary Encoder 1. Specifications:  Inputs: the 8 octal digits D 0 -D 7  Output: the 3-bit binary code corresponding to the input octal digit.  Assumptions: Only one input has a value of 1 at any time. 2. Truth table: A 2 = D 4 +D 5 +D 6 +D 7 A 1 = D 2 +D 3 +D 6 +D 7 A 0 =D 1 +D 3 +D 5 +D 7 The encoder can be implemented with 3 OR gates.

4 CS 151 Encoder Example-2 A decimal-to-BCD encoder  Inputs: 10 bits corresponding to decimal digits 0 through 9, (D 0, …, D 9 )  Outputs: 4 bits with BCD codes  Function: If input bit D i is a 1, then the output (A 3, A 2, A 1, A 0 ) is the BCD code for i, The truth table could be formed, but alternatively, the equations for each of the four outputs can be obtained directly.

5 CS 151 Encoder Example-2 (continued) Input D i is a term in equation A j if bit A j is 1 in the binary value for i. Equations: A 3 = D 8 + D 9 A 2 = D 4 + D 5 + D 6 + D 7 A 1 = D 2 + D 3 + D 6 + D 7 A 0 = D 1 + D 3 + D 5 + D 7 + D 9 F 1 = D 6 + D 7 can be extracted from A 2 and A 1 Is there any cost saving?

6 CS 151 Priority Encoder Problem 1: If more than one input value is 1, then the encoder just designed does not work. (E.g. if D 3 and D 6 are both 1, what is the output?) Solution: One encoder that can accept all possible combinations of input values and produce a meaningful result is a priority encoder. Priority encoders establish an input priority to ensure that only one input is encoded. Among the 1s that appear, it selects the most significant input position containing a 1 and responds with the corresponding binary code for that position.

7 CS 151 Priority Encoder Problem 2: When all inputs are equal to 0, an output of all 0’s is generated- but this is the same output for D 0 ??? Solution: Provide one more output (v) to indicate that at least one input is equal to 1.

8 CS 151 Priority Encoder Example Priority encoder with 4 inputs (D 3, D 2, D 1, D 0 ) - highest priority to most significant 1 present - Code outputs A2, A1, A0 and V where V indicates at least one 1 present. 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 16 minterms are present in the product terms in the table. No. of Min- terms/Row inputsoutputs D3D2D1D0A1A0V 10000XX0 10001001 2001X011 401XX101 81XXX111 X’s in output represent don’t cares Condensed truth table A 1 = D 3 ’D 2 + D 3 A 0 = D 3 ’D 2 ’D 1 + D 3 V = D 0 + D 1 + D 2 + D 3

9 CS 151 What does the full truth table look like? InputsOutputs D3D3 D2D2 D1D1 D0D0 A1A1 A0A0 V 0000XX0 0001001 0010011 0011011 0100101 0101101 0110101 0111101 1000111 1001111 1010111 1011111 1100111 1101111 1110111 1111111 D 0 =X D 1 =X D 0 =X D 2 =X D 1 =X D 0 =X Priority Encoder Example

10 CS 151 Priority Encoder Example A 1 = D 3 ’D 2 + D 3 A 0 = D 3 ’D 2 ’D 1 + D 3 V = D 0 + D 1 + D 2 + D 3

11 CS 151 Priority Encoder Example A 0 = D 3 + D 1 D 2 ’ A 1 = D 2 + D 3 V = D 0 + D 1 + D 2 + D 3

12 CS 151 In Class Exercise (Problem 4-11) Derive the truth table of a BCD-to-binary priority encoder. Where the highest priority is assigned to the least index among BCD inputs.


Download ppt "CS 151: Digital Design Chapter 3 3-8: Encoding. CS 151 Encoding Encoding - the opposite of decoding - the conversion of a maximum of 2 n input code to."

Similar presentations


Ads by Google