FPGARelated.com
Forums

Standard forms for Karnaugh maps?

Started by Evan Lavelle ●June 27, 2008
On Jun 28, 3:08 pm, Jim Granville <no.s...@designtools.maps.co.nz>
wrote:
> KJ wrote: > > "General Schvantzkopf" <schvantzk...@yahoo.com> wrote in message > >news:y-2dnZJNvsTS8vvVnZ2dnUVZ_sjinZ2d@comcast.com... > > >>On Sat, 28 Jun 2008 09:00:28 +0100, Evan Lavelle wrote: > > >>>On Sat, 28 Jun 2008 09:00:03 +1200, Jim Granville > >>><no.s...@designtools.maps.co.nz> wrote: > > > <snip> > > >>It's been 30 years since I've used Karnaugh maps, they were useful when > >>the 7400 was state of the art and every gate counted. In that era logic > >>was necessarily simple so a tool that could minimize a four input equation > >>was helpful. > > > All very true, but Evan's question was explicitly targetted toward people > > who USE K-maps ("If you use K-maps, which version do you prefer..." from the > > original post) and his reasons had to do with verification not design (later > > post). > > To answer that question, the Logic minimisation I use, is that built > into the tools, which will include the tools version of K-Maps, and > others as well. ie the REPORT files are closely scrutinised. > > It is common to look at the tool output, and recode the source, and > sometimes we have taken one tools output, and pasted into another > as source code. > > Sometimes, the choices made within the tools surprises, and sometimes it > disappoints.... > > Where the tools have a blind spot is in 'node creation' to reduce > total mapped logic (at the expense of some speed). Understandable, > as that is a LOT more variables in the air. > > Sometimes the designer has to help there. > > It's a matter of matching the degrees of freedom, to the tools IQ. > > In Xilinx flows, fastest and smallest switches sometimes seem to work > backwards :) > > -jg
I rarely use a K map for "logic minimization". Once I got out of school (some 22 years ago), about the only thing I used them for was for state-code assignments in state machines with unsynchronized inputs (guaranteeing gray-code state transitions on those inputs), and for P-term minimization when using PALs (choosing state assignments to minimize branches into states with bits set). With modern FPGAs in most cases, if you are designing at the k-map level, you are not taking maximum advantage of the tools. Specifying design behavior at higher levels of abstraction often leads to correspondingly higher levels of optimization. But not always... Another advantage of using higher levels of abstraction is in debugging and verification. State transition optimization to avoid an extra register for input synchronization may have been a good idea when an entire device had only 8 or 10 registers. But when extra registers are so darn cheap in an FPGA, it is foolhardy, and not nearly as easily verified by inspection as simply burning another register to synchronize the input. Andy
On Sat, 28 Jun 2008 13:39:09 -0400, "KJ" <kkjennings@sbcglobal.net>
wrote:

> <snipped>
Thanks. And thanks to those who gave me an opinion without an accompanying lecture on logic minimisation. The 'why' is not very interesting - basically feature creep. I have a verification tool which allows usage of multi-dimensional arrays. It occurred to me that, with a couple of hours fiddling, I could modify the array indexing so that you could convert an array initialiser into a K-map: // f is a 5D array, but the 'kmap' declaration handles the complexity kmap f = 0 1 1 0 1 0 1 0 // uses reflected-binary addressing, 1 1 0 0 0 0 1 1 // not "C-style" addressing 1 0 1 0 0 1 1 1 1 0 1 1 1 1 1 0; ... x = f[A,B,C,D,E]; // compute a function of 5 vars Not Earth-shattering, but potentially useful to people who still do combinatorial logic design, although there can't be many of them left. Nothing to do with minimisation, but presumably those people will have a preferred array layout which was originally derived from minimisation principles. I didn't want to impose reflected-binary addressing on them if another form was preferable. -Evan
On Sat, 28 Jun 2008 17:25:42 -0700 (PDT), ajjc <ajjc@optngn.com>
wrote:

>In John F. Wakerly's "Digital Design, Principles and Practices", >4th Edition, pgs 235-236,564 (there is also a 5th edition) >uses your second version (the historical one) of 5/6-variable map >for logic minimization exercises and FSM synthesis. >Of course, mathematically, either one works.
Yes, my copy of Lewin ("Logical Design of Switching Circuits") does the same. I suspect that teaching material does this because it's easier to visualise, where the more academic approach may be the reflected-binary version. Thanks Evan
Evan Lavelle wrote:
> There's a common misconception that K-maps are/were only used for > minimisation, so they're now irrelevant. Actually, K-maps are probably > the most fundamental tool for the design, specification, and analysis > of combinatorial logic.
That may have been true at one time, but it's not true any longer. Aside from my own experience, I know quite a few digital designers, and most have not used a K-map since school.
> They're also independent of the > implementation, which makes them ideally suited for verification of > the same circuits. They're about 'what', not 'how'. An HDL > description, on the other hand, is exactly the opposite - 'how', not > 'what'.
That entirely depends on how you write the HDL. It's possible and not even all that uncommon to write behavioral HDL that specifies what is desired, and let the synthesizer decide how to implement it. In VHDL one way to do that is to use conditional assignment statements, e.g., Q <= '1' when A = '0' and B = '0' and C = '0' else '0' when A = '0' and B = '0' and C = '1' else '1' when A = '0' and B = '1' and C = '0' else '0' when A = '0' and B = '1' and C = '1' else '1' when A = '1' and B = '0' and C = '0' else '0' when A = '1' and B = '0' and C = '1' else '0' when A = '1' and B = '1' and C = '0' else '1'; That specifies the desired behavior of a combinatorial circuit with three inputs and one output, but nowhere does it explicitly direct the synthesizer to implement it in any particular way. The synthesizer could use a sum-of-products and generate four three-input AND gates and a four-input OR gate, or it might generate a two-input NAND and a two-input XOR, or an eight-input mulitplexer. Even though I knew the desired behavior of the circuit, I didn't have any need to write a K-map, nor would doing so have benefitted me in any way. While this is a trivial example, the same is true of more complex combinatorial logic. For combinatorial circuits with four or fewer inputs, I could easily write out a K-map, but I wouldn't gain anything. For five or more inputs, writing a K-map by hand becomes very tedious and error-prone, and a good synthesizer can minimize the logic just as well as I can anyhow.