Decoders and Encoders 1 ECE 352 Digital System

  • Slides: 20
Download presentation
Decoders and Encoders 1 ECE 352 Digital System Fundamentals Decoders Encoders and Priority Encoders

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

Topics Decoders and Encoders • Decoders and Encoders 2 – Decoders – Encoders and

Topics Decoders and Encoders • Decoders and Encoders 2 – Decoders – Encoders and Priority Encoders

Decoders and Encoders • Converts an n-bit input codeword into a unique m-bit output

Decoders and Encoders • Converts an n-bit input codeword into a unique m-bit output code (called n-to-m or n: m decoder) – n ≤ m ≤ 2 n – There may be unused input and output codes… • Commonly, m = 2 n – Exactly one output is true (and the others are false) for any possible input combination – Each output represents one of the 2 n possible 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) 3

Decoders and Encoders Decoder Symbol Examples Inputs 4 Outputs

Decoders and Encoders Decoder Symbol Examples Inputs 4 Outputs

Decoders and Encoders 1: 2 Decoder 5 • One input, two outputs (2#inputs 21

Decoders and Encoders 1: 2 Decoder 5 • 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 Pay attention to labels! They explain which output pin is which (same for inputs if multiple inputs)…

Decoders and Encoders 2: 4 Decoder 6 • Two inputs, four outputs • The

Decoders and Encoders 2: 4 Decoder 6 • 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! Preferred pin order These outputs together say that the input was “ 01”

Decoders and Encoders Decoders 7 • Remember: each decoder output corresponds to a minterm

Decoders and Encoders Decoders 7 • 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 • Example: Use a decoder plus an OR gate to implement the “odd function” for 3 variables

Decoder Structure Decoders and Encoders • Each output is a minterm function that includes

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

Enable Signals Decoders and Encoders • Some decoders have an additional input called an

Enable Signals Decoders and Encoders • 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 9 – A bubble before the enable input – A bar over the enable signal name – A statement saying it is active-low

Adding an Enable Decoders and Encoders • Each output of the decoder is ANDed

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

Topics Decoders and Encoders • Decoders and Encoders 11 – Decoders – Encoders and

Topics Decoders and Encoders • Decoders and Encoders 11 – Decoders – Encoders and Priority Encoders

Encoder Decoders and Encoders • Performs the reverse operation of a decoder • Takes

Encoder Decoders and Encoders • Performs the reverse operation of a decoder • Takes up to 2 n inputs, produces n-bit output 12 – Implies that meaningful inputs have only a single bit set to 1 – Multiple 1 bits or no 1 bits would give erroneous output values This says that input #0 is a 1

Priority Encoder Decoders and Encoders • Can resolve the encoding problem of multiple 1’s

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

Priority Encoder w/Value Detect Decoders and Encoders • A variant of the priority encoder

Priority Encoder w/Value Detect Decoders and Encoders • A variant of the priority encoder has an additional output so that it can also detect all inputs equal 0 – Method 1: re-number inputs to start from 1 so an encoder output of all 0 s means there were no 1 s present – Method 2: output V (valid) is 1 if any 1 s 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 14

“X” Output Decoders and Encoders • Here we use the “X” to say that

“X” Output Decoders and Encoders • 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” 15

Example 4 -Input Encoder Behaviors Priority Encoder Decoders and Encoders Encoder D 3 D

Example 4 -Input Encoder Behaviors Priority Encoder Decoders and Encoders Encoder D 3 D 2 D 1 D 0 Y 1 Y 0 D 3 D 2 D 1 D 0 0 0 1 0 0 0 0 0 1 1 0 0 0 others 0 X X 1 0 0 1 1 X X 0 0 0 1 X X Y 1 Y 0 V 0 X X 1 0 0 X 0 1 X 1 0 X 1 1 0 1 1 An “X” on the input side of a truth table is a wildcard indicating all possible values 16 Valid Flag

Decoders and Encoders Decoding, Enabling 17 • These are all concepts • The ideas

Decoders and Encoders Decoding, Enabling 17 • These are all concepts • The ideas are more broad than the common examples shown on the previous slides • 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….

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

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

Design Example: Codes Decoders and Encoders Letter tiles that can be placed in the

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

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

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