+ All Categories
Home > Documents > HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu...

HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu...

Date post: 06-Apr-2018
Category:
Upload: lytram
View: 225 times
Download: 3 times
Share this document with a friend
10
HW 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC
Transcript
Page 1: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

HW 1 Solutions ECE 465, Fall 13

Shantanu Dutt

UIC

Page 2: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Question 1. (a) Prove that a necessary condition for two minterms to be logically adjacent is for the difference in their numerical values to be a power of 2, i.e., 2i for some i >= 0. (20)

(b) The above condition is, however, not sufficient, i.e., if the above condition is true, it will not always the case that the two minterms will be logically adjacent. Provide a generic situation of bit patterns in a minterm mk such that the minterm mj = mk + 2i is not logically adjacent to mk , and show how this comes about. (20)

Soln.

1a) Let 2 MTs u, v be logically adjacent, and let them differ in bit i. Then without loss of generality, if u(i) = 0, then v(i) = 1. Since all their other bits are the same v = u + 2i. Thus logical adjacency between u, v a difference of some 2i between u, v.

1b) Let MT u have a maximal sequence of 1’s (surrounded by 0’s) in m+1 bits, say, in i’th to (i+m)’th bits, where m >= 0.

So u = un-1 un-2 … ui+m+2 0 1 1….1 0 ui-2 …. u0, where the uj’s can be 1 or 0.

Let v = u + 2i. Then v = un-1 un-2 … ui+m+2 0 1 1 …. 1 1 0 ui-1 …. u0

+ 0 0 …... 0 0 0 0 ....0 1 0 0 …… 0

---------------------------------------------

un-1 un-2 … ui+m+2 1 0 0 …. 0 0 0 ui-1 …. u0

which differs from u in bits i to i+m+1 (m+2) bits >= 2 bits. Thus v is not logically adjacent to u. Thus a difference of some 2i between two MTs u, v does not guarantee that they will be logically adjacent.

Page 3: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Question 2. In class we proved that optimality of the “good” row covering rule in which the covering row (PI) has cost less than or equal to the cost of the covered row (PI). For the column covering rule, prove that:

a) It is correct, i.e., after a covering column mj is deleted, any final SOP expression determined using QM will automatically cover mj . (10)

b) It is optimal, i.e., deleting a covering column mj does not lead to a final SOP expression determined using QM that can have cost greater than an expression determined using QM if mj is not deleted. (40)

Soln.

2a) Let col/MT mj covers col/MT mi. Since mi must be covered in the final solution, one of the PIs that cover mi (PIk or PIq) must be in the final solution. Since any PI that covers

mi also covers mj, mj is automatically covered in the final solution.

Therefore, mj can be excl. deleted from PIT/RPIT.

2b) Let col/MT mj cover col/MT mi as shown in the PIT on the right.

Let PI(mj/mi) be the set of PIs that cover mj but not mi. If mj is deleted,

then sub-optimality in the selection of PIs can only come about if the

PIs in PI(mj/mi) are incorrectly exclusion deleted due to deleting mj.

A PI, say, PIr in PI(mj/mi) can be excl. deleted due to the deletion of mj

if and only if it only covers mj in the current PIT/RPIT. Thus at the

current stage of the PIT/RPIT to include PIr in the final expression, it will only be to cover mj. However, it is necessary to include a PI (say, PIk) that covers mi in the final solution, and PIk also covers mj (by definition of col. covering). Thus it is unnecessary and incurs more cost to also include a PI in PI(mj/mi) for the purpose of only covering mj. Thus, since a PI in PI(mj/mi) that is excl. deleted due to deleting mj only covers MT mj at the current stage of the PIT/RPIT, their exclusion deletion cannot result in a final SOP expression that has more cost than the SOP expression that would result if such a PI were not exclusion deleted. Thus deleting a covering col. mj cannot result in a final SOP expression that has more cost than the SOP expression that would result if mj were not deleted.

QED

mi mj

PIk x x

PIr x

PIq x x

PIt x

Page 4: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

3. (a) One of the sources of sub-optimality of QM is the use of heuristics to choose a PI to break a cyclic PIT or RPIT. Devise a simple method that is optimal in the case of a cyclic PIT or RPIT (state the method clearly in words; a pseudo-code of the type given for QM in the notes is not needed, though you can give one if you think it will be more explanatory). 40

(b) In a 2-level logic minimization problem in which a cyclic PIT or RPIT is encountered only once, what will be the time-complexity of your method in O notation (discussed in the notes). 20

