Understanding Decoders and Encoders in Digital Systems

Slide Note
Embed
Share

Decoders and encoders are essential components in digital systems that convert input signals into specific output codes. Decoders, such as 1:2 and 2:4 decoders, translate n-bit input codewords into m-bit output codes, where m = 2^n. Encoders perform the opposite function, encoding multiple inputs into a smaller number of outputs. These functional blocks are fundamental in various logic circuits for tasks like addressing. Understanding how decoders work is crucial for implementing logical functions efficiently.


Uploaded on Aug 01, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. ECE 352 Digital System Fundamentals Decoders and Encoders Decoders Encoders and Priority Encoders 1 1

  2. Topics Decoders and Encoders Decoders Encoders and Priority Encoders Decoders and Encoders 2 2

  3. Decoder Converts an n-bit input codeword into a unique m-bit output code (called n-to-m or n:m decoder) n m 2n There may be unused input and output codes Commonly, m = 2n Exactly one output is true (and the others are false) for any possible input combination Each output represents one of the 2npossible minterms of an n-input function An output is true if the current input values correspond to the minterm for that output Fundamental functional block that is used in many other logic circuits (e.g., addressing) Decoders and Encoders 3 3

  4. Decoder Symbol Examples DEC 1:2 DEC 2:4 DEC 3:8 IN 1 0 1 3 2 1 0 2 7 6 5 4 3 2 1 0 0 1 Decoders and Encoders 0 Inputs Outputs 4 4

  5. 1:2 Decoder One input, two outputs (2#inputs 21 2) The input value indicates which one of the outputs will be 1 (the other output will be zero) The outputs must be labeled so we know which is output 1 and which is output 0 The top output does not have to be the higher number Decoders and Encoders DEC 1:2 DEC 1:2 DEC 1:2 0 0 1 1 1 0 0 1 0 IN 1 0 IN 1 0 IN 0 1 Pay attention to labels! They explain which output pin is which (same for inputs if multiple inputs) 5 5

  6. 2:4 Decoder Two inputs, four outputs The input can be interpreted as a binary number, and that number indicates which output will be 1 Inputs/outputs need to be labeled if more than one You should put them in an order that makes sense Pay attention to labels! Decoders and Encoders DEC 2:4 DEC 2:4 DEC 2:4 0 0 0 1 0 0 1 1 0 1 3 2 1 0 0 1 3 2 1 0 1 0 0 0 0 0 0 1 0 1 0 2 1 0 1 3 These outputs together say that the input was 01 Preferred pin order 6 6

  7. Decoders Remember: each decoder output corresponds to a minterm of the input set Can use a decoder with an OR gate to implement functions in sum-of-minterms form Decoders and Encoders Example: Use a decoder plus an OR gate to implement the odd function for 3 variables 7 7

  8. Decoder Structure Each output is a minterm function that includes every input variable DEC 1:2 Decoders and Encoders IN Y1 Y0 1:2 decoder Can use hierarchy to create a larger decoder from a smaller one... A decoder computes part of each output minterm based on a subset of the inputs Add logic to complete the minterms 8 8

  9. Enable Signals Some decoders have an additional input called an enable Many times the names for things are a hint as to what they mean An enabled decoder operates normally the outputs of a disabled decoder are ALL 0 Need to know if enable is active-high or active-low Active-high enable: decoder is enabled when enable is 1 Active-low enable: decoder is enabled when enable is 0 Can indicate active-low several ways A bubble before the enable input A bar over the enable signal name A statement saying it is active-low DEC 1:2 1 0 0 0 IN EN 1 0 Decoders and Encoders 9 9

  10. Adding an Enable Each output of the decoder is ANDed with the enable signal (for an active-high enable) Decoders and Encoders 10 10

  11. Topics Decoders and Encoders Decoders Encoders and Priority Encoders Decoders and Encoders 11 11

  12. Encoder Performs the reverse operation of a decoder Takes up to 2n inputs, produces n-bit output Implies that meaningful inputs have only a single bit set to 1 Multiple 1 bits or no 1 bits would give erroneous output values Decoders and Encoders ENC 8:3 0 1 7 6 5 4 3 2 1 0 2 1 0 1 1 ENC 4:2 0 0 ENC 2:1 0 1 0 0 0 1 3 2 1 0 0 1 0 0 0 0 1 0 Y 1 0 0 This says that input #0 is a 1 0 12 12

  13. Priority Encoder Can resolve the encoding problem of multiple 1 s by assigning each a priority Design encoder so that the output is the code that corresponds to the highest-priority input that is 1 Can prioritize 1s at higher-numbered positions Output is then the highest input # where the input is 1 Decoders and Encoders PRI 4:2 PRI 4:2 PRI 4:2 1 1 1 0 1 0 1 1 0 1 0 0 1 0 0 3 2 1 0 1 3 2 1 0 1 3 2 1 0 1 1 0 1 0 0 0 There s still a problem what if all the inputs are 0? 13 13

  14. Priority Encoder w/Value Detect A variant of the priority encoder has an additional output so that it can also detect all inputs equal 0 PRI 4 PRI 4 Decoders and Encoders Method 1: re-number inputs to start from 1 so an encoder output of all 0s means there were no 1s present 0 0 0 0 0 1 1 0 0 1 4 2 1 0 4 2 1 0 0 0 0 0 3 3 2 2 1 1 Method 2: output V (valid) is 1 if any 1s on inputs If the valid flag is 0, the other outputs are meaningless The X s on the output mean the value is not specified PRI 4 PRI 4 0 0 0 0 X 0 1 0 1 1 3 2 1 0 1 3 2 1 0 1 X 0 0 0 0 1 V V 14 14

  15. X Output Here we use the X to say that the output value is not specified by the circuit s requirements An output labeled as X will actually be a 1 or 0, because those are the only valid options But you shouldn t depend on it to be one of these in particular, because the actual value isn t specified e.g., two different priority encoders may have different output values when all inputs are 0 Generally also means that the circuit design uses don t-cares If all inputs are 0, then V=0 but we don t care about the other outputs Decoders and Encoders PRI 4 0 0 0 0 X 3 2 1 0 1 X 0 0 V 15 15

  16. Example 4-Input Encoder Behaviors Valid Flag Priority Encoder Encoder Decoders and Encoders D3 D2 D1 D0 0 0 0 0 0 0 0 1 0 0 1 X 0 1 X X 1 X X X Y1 Y0 V X X 0 0 0 1 0 1 1 1 0 1 1 1 1 D3 D2 D1 D0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 others Y1 Y0 X X 0 0 0 1 1 0 1 1 X X An X on the input side of a truth table is a wildcard indicating all possible values 16 16

  17. Decoding, Encoding, Enabling These are all concepts The ideas are more broad than the common examples shown on the previous slides Decoders and Encoders Example: BCD to 7-segment Decoder Inputs 4-bit BCD value Outputs 7 bits, one per segment of the display Decodes the BCD value to determine which segments are lit May include an enable to allow turning the display off regardless of the BCD value . 3 2 1 0 A B C D E F G EN 17 17

  18. Design Example: Codes Decoders and Encoders Toy: 6 Switches 18 18

  19. Design Example: Codes Letter tiles that can be placed in the slot have posts on the bottom that press the switches Decoders and Encoders Different letter tiles have different post positions (different codes!) 19 19

  20. ECE 352 Digital System Fundamentals Decoders and Encoders Decoders Encoders and Priority Encoders 20 20

Related


More Related Content