Quine–McCluskey algorithm

Quine–McCluskey algorithm

The Quine–McCluskey algorithm (or the method of prime implicants) is a method used for minimization of boolean functions which was developed by W.V. Quine and Edward J. McCluskey. It is functionally identical to Karnaugh mapping, but the tabular form makes it more efficient for use in computer algorithms, and it also gives a deterministic way to check that the minimal form of a Boolean function has been reached. It is sometimes referred to as the tabulation method.

The method involves two steps:
# Finding all prime implicants of the function.
# Use those prime implicants in a "prime implicant chart" to find the essential prime implicants of the function, as well as other prime implicants that are necessary to cover the function.

Complexity

Although more practical than Karnaugh mapping when dealing with more than four variables, the Quine-McCluskey algorithm also has a limited range of use since the problem it solves is NP-hard: the runtime of the Quine-McCluskey algorithm grows exponentially with the input size. It can be shown that for a function of "n" variables the upper bound on the number of prime implicants is 3"n"/"n". If "n" = 32 there may be over 6.5 * 1015, prime implicants. Functions with a large number of variables have to be minimized with potentially non-optimal heuristic methods, of which the Espresso heuristic logic minimizer is the de-facto world standard. [V.P. Nelson e.a., "Digital Circuit Analysis and Design", Prentice Hall, 1995, pag. 234]

Example

tep 1: finding prime implicants

Minimizing an arbitrary function:

:f(A,B,C,D) =sum m(4,8,10,11,12,15) + d(9,14) ,

A B C D f m0 0 0 0 0 0 m1 0 0 0 1 0 m2 0 0 1 0 0 m3 0 0 1 1 0 m4 0 1 0 0 1 m5 0 1 0 1 0 m6 0 1 1 0 0 m7 0 1 1 1 0 m8 1 0 0 0 1 m9 1 0 0 1 x m10 1 0 1 0 1 m11 1 0 1 1 1 m12 1 1 0 0 1 m13 1 1 0 1 0 m14 1 1 1 0 x m15 1 1 1 1 1

