Digital Electronics
Encoders and Decoders
Decoders
           2
Decoders
 
     A decoder has
              N inputs
              2N outputs
 
     A decoder selects one of 2N outputs by decoding the binary value on
     the N inputs.
 
     The decoder generates all of the minterms of the N input variables.
              Exactly one output will be active for each combination of the inputs.
                                                                                       3
Decoders
                                                   W = A'.B'
                          Out0    W
        B       I0        Out1    X                X = A.B'
        A       I1        Out2    Y                Y = A'.B
                          Out3    Z
  msb                                              Z = A.B
                         Active-high outputs
            A        B      W       X          Y      Z
            0        0       1        0        0      0
            0        1       0        1        0      0
            1        0       0        0        1      0
            1        1       0        0        0      1
                                                               4
Decoders
                                                  W = (A'.B')'
                          Out0    W
        B       I0        Out1    X               X = (A.B')'
        A       I1        Out2    Y               Y = (A'.B)'
                          Out3    Z
  msb                                             Z = (A.B)'
                         Active-low outputs
            A        B      W       X         Y       Z
            0        0       0        1       1       1
            0        1       1        0       1       1
            1        0       1        1       0       1
            1        1       1        1       1       0
                                                                 5
Decoders
  msb
           6
Decoder with Enable
                                        Out0   W
                          B    I0
    high-level                          Out1   X
     enable               A    I1
                                        Out2   Y
                                        Out3   Z
                      Enable   En
                 En       A     B       W      X   Y   Z
                 1        0         0   1      0   0   0
                 1        0         1   0      1   0   0
 enabled
                 1        1         0   0      0   1   0
                 1        1         1   0      0   0   1
 disabled        0        x         x   0      0   0   0
                                                           7
Decoder with Enable
                                          Out0   W
                            B    I0
       low-level                          Out1   X
        enable              A    I1
                                          Out2   Y
                                          Out3   Z
                        Enable   En
                   En       A     B       W      X   Y   Z
                   0        0         0   1      0   0   0
                   0        0         1   0      1   0   0
 enabled
                   0        1         0   0      0   1   0
                   0        1         1   0      0   0   1
 disabled          1        x         x   0      0   0   0
                                                             8
Decoders
                     Exercise:
           Design a 4-to-16 decoder using
                2-to-4 decoders only.
                                            9
Encoders
           10
Encoders
 
     An encoder has
            2N inputs
            N outputs
 
     An encoder outputs the binary value of the selected (or
     active) input.
 
     An encoder performs the inverse operation of a decoder.
 
     Issues
            What if more than one input is active?
            What if no inputs are active?
                                                          11
Encoders
               D   I0
               C   I1       Out0   Z
               B   I2
                            Out1   Y
               A   I3
           A   B        C     D    Y   Z
           0   0        0     1    0   0
           0   0        1     0    0   1
           0   1        0     0    1   0
           1   0        0     0    1   1
                                           12
Priority Encoders
 
     If more than one input is active, the higher-order input
     has priority over the lower-order input.
             The higher value is encoded on the output
 
     A valid indicator, d, is included to indicate whether or not
     the output is valid.
             Output is invalid when no inputs are active
                 
                     d=0
             Output is valid when at least one input is active
                 
                     d=1
                                          Why is the valid indicator needed?
                                                                        13
Priority Encoders
                    msb
                          Valid bit
                                      14
Designing logic circuits using multiplexers
                                              15
Using an n-input Multiplexer
 
     Use an n-input multiplexer to realize a logic circuit for a
     function with n minterms.
         m = 2n, where m = # of variables in the function
 
     Each minterm of the function can be mapped to an input
     of the multiplexer.
 
     For each row in the truth table, for the function, where
     the output is 1, set the corresponding input of the
     multiplexer to 1.
         That is, for each minterm in the minterm expansion of the
          function, set the corresponding input of the multiplexer to 1.
 
     Set the remaining inputs of the multiplexer to 0.
                                                                       16
Using an n-input Mux
                                    Example:
   Using an 8-to-1 multiplexer, design a logic circuit to realize the following
                               Boolean function
                           F(A,B,C) = m(2, 3, 5, 6, 7)
                                                                        17
Using an n-input Mux
                                    Example:
   Using an 8-to-1 multiplexer, design a logic circuit to realize the following
                               Boolean function
                             F(A,B,C) = m(1, 2, 4)
                                                                        18
Using an (n / 2)-input Multiplexer
 
     Use an (n / 2)-input multiplexer to realize a logic circuit
     for a function with n minterms.
         m = 2n, where m = # of variables in the function
 
     Group the rows of the truth table, for the function, into
     (n / 2) pairs of rows.
         Each pair of rows represents a product term of (m – 1)
          variables.
         Each pair of rows can be mapped to a multiplexer input.
 
     Determine the logical function of each pair of rows in
     terms of the mth variable.
         If the mth variable, for example, is x, then the possible values
          are x, x', 0, and 1.
                                                                         19
Using an (n / 2)-input Mux
        Example: F(x,y,z) = m(1, 2, 6, 7)
                                             20
Using an (n / 2)-input Mux
     Example: F(A,B,C,D) = m(1,3,4,11,12–15)
                                                21
 Using an (n / 4)-input Mux
The design of a logic circuit using an (n / 2)-input multiplexer can be
     easily extended to the use of an (n / 4)-input multiplexer.
                                                                          22
Designing logic circuits using decoders
                                          23
Using an n-output Decoder
    Use an n-output decoder to realize a logic circuit for a
    function with n minterms.
    Each minterm of the function can be mapped to an output
    of the decoder.
    For each row in the truth table, for the function, where the
    output is 1, sum (or “OR”) the corresponding outputs of
    the decoder.
        That is, for each minterm in the minterm expansion of the
         function, OR the corresponding outputs of the decoder.
    Leave remaining outputs of the decoder unconnected.
                                                                     24
Using an n-output Decoder
                                  Example:
    Using a 3-to-8 decoder, design a logic circuit to realize the following
                             Boolean function
                         F(A,B,C) = m(2, 3, 5, 6, 7)
                                                                      25
Using an n-output Decoder
                                   Example:
   Using two 2-to-4 decoders, design a logic circuit to realize the following
                             Boolean function
                          F(A,B,C) = m(0, 1, 4, 6, 7)
                                                                      26
Questions?
             27