fpgadesign.io #11 - One LUT, Any Equation (Up To 6 Inputs)
π Welcome back.
A candidate is handed two equations β one trivially simple, one deliberately ugly β and asked which one costs more hardware. Most spend their first thirty seconds on the wrong variable entirely. This issue is about the one number that actually sets the price.
β‘ Concept of the Week: On an FPGA, complexity is free β up to a point
Here's the setup: you're targeting an FPGA, and you need to implement two equations.
Y = A AND B
Z = AB + B'CD + AC'E + DE'F + BF' + A'CE'F
Z looks like it should cost more. It's got six variables, six product terms, a wall of logic. Y is one gate. If you're thinking in ASIC terms β gate count, transistor count β that intuition is correct: Z needs more silicon than Y, every time.
On an FPGA, it's wrong, and the reason is worth understanding.
A LUT (look-up table) isn't built out of gates at all. It's a tiny memory. For every possible combination of its inputs, it stores the one bit the output should be β program it once, and from then on it's a lookup, not a computation. A 6-input LUT (a LUT6) has 2βΆ = 64 rows in that table. It costs exactly the same to program whether those 64 rows encode A AND B or the messiest 6-variable function you can write. Same silicon, same delay, same one level of logic β because the circuit evaluating it never changes, only the contents of the table do.
So Y and Z β both β€6 inputs β cost the same: one LUT6, one level of logic. Complexity inside that boundary is free.
The boundary itself is the real variable. Go past 6 inputs and the free ride ends β not gradually, but by forcing a structural change. A plain 8-input AND gate, arguably the most "trivial" function imaginable, no longer fits one table. It needs two LUT6s computing partial results, feeding a third LUT that combines them: 2 levels of logic, for a gate simpler than Z. The thing that costs you on an FPGA was never how smart the function is β it's how many inputs it watches.
(Dedicated hardware β carry chains, the MUXF7/MUXF8 pair that can fold two or three LUT6 outputs back into one level β changes this picture further, but that's a deeper rabbit hole than one issue can hold. The Worth Reading link below goes straight there if you want it.)
Ch4 Β§4.7.2 of the book ("The Fundamental Building Block: The Look-Up Table") works through this with the same two equations, plus where carry chains and wide muxes take over from the LUT entirely.
π― Interview Question of the Week
Q: "You're targeting a Xilinx UltraScale+ device, speed grade -2, synthesizing at 400 MHz, single-cycle combinational, no pipelining allowed. Implement Y = A AND B and Z = AB + B'CD + AC'E + DE'F + BF' + A'CE'F. Which one costs more resources?"
How to approach it: notice what's being loaded into the question before you answer it. Speed grade, clock target, tool version, "no pipelining" β none of it is load-bearing. The only fact that decides the answer is that both equations have six or fewer inputs, which means both fit in a single LUT6, which means they cost exactly the same: one LUT, one level of logic. Candidates who start reasoning about setup margin at 400 MHz are solving a problem that was never asked. Interviewers are listening for whether you reach for input count, not for how quickly you can sound busy with irrelevant detail.
(More on this in Chapter 4, Β§4.7.2, p.165 of the book.)
π§© Design Question of the Week
Packet 3 finishes first. It still has to leave last.
Four packets arrive and get dispatched, one each, to four parallel processing engines. Each engine takes a different, data-dependent amount of time to finish, and fires a "done" interrupt β carrying a tag identifying which packet it just completed β the instant it's ready. The interrupts arrive out of order. Engine 3 might signal done before engine 1 even starts.
The output stream has to leave in the original arrival order, not completion order.
A FIFO on the output sounds like the obvious fix β until you notice it doesn't actually solve anything on its own. What has to happen at dispatch time, not completion time, for ordering to be free later? And what single piece of state does the output side need to check, every cycle, before it's allowed to drain the next slot?
Reply with your approach, or with where it gets uncomfortable. Every email gets read. π
π Author's Note
The candidates who get this LUT question wrong almost never get it wrong on the logic β they get it wrong on discipline. They hear "speed grade," "400 MHz," "no pipelining," and start building a timing argument before checking whether timing is even what's being tested. In 20 years of reviewing designs, the engineers who close timing fastest are the ones who first ask "what's the actual lever here?" instead of reaching for the lever they're most comfortable pulling. Input count, not clock speed, was the lever in this one. Knowing which lever you're holding is half the job.
π ICYMI on LinkedIn
π¨ Your 64-bit DMA bus is big-endian. Your FPGA fabric is little-endian. A teammate blames the byte-swap for the timing miss. It's pure re-wiring β zero logic levels, zero LUTs. The real bottleneck was never the swap. β LinkedIn post
π¨ "I added an ILA and timing closed" is not the flex it sounds like. Place-and-route is a search, not a calculation β any perturbation, including the ILA you just added, can land on a different result by chance. If its presence decides pass or fail, you never had margin to begin with. β LinkedIn post
π Worth Reading
- Using Carry Logic β UG474, 7 Series FPGAs CLB User Guide β the official walkthrough of what we did not go into details about: how MUXF7/MUXF8 and the dedicated carry chain fold multiple LUT6 outputs into fewer logic levels than the simple "6 inputs = 1 LUT" picture suggests.
π‘ On the Radar
π΅ Intel and Altera plan a real-time sensor bridge for edge and physical AI β announced Nov 10, combining Intel compute/connectivity with Altera FPGAs to handle multi-sensor timing and real-time processing for robotics, healthcare, and aerospace/defense. No product name, launch date, or customer yet β but it's a tell that FPGAs are the default answer whenever "real-time" and "multiple sensors" show up in the same sentence.
π£ Lattice Prompt 1.1 adds SoC construction, RISC-V firmware, and timing-closure consulting to its AI design assistant β released Oct 30, built on an open MCP-server architecture so it works with any capable LLM, not just one vendor's. The timing-closure anecdote in the release notes: a quantum-error-correction decoder missing 200 MHz by 5ns, root-caused and fixed in 4 hours instead of days. Same thread as a few issues back β AI is moving fastest on the parts of the flow that were always mechanical, not on the judgment calls.
π One small ask
If you've read Demystifying the Digital Design Interview and it's helped you prep, a review on Amazon would help me out tremendously in spreading the word.
There's no big publishing house and no ad budget behind this book β it moves entirely on what readers say about it. Amazon's own algorithm decides who sees it next largely by review count and rating, and the next engineer deciding between prep options reads the reviews before they read anything I've written. A few honest sentences about what actually helped you is the single highest-leverage thing a reader can do.
β Leave a review on Amazon β this link routes to the right Amazon storefront for your country, so it works the same whether you bought it on .com, .in, .co.uk, or elsewhere.
Until next time,
Milind
π Get the book Β· π LinkedIn Β· βοΈ Email