How it works
An 8-bit successive-approximation (SAR) ADC in sky130, in one 1x2 analog
slot. The block breakdown and the sweep behind it are in
architecture.md.
- Input: VIN on ua[0], from 0 V to VREF.
- Reference: VREF on ua[1], 1.8 V nominal (1.2 V to 1.8 V allowed).
- Sampling: bottom-plate sampling. While SAMPLE is high, the top plate
of the capacitor array and a held reference node are tied to an internal
VCM (VDPWR/2) and every bottom plate tracks VIN. The top plate is released
first, so charge injection is a constant offset.
- CDAC: 8-bit binary array of 3x3 um MIM capacitors (256 units, 5.1 pF),
bottom plates switched between VREF and VGND.
- Comparator: StrongARM latch with an NMOS input pair, comparing the top
plate to the held reference at a fixed 0.9 V common mode, then an SR latch.
- SAR logic: on-tile digital (
src/digital/sar_logic.v), MSB first, two
clocks per bit. The result appears on uo[7:0] when DONE pulses.
One conversion takes 21 clocks (4 sample + 16 bit cycles + 1), or 20 back
to back with CONT high. At 10 MHz that is 476 kS/s (500 kS/s continuous).
How to test
- Select the project and pulse rst_n low. The tile is powered off while
deselected, so it starts cold after every select.
- Set the clock to 10 MHz (or lower: 1, 2 or 5 MHz).
- Drive VREF (1.8 V) on ua[1] and VIN (0 V to VREF) on ua[0]. Never
drive an analog pin while the project is deselected.
- Pulse START (ui[0]) for one conversion, or hold CONT (ui[1]) high to
convert continuously.
- BUSY (uio[0]) is high during a conversion. When DONE (uio[1]) pulses, read
D0-D7 on uo[7:0].
External hardware
A 1.8 V reference for VREF and a source for VIN between 0 V and VREF
(for example a buffered DAC on a PMOD). VIN has to charge 5.1 pF in the
400 ns sample window.