truth table 'table &+# In this table we see that as lon) as E is :ero, the outputs D0 to D2 will remain :ero, no matter whatever value !ou provide at the inputs "* "0, depicted b! two don
A
A 1
0
D
0
D
D
1
2
D
3
(i)ure 1 Implementation &%to %1 decoder with enable
Decimal alue
0 1 2 3
Ena!le E 0 1 1 1 1
Inputs A1 $ 0 0 1 1
A0 $ 0 1 0 1
Outputs D0 0 1 0 0 0
D1 0 0 1 0 0
D2 0 0 0 1 0
D3 0 0 0 0 1
-able & -ruth table of &%to %1 decoder with enable
Example: 3-to-% decoders In a three to ei)ht decoder, there are three inputs and ei)ht outputs, as shown in fi)ure ># "0 is the least si)nificant variable, while "& is the most si)nificant variable# -he three inputs are decoded into ei)ht outputs# -hat is, binar! values at the input form a combination, and based on this combination, the correspondin) output line is activated#
D0 4 " "0
2%to%A
"*
Decoder
" "
&
*
0
D* 4 "&"*"0 D& 4 "&"*"0 D2 4 " " " &
*
0
D1 4 "&"*"0 D>4 "&"* "0 D? 4 " " " & * 0 D@ 4 "&"*"0
"&
Enable
(i)ure > " 2% to %A decoder with enable Each output represents one minterm # o (or example, for input combination "&"*"0 4 00*, output line D* e/uals * while all other output lines e/ual 0
Dec& 'ode 0 1 2 3 4 ( ) *
Inputs
Outputs
A2 A1 A0 D0 D1 D2 D3 D4 D( D) D* 0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
-able 2 -ruth table of 2%to %A decoder Since each input combination represents one minterm, the truth table 'table 2+ contains ei)ht output functions, from D0 to D@ seven, where each function represents one and onl! 6 6 6 one minterm# -hus function D0 is "& "* "0 # Similarl! function D@ is "&"*"0 # -he correspondin) circuit is )ive n in (i)ure ?# In this fi)ure, the three inverters provide complement of the inputs, and each one of the "5D )ates )enerates one of the minterms# It is also possible to add an Enable input to this decoder#
(i)ure ? Implementation of a 2%to %A decoder without enable
Decoder Expansion o
o
It is possible to build lar)er decoders usin) two or more smaller ones# (or example, a ?%to%?1 decoder can be desi)ned with four 1%to%*? decoders and one &%to%1 line decoder#
Example Construct a 2%to%A decoder usin) two &%to%1 deocders with enable inputs# (i)ure @ shows how decoders with enable inputs can be connected to form a lar)er decoder# -wo &%to%1 line decoders are combined to build a 2% to%A line decoder# o
o o
o
o
-he two least si)nifncat bits 'i#e# "* and "0 + are connected to both decoders Most si)nifcant bit '"&+ is connected to the enable input of one decoder# -he complement of most si)nificant bit '" &+ is connected to the enable of the other decoder# =hen "& 4 0, upper decoder is enabled, while the lower is disabled# -hus, the outputs of the upper decoder correspond to minterms D0 throu)h D2# =hen "& 4 *, upper decoder is disabled, while the lower is enabled# -hus, the outputs of the lower decoder correspond to minterms D1 throu)h D@ #
(i)ur e @ Implementin) a 2%to %A decoder with two &%to %1 decoders
Decoder desi+n ,ith AD +ates o
o
Some decoders are constructed with 5"5D rather than "5D )ates# In this case, all decoder outputs will be *
Input A1 A0 0 0 0 1 1 1 1 1
D0 . 0 1 1 1
Output D1 . D2 . 1 1 0 1 1 0 1 1
D3. 1 1 1 0
-able 1 -ruth table of &%to %1 decoder with 5"5D )ates -his decoder can be constructed without enable, similar to what we have seen in the desi)n of decoder with "5D )ates, without enable# -he truth table and correspondin) minters are )iven in table 1# 5otice that the minters are in the complemented form#
(i)ure A " &% to %1 decoder with Enable constructed with 5"5D )ates# Decimal alue
0 1 2 3
Ena!le
Inputs
Outputs
E.
A1
A0
D0.
D1 .
D2 .
D3 .
1 0 0 0 0
$ 0 0 1 1
$ 0 1 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
-able > -ruth table of &%to %1 decoder with Enable usin) 5"5D )ates " &%to%1 line decoder with an enable input constructed with 5"5D )ates is shown in fi)ure A# -he circuit operates with complemented outputs and enable input E< is also complemented to match the outputs of the 5"5D )ate decoder# -he decoder is enabled when E< is e/ual to :ero# "s indicated b! the truth table, onl! one output can be e/ual to :ero at an! )iven time, all other outputs bein) e/ual to one# -he output with the value of :ero represents the minterm selected b! inputs "* and "0# -he circuit is disabled when E< is e/ual to one, re)ardless of the values of the other two inputs# =hen the circuit is disabled, none of the outputs are e/ual to :ero, and none of the minterms are selected# -he correspondin) lo)ic e/uations are also )iven in table >#
'om!inational circuit implementation usin+ decoder o o
o
o
n
"s .nown, a decoder provides the & minterms of n input variables Since an! boolean functions can be expressed as a sum of minterms, one can use a decoder to implement an! function of n variables# n In this case, the decoder is used to )enerate the & minterms and an additional OB )ate is used to )enerate the sum of the re/uired minterms# In this wa!, an! combinational circuit with n inputs and m outputs can be
n
implemented usin) an n%to%& decoder in addition to m OB )ates#
Bemember,
that o
o
-he function need not be simplified since the decoder implements a function usin) the minterms, not product terms# "n! number of output functions can be implemented usin) a sin)le decoder, provided that all those outputs are functions of the same input variables#
Example : Decoder Implementation o/ a ull Adder Let us loo. at the truth table 'table ?+ for the )iven problem# =e have two outputs, called S, which stands for sum, and C, which stands for carr!# 3oth sum and carr! are functions of , , and # Decimal alue
Input
0 1 2 3 4 ( ) *
Output
$
'
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
1
0
1
1
1
0
0
1
1
1
1
1
1
-able ? -ruth table of the (ull "dder -he output functions S F C can be expressed in sum%of%minterms forms as follows o S ',,+ 4 m '*,&,1,@+ o
o
C ',,+ 4
m '2,>,?,@+
Loo.in) at the truth table and the functions in sum of minterms form, we observe that there are three inputs, , , and that correspond to ei)ht minterms# -his implies that a 2%to%A decoder is needed to implement this function# -his implementation is )iven in (i)ure G, where the sum S is implemented b! ta.in) minterms *, &, 1, and @ and the OB )ates forms the lo)ical sum of minterm for S# Similarl!, carr! C is implemented b! ta.in) lo)ical sum of minterms 2, >, ?, and @ from the same decoder# 2%to%A Decoder
&
&*
&
0
&
0 *
S
& 2 1 >
? @
C
Encoders o o o
o
(i)ure G Decoder implementation of a (ull "dder
"n encoder performs the inverse operation of a decoder, as shown in (i)ure *0# n It has & inputs, and n output lines# Onl! one input can be lo)ic * at an! )iven time 'active input+# "ll other inputs must be 0
n
n Outputs
2 -to-n Encoder
n
& Inputs
(i)ure *0 " t!pical Encoder
Example: Octal-to-!inar encoder =e will use A%to%2 encoder '(i)ure **+ for this problem, since we have ei)ht inputs, one for each of the octal di)its, and three outputs that )enerate the correspondin) binar! number# -hus, in the truth table, we see ei)ht input variables on the left side of the vertical lines, and three variables on the ri)ht side of the vertical line 'table @+# Inputs E* 0 0 0 0 0 0 0 0 1
E) 0 0 0 0 0 0 0 1 0
E( 0 0 0 0 0 0 1 0 0
E4 0 0 0 0 0 1 0 0 0
E3 0 0 0 0 1 0 0 0 0
Outputs E2 0 0 0 1 0 0 0 0 0
E1 0 0 1 0 0 0 0 0 0
E0 0 1 0 0 0 0 0 0 0
A2 0 0 0 0 0 1 1 1 1
A1 0 0 0 1 1 0 0 1 1
A0 0 0 1 0 1 0 1 0 1
Decimal 'ode
0 1 2 3 4 ( ) *
-able @ -ruth table of Octal%to %binar! encoder
A Inputs
E0 E* E& E2 E1 E> E? E@
"0
%-to-3 Encoder
3 Outputs
"* "&
(i)ure ** Octal%to %binar! encoder o o
o
o
o
5ote that not all input combinations are valid# 9alid combinations are those which have exactl! one input e/ual to lo)ic * while all other inputs are lo)ic 0 or @, then we can write o "0 4 E* E2 E> E@ Li.ewise, "* 4 E& E2 E? E@, and similarl! o "& 4 E1 E> E? E@ o -hus, the encoder can be implemented usin) three 1% input OB )ates#
5a6or 7imitation o/ Encoders o o
o
Exactl! one input must be active at an! )iven time# If the number of active inputs is less than one or more than one, the output will be incorrect# (or example, if E2 4 E? 4 *, the output of the encoder "& "* "0 4 ***, which implies incorrect output#
T,o 8ro!lems to 9esol e& *# If two or more inputs are active at the same time, what should the output be? "n output of all 0Js is )enerated in & cases when all inputs are 0 o when E0 is e/ual to *# o
How can this ambiguity be resolved? Solution To Problem 1: o
o
o
Kse a Priority Encoder which produces the output correspondin) to the input with hi)her priorit!# Inputs are assi)ned priorities accordin) to their subscript value e#)# hi)her subscript inputs are assi)ned hi)her priorit!# In the previous example, if E2 4 E? 4 *, the output correspondin) to E? will be produced '"&"*"0 4 **0+ since E? has hi)her priorit! than E2 #
Solution To Problem 2: o o
rovide one more output si)nal V to indicate validity of input data# V 4 0 if none of the inputs e/uals *, otherwise it is *
Example: 4-to-2 8riorit Encoders o o o
Sixteen input combinations -hree output variables "*, "0, and 9 9 is needed to ta.e care of situation when all inputs are e/ual to :ero# Outputs Inputs
E3 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
E2 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
E1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
E0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
A1 $ 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
A0 $ 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Invalid Input
-able A -ruth table of 1%to %& riorit! Encoder In the truth table 'table A+, we have sixteen input combinations# In the output, we have three variables# -he variable 9 is needed to ta.e care of the situation where all inputs are :ero# In that case 9 is .ept at :ero, re)ardless of the values of " * and "0# -his combination is hi)hli)hted )reen# In all other cases, 9 is .ept at *, because at least one of the inputs is one# =hen E0 is *, the output combination of "* and "0 is 00# -his combination is hi)hli)hted blue# -hen we have two combinations hi)hli)hted !ellow# In both these combinations, "* and "0 are 0*# -his is because in both these combinations E* is *, re)ardless of the value of E0 , and since E* has hi)her subscript, the correspondin) output value is 0*# -his is followed b! four input combinations in pin. # In these four combinations, the output "* "0 is *0, since E& is * in all these combinations, and E& has the hi)hest
precedence compared to E0 and E* # "lthou)h E0 and E* are also havin) a value of one in this set of four combinations, but the! do not have the priorit!# (inall! we have the last ei)ht input combinations, whose output is **# -his is because E2 is the hi)hest priorit! input, and it is e/ual to *# -hou)h the other inputs with smaller subscripts, namel!, E&, E*, and E0 are also havin) values of one in some combinations, but the! do not have the priorit!# -he truth table can be rewritten in a more compact form usin) don
1 2 3 4 (
E3 0 0 0 0 1
E2 0 0 0 1 $
E1 0 0 1 $ $
Outputs E0 0 1 $ $ $
A1 $ 0 0 1 1
A0 $ 0 1 0 1
0 1 1 1 1
-able G -ruth table of 1%to %& priorit! encoder 'compact fo rm+
o
o
o
o
o
o
=ith 1 Input variables, the truth table must have *? rows, with each row representin) an input combination# =ith don represents A combinations# -hus, the total number of input combinations represented b! the >%row truth table 4 * * & 1 A4 *? input combinations#
3oolean Expressions for 9, " * and "0 and the circuit, See next pa)e
(i)ure *& E/uations and circuit for 1%to %& priorit! encoder