One can easily form the canonical sum of products expression from this table, simply by summing the minterms (leaving out don't-care terms) where the function evaluates to one:

:f_{A,B,C,D} = A'BC'D' + AB'C'D' + AB'CD' + AB'CD + ABC'D' + ABCD

Of course, that's certainly not minimal. So to optimize, all minterms that evaluate to one are first placed in a minterm table. Don't-care terms are also added into this table, so they can be combined with minterms:

Number of 1s Minterm Binary Representation -------------------------------------------- 1 m4 0100 m8 1000 -------------------------------------------- 2 m9 1001 m10 1010 m12 1100 -------------------------------------------- 3 m11 1011 m14 1110 -------------------------------------------- 4 m15 1111

At this point, one can start combining minterms with other minterms. If two terms vary by only a single digit changing, that digit can be replaced with a dash indicating that the digit doesn't matter. Terms that can't be combined any more are marked with a "*". When going from Size 2 to Size 4, treat '-' as a third bit value. Ex: -110 and -100 or -11- can be combined, but not -110 and 011-. (Trick: Match up the '-' first.)

Number of 1s Minterm 0-Cube | Size 2 Implicants | Size 4 Implicants ------------------------------|-------------------|---------------------- 1 m4 0100 | m(4,12) -100* | m(8,9,10,11) 10--* m8 1000 | m(8,9) 100- | m(8,10,12,14) 1--0* ------------------------------| m(8,10) 10-0 |---------------------- 2 m9 1001 | m(8,12) 1-00 | m(10,11,14,15) 1-1-* m10 1010 |-------------------
m12 1100 | m(9,11) 10-1
------------------------------| m(10,11) 101-
3 m11 1011 | m(10,14) 1-10
m14 1110 | m(12,14) 11-0
------------------------------|-------------------
4 m15 1111 | m(11,15) 1-11
m(14,15) 111-

tep 2: prime implicant chart

None of the terms can be combined any further than this, so at this point we construct an essential prime implicant table. Along the side goes the prime implicants that have just been generated, and along the top go the minterms specified earlier. The don't care terms are not placed on top - they are omitted from this section because they are not necessary inputs.

Here, each of the "essential" prime implicants has been starred - the second prime implicant can be 'covered' by the third and fourth, and the third prime implicant can be 'covered' by the second and first, and is thus neither an essential. If a prime implicant is essential then, as would be expected, it is necessary to include it in the minimized boolean equation. In some cases, the essential prime implicants do not cover all minterms, in which case additional procedures for chart reduction can be employed. The simplest "additional procedure" is trial and error, but a more systematic way is Petrick's Method. In the current example, the essential prime implicants do not handle all of the minterms, so, in this case, one can combine the essential implicants with one of the two non-essential ones to yield one of these two equations:

:f_{A,B,C,D} = BC'D' + AB' + AC :f_{A,B,C,D} = BC'D' + AD' + AC

Both of those final equations are functionally equivalent to this original (very area-expensive) equation::f_{A,B,C,D} = A'BC'D' + AB'C'D' + AB'C'D + AB'CD' + AB'CD + ABC'D' + ABCD' + ABCD

ee also

* Boolean algebra (logic)
* Circuit minimization
* Karnaugh map
* Espresso heuristic minimization program
* Petrick's Method
* Willard Van Orman Quine

References

External links

* [http://www.omnistream.co.uk/qm/ Web-Based Quine-McCluskey Algorithm] , an open source implementation written in PHP. ( [http://www.phpclasses.org/quine_mccluskey PHP Class] )
* [http://user.cs.tu-berlin.de/~lordmaik/projects/quinemccluskey/quinemccluskey/quineapplet.htm Java-Applet] Applet to minimize a boolean function based on QuineMcCluskey Algorithm. (German page)
* [http://www.inf.ufrgs.br/lagarto/ Karma (Karnaugh Map Viewer)] – A CAD tool for Karnaugh map manipulation with didactic features in logic circuit synthesis. Uses Quine-McCluskey algorithm to generate a minimal sum of products.
* [http://134.193.15.25/vu/course/cs281/lectures/simplification/quine-McCluskey.html Lecture on the Quine–McCluskey algorithm]
* A. Costa [http://www.dei.isep.ipp.pt/~acc/bfunc/ BFunc] , QMC based boolean logic simplifiers supporting up to 64 inputs / 64 outputs (independently) or 32 outputs (simultaneously)
* [http://www25.brinkster.com/denshade/QuineMcCluskey.html Java applet] to display all the generated primes.
* Python [http://cheeseshop.python.org/pypi/qm/0.2 Implementation]
* [http://sourceforge.net/projects/quinessence/ Quinessence] , an open source implementation written in Free Pascal.
* A literate program written in Java [http://en.literateprograms.org/Quine-McCluskey_algorithm_%28Java%29 implementing the Quine-McCluskey algorithm] .
* [http://automatics.hit.bg/#minBool minBool] a Matlab implementation.
* [http://cran.r-project.org/src/contrib/Descriptions/QCA.html QCA] an open source, R based implementation used in the social sciences, by Adrian Duşa
* A series of two articles describing the algorithm(s) implemented in R: [http://www.compasss.org/Dusa2007.pdf first article] and [http://www.compasss.org/Dusa2007a.pdf second article] . The R implementation is exhaustive and it offers complete and exact solutions. It processes up to 20 input variables.
* [http://geocities.com/abeautifulmind1998] , a Java program to display the boolean expression ..... by Manoranjan Sahu
* [http://www-ihs.theoinf.tu-ilmenau.de/~sane/projekte/qmc/embed_qmc.html] , an applet for a step by step analyze of the QMC- algorithm by Christian Roth
* [http://sourceforge.net/projects/qmcs] SourceForge.net C++ program implementing the algorithm.
* [http://search.cpan.org/~kulp/Algorithm-QuineMcCluskey-0.01/lib/Algorithm/QuineMcCluskey.pm Perl Module]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Quine — may refer to: * Willard Van Orman Quine American philosopher and logician * Robert Quine American guitarist * Quine (computing), a program that produces its source code as output * Quine (surname), people with the surname Quine * Quine–McCluskey… …   Wikipedia

  • Willard Van Orman Quine — Unreferenced|date=August 2007 Infobox Philosopher region = Western Philosophy era = 20th century philosophy color = #B0C4DE image caption = Willard Van Orman Quine name = Willard Van Orman Quine birth = birth date|mf=yes|1908|6|25 death = death… …   Wikipedia

  • Edward J. McCluskey — (16 October 1929, Orange, New Jersey) is currently a Professor Emeritus at Stanford University. He is a pioneer in the field of Electrical Engineering.BiographyProfessor McCluskey worked on electronic switching systems at the Bell Telephone… …   Wikipedia

  • Espresso heuristic logic minimizer — The Espresso logic minimizer is a computer program using heuristic and specific algorithms for efficiently reducing the complexity of digital electronic gate circuits.[1] Espresso was developed at IBM by Robert Brayton. Rudell later published the …   Wikipedia

  • Karnaugh map — For former radio station KMAP (1962 1968) in Dallas Fort Worth, see KRLD FM. An example Karnaugh map The Karnaugh map (K map for short), Maurice Karnaugh s 1953 refinement of Edward Veitch s 1952 Veitch diagram, is a method to simplify Boolean… …   Wikipedia

  • Don't-care (logic) — In digital logic, a don t care term is an input sequence (a series of bits) to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes… …   Wikipedia

  • Don't-care term — In digital logic, a don t care term is an input sequence (a series of bits) to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes… …   Wikipedia

  • List of algorithms — The following is a list of the algorithms described in Wikipedia. See also the list of data structures, list of algorithm general topics and list of terms relating to algorithms and data structures.If you intend to describe a new algorithm,… …   Wikipedia

  • Implicant — In Boolean logic, an implicant is a covering (sum term or product term) of one or more minterms in a sum of products (or maxterms in a product of sums) of a boolean function. Formally, a product term P in a sum of products is an implicant of the… …   Wikipedia

  • Digital electronics — Main articles: Electronics and Electronic circuit Digital electronics represent signals by discrete bands of analog levels, rather than by a continuous range. All levels within a band represent the same signal state. Relatively small changes to… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”