Decoders andDecodersWhat a decoder doesHow can you build a 2-to-4 decoder?A picture of a 2-to-4 decoderEnable inputsAn aside: abbreviated truth tablesBlocks and abstractionA 3-to-8 decoderSo what good is a decoder?Design example: additionDecoder-based adderUsing just one decoderSlide 14Slide 15Slide 16Slide 17MultiplexersSlide 19Slide 20Combinational circuit implementation using MUXSlide 22Slide 23Slide 24Example of MUX combo circuitSlide 264 Basic types of Flip-FlopsSlide 28Slide 29Gated D-LatchSlide 31Recap - Sequential SystemsSequential Systems - Cont.Slide 34Slide 35Slide 36D Flip-FlopT Flip-FlopJK – Flip FlopClocked JK – Flip FlopD and JK Flip-FlopSlide 42Slide 43Slide 44Slide 45How to use JK to implement D Flip-FlopHow to use JK to implement T Flip-FlopHow to use D to implement JK Flip-FlopSlide 49How to use T to implement JK Flip-FlopSlide 51How to use D to implement T Flip-FlopSlide 53How to use T to implement D Flip-FlopSlide 55Edge and level-triggered Flip FlopDecoders andSequential Circuits Prof. Sin-Min LeeDepartment of Computer ScienceDecoders•Next, we’ll look at some commonly used circuits: decoders and multiplexers.–These serve as examples of the circuit analysis and design techniques from last lecture.–They can be used to implement arbitrary functions.–We are introduced to abstraction and modularity as hardware design principles.•We often use decoders and multiplexers as building blocks in designing more complex hardware.What a decoder does•A n-to-2n decoder takes an n-bit input and produces 2n outputs. The n inputs represent a binary number that determines which of the 2n outputs is uniquely true.•A 2-to-4 decoder operates according to the following truth table.–The 2-bit input is called S1S0, and the four outputs are Q0-Q3.–If the input is the binary number i, then output Qi is uniquely true.•For instance, if the input S1 S0 = 10 (decimal 2), then output Q2 is true, and Q0, Q1, Q3 are all false.•This circuit “decodes” a binary number into a “one-of-four” code.S1 S0 Q0 Q1 Q2 Q30 0 1 0 0 00 1 0 1 0 01 0 0 0 1 01 1 0 0 0 1How can you build a 2-to-4 decoder?•Follow the design procedures from last time! We have a truth table, so we can write equations for each of the four outputs (Q0-Q3), based on the two inputs (S0-S1).•In this case there’s not much to be simplified. Here are the equations:S1 S0 Q0 Q1 Q2 Q30 0 1 0 0 00 1 0 1 0 01 0 0 0 1 01 1 0 0 0 1Q0 = S1’ S0’Q1 = S1’ S0Q2 = S1 S0’Q3 = S1 S0A picture of a 2-to-4 decoderS1 S0 Q0 Q1 Q2 Q30 0 1 0 0 00 1 0 1 0 01 0 0 0 1 01 1 0 0 0 1Enable inputs•Many devices have an additional enable input, which is used to “activate” or “deactivate” the device.•For a decoder,–EN=1 activates the decoder, so it behaves as specified earlier. Exactly one of the outputs will be 1.–EN=0 “deactivates” the decoder. By convention, that means all of the decoder’s outputs are 0.•We can include this additional input in the decoder’s truth table:EN S1 S0 Q0 Q1 Q2 Q30 0 0 0 0 0 00 0 1 0 0 0 00 1 0 0 0 0 00 1 1 0 0 0 01 0 0 1 0 0 01 0 1 0 1 0 01 1 0 0 0 1 01 1 1 0 0 0 1An aside: abbreviated truth tables•In this table, note that whenever EN=0, the outputs are always 0, regardless of inputs S1 and S0.•We can abbreviate the table by writing x’s in the input columns for S1 and S0. EN S1 S0 Q0 Q1 Q2 Q30 0 0 0 0 0 00 0 1 0 0 0 00 1 0 0 0 0 00 1 1 0 0 0 01 0 0 1 0 0 01 0 1 0 1 0 01 1 0 0 0 1 01 1 1 0 0 0 1EN S1 S0 Q0 Q1 Q2 Q30 x x 0 0 0 01 0 0 1 0 0 01 0 1 0 1 0 01 1 0 0 0 1 01 1 1 0 0 0 1•Decoders are common enough that we want to encapsulate them and treat them as an individual entity. •Block diagrams for 2-to-4 decoders are shown here. The names of the inputs and outputs, not their order, is what matters•A decoder block provides abstraction:–You can use the decoder as long as you know its truth table or equations, without knowing exactly what’s inside.–It makes diagrams simpler by hiding the internal circuitry.–It simplifies hardware reuse. You don’t have to keep rebuilding the decoder from scratch every time you need it.•These blocks are like functions in programming!Blocks and abstractionQ0 = S1’ S0’Q1 = S1’ S0Q2 = S1 S0’Q3 = S1 S0A 3-to-8 decoder•Larger decoders are similar. Here is a 3-to-8 decoder.–The block symbol is on the right.–A truth table (without EN) is below.–Output equations are at the bottom right.•Again, only one output is true for any input combination.S2 S1 S0 Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q70 0 0 1 0 0 0 0 0 0 00 0 1 0 1 0 0 0 0 0 00 1 0 0 0 1 0 0 0 0 00 1 1 0 0 0 1 0 0 0 01 0 0 0 0 0 0 1 0 0 01 0 1 0 0 0 0 0 1 0 01 1 0 0 0 0 0 0 0 1 01 1 1 0 0 0 0 0 0 0 1Q0 = S2’ S1’ S0’Q1 = S2’ S1’ S0Q2 = S2’ S1 S0’Q3 = S2’ S1 S0Q4 = S2 S1’ S0’Q5 = S2 S1’ S0Q6 = S2 S1 S0’Q7 = S2 S1 S0So what good is a decoder?•Do the truth table and equations look familiar?Decoders are sometimes called minterm generators.–For each of the input combinations, exactly one output is true.–Each output equation contains all of the input variables.–These properties hold for all sizes of decoders.•This means that you can implement arbitrary functions with decoders. If you have a sum of minterms equation for a function, you can easily use a decoder (a minterm generator) to implement that function.S1 S0 Q0 Q1 Q2 Q30 0 1 0 0 00 1 0 1 0 01 0 0 0 1 01 1 0 0 0 1Q0 = S1’ S0’Q1 = S1’ S0Q2 = S1 S0’Q3 = S1 S0Design example: addition•Let’s make a circuit that adds three 1-bit inputs X, Y and Z.•We will need two bits to represent the total; let’s call them C and S, for “carry” and “sum.” Note that C and S are two separate functions of the same inputs X, Y and Z.•Here are a truth table and sum-of-minterms equations for C and S.X Y Z C S0 0 0 0 00 0 1 0 10 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 11 + 1 + 1 = 110 + 1 + 1 = 10C(X,Y,Z) = m(3,5,6,7)S(X,Y,Z) = m(1,2,4,7)•Here, two 3-to-8 decoders implement C and S as sums of minterms.•The “+5V” symbol (“5 volts”) is how you represent a constant 1 or true in LogicWorks. We use it here so the decoders are always active.Decoder-based adderC(X,Y,Z) = m(3,5,6,7)S(X,Y,Z) = …
View Full Document