Boolean Algebra / Karnaugh Maps with N > 2 (Higher Dimensions)

Dec 30, 2006 5 Replies

Most who inhabit this list are probably familiar with standard Boolean algebra and Karnaugh maps, i.e.



formatting link



Karnaugh maps come up very frequently in the design of microcontroller software, i.e. on a processor that handles bitfields very efficiently, one might even implement a 3-state state machine as something like:



if (!x.bf1) { if (!x.bf0) { /* 0/0 logic, First State */ } else { /* 0/1 logic, Second State */ } } else { /* 1/X logic, Third State */ }



However, it also occurs frequently that an integer range (x, 0-255, say) is "paneled" into smaller pieces of significance (0-10, 11-67, and 68-255, say), and this can lead to truth tables that are a mixture of these "paneled" ranges and Boolean values. The simplest example would be a table with 3 columns (corresponding to the three ranges above), and two rows (y, one for F, one for T).



i.e. | 0-10 | 11-67 | 68-255 F | 1 | 1 | 0 T | 0 | 1 | 0



In "reducing" a 3 x 2 table like this, one could easily end up with a Boolean-valued function like:



(!y && x=11 && x


Its academic , i let the CPU do all this at microsecond speeds .

How fast are you at Carnaugh ?

There is no money in teaching computers , because if the computer is to be useful , it must not require humans to write its code .

I have demonstrated many times , the method of forcing to OpSys to create the algorithms .....

Uhuh (looks up, down, and around to see if a trick question is about to drop on my head or run me over).... maybe I missed something really significant, but you apparently answered your own question implicitly with the little piece of C you gave. What is (V > 10) if not a Boolean result?

Instead of thinking about this as a single Boolean input A and a binary variable V that can lie in one of three possible "panels" of interest, you should think about this as a single Boolean input (from your original problem/circuit), and two additional Boolean inputs, which I'll call C and D.

C = 1 iff (v is an element of {0..10}) D = 1 iff (v is an element of {11..67}) [Note there is an implicit third state where C=D=0, i.e. v > 67].

You now have a vanilla three-input K-map with inputs V, C and D. Once you reduce this to a Boolean expression, you can substitute the appropriate numeric comparisons:

C = (V 10) (implies D=X) C'D = (V > 10 && V < 68) D' = (V < 11 || V > 67) C'D' = (V >= 68) (CD) = impossible

(Hey, I never thought I would use a K-map again, I guess that wasn't time wasted at college after all).

The technique you proposed works ...

I was hoping for some kind of a very general result or a very general way of thinking ... I have this feeling ... maybe too much caffeine or maybe I misread the expiration date on that chicken in my fridge ... that there are some optimizations that could be performed better with a more general way of thinking.

For example, in Boolean algebra,

((x == FALSE) OR (x == TRUE)) == TRUE,

or more compactly,

(x OR !x) = 1

Similarly, in the "paneled" math,

((x = 11 AND x = 68)) = TRUE

Also,

(! ((x = 68))) = (x >=11 AND x

It seems to me that any heuristic you could devise for working with these fuzzy logic type expressions (which is what they are, by the way) would ultimately reduce to something very much the same as what I described.

That funny feeling you describe is the one you get right before you make a wonderful new discovery, but I'm afraid you have to figure out what it is yourself.

...or else switch to decaf. ;^)

Personally, anything that takes K-maps beyond much beyond 4 inputs seems to be stretching the tool beyond what it does well until I get N-dimensional paper to doodle them on.

- Tim.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required