
A bit-serial RISC-V core (SERV, 4-bit datapath, RV32I subset with 4 general-purpose registers mapped to x10-x13) fetches every instruction from an external SPI NOR flash (W25Q128JV on the QSPI Pmod) with the standard READ command (0x03, mode 0, SCK = clk/2 = 10 MHz at 20 MHz). Stores to address 0x1C write a 16-bit output register (CPU_OUT); stores to 0x20 write the TDC control register.
A time-to-digital converter (TDC) measures the interval between a START and a STOP edge. The delay line is a custom
hard macro (tdc_core_d16, 89.4 x 27.8 um): 16 custom delay cells, each tap sampled by a DFF on the rising edge of
STOP. Pre-layout simulation gives about 53 ps per stage (typical corner; 33-98 ps over ff-ss), i.e. a range of
about 0.85 ns. The source of START/STOP
is selected by MODE: external pins (ui[0]/ui[1]), an internal fixed-delay reference, or internal CPU timing probes.
The START and STOP selectors are built from identical cells, so that the same edge applied to both gives a code
near zero. The result (16 raw taps, 5-bit count, overflow) and the CPU output are read on uo[7:0] through the
register address on ui[4:2].
Two calibration ring oscillators (tdc_ro_d8, tdc_ro_d16) are built from one NAND2 and 8 or 16 copies of the
same custom delay cell as the TDC. Pre-layout estimates are about 1.08 GHz (D8) and 0.56 GHz (D16). Only one runs
at a time; a 20-bit ripple counter counts its periods during a gate window of exactly 2^W clock cycles. The
difference of the two periods, T16 - T8 = 2 x 8 x t_cell, gives the average delay of one cell (the TDC LSB)
independent of the NAND and output loading.
CTRL register (store to 0x20, data bits): [0] arm pulse, [2:1] PSEL (probe pair 0..3), [3] invert START, [4] invert STOP, [5] START coarse delay on (about 18 LSB, for the ALU carry probe). The ring oscillators are controlled from the pins only (MODE = 11, see below); the CPU has no access to them.
QSPI Pmod (v2.2) on the uio header: uio[0] flash CS#, uio[1] MOSI, uio[2] MISO, uio[3] SCK, uio[4]/uio[5] /WP and /HOLD (driven high by the design), uio[6]/uio[7] PSRAM CS# (driven high). A pulse generator or a second board can drive START/STOP on ui[0]/ui[1] for external TDC measurements. The RO measurement needs only the clock and the ui/uo pins.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | START_ext (TDC external START); MODE=11: RO select (0 D8, 1 D16) | REG[ADDR] bit 0 (STATUS: done) | Flash CS# (output; 10k pull-up on the Pmod) |
| 1 | STOP_ext (TDC external STOP); MODE=11: RO window (0: 256 clk, 1: 4096 clk) | REG[ADDR] bit 1 (STATUS: valid) | Flash MOSI / SD0 (output) |
| 2 | ADDR[0] (register shown on uo_out) | REG[ADDR] bit 2 (STATUS: overflow) | Flash MISO / SD1 (input) |
| 3 | ADDR[1] | REG[ADDR] bit 3 (STATUS: armed) | Flash SCK = clk/2 (output) |
| 4 | ADDR[2] | REG[ADDR] bit 4 (STATUS: CPU fault) | SD2 / WP# (output, driven high) |
| 5 | MODE[0] (00 TDC external, 01 TDC fixed delay, 10 TDC CPU probes, 11 RO calibration; synchronised) | REG[ADDR] bit 5 (STATUS: RO done) | SD3 / HOLD# (output, driven high) |
| 6 | MODE[1] | REG[ADDR] bit 6 (STATUS: MODE[0]) | PSRAM A CS# (output, driven high) |
| 7 | ARM (rising edge starts a TDC measurement, or an RO measurement in MODE=11; synchronised) | REG[ADDR] bit 7 (STATUS: MODE[1]) | PSRAM B CS# (output, driven high) |