PS 3

advertisement
SOLUTIOS TO PROBLEM SET 3
The most direct way to solve this problem is to draw a truth table and use it to find simplified expressions for
each bit of the output. The truth table is drawn below:
X2
X1
X0
Y6
Y5
Y4
Y3
Y2
Y1
Y0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
0
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
We can now draw K-maps to simplify the Boolean expression for each output bit.
Y0 = X2 + X0 + X1
Y1 = X2 + X1
Y2 = X2 + X1X0
Y3 = X2
Y4 = X2 (X1 + X0)
Y5 = X2X1
Y6 = X2X1X0
Thus, the circuit implementation with basic gates can be carried out as follows.
•
A normal 8-to-3 priority encoder takes an 8 bit input and gives as its output a 3 bit binary
representation of the Most Significant Bit in the input that is ‘1’ . The output is valid if there is at
least one TRUE bit in the input.
•
Hence, when A7:0 is fed to an 8-to-3 priority encoder, it gives on its output lines Y2:0 the binary
representation of the most significant bit which is true.
•
Some priority encoders also output an additional bit which indicates the validity of the 3-bit output
which is the desired output v. We can also implement v from the following equation:
v = A0 + A1 + A2 + A3 +A4 + A5 + A6 + A7
(v is true if AT LEAST one of the 8 bits of the input is true)
•
Central Idea: If the most significant bit that is True in A is made False to obtain Az, the 2nd most
significant bit that is True in A is the most significant bit which is True in Az .
When Az is fed to an 8-to-3 priority encoder, its output is the second most significant bit which is
True in A which is the required output Z2:0. To obtain Az, we first use a 3-to-8 active low decoder
whose input is Y2:0. (An active low decoder has all outputs as ‘1’ except the output corresponding to
the minterm of its 3 bit input, which is ‘0’. E.g. If the input to a 3-to-8 decoder is 110 (the 6th
minterm), then the output will be 10111111. Basically, the outputs of an active-low decoder are
complements of those of a normal decoder).
When each of these 8 outputs of the decoder are ‘AND’ed with the corresponding bits from A, we
obtain Az (because the Most Significant Bit that is true in A will be flipped to false).
•
W is true when there are two or more significant bits that are true in A. Since Az has exactly one ‘1’
of A flipped to ‘0’, the equation w = Az0 + Az1 + Az2 + Az3 +Az4 + Az5 + Az6 + Az7 becomes true
when there are at least 2 true bits in A.
Correctness: We need to ensure the correctness of the circuit in the case of the input A having no true bits at
all. V=0 since all inputs to OR gate are 0, Y=000 (From the equations used to implement a standard priority
encoder – refer text), Az = 00000000 since A = 00000000, output Z=000 (From the equations used to
implement a standard priority encoder – refer text), and finally w = 0 (Since all inputs to the OR gate are 0.
a) A full adder constructed from two half adder modules.
The Boolean equations for the Sum and Carry of a full adder can be manipulated as follows:
Sum = A ⊕ B ⊕ C in = (A ⊕ B ) ⊕ C in
C out = AB + BC in + AC in = AB + C in (A + B) = AB + C in (A(B + B ) + B(A + A ))
⇒ C out = AB + C in (AB + AB + AB) = AB(1 + C in ) + C in (AB + AB) = AB + C in (A ⊕ B )
A half adder consists of an XOR gate and an AND gate, thus we can implement the above Boolean functions
using 2 half adders and an OR gate.
b) An active low 3:8 decoder produces all the 8 minterms in the truth table above in their complemented
form. We can obtain the Sum and Carry in their standard SOP form.
c) In the truth table, the rows corresponding to AB=00,01,10 and 11 have been marked.In the mux below, A
and B are fed to the select inputs (the order does not matter in this case) s1 and s0. From the truth table, we
can connect the four 2 bit inputs by expressing the sum and the carry out in terms of Cin
A
B
A<B
(L)
A=B
(E)
A>B
(G)
0
0
0
1
0
0
1
1
0
0
1
0
0
0
1
1
1
0
1
0
Boolean Expressions for 4-bit comparator:
E = E1 . E2 . E3 . E4
(The two 4 bit numbers are equal if and only if each of the 4 bits of one number are equal to the
corresponding four bits in the other number).
L = L3 + E3.L2 + E3.E2.L1 + E3. E2. E1. L0
(We start comparison from MSB position and proceed right checking each bit)
G = E’.L’
( If A is not equal to B AND A is not less than B, then A is greater than B).
Download