Soln. 3: Let QMc be the desired algorithm, which applies the cycle tackling technique given below for a cyclic pit/rpit, and uses normal QM for a non-cyclic pit/rpt. Various possible solutions:

i. Naïve method: Let p be the # of PIs in the cyclic pit/rpit: Select (inclusion delete) each PI PIj in turn, solve the corresponding rpit recursively using QMc, and determine the cost of the final soln fj. Select the least expensive of all solutions fj.

Proof of Optimality: There are exactly p ways of breaking the cyclic pit/rpit, and all these ways are explored. Thus, since all cases at the current decision point (of how to break the cyclic pit/rpit) are considered, and the min-cost one chosen, the resulting solution is optimal for breaking the cyclic pit/rpit.

Worst-case complexity for 1 cyclic pit/rpit occurrence: p*(complexity of QM) = O(max(m3p2, mp4)) [Note: In the complexity of QM, m2p2 can be removed, as for m > p, it is dominated by m3p, otherwise, it is dominated by mp3].

ii. Choose a MT mi w/ the least # pi of PIs that cover it. For each PI PIj covering mi, select (inclusion delete) it in turn, solve the corresponding rpit recursively using QMc, and determine the cost of the final soln fj. Select the least expensive of all solutions fj.

Proof of Optimality: At least one of the pi PIs covering mi have to be part of final soln., and each such PI being in the final soln. is explored, and the cyclic pit/rpit is also broken each time while doing so. Thus, since for the decision point of which PI covering mi to definitely include in the final soln. is exhaustively explored (while also breaking the cyclic pit/rpit at the same time), and the min-cost solution is chosen, this also leads to the optimal solution for breaking the cyclic pit/rpit.

Worst-case complexity for 1 cyclic pit/rpit occurrence: = pi*(complexity of QM). Since pi = O(p), complexity = O(max(m3p2, mp4)). However, since on the average pi will be much lower than O(p), the average complexity of this technique will be much lower (and also much lower than that of the above naïve method).

iii. Select (inclusion delete) any single PI, PIj solve the corresponding rpit recursively using QMc, and determine the cost of the final soln fj. Follow this by exclusion deletion of PIj, solve the corresponding rpit recursively using QMc, and determine the cost of the final soln fj’. Select the least expensive of the two solutions fj, fj’. Possible issue w/ this approach: see next slide.

Page 5: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

iii. (contd.) Possible issue w/ this approach: It may not break the cycle when PIj is exclusion deleted since no MTs are deleted in the process. This is shown the the figure below.

However, repeated application of this technique will ultimately break the cycle. E.g., in the figure above, excl. deletion of PIj does not break the cycle, but this followed by either inclusion or excl. deletion of any other PI breaks the cycle.

Proof of Optimality: The decision point of whether a PI should be in the final solution or not, is exhaustively explored by the 2 cases of it should or should not be included, and the best solution chosen. Thus the best solution found is optimal. Note that even if the cyclic pit/rpit is not broken w/ an exclusion deletion of a PI, the solution path from this choice is explored further until the cyclic break occurs, and so a solution will be found for the exclusion-deletion choice.

Worst-Case complexity for 1 cyclic pit/rpit occurrence: If there are k PIs covering, say a group of exactly 2 MTs involved in a cycle (k=2 in the above figure), then we have k decision points in the worst-case focusing only on these PIs, and each decision point involves 2 choices. The complexity is thus 2k*(complexity of QM) = O(max(km3p, kmp3)). We have seen that in the worst case the # of PIs covering a MT can be O(2n-1), and thus k is also O(2n-1). However, on the average, k is probably a constant.

2 X’s

2 X’s

1 mt

1 mt

1 mt 1 mt 1 mt

1 mt

1 mt 1 mt

2-mt PIs

4-mt/X PIs

PIj

PIk

Fig.: Exclusion deletion of either PIj or PIk does not break the cycle

Page 6: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

iv. Form PI pairs that extend the coverage of each of their constituent PIs (i.e., if a pair is covered any of its constituent PI, do not form it), and see if good covering exists between pairs or pair to singles (the latter will be rare). If so apply the covering, i.e., exclusion delete the PIs of the good-covered pairs that are not in the good covering pairs, go back to the RPIT w/ only single PIs (the remaining ones), and apply QMc to it. If no good covering exists, form PI triples that extend the coverage of each constituent PI pair in it, and check for good coverings among triples, triples to pairs and triples to singles. If so, apply all of them (exclusion delete all single PIs in the good-covered sets of PIs that are not in the good-covering ones), go back to the RPIT w/ only single PIs (the remaining ones), and apply QMc to it. If no good coverings found here form the next larger set of PIs that extend the coverage of their previous smaller constituent sets, and again look for good coverings between them or from them to all smaller set of PIs, and so on until good coverings are found (in the worst-case if even (p-1)-set PIs do not good cover any other set all p PIs are needed in the expression (it can probably be proven this will be the case only if at least one is an EPI, and we are assuming that this is a cyclic pit/rpit, so there are no EPIs, and thus the worst-case will be forming up to (p-1)-set PIs (we are guaranteed to find good coverings at this point).

Proof of Optimality: If a good covering is found, it breaks the cycle and, as we have seen good covering is optimal (the optimality proof and thus result for single-PI coverings that we have seen hold in the case of multiple-PI coverings as well). If no good-covering is found for PI sets of size i, we try sets of size i+1, until we get to set sizes of size p-1. Since at most p-1 PIs will be needed in the final expression as stated above, and we will reach this point only if the optimal solution has p-1 PIs (otherwise if the optimal solution has k < p-1 PIs, then we would have found a good covering earlier in our process of set sizes of <= k), we will find a good covering of the set of p-1 PIs of the optimal solution covering all other (p-1)-size sets. Thus the process will terminate with finding at least one good covering, which will be optimal and also break the cycle.

Worst-case complexity for 1 cyclic pit/rpit occurrence O( 𝑚 ∗ 𝑝𝐶𝑖 ∗ [𝑝𝐶𝑖

2

𝑝−1𝑖=2 + (𝑝𝐶𝑗)] + 𝐶𝑜𝑚𝑝𝑙𝑒𝑥𝑖𝑡𝑦 𝑜𝑓 𝑄𝑀)𝑖−1

𝑗=1

where m = # of MTs. This complexity expression is due the checking for good covering that has to be done for i-size PI sets

between themselves and between them and smaller PI sets. The first term is dominated by m*(pCp/2)*[(pCp/2)/2 + 𝑝𝐶𝑗𝑝

2−1

𝑗=1]

~ Q(m*2p-1*2p-1) = Q(m*22p), which dominates each of the other terms. However, there are p-3 other terms, i.e., not just a constant # of terms, but a # of terms that is a function of size parameter p. The max. value of the inner summation is

𝑝𝐶𝑗𝑝−2𝑗=1 = O(2p). Thus 𝑚 ∗ 𝑝𝐶𝑖 ∗ [

𝑝𝐶𝑖

2

𝑝−1𝑖=2 + (𝑝𝐶𝑗)]𝑖−1

𝑗=1 < 𝑚 ∗ 𝑝𝐶𝑖 ∗ [𝑝𝐶𝑝

2

𝑝−1𝑖=2 + 2^𝑝] ~

𝑚 ∗ (𝑝𝐶𝑖) ∗ [3 ∗ 2𝑝_1]

𝑝−1𝑖=2 < 3*2p-1 *m*2p = 3*22p-1 = Q(m*22p), which is the same order as that of the max subterm of the

1st term of the above complexity expression. Thus this 1st term is Q(m*22p), and since this dominates the basic QM complexity, and since the outer notation is big O, we have the complexity as O(m*22p) (note that if we could have proved that there is a problem instance for which (p-1)-size subsets of PIs will need to be formed in the above technique, then we could have said that the complexity is Q(m*22p) ). As can be seen this is exponential in p, while QM is polynomial in p.

Page 7: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Question 4)

Suppose we pick PI2*PI3*PI5*PI7. The corresponding final solution of the original function is: f = PI2 + PI3 + PI5 + PI7 , f (A, B, C, D) = A’B’D + B’C’D + A’CD + BCD’

Page 8: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Suppose we pick PI1*PI4*PI6*PI8. The corresponding final solution of the original function is: f = PI1 + PI4 + PI6 + PI8 , f (A, B, C, D) = A’B’D’ + A’BC’ + AB’C + BCD

Page 9: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Question 5)

Page 10: HW 1 Solutions ECE 465, F’13 - University of Illinois at … 1 Solutions ECE 465, Fall 13 Shantanu Dutt UIC Question 1. (a) Prove that a necessary condition for two minterms to be

Recommended