COE/EE 243 Lect #20 Homework #5 passed out. More on encoders. Output of a decoder is normally more bits than its input code (3 to 8 decoder has 3 input bits and 8 output bits) If there are more input bits than its output code. Simplest is the 2^n inputs and n outputs. The input will be all 0's with a single 1. ______ | | I7-| | I6-| |- Y2 I5-| |- Y1 I4-| |- Y0 I3-| | I2-| | I1-| | I0-| | |______| I7 I6 I5 I4 I3 I2 I1 I0 | Y2 Y1 Y0 ------------------------|--------- 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 0 1 0 | 0 0 1 0 0 0 0 0 1 0 0 | 0 1 0 0 0 0 0 1 0 0 0 | 0 1 1 0 0 0 1 0 0 0 0 | 1 0 0 0 0 1 0 0 0 0 0 | 1 0 1 0 1 0 0 0 0 0 0 | 1 1 0 1 0 0 0 0 0 0 0 | 1 1 1 Y0 = I1 + I3 + I5 + I7 Y1 = I2 + I3 + I6 + I7 Y2 = I4 + I5 + I6 + I7 The decoder can be used to control 2^n devices with n bit codes with one (or fewer) devices active at the same time. The encoder will take input on one of the data lines, often from an external interface such as a sensor or a request for a service or interrupt. The output will be the address of the requestor. Need to ensure that only 1 bit on the inputs is 1 at the same time. As a way of error checking, can assign a priority to each bit. Result is called a priority encoder. H7 = I7 (give I7 the highest priority) H6 = I6*I7' H5 = I5*I6'*I7' H4 = I4*I5'*I6'*I7' . . . . . . . . . H0 = I0*I1'*I2'*I3'*I4'*I5'*I6'*I7' A2 = Y2 = H4 + H5 + H6 + H7 A1 = H2 + H3 + H6 + H7 A0 = H1 + H3 + H5 + H7 Add another output for the case where all are 0 IDLE = (I0+I2+I3+I4+I5+I6+I7)' 74x148 Priority Encoder: Note, the 74x148 is the TTL part number for a specific IC. The book presents several IC's this way. The x stands for LS, S, etc. ______ The numbers by the input correspond | | to the pin numbers on a dual inline 5 | | package EI-o| | | | 4 | | I7-o| | | | 3 | | 6 I6-o| |o- Y2 | | 2 | | 7 I5-o| |o- Y1 | | 1 | | 9 I4-o| |o- Y0 | | 13 | | I3-o| | | | 12 | | 14 I2-o| |o- GS | | 11 | | 15 I1-o| |o- EO | | 10 | | I0-o| | |______| Inverted inputs. Datasheets refer to I7_L instead of I7' When I7_L = 0 then that input is active (active low) EI is enable inputs EO is enable out, which is used when the outputs of this encoder feed another encoder. For example, if this encoder is active (EI = 0) and none of the inputs are 0, then EO = 0. For example if have 16 requests, can daisy chain these together GS is 0 whenever EI is 0 and none of one of the inputs is 0 group select (author refers to this as "got something") EI_L I7_L I6_L I5_L I4_L I3_L I2_L I1_L I0_L | A2_L A1_L A0_L GS_L EO_L ----------------------------------------------|-------------------------- 1 x x x x x x x x | 1 1 1 1 1 0 1 1 1 1 1 1 1 1 | 1 1 1 1 0 0 1 1 1 1 1 1 1 0 | 1 1 1 0 1 0 1 1 1 1 1 1 0 x | 1 1 0 0 1 0 1 1 1 1 1 0 x x | 1 0 1 0 1 0 1 1 1 1 0 x x x | 1 0 0 0 1 0 1 1 1 0 x x x x | 0 1 1 0 1 0 1 1 0 x x x x x | 0 1 0 0 1 0 1 0 x x x x x x | 0 0 1 0 1 0 0 x x x x x x x | 0 0 0 0 1 Example: Problem 5.47: Paraphrased problem description Use a 74x148 to realize a priority encoder with active high inputs and outputs. Retain I7 as the priority input, then I6, I5, etc. with I0 as the lowest. If no inputs are asserted then IDLE=1 and A2 =1, A1 = 1, and A0 = 1. The can be realized by adding external gates to the 74x148. In other cases it may just require swapping inputs around. The inputs can realized by simply placing inverters on between the input signals and the IC for the encoder. Similary the outputs can also go through inverters. This covers most of the requirement. Also inverting the EO output will meet the requirement for IDLE = 1 if not inputs present. In order to meet the requirement for output address to be 111 if there are no inputs requires extra gates since we would see 000 if no inputs are present with the inverters added. Since IDLE = 1 if there are no inputs, we can OR each output with IDLE to meet the desired behavior. See graphics file linked from this lecture on the course web page.