Logic Families, Flip-Flops, Shift Registers, Counters, DAC/ADC, and Digital Memories — the questions that come up most in VLSI, embedded systems, and hardware design interviews.
In a CMOS gate, PMOS and NMOS transistors always work as complementary pairs. In every stable logic state, one transistor of each complementary pair is cut off — there is no DC current path from V_DD to ground. Power is only consumed when switching (P = C·V²·f).
In a TTL totem-pole output, T₃ (upper transistor) is actively driving HIGH and T₄ (lower transistor) is actively driving LOW. If two gates with opposite output states are connected:
Solutions:
Propagation delay (t_pd) is measured from when the input crosses 50% of its swing to when the output crosses 50% of its swing. Two parameters:
What it limits: The longest combinational path between two flip-flops (the critical path) determines maximum clock frequency: f_max = 1 / (t_setup + t_pd_FF + t_comb_path). In VLSI, Static Timing Analysis (STA) finds this critical path and reports setup/hold violations.
The ECL gate is a differential amplifier. A reference transistor biased at −1.29V competes with the input transistors. When an input exceeds the reference, current shifts from the reference branch to the input branch. Transistors switch between cutoff and active regions — never entering saturation:
Trade-offs: ~300mW per gate, negative supply (−5.2V), very low noise margin (~0.2V), difficult PCB design (50Ω transmission lines needed). Used in mainframes, high-speed networking, and radar where 1ns speed is worth any power cost.
Metastability: When timing is violated, the FF can enter a metastable state — neither a valid 0 nor 1. The output may oscillate or settle to an arbitrary value after an unpredictable time. This is the fundamental problem in clock-domain crossing (CDC) circuits.
The JK flip-flop adds Q and Q̄ feedback to the AND gates of the clocked RS latch:
PRESET (PRE̅) and CLEAR (CLR̅) are asynchronous inputs — they operate independently of the clock:
Power-on initialisation: When power is applied, all flip-flop Q outputs are undefined. A brief initialisation pulse on CLR̅ (or PRE̅) resets every FF to a known state before the system clock begins. This is why every real flip-flop in an FPGA or ASIC has an async reset — RTL designers use it to define the power-on state in the reset block.
JK → D flip-flop: D FF characteristic: Q(n+1) = D. From JK excitation table, we need J=D and K=D̄. Connect J directly to D, and K through a NOT gate to D. Simple — 1 NOT gate added.
JK → T flip-flop: T FF characteristic: Q(n+1) = T⊕Q. When T=1, toggle; when T=0, hold. From JK table: toggle when J=K=1, hold when J=K=0. So simply wire J=T and K=T — connect both inputs together. Zero extra gates.
Connect these as AND/NOT gates feeding the JK inputs of the three flip-flops. All FFs share the common clock.
In an asynchronous FIFO, the write pointer runs in the write clock domain; the read pointer comparison must happen in the read clock domain (and vice versa for full/empty detection). Passing a multi-bit binary counter across a clock domain means all changing bits are subject to metastability simultaneously:
This is a fundamental VLSI design rule: always use Gray code counters for FIFO pointers that cross clock domain boundaries. The Gray counter is synthesised as a binary counter with a Gray converter (XOR tree).
For an n-bit weighted resistor DAC, resistors span R to 2^(n-1)·R — a range of 512 for 10-bit. Maintaining this ratio accurately across process, voltage, and temperature (PVT) variation is impractical. Resistors at opposite ends of this range are physically very different and drift differently.
R-2R requires only R and 2R. In VLSI, both are laid out as multiples of a unit resistor in a matched array — they track each other through all PVT variations because:
The Nyquist-Shannon sampling theorem: to perfectly reconstruct a continuous-time signal, the sampling rate f_s must be at least 2 × f_max (the highest frequency component in the signal).
Aliasing: If f_s < 2·f_max, high-frequency components fold back into the baseband and appear as spurious low-frequency signals. Example: a 9 kHz signal sampled at 16 kHz appears as a 7 kHz alias (16 − 9 = 7 kHz).
Solution: Place an anti-aliasing filter (low-pass) before the ADC to band-limit the input to f_s/2. In practice, use f_s = 2.5 to 3× f_max to allow for a realizable filter roll-off.
The memory hierarchy exploits two types of locality in typical programs:
Hierarchy (fastest/smallest to slowest/largest): Registers (~1 cycle) → L1 SRAM cache (3–5 cycles) → L2/L3 SRAM cache (10–40 cycles) → DRAM main memory (~200 cycles) → Flash/SSD (~100,000 cycles) → Hard disk (~10,000,000 cycles).