diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-02-09 23:48:23 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-02-09 23:48:23 +0000 |
commit | 94d261906570f5528256e2ddceaa4a8822398efe (patch) | |
tree | cb69730ede57c4710d8d1a1d051dd80164bcd1bc | |
parent | b0d5501f1f23aa46a217497ed899ec51aa571f1f (diff) | |
download | Quine-McCluskey-94d261906570f5528256e2ddceaa4a8822398efe.tar.gz Quine-McCluskey-94d261906570f5528256e2ddceaa4a8822398efe.zip |
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | src/qm.c | 4 |
2 files changed, 19 insertions, 1 deletions
@@ -1,2 +1,18 @@ # Quine-McCluskey An implementation of the Quine-McCluskey algorithm to simpily a DNF written in C + +## How it works: +1. Parse the input (the sum of products) into a format we can use, nested structs +2. Create the simplification table of minterms +3. Merge minterms if possible, marking them if merged +4. Keep merging until we can't any more +5. Get what we couldn't merge, the 'Prime Implicants'- this is the output + +## Example +`./quineMcCluskey -C-B-A + -CB-A + C-B-A + CB-A + CBA` + +`-A + CB` + +(Alternative output format:) + +`A v (C ∧ B)` @@ -13,6 +13,8 @@ int main(int argc, char* argv[]) { } DNF startDNF = parseDNFStr(argv[1]); + printForm(&startDNF); + printForm2(&startDNF); SimplifiedTableItem simplifiedTable[startDNF.numTerms]; unsigned int simplifiedTableLength = startDNF.numTerms; setupMergeTable(simplifiedTable, &startDNF); @@ -209,4 +211,4 @@ void printForm2(const DNF* form) { } } printf("\n"); -}
\ No newline at end of file +} |