VLSI design interviews mix three kinds of questions: aptitude and analytical puzzles, quick logic design brain-teasers, and deeper questions on RTL, verification, test and physical design. This page collects them in one place: the original puzzle index with links to every question tagged "Interview Questions" on this blog, a digest of eleven classic ASIC puzzles, and eight puzzles solved here step by step, with Verilog where it helps.
Key takeaways
- Most hardware puzzles test one idea at a time: a universal gate, a counting trick, a timing equation or a clock edge trick. Name the idea before you start drawing.
- Say your assumptions out loud (registered or not, reset style, which clock edge). Interviewers mark the reasoning, not only the final answer.
- Always check your answer with a small example: a truth table row, a timing number or a two-cycle waveform.
- Puzzles that produce clocks (dividers, gating) have a second question hidden inside: is the result glitch-free and safe for timing tools?
Great puzzles and VLSI design interview questions: the index
Great Puzzles / VLSI Design Interview questions
- Everything that is tagged "Interview Questions": all interview question posts on this blog
- Aptitude
- Analytical
- Quantitative
- ASIC/VLSI/SoC
- RTL/Logic Design
- Design Verification
- Design for Test
- Design for Debug
- Work in progress: questions on debug and silicon bring-up will be added here. Suggestions are welcome in the comments.
- Physical Design
Eleven classic ASIC design puzzles (external digest)
These eleven puzzles were posted on the ASIC digital design blog at asicdigitaldesign.wordpress.com in 2007. Each link goes to the puzzle itself, and the comments under each post discuss solutions.
- Puzzle #1: XOR from odd parts. Build an XOR gate from two unusual components whose truth tables include a high-Z output. Good practice for reasoning about tri-state outputs.
- Puzzle #2: counting ones with full adders. Count the 1s in a 7-bit vector using the fewest full adders. A worked answer is in the deep dive below.
- Puzzle #3: swap two registers. Exchange the contents of two n-bit registers using only bitwise operations, loading one register per cycle.
- Puzzle #4: the min-max question. Sort four numbers using as few two-input MinMax blocks as possible, then try six. An introduction to sorting networks.
- Puzzle #5: binary and Gray. Which burns more power over a full count: a binary counter, or a Gray counter whose cells cost three times as much per toggle? Worked answer below.
- Puzzle #6: the spy. Send as much information as possible by flipping at most one bit of a fixed 15-bit broadcast. A route into error-correcting codes.
- Puzzle #7: transitions. Can a finite state machine tell, at any moment, whether an endless bit stream has had more 0-to-1 or 1-to-0 transitions?
- Puzzle #8: clock frequency driver. Fix the duty-cycle distortion that the output XOR gate causes in a clock frequency circuit from an earlier post on that blog.
- Puzzle #9: the snail. Work out which way to follow a trail of 0s and 1s to get home.
- Puzzle #10: mux logic. Rebuild a given gate circuit using only multiplexers, the same idea as puzzle 1 in the deep dive below.
- Puzzle #11: not just another hats problem. Fifty people in a column guess their own hat colors; find the strategy that saves the most. The answer uses parity.
Note (November 2026): all eleven links above were checked on 18 November 2026 and still open on the original site.
How interviewers extend these puzzles
- Change one constraint: divide by 5 instead of 3, or use only NOR gates instead of NAND.
- Ask for cost: how many gates, flops or LUTs, and what is the critical path.
- Ask for robustness: what happens after reset, during a glitch, or when a signal crosses a clock domain.
- Ask for verification: how would you prove the circuit correct in simulation, and what assertions would you write.
Mistakes to avoid
- Jumping to Verilog before you have a truth table or a waveform.
- Forgetting reset: a counter or divider with no defined start state is an incomplete answer.
- Gating or dividing clocks with logic without mentioning glitches and timing constraints.
- Answering an aptitude puzzle without explaining why the method always works.
If you are preparing for a role, the semiconductor jobs board on The Semiconductor Hub lists current openings, and the semiconductor glossary is a quick way to check terms that come up in interviews.
Deep dive: the numbers and details
This part holds ten puzzles solved step by step, with truth tables, waveforms, Verilog and the arithmetic. Try each one before reading the answer. Skip this part if the index is all you need.
Puzzles 1 to 8 were written for this page; puzzles 9 and 10 are worked answers to two of the external digest puzzles above.
1. Build any gate from 2:1 multiplexers
Question: Using only 2:1 muxes and the constants 0 and 1, build NOT, AND, OR and XOR.
Answer: A 2:1 mux computes y = s ? i1 : i0. Put one input on the select line and choose the data inputs:
| Gate | Select | i1 (when select = 1) | i0 (when select = 0) | Muxes |
|---|---|---|---|---|
| NOT a | a | 0 | 1 | 1 |
| a AND b | a | b | 0 | 1 |
| a OR b | a | 1 | b | 1 |
| a XOR b | a | NOT b (one more mux) | b | 2 |
Because NOT and AND can both be built, the 2:1 mux is a universal element. This is also why an FPGA lookup table, which is a tree of muxes, can implement any function.
2. XOR from NAND gates only
Question: What is the minimum number of 2-input NAND gates for a 2-input XOR?
Answer: Four. Let n1 = NAND(a, b), n2 = NAND(a, n1), n3 = NAND(b, n1), y = NAND(n2, n3). Check one row: a = 1, b = 0 gives n1 = 1, n2 = 0, n3 = 1, y = 1, which is correct for XOR.
3. Binary to Gray and back
Question: Write the conversion both ways for an N-bit value.
Answer: Binary to Gray is one XOR per bit: each Gray bit is the binary bit XOR the next higher binary bit. Gray to binary is a running XOR from the most significant bit down. Example: binary 0110 (6) gives Gray 0101; converting back, 0, 0^1 = 1, 1^0 = 1, 1^1 = 0, which is 0110 again.
module bin_gray #(parameter N = 4) (
input wire [N-1:0] bin,
output wire [N-1:0] gray,
input wire [N-1:0] gray_in,
output reg [N-1:0] bin_out
);
assign gray = bin ^ (bin >> 1);
integer i;
always @* begin
bin_out[N-1] = gray_in[N-1];
for (i = N-2; i >= 0; i = i - 1)
bin_out[i] = bin_out[i+1] ^ gray_in[i];
end
endmodule
Interview follow-up: Gray codes are used for FIFO pointers that cross clock domains because only one bit changes per increment, so a synchronizer can never capture a value that is more than one step wrong. Puzzle 10 below adds the power side of the trade-off.
4. Divide a clock by 3 with a 50% duty cycle
Question: Produce a divide-by-3 clock with exactly 50% duty cycle.
Answer: A mod-3 counter alone gives a high time of one or two input periods out of three (33% or 67%). To get 1.5 periods, use both clock edges: a rising-edge flop that is high for one period, and a falling-edge copy of it that is delayed by half a period. Their OR is high for 1.5 of every 3 periods.
| Time (input periods) | 0 to 0.5 | 0.5 to 1 | 1 to 1.5 | 1.5 to 2 | 2 to 2.5 | 2.5 to 3 |
|---|---|---|---|---|---|---|
| q_pos | 1 | 1 | 0 | 0 | 0 | 0 |
| q_neg | 0 | 1 | 1 | 0 | 0 | 0 |
| clk_out | 1 | 1 | 1 | 0 | 0 | 0 |
module div3_50 (
input wire clk,
input wire rst_n,
output wire clk_out
);
reg [1:0] cnt;
reg q_pos, q_neg;
always @(posedge clk or negedge rst_n)
if (!rst_n) cnt <= 2'd0;
else if (cnt == 2'd2) cnt <= 2'd0;
else cnt <= cnt + 2'd1;
// high for one input period out of three
always @(posedge clk or negedge rst_n)
if (!rst_n) q_pos <= 1'b0;
else q_pos <= (cnt == 2'd2);
// same waveform, delayed by half a period
always @(negedge clk or negedge rst_n)
if (!rst_n) q_neg <= 1'b0;
else q_neg <= q_pos;
assign clk_out = q_pos | q_neg;
endmodule
Interview follow-up: in an ASIC, say that a derived clock built from logic must be declared to the timing tool (a generated clock), and that a duty-cycle-sensitive design needs the input clock duty cycle to be well controlled too, because the falling edge sets half a period.
5. Maximum clock frequency
Question: Clock-to-Q is 0.3 ns, the worst logic path is 2.5 ns, setup time is 0.2 ns, and the capture clock arrives 0.1 ns later than the launch clock. What is the maximum frequency?
Answer: T(min) = t(clk-q) + t(logic) + t(setup) minus skew = 0.3 + 2.5 + 0.2 minus 0.1 = 2.9 ns, so f(max) is about 345 MHz. Late capture skew helps setup but hurts hold, so the follow-up is the hold check: t(clk-q) + t(logic, min) must be at least t(hold) + 0.1 ns. The setup time and hold time explainer covers both checks in detail.
6. Is a number a power of two?
Question: Detect, in one cycle, whether an N-bit unsigned value x is a power of two.
Answer: (x != 0) && ((x & (x - 1)) == 0). Subtracting 1 clears the lowest set bit and sets the bits below it, so the AND is zero only when x had exactly one bit set. Example: x = 8 (1000), x minus 1 = 0111, AND = 0, so true; x = 6 (0110), x minus 1 = 0101, AND = 0100, so false.
7. Eight balls, one heavier, two weighings
Question: Eight identical-looking balls, one is heavier. Find it with a balance in two weighings.
Answer: Weigh 3 against 3. If they balance, the heavy ball is in the remaining 2: weigh them against each other. If one side is heavier, take its 3 balls, weigh 1 against 1; if they balance, it is the third. Each weighing has three outcomes, so two weighings separate up to 3 x 3 = 9 balls, which is the reasoning interviewers want to hear.
8. Glitch-free clock gating with a plain AND gate?
Question: Why is assign gclk = clk & en; risky when en comes from rising-edge logic, and how do you fix it?
Answer: en changes shortly after the rising edge, while clk is high, so the AND output can show a runt pulse or a clipped high phase. The standard fix is a latch that is transparent while clk is low, so en is frozen during the high phase. Library integrated clock gating (ICG) cells contain exactly this latch plus the AND gate.
module clk_gate (
input wire clk,
input wire en,
output wire gclk
);
reg en_lat;
always @*
if (!clk) en_lat = en; // transparent while clk is low
assign gclk = clk & en_lat;
endmodule
Use the library ICG cell in real designs; the model above shows the idea. For latch behavior in general, see latch vs flip-flop: differences, table and code.
9. Count the ones in 7 bits with full adders (digest puzzle #2)
Question: A 7-bit input must produce the number of 1s it contains, as a 3-bit binary value. Only full adders are available. What is the minimum number?
Answer: Four. A full adder is itself a counter: it takes three bits of equal weight and returns their count as a sum bit (weight 1) and a carry bit (weight 2).
- FA1 adds bits a, b, c giving s1 (weight 1) and k1 (weight 2).
- FA2 adds bits d, e, f giving s2 (weight 1) and k2 (weight 2).
- FA3 adds s1, s2 and bit g. Its sum is output bit 0; its carry k3 has weight 2.
- FA4 adds k1, k2 and k3, all of weight 2. Its sum is output bit 1 and its carry is output bit 2.
Check with 1100110: FA1 on 1, 1, 0 gives s1 = 0, k1 = 1; FA2 on 0, 1, 1 gives s2 = 0, k2 = 1; FA3 on 0, 0, 0 gives bit 0 = 0, k3 = 0; FA4 on 1, 1, 0 gives bit 1 = 0, bit 2 = 1. The result is 100, which is 4. This 7-to-3 counter is the building block of the compressor trees inside fast multipliers.
10. Binary counter or Gray counter: which burns more power? (digest puzzle #5)
Question: An n-bit binary counter has cells that cost P per toggle. An n-bit Gray counter has cells that cost 3P per toggle. Over one full cycle of 2n counts, which uses more energy?
Answer: Count the toggles. In the binary counter, bit 0 toggles on every count (2n times per cycle), bit 1 half as often (2n-1), and so on down to the top bit (2 times). The total is 2n + 2n-1 + ... + 2 = 2n+1 - 2 toggles, so the energy is (2n+1 - 2)P, just under 2 · 2n P. A Gray counter changes exactly one bit per count, so it makes 2n toggles and uses 3 · 2n P. The Gray counter burns about 1.5 times more. For n = 4: binary 30P, Gray 48P.
The follow-up is the useful part: the Gray counter is still preferred for FIFO pointers that cross clock domains, because only one bit changes per step. Clifford Cummings explains this in section 2 of Simulation and Synthesis Techniques for Asynchronous FIFO Design (SNUG 2002, Internet Archive copy).
Frequently asked questions
What kind of puzzles are asked in VLSI interviews?
Typical ones are logic puzzles (universal gates, Gray code, counters, clock dividers), timing puzzles (maximum frequency, setup and hold with skew) and general aptitude puzzles (weighing, probability, counting). Most can be solved in five to ten minutes on a whiteboard.
How should I answer a hardware puzzle I have not seen before?
Restate the problem, write down the assumptions, solve a tiny case first (2 bits, 2 cycles), then generalize. Check the answer against one example before you call it done.
Do I need to write Verilog in a puzzle round?
Often yes, for short blocks such as a counter, divider or edge detector. Keep it synthesizable, include reset, and explain the hardware it describes.
Why is a 50% duty cycle divide-by-3 harder than divide-by-2?
An odd divider must hold its output high for a fractional number of input periods (1.5 of 3), which needs both clock edges. Even dividers only need a toggle flop or a counter.
Further reading
- Clifford E. Cummings, Simulation and Synthesis Techniques for Asynchronous FIFO Design (SNUG 2002, Internet Archive copy): Gray code pointers and synchronizers, the real-world reason behind puzzles 3 and 10.


yaa... i have seen allready.... its nice..... lets share knowledge and learn little more..!
ReplyDeleteCan you post solutions to your interview questions?
ReplyDeleteHi
ReplyDeleteTks very much for post:
I like it and hope that you continue posting.
Let me show other source that may be good for community.
Source: Good interview questions
Best rgs
David