Draft preview. Lessons are being written and reviewed.

Digital Design / Module 12: Projects and interview preparation

68. Interview patterns

Recognise the common problem shapes.

Lecture coming soon

The idea

Digital design interviews repeat a small set of problem shapes. They're testing how you think about hardware, more than whether you remember an answer. Practise the routine as well as the questions.

A reliable routine

  • Clarify. Ask about reset, clock, width, valid inputs, and whether it's overlapping. Asking well is part of the test.
  • Sketch hardware. Draw blocks and a timing diagram before coding.
  • State your assumptions out loud.
  • Write the RTL, clean and synthesizable.
  • Check the edge cases: reset, full, empty, wrap, and first and last cycles.
  • Discuss trade-offs: area, timing, and power, and what you'd change at higher speed.

The common shapes

ShapeExamples
Sequence and FSMPattern detectors, vending machines, divisibility by 3
Clock tricksDivide by odd numbers, -free clock mux,
Timing mathfmax, , effects, hold fixes
Buffering depth, full and empty,
Crossing, pulses, multi-bit buses, async FIFO
Tricks with few gatesBuild XOR from NANDs, a mux as universal logic
Debugging"This code has a bug", "this waveform looks wrong"
Bit manipulationCount ones, find lowest set bit, detect power of 2

How to answer "I don't know"

Reason from what you do know, out loud. "I haven't built one of those, but a crossing needs a stable signal, so I'd start by..." is a strong answer. Silence, or a memorised answer that collapses at the first follow-up, is weak.

Prepare your project story

Be ready to walk through one design in depth: what it does, why you made its key choices, what went wrong, and how you found it. Expect "what would you change at twice the frequency?" A real story with real numbers beats any textbook answer.

Practise under pressure

Use the Interview page to answer out loud, with a timer. Write RTL on paper, or in a plain text editor, without autocomplete. Then check your answer, and record what you missed.

Common mistake

Rushing to write code. The candidates who sketch first, then ask questions, usually finish sooner and with fewer errors. And they show exactly the habits a team wants to hire.

Key ideas

  • Clarify, sketch hardware, then write RTL.
  • State your assumptions about reset and timing.
  • Check edge cases out loud.

Your exercise

Timed practice: 20 mixed questions.

Interview questions

coreWhat do interviewers look for?

basicIs this a correct power-of-two test for an 8-bit x?

assign is_pow2 = ((x & (x - 8'd1)) == 8'd0);

basicYou are asked to detect the pattern 101 in a serial stream. The input is 1, 0, 1, 0, 1. How many matches should be reported, and what should you ask first?

coreBits arrive one per clock, MSB first. This FSM keeps the remainder of the number so far divided by 3. Feed it 1, 1, 1, 1: when does div go high?

always @(posedge clk or negedge rst_n)
  if (!rst_n) r <= 2'd0;
  else case (r)
    2'd0:    r <= bit_in ? 2'd1 : 2'd0;
    2'd1:    r <= bit_in ? 2'd0 : 2'd2;
    default: r <= bit_in ? 2'd2 : 2'd1;
  endcase
assign div = (r == 2'd0);

coreA burst of 120 words is written at 250 MHz, one per cycle. The reader takes one word per cycle at 100 MHz. What is the minimum FIFO depth?

coreWhat hardware does this population count become, and how would you make it faster?

always @(*) begin
  n = 4'd0;
  for (i = 0; i < 8; i = i + 1)
    n = n + x[i];
end

coreYou design a rising-edge detector that compares the input with last cycle's value. What assumption should you state, and what changes if it does not hold?

advancedDescribe a glitch-free clock multiplexer for two unrelated clocks.

advancedA path has clock-to-Q 0.2 ns, maximum logic 3.1 ns, minimum logic 0.05 ns, setup 0.15 ns and hold 0.1 ns. The capture clock arrives 0.25 ns later than the launch clock. What is the highest clock frequency, and is hold met?

Practise these 9 questions with animations