90+ free questions on the round that opens most VLSI interviews: number systems, gates, K-maps, adders, flip-flops, setup and hold, counters, FSMs and CMOS basics. Includes 18 worked answers, 8 solved numericals, a K-map solved step by step and a two's-complement converter.
581 questions with interview-ready answers and tips, 20 Verilog exercises with solutions, 25 solved numericals and 30 debugging scenarios.
Whatever VLSI role you apply for, someone will ask you to convert a number, simplify a function, draw a flip-flop waveform or design a counter. It's the screening round for RTL, verification, FPGA, physical design and DFT jobs, and the foundation every later round quietly assumes.
The questions sound simple, which is the trap. Interviewers use them to see how you reason: whether you check your arithmetic, mention the edge case, and know why a circuit works, not just what it's called. Use the formula sheet and converter first, skim the 50 questions by topic, then attempt each worked answer and numerical before you open it.
Base conversions in your head, two's complement and overflow, Gray and BCD, De Morgan, universal gates and K-maps. Fast, short questions where a small slip costs you.
Adders, MUX-based logic, decoders, latches versus flip-flops, counters, shift registers, sequence detectors and clock dividers. Expect to draw on the whiteboard or write a few lines of Verilog.
Setup and hold, fmax, hazards, metastability, inferred latches and "it works in simulation but not on the board". They're checking whether you can find a cause, not recite a fact.
After a conversion, add the place values back up. After a two's-complement answer, use the negative MSB weight. A self-check out loud is worth more than speed.
A truth table, a K-map or a three-line waveform makes your reasoning visible and catches mistakes before the interviewer does.
Overflow, the most negative number, don't-cares, unused counter states, the LFSR lock-up state, overlapping patterns. Mentioning it unprompted signals experience.
How many gates, how many logic levels, how many flip-flops? Ripple versus lookahead, binary versus one-hot: every design answer has a trade-off.
Setup depends on the clock period; hold doesn't. Slowing the clock fixes setup only. Mixing these up is the most common timing error in fresher rounds.
Picture the flops and gates before you type. Non-blocking for clocked logic, every output assigned in combinational blocks, and a reset for every state register.
Most numerical questions in this round reduce to one of these.
Type any whole number, negative values included, and pick a width. Use it to check your hand conversions.
Counter questions are almost guaranteed. Knowing these trade-offs answers most follow-ups before they're asked.
| COUNTER | FLOPS FOR N STATES | STATES FROM n FLOPS | DECODE | CATCH | TYPICAL USE |
|---|---|---|---|---|---|
| Ripple (asynchronous) | ⌈log2N⌉ | 2n | n-input gate | Bits settle one after another, so decoded outputs glitch | Slow prescalers, low-power dividers |
| Synchronous binary | ⌈log2N⌉ | 2n | n-input gate | Carry chain sets the speed | Timers, general counting |
| Ring (one-hot) | N | n | None needed | Most flops; needs a valid start pattern | Sequencers, one-hot FSMs |
| Johnson (twisted ring) | N / 2 | 2n | 2-input AND | Unused states unless self-correcting | Glitch-free decode, multiphase clocks |
| Maximal-length LFSR | ⌈log2(N + 1)⌉ | 2n − 1 | n-input gate | All-zeros (XOR) state locks up | PRBS, BIST, CRC, scramblers |
| Gray counter | ⌈log2N⌉ | 2n | n-input gate | Arithmetic needs conversion | Async FIFO pointers, low switching |
A cross-section of what interviewers draw on most. The 581-question ebook goes much deeper on every topic and answers each one.
Moving between bases and encodings without a calculator.
Signed numbers, overflow and fixed point.
The algebra under every circuit.
From truth table to the fewest gates.
Adders, multiplexers, decoders and comparators.
What gate delays do to clean logic.
How one bit is stored, and when it changes.
The timing questions that decide the round.
Sequential design on the whiteboard.
Where logic meets silicon and code.
case in an always @(*) block infer a latch?581 questions across 27 chapters, every one answered: 20 Verilog exercises with solutions, 25 solved numericals, 30 debugging scenarios, plus memories, data converters, interfacing and low-power design.
Say your answer out loud first (or sketch it, for the design ones), then open it. Each answer shows what a strong reply includes, what the interviewer is listening for, and the slip that costs candidates the most.
Flip-flops give one sampling instant per cycle, so timing analysis is simple and glitches on the data path between edges don't matter. Latches are smaller and allow time borrowing, which is why they appear on purpose in clock-gating cells and some high-speed paths.
With two's complement, the same adder handles signed and unsigned numbers, subtraction is just A + (~B + 1), and there is only one zero. Sign-magnitude and one's complement both have a +0 and a −0 and need extra logic for subtraction.
Example in 8 bits: 100 + 50 = 0110 0100 + 0011 0010 = 1001 0110, which reads as −106. Two positives gave a negative, so V = 1.
A gate is universal if any Boolean function can be built using only that gate. NAND and NOR each can produce NOT plus either AND or OR, and that set is functionally complete.
NOT : Y = (A·A)' → 1 NAND AND : Y = ((A·B)')' → 2 NANDs (NAND, then NAND as inverter) OR : Y = (A'·B')' = A + B → 3 NANDs (invert each input, then NAND)
Universality matters in practice because NAND is the fastest, smallest 2-input gate in CMOS, so standard-cell libraries and early logic families were built around it.
Gray code is an ordering of binary values in which consecutive values differ in exactly one bit. Converting is a single XOR per bit:
binary → Gray : g = b ^ (b >> 1) 1011 → 1110
Gray → binary : b[MSB] = g[MSB], then
b[i] = b[i+1] ^ g[i] 1110 → 1011Setup time is how long the data must be stable before the clock edge; hold time is how long it must stay stable after it. Together they form a small window around the edge where the input must not change.
Physically, the master latch inside the flip-flop needs time for the new value to propagate through its internal path before it closes (setup), and the closing transmission gate needs time to turn fully off before the input moves (hold). Change inside the window and the internal node can be left mid-way, which is metastability.
setup: t_cq + t_logic,max + t_su ≤ T + t_skew − t_jitter hold : t_cq,min + t_logic,min ≥ t_h + t_skew
Note that the clock period T appears only in the setup check.
A common compromise is a Mealy machine whose outputs are registered: it keeps the smaller state count and gets clean outputs, at the cost of one cycle of latency, which makes it behave like a Moore machine at the output.
Use A and B as the select lines and express each data input as a function of C:
| AB | Minterms | F in terms of C | Data input |
|---|---|---|---|
| 00 | m0 = 0, m1 = 1 | F = C | I0 = C |
| 01 | m2 = 1, m3 = 0 | F = C' | I1 = C' |
| 10 | m4 = 0, m5 = 0 | F = 0 | I2 = 0 |
| 11 | m6 = 1, m7 = 1 | F = 1 | I3 = 1 |
So a 2n:1 multiplexer plus an inverter implements any function of n + 1 variables. Choosing different select variables changes how simple the data inputs are, so try the variable that appears least.
In a ripple-carry adder, each full adder waits for the carry from the one below it, so delay grows linearly with width: an n-bit add takes about n carry delays.
Carry lookahead computes every carry directly from two per-bit signals:
G_i = A_i · B_i (this bit generates a carry) P_i = A_i ⊕ B_i (this bit propagates an incoming carry) C1 = G0 + P0·C0 C2 = G1 + P1·G0 + P1·P0·C0 C3 = G2 + P2·G1 + P2·P1·G0 + P2·P1·P0·C0
All carries come out of two levels of logic instead of a chain. The cost is fan-in and area, which grow quickly, so real adders use 4-bit lookahead blocks combined hierarchically, or prefix adders (Kogge–Stone, Brent–Kung) with O(log n) delay.
Take B = C = 1 and let A fall from 1 to 0. Logically F = 1 throughout. In the circuit, AB turns off when A falls, but A'C only turns on after the inverter delay. For that brief moment both product terms are 0 and F dips: a static-1 hazard.
On the K-map, the two 1-cells ABC = 111 and 011 are adjacent but covered by different groups. Adding the consensus term BC covers both, so it holds F at 1 while A changes:
F = AB + A'C + BC (BC is logically redundant but removes the hazard)
In synchronous design this glitch usually doesn't matter, because it settles before the next clock edge. It matters on anything sampled asynchronously: clocks, asynchronous resets, latch enables and outputs leaving the chip.
Give each state a meaning: how much of the pattern has been seen so far.
| State | Meaning | Input 0 | Input 1 | Output |
|---|---|---|---|---|
| S0 | nothing useful | S0 | S1 | 0 |
| S1 | seen "1" | S0 | S2 | 0 |
| S2 | seen "11" | S3 | S2 | 0 |
| S3 | seen "110" | S0 | S1 | 1 |
Two transitions carry the logic. From S2, another 1 stays in S2, because the last two bits are still "11". From S3, a 1 goes to S1, because that 1 could start the next match. Four states need two flip-flops in binary or four in one-hot.
module mod_n_counter #(parameter N = 10, W = $clog2(N)) (
input wire clk, rst_n, en,
output reg [W-1:0] count,
output wire tc // high on the last count
);
assign tc = en && (count >= N-1);
always @(posedge clk or negedge rst_n)
if (!rst_n) count <= {W{1'b0}};
else if (tc) count <= {W{1'b0}};
else if (en) count <= count + 1'b1;
endmodule>= N-1 instead of == N-1 makes any unused state wrap to 0 on the next enabled clock, so the counter recovers on its own.tc lets counters cascade: the next stage counts only when this one wraps.A blocking assignment (=) updates immediately, so the next line sees the new value. A non-blocking assignment (<=) evaluates all right-hand sides first and updates the targets together at the end of the time step, the way flip-flops all sample on one edge.
// non-blocking: a real 3-stage shift register always @(posedge clk) begin q1 <= d; q2 <= q1; q3 <= q2; end // blocking: every stage gets d on the same edge, // so it behaves (and synthesises) like a single flop always @(posedge clk) begin q1 = d; q2 = q1; q3 = q2; end
always blocks.always @(*) blocks.In a ripple counter each flip-flop is clocked by the previous one, so the bits change one after another. Going from 0111 to 1000, the outputs briefly pass through 0110, 0100 and 0000. A decoder looking for any of those values produces a short spike, and a block that reacts to edges or levels asynchronously sees a false trigger.
To tell them apart: check the timing report for both setup and hold, check that every clock and input delay is constrained, and look for paths between unrelated clocks. Changing frequency is a quick diagnostic, but not a fix for hold.
A latch is inferred whenever some path through an always @(*) block leaves an output unassigned, so the tool must remember its old value.
always @(*) begin
y = 1'b0; // default first: every path assigns y
case (sel)
2'd0: y = a;
2'd1: y = b;
2'd2: y = c;
default: y = 1'b0; // covers sel = 3 and X in simulation
endcase
endif needs an else, or a default assignment at the top.case needs a default, or full coverage of all values.The enable comes from logic clocked on the same clock, so it changes shortly after the rising edge, while the clock is high. With gclk = clk & en, an enable that rises or glitches during the high phase creates a short extra pulse on the gated clock, and the register counts it.
The standard fix is an integrated clock-gating cell: a latch that is transparent while the clock is low captures the enable, and the AND uses the latched enable. The enable can only change while the clock is low, so the gated clock is always a whole, clean pulse.
On FPGAs, avoid gating clocks in logic at all: use the flip-flop's clock-enable pin or a dedicated clock buffer with enable.
A CMOS input has almost no DC current, so a floating pin drifts with leakage, coupling and noise and often settles near the middle of the supply. At that voltage both the PMOS and NMOS of the input stage are partly on, so current flows straight from VDD to ground: extra power and heat. The input also wanders across the threshold, so the logic it drives toggles at random.
The state register has codes that aren't real states: 3 bits for 5 states leaves 3 unused codes, and one-hot has many more. If power-up or noise leaves the register in one of them and the next-state logic has no way out, the FSM is stuck.
Short calculations come up in written tests and in the interview itself. Solve each on paper, then tap to check.
Integer: 45 = 32 + 8 + 4 + 1 → 101101
Fraction: 0.625 × 2 = 1.25 → 1
0.25 × 2 = 0.5 → 0
0.5 × 2 = 1.0 → 1 → .101
Binary: 101101.101
Octal : 101 101 . 101 → 55.5
Hex : 0010 1101 . 1010 → 2D.ANote: group in threes or fours outward from the binary point, padding with zeros on both ends.
+75 = 0100 1011 → −75 = 1011 0101 +60 = 0011 1100 → −60 = 1100 0100 1011 0101 + 1100 0100 = 1 0111 1001 → keep 8 bits: 0111 1001 = +121 Carry into MSB = 0, carry out = 1 → V = 1
Note: the true sum −135 is below −128, so it doesn't fit. Two negatives gave a positive: overflow.
Need 2^p ≥ m + p + 1, with m = 26 p = 4: 16 ≥ 31 ✗ p = 5: 32 ≥ 32 ✓ → 5 check bits (31-bit codeword) SECDED: add one overall parity bit → 6 (32 bits)
Note: 26 data bits is the exact fit for 5 check bits, so a 32-bit SECDED word is a natural size.
T_min = t_cq + t_logic + t_su − t_skew + t_jitter
= 0.35 + 2.6 + 0.15 − 0.2 + 0.1
= 3.0 ns
f_max = 1 / 3.0 ns ≈ 333 MHzNote: a late capture clock helps setup. The same skew makes hold harder, as N5 shows.
Arrival = 0.12 + 0.08 = 0.20 ns Required = t_h + t_skew = 0.10 + 0.15 = 0.25 ns Slack = 0.20 − 0.25 = −0.05 ns → violation
Note: add at least 0.05 ns of delay on the short path, or reduce the skew. The clock period doesn't appear anywhere, so slowing the clock doesn't help.
Worst settle = 6 × 4 ns = 24 ns, plus decode 8 ns = 32 ns f_max ≈ 1 / 32 ns ≈ 31 MHz MSB frequency = 12 MHz / 2^6 = 187.5 kHz
Note: a synchronous counter's speed doesn't depend on its width in the same way, which is why ripple counters are rare in fast logic.
P = α · C · V² · f P1 = 0.15 × 1.5 nF × 0.81 × 1.2 GHz ≈ 219 mW P2 = 0.15 × 1.5 nF × 0.64 × 1.0 GHz = 144 mW Saving ≈ 34% for a 17% drop in frequency
Note: voltage is squared, so scaling voltage and frequency together saves far more than frequency alone.
LSB = 3.3 V / 1024 ≈ 3.22 mV Code = floor(1.2 / 3.22 mV) = floor(372.4) = 372 = 0x174 SQNR ≈ 6.02 × 10 + 1.76 ≈ 62.0 dB
Note: each extra bit halves the LSB and adds about 6 dB.
F(A, B, C, D) = Σm(0, 2, 5, 7, 8, 10, 13, 15). Two groups cover every 1, and one of them is the grouping candidates miss most often.
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1m0 | 0m1 | 0m3 | 1m2 |
| 01 | 0m4 | 1m5 | 1m7 | 0m6 |
| 11 | 0m12 | 1m13 | 1m15 | 0m14 |
| 10 | 1m8 | 0m9 | 0m11 | 1m10 |
Because the cells aren't visibly next to each other. A K-map is really drawn on a torus: the top row touches the bottom row and the left column touches the right column. Point this out on the whiteboard; it's often exactly what the interviewer is testing.
No. A static-1 hazard needs two adjacent 1-cells covered by different groups, so that changing one variable hands the output from one product term to another. Here no 1 in the corner group is adjacent to a 1 in the centre group: moving from one group to the other always means changing both B and D.
F = B'D' + BD in two-level NAND–NAND form is ((B'D')' · (BD)')'. That is three NANDs plus two NANDs used as inverters for B' and D': five in total. Recognising it as XNOR is better still: XNOR is an XOR (four NANDs) followed by an inverter, also five, but a single XNOR cell is the cheapest real implementation.
It doesn't help. m1 touches m0 and m5, but every possible quad that includes m1 also includes a 0 (m3, m4 or m9), so it can't enlarge either group. A don't-care is only used when it makes a group bigger; otherwise it is left as 0. The ebook has a whole chapter of K-map and Quine–McCluskey problems.
Screening rounds and online tests love questions like these. Answer each in a few seconds, then tap to check.
Four.
4,095.
−128 to +127.
1111.
Four.
Eight (2n).
Fifteen (2n − 1).
Five.
Fifteen.
BC.
T (or JK with J = K = 1).
S = R = 1.
No. Hold doesn't depend on the period.
250 MHz.
P = α·C·V2·f.
NOR stacks the slower PMOS in series.
Four.
About 49.9 dB.
An inverter.
Non-blocking.
A wrong conversion said confidently hurts more than a slow correct one. Check by adding place values back, or by using the negative MSB weight.
Carry-out flags unsigned overflow. Signed overflow is the XOR of the carries into and out of the MSB.
Corners and opposite edges are neighbours. Missing them gives a correct but non-minimal answer, and interviewers notice.
It fixes setup. Hold violations need more delay on the short path or less skew.
Counters and FSMs with spare codes need a way back to the sequence. Say so before you're asked.
Blocking assignments in clocked blocks, missing defaults in combinational blocks, and no reset on state registers all show up as real hardware bugs.
Yes. It is usually the first technical round for RTL design, verification, FPGA, physical design, DFT and embedded-hardware roles, and it is common in online tests for campus drives. Later rounds also assume it: STA builds on setup and hold, RTL on FSMs and counters, and verification on reading waveforms.
Two's complement and overflow, universal gates, K-maps, MUX-based logic, adders, hazards, latch versus flip-flop, setup and hold, counters, FSM sequence detectors, clock dividers and metastability. Freshers are also often asked to write a small Verilog module.
Enough to draw a CMOS inverter, NAND and NOR, explain why NAND is preferred, state the dynamic power formula and explain noise margin and propagation delay. Transistor-level sizing and device physics belong to the CMOS round.
For RTL, verification and FPGA roles, yes: expect to write a counter, an edge detector, a MUX or a simple FSM, and to explain blocking versus non-blocking assignments. For other roles a gate-level or block-diagram answer is usually enough.
Work through the formula sheet, redraw a K-map, a full adder, a flip-flop timing diagram and a sequence detector from memory, solve a few setup and hold numericals, then answer the rapid-fire round out loud.
No. Latches are used on purpose in clock-gating cells, time-borrowing high-speed designs and some memories. What interviewers dislike is an unintended latch inferred from an incomplete if or case in combinational RTL.
Book a 1:1 mock interview with a mentor working in this exact domain.
Book a mock interview