Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Quine–McCluskey algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Creating the prime implicant chart ==== The prime implicant chart can be represented by a dictionary where each key is a prime implicant and the corrresponding value is an empty string that will store a binary string once this step is complete. Each bit in the binary string is used to represent the ticks within the prime implicant chart. The prime implicant chart can be created using the following steps: # Iterate through each key (prime implicant of the dictionary). # Replace each dash in the prime implicant with the <code>\d</code> character code. This creates a regular expression that can be checked against each of the minterms, looking for matches. # Iterate through each minterm, comparing the regular expression with the binary representation of the minterm, if there is a match append a <code>"1"</code> to the corresponding string in the dictionary. Otherwise append a <code>"0"</code>. # Repeat for all prime implicants to create the completed prime implicant chart. When written in pseudocode, the algorithm described above is: '''function''' CreatePrimeImplicantChart(list primeImplicants, list minterms) primeImplicantChart ← new dictionary with key of type string and value of type string // Creating the empty chart with the prime implicants as the key and empty strings as the value. '''for''' i = 0 '''to''' length(primeImplicants) '''do''' // Adding a new prime implicant to the chart. primeImplicantChart.Add(primeImplicants[i], "") '''for''' i = 0 '''to''' length(primeImplicantChart.Keys) '''do''' primeImplicant ← primeImplicantChart.Keys[i] // Convert the "-" to "\d" which can be used to find the row of ticks above. regularExpression ← ConvertToRegularExpression(primeImplicant) '''for''' j = 0 '''to''' length(minterms) '''do''' // If there is a match between the regular expression and the minterm than append a 1 otherwise 0. '''if''' regularExpression.matches(minterms[j]) '''then''' primeImplicantChart[primeImplicant] += "1" '''else''' primeImplicantChart[primeImplicant] += "0" // The prime implicant chart is complete so return the completed chart. '''return''' primeImplicantChart The utility function, <code>ConvertToRegularExpression</code>, is used to convert the prime implicant into the regular expression to check for matches between the implicant and the minterms. '''function''' ConvertToRegularExpression(string primeImplicant) regularExpression ← new string '''for''' i = 0 '''to''' length(primeImplicant) '''do''' '''if''' primeImplicant[i] == "-" '''then''' // Add the literal character "\d". regularExpression += @"\d" '''else''' regularExpression += primeImplicant[i] '''return''' regularExpression
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)