Docsity

Petrick’s Algorithm - Digital Systems - Lecture Slides, Slides of Digital Systems Design

Partial preview of the text

Download Petrick’s Algorithm - Digital Systems - Lecture Slides and more Slides Digital Systems Design in PDF only on Docsity!

Petrick’s Algorithm for 2-level

Minimization

Petrick’s Algorithm for Choosing Minimal Cost

cover

  • The PIT portion of Q-M can get optimal in most

cases and near-optimal cost coverings, but will not

be optimal in all cases.

  • Can use an algebraic method called Petrick’s

algorithm.

Petrick’s Algorithm (Contd.)

Cost PIs 1 2 3 4 5 6 9 11
2+1 PI 1
3+1 PI 2
3+1 PI 3
3+1 PI 4
3+1 PI 5
3+1 PI 6
PI 1
PI 6
PI 2
PI 3
PI 1
PI 2
PI 4
PI 5
PI 5
PI 6
PI 3
PI 4
C=(PI 1 +PI 2 PI 6 )(PI 5 +PI 4 PI 6 )(PI 3 +PI 2 PI 4 )

Absorb

Cost=8 +3 Cost=9 +

Minimal solution

X’s
Example 1
=(PI 1 PI 5 +PI 1 PI 4 PI 6 +PI 2 PI 5 PI 6 +PI 2 PI 4 PI 6 )(PI 3 +PI 2 PI 4 )
PI 1 PI 3 PI 5 +PI 2 PI 4 PI 6 +PI 1 PI 3 PI 4 PI 6
+PI 2 PI 3 PI 5 PI 6 +PI 1 PI 2 PI 4 PI 5 +
PI 2 PI 3 PI 4 PI 6 +PI 1 PI 2 PI 4 PI 6 +
PI 2 PI 4 PI 5 PI 6

Petrick’s Algorithm (Contd.)

• Exercise: Use this algorithm to obtain the least cost

cover for the example in which we used the max. MT

covering heuristic to get the minimal solution.

QM PIT (Covering Stage) Complexity

If m =# of MTs n = # of vars, p i = # of PIs covering MT i ,
pav = avg # of PIs covering a MT, p = total # of PIs
  • The time taken to determine row covering is O(mp 2 ) (look at all PI pairs—naïve method, and each pair takes O(m) time to determine if there is covering betw. them)
  • If after every row covering, we detect an EPI, we reduce # of MTs by at least 1; so we would require O(m^2 p^2 ) time until all MTs are covered.
  • Or, we do not get any EPIs until we do lots of covering until 1 PI is left that covers all MTs (worst case). This will take time O(mp^3 ).
  • So overall complexity (using no appropriate data structures) is O(max(m 2 p^2 , mp^3 )).
  • Compare this to O((pav ) m) ~ O((p/m) m) for Petrick’s, and we see that QM is much less complex ( m appears as an exponent in Petrick’s as opposed to as the base of a low- order polynomial in QM),

Graphical comparison of Petrick’s and QM’s time complexities

  • As can be seen, Petrick’s run-time quickly becomes huge and impractical for n > 7, while QM’s is much more reasonable and thus could potentially be used in a CAD tool.
  • Further, as we have seen, besides the cyclic PIT scenario, QM’s non-optimality stems from very rare (and thus very low probability) cases. Thus on the average, QM produces good (near-optimal) solutions.
  • Thus overall, QM is a very good and practical algorithm to use for, say, n > 5. Docsity.com