S249 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S2 · Lesson 49 · Converter lab

ENOB, DNL and INL, and a delta-sigma modulator, in Python

Data converters are specified by a handful of numbers (SINAD and ENOB, DNL and INL, a figure of merit) and each comes from a precise measurement procedure. This lab writes those procedures in Python: quantize a coherently sampled sine and compute its SINAD, turn a converter's measured transition levels into DNL and INL, and simulate a first-order delta-sigma modulator to see a one-bit stream average out to an arbitrary input.

  • The curve is the ideal SQNR of a one-bit delta-sigma modulator against oversampling ratio, for loop orders 1 to 4: 6.02+1.76−10log10⁡π2L2L+1+(2L+1)10log10⁡M.
  • Each doubling of M adds (2L+1)×3 dB: 9 dB at first order, 15 at second.
  • High-order loops reach 16 bits or more at modest oversampling, at the cost of stability problems the formula doesn't show.

Predict

A 6-level converter's transition levels are ideally 1 LSB apart, but the fourth transition sits half an LSB late. What are the largest DNL and INL?

Name it

The procedures

  • SINAD and ENOB: sample a sine for a whole number of cycles that is coprime with the record length (coherent sampling), quantize, reconstruct, and compare the error's power with the signal's: ENOB=(SINAD−1.76)/6.02.
  • DNL and INL: from the transition levels Tk, take LSB=(Tlast−Tfirst)/(number of transitions−1); then DNLk=(Tk+1−Tk)/LSB−1 and INLk=(Tk−(Tfirst+kLSB))/LSB (endpoint fit).
  • First-order delta-sigma: each step, output y=±1 by the sign of an integrator v, then add x−y to v. The average of y equals x.
  • Walden figure of merit: P/(2ENOBfs).

Check

Write sinad_enob(bits, n=4096, cycles=127): quantize sin⁡(2π⋅cycles⋅k/n) to bits bits with a mid-rise quantizer (code = ⌊(v + 1)/2 · 2^bits⌋, clamped to the top code; reconstruct at code centers) and return (SINAD in dB, ENOB).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write dnl_inl(edges): from a list of transition levels, return (DNL list, INL list) in LSB, with the endpoint-fit LSB.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write sd1(x, n): run a first-order delta-sigma modulator for n steps with input x (|x| < 1) and return the average of its ±1 output.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write sd_sqnr(L, M): the ideal one-bit SQNR of an L-th order modulator at oversampling ratio M, and walden(P, fs, enob).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why does a one-bit delta-sigma modulator's output average converge to its input, even though each output is only +1 or −1?