608 Highspeed voltage discriminator

608 : Highspeed voltage discriminator

Design render

High-Speed Voltage Window Discriminator

A digital signal discriminator for detecting voltage pulses that fall within a programmable voltage window.

The design accepts two digital signals from external comparators representing a lower and upper voltage threshold. It determines whether a pulse crosses the lower threshold without subsequently crossing the upper threshold, generates a short digital output pulse, and counts the detected events with a 32-bit counter.

The design is intended for high-speed physical signal processing and experimentation with standard-cell propagation delays.

How it works

The analog signal is not directly connected to the TinyTapeout tile. Instead, two external comparators convert the analog input into digital threshold signals:

                 ┌──────────────────┐
Analog pulse ───►│ Lower comparator │──► ui_in[0]
                 └──────────────────┘

                 ┌──────────────────┐
Analog pulse ───►│ Upper comparator │──► ui_in[1]
                 └──────────────────┘

                         │
                         ▼
                ┌────────────────────┐
                │Signal discriminator│
                └────────────────────┘
                         │
             ┌───────────┴───────────┐
             ▼                       ▼
       uo_out[0]                 32-bit counter
      output pulse                    │
                                      ▼
                              32-bit snapshot
                                      │
                                      ▼
                                  uio_out[7:0]

The discriminator uses the relative timing of the two comparator outputs to determine whether the input pulse lies inside the voltage window.

A pulse that crosses the lower threshold but does not cross the upper threshold before the lower-threshold condition ends produces a discriminator output event.

A pulse that crosses both thresholds is rejected.

Conceptual voltage window
Voltage
  ^
  |
  |          Upper threshold
  |       ─────────────────────
  |
  |        ┌──────────────┐
  |        │ VALID PULSE  │
  |        │              │
  |       /                \
  |      /                  \
  |─────/────────────────────\──── Lower threshold
  |
  +──────────────────────────────────► Time

The actual threshold voltages are established externally by the comparator circuitry.

Discriminator output

The discriminator output is available on:

uo_out[0]

The other dedicated outputs are driven low.

The discriminator output is a short digital pulse whose width can be selected using the physical delay chain.

Four delay settings are available:

ui_in[3:2] Delay chain
00 1 stage
01 3 stages
10 9 stages
11 27 stages

The delay is implemented using sg13g2_dlygate4sd2_1 standard cells.

This is intentional: the delay is produced by physical standard-cell propagation rather than by RTL simulation delays.

The exact pulse width depends on the fabricated process, supply voltage, temperature, loading, and routing. The values should therefore be considered approximate rather than guaranteed timing specifications.

Event counter

Every accepted discriminator event increments a 32-bit counter.

The counter is implemented as a hybrid architecture:

  • The lower 4 bits form a ripple-style prescaler.
  • The upper 28 bits are synchronously incremented from the prescaler output.

This reduces the switching frequency of the upper counter stages while providing a full 32-bit event count.

The counter can therefore record:

0 ... 4,294,967,295

events before rolling over.

Counter readout

Because the TinyTapeout user IO interface is only 8 bits wide, the 32-bit counter is read in four bytes.

Before reading the counter, its current value is copied into a 32-bit shadow register by applying a rising edge to:

ui_in[4]

The shadow register then holds a stable snapshot while the counter continues counting.

This allows the counter to be read without requiring the external system to capture all 32 bits simultaneously.

Byte selection

The byte presented on uio_out[7:0] is selected using ui_in[6:5]:

ui_in[6:5] Output
00 Counter [7:0]
01 Counter [15:8]
10 Counter [23:16]
11 Counter [31:24]

For example, to read the complete counter:

  1. Generate a rising edge on ui_in[4].
  2. Set ui_in[6:5] = 2'b00 and read uio_out.
  3. Set ui_in[6:5] = 2'b01 and read uio_out.
  4. Set ui_in[6:5] = 2'b10 and read uio_out.
  5. Set ui_in[6:5] = 2'b11 and read uio_out.

All four bytes belong to the same captured counter value.

Pinout

Dedicated inputs
Pin Function
ui_in[0] Lower-threshold comparator output
ui_in[1] Upper-threshold comparator output
ui_in[2] Delay selection bit 0
ui_in[3] Delay selection bit 1
ui_in[4] Counter snapshot/latch
ui_in[5] Counter byte select bit 0
ui_in[6] Counter byte select bit 1
ui_in[7] Counter enable
rst_n Active-low global reset
Dedicated outputs
Pin Function
uo_out[0] Discriminator output
uo_out[7:1] Unused, driven low
User IO
Pin Function
uio_out[7:0] Selected byte of the counter snapshot
uio_oe[7:0] All user IO pins configured as outputs
uio_in[7:0] Unused

The TinyTapeout clk input is not used by the discriminator or counter. The circuit is event-driven by the comparator signals and internal standard-cell logic.

How to test

1. Reset the design

Hold:

rst_n = 0

This resets the discriminator state, event counter, and counter snapshot register.

Then set:

rst_n = 1

to enable normal operation.

2. Connect the comparators

Connect the output of the lower-threshold comparator to:

ui_in[0]

and the output of the upper-threshold comparator to:

ui_in[1]

The comparator polarity must match the expected threshold-crossing convention of the discriminator.

3. Generate test pulses

Apply pulses to the external comparator inputs.

A pulse that crosses the lower threshold but remains below the upper threshold should generate an output event on:

uo_out[0]

A pulse that also crosses the upper threshold should be rejected.

4. Check the counter

After generating a known number of valid pulses, create a rising edge on:

ui_in[4]

This captures the counter.

Then select each byte using:

ui_in[6:5]

and read the result on:

uio_out[7:0]

For example:

ui_in[6:5] = 00  → bits  7:0
ui_in[6:5] = 01  → bits 15:8
ui_in[6:5] = 10  → bits 23:16
ui_in[6:5] = 11  → bits 31:24

External hardware

The TinyTapeout tile expects digital comparator outputs, not an analog voltage directly.

For a complete voltage-discrimination setup, external hardware is therefore required:

                 ┌─────────────────┐
Analog input ───►│ Lower comparator│───► ui_in[0]
                 └─────────────────┘
                         │
                         │
                 ┌─────────────────┐
Analog input ───►│ Upper comparator│───► ui_in[1]
                 └─────────────────┘

                              ┌────────────────────┐
                              │ TinyTapeout tile   │
                              │                    │
             ui_in[0] ───────►│ Lower threshold    │
             ui_in[1] ───────►│ Upper threshold    │
                              │                    │
                              │ uo_out[0] ────────►│ Discriminator
                              │                    │
                              │ uio_out[7:0] ◄─────│ Counter
                              └────────────────────┘

For high-speed operation, the external comparators and their signal paths should have sufficiently fast propagation time and clean logic transitions.

The delay-chain output is particularly useful for laboratory measurements because it allows the generated discriminator pulse to be stretched sufficiently for observation with conventional high-bandwidth oscilloscopes.

Implementation

The design uses SkyWater/S130 sg13g2 standard-cell primitives for the timing-critical portions of the circuit, including:

  • Delay cells
  • Flip-flops
  • Buffers
  • Logic gates
  • Multiplexers

The delay paths are deliberately implemented using physical standard cells rather than behavioral Verilog delay statements.

The project therefore relies on the physical characteristics of the fabricated standard-cell implementation. Measured timing will depend on process, voltage, temperature, routing, fanout, and the external measurement setup.

Project goals

The main goal of this project is to explore high-speed digital pulse discrimination using physically implemented standard-cell delay chains.

Potential applications include:

  • Pulse-height discrimination
  • Particle detector readout
  • Event counting
  • Time-domain experiments
  • Fast laboratory instrumentation
  • Detector signal processing

The design is intentionally simple at the interface: external comparators perform the analog-to-digital threshold conversion, while the TinyTapeout tile performs the high-speed digital discrimination, pulse generation, and event counting.

Discriminators of the fast kind. The faster the better.

IO

#InputOutputBidirectional
0low discriminator thresholdevent outoutput counter bit 0
1high discriminator thresholdoutput counter bit 1
2addr MUX delay 0output counter bit 2
3addr MUX delay 1output counter bit 3
4latch to buffoutput counter bit 4
5MUX IO to countr 0output counter bit 5
6MUX IO to countr 1output counter bit 6
7counter enableoutput counter bit 7

Chip location

Controller Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Analog Mux Mux Mux Mux Mux Mux Mux Mux tt_um_chip_rom (Chip ROM) tt_um_factory_test (Tiny Tapeout Factory Test) tt_um_ieee_LDO (LDO) tt_um_chip_ieee_analog (IEEE Bandgap Reference) tt_um_snn_voice_calculator_mauro_ciccone (snn-voice-calculator) tt_um_hx2003_delay (4 Channel - 32 Tap Programmable Delay with Delay Locked Loop Calibration) tt_um_adxl362_test (tt_um_adxl362_test) tt_um_larsnit_cfar (1D CA/GO/SO CFAR radar detector) tt_um_abeccari_swsynth (Sine Wave Synthesizer) tt_um_dpi_adexp (AdExp DPI Neuron ) tt_um_140oo041_fpu130 (FPU-130) tt_um_blonghi_uart (uart) tt_um_directsgg_mini_proceo_8bit (Mini 8-bit Processor) tt_um_umaece1982_lfsr (Low-Power LFSR-Based Test Pattern Generator) tt_um_deploy_timer (launch deployment timer) tt_um_urish_simon (Simon Says memory game) tt_um_nimelli_kinematic_wave_engine (Kinematic Wave Engine) tt_um_multi_seg_monitor (Multi Segment Monitor) tt_um_UART_TX (project) tt_um_crc8_lfsr (CRC-8 Serial LFSR) tt_um_tinynpu4 (TinyNPU4) tt_um_alu_bns (6-bit multi function ALU ( eldawly_V2) ) tt_um_echoworld424_tpv (Timing-Prediction Test Vehicle) tt_um_gyro_lockin (Laser Gyro Lock-in Readout Core) tt_um_josue_olivos_sar_adc (4-Bit Charge-Redistribution SAR ADC Controller) tt_um_flower (VGA Flower) tt_um_vperumal_l1_fabric (Scalable Banked L1 Memory Fabric for Edge AI) tt_um_preinception_top (Preinception: Simple Compute Accelerator) tt_um_italu (iTALU: Interactive Testable Arithmetic Logic Unit) tt_um_neuron (4-Input Signed Neuron / Perceptron) tt_um_4tap_mac (4-Tap Signed MAC Unit) tt_um_mac_engine (DSP MAC Engine) tt_um_crypto_led_demo (QAMER CryptoUART: Encrypted UART with LED Status) tt_um_layernorm (LayerNorm) tt_um_ez130_8t_mystery (EZ130 8T Mystery Circuit) tt_um_sent2spi (SENT Receiver with SPI Interface) tt_um_llr_hepiarisc (Hepiarisc with SPI flash) tt_um_rebeccargb_vga_pride (VGA Pride) tt_um_hasi_ising (Oscillator Ising Machine) tt_um_c061618g2 (Circuitli C061618G2) tt_um_tiny_dram_pim (Tiny Dual-Channel DRAM-PIM Controller + PU) tt_um_Tbilisi_CORDIC_Engine (Tbilisi CORDIC Engine) tt_um_rahulmascarenhas_folded_nn (Frozen ternary backbone + loadable head) tt_um_miniMAC (miniMAC_IHP26b) tt_um_rumcajs (IEEE DOORSH) tt_um_sg13g2_mystery (SG13G2 Mystery Circuit) tt_um_ULSR88 (ULSR demo) tt_um_ez130_7t_mystery (EZ130 7T Mystery Circuit) tt_um_tinyopt4 (ieee_tt_tinyopt4) tt_um_vga_example (IEEE VGA Animated Beach) tt_um_hyphen133_drone_detection (IEEE Acoustic Drone Detector) tt_um_nuatlabs_fifo_pwm (Async FIFO with CDC + PWM Peripheral) tt_um_nuatlabs_uart (8N1 UART Transceiver) tt_um_eeg_threshold_detector (IEEE Digital EEG Threshold Event Detector) tt_um_smart_traffic (Smart Traffic Light Controller) tt_um_94442024_mini_cpu (Mini 8-bit Accumulator CPU) tt_um_wokwi_475369131246576641 (IEEE_UPB_TT_1) tt_um_aion (AION) tt_um_rebeccargb_hardware_utf8 (Hardware UTF Encoder/Decoder) tt_um_rebeccargb_universal_decoder (Universal Binary to Segment Decoder) tt_um_rebeccargb_intercal_alu (INTERCAL ALU) tt_um_flappy_bird (IEEE Flappy Bird VGA Game) tt_um_oryan01_alu (ALU CASS PUCV) tt_um_S4xU4 (S4xU4) tt_um_vga_ca (Space CA) tt_um_llr_simplenpu (simple SPI flash streaming NPU) tt_um_pucv_pspwm (3LFCC PS-PWM Modulator) tt_um_yuri_fpga (Tiny FPGA) tt_um_mikailgedik_inverted_inverters (Inverted inverters) tt_um_esauqch_hamming74 (Hamming(7,4) encoder/decoder (IEEE)) tt_um_hackin7_analog_experiments (TinyAnalogExperiments) tt_um_snake (snake game) tt_um_mini_kraken (Kraken IO Subprocessor) tt_um_fabien_pio (AstraPIO) tt_um_chiplab (ChipLab) tt_um_wokwi_475490677474407425 (Tiny_Divider) tt_um_c061618g2tr (Circuitli C061618G2TR) tt_um_catalinlazar_nanopio (nanoPIO) tt_um_catalinlazar_uart_spi_i2c_bridge (UART-SPI-I2C Bridge) tt_um_enzonappi_sent_i2c (SENT to I2C bridge) tt_um_kush1434_proof (Proof) tt_um_schwallsunk_signal_discriminator (Highspeed voltage discriminator) tt_um_tiarinix_ttihp_verilog_template (8-bit educational SAP-style CPU) tt_um_vga_glyph_mode (BOOTCAMP) tt_um_GiulioGirelli_packet_processor (Configurable Low-Latency Match-Action Packet Processor) tt_um_vga_tictactoe (Tic Tac Toe) tt_um_vga_dvd_player (DVD player) tt_um_clea_katseye_rain (KATSEYE) tt_um_romd_uart_hello (UART Hello World) tt_um_vga_snake (CDM PYTHON GAME) tt_um_vga_slot_machine (tt_um_vga_slot_machine) tt_um_jet_seq8b (SEQ8 Programmable Sequencer) tt_um_kibo_leak_inspect (KIBO Leak-Inspection Target Controller (VGA)) tt_um_endless_runner (Endless Runner) tt_um_omega_infinity_kaoru (OMEGA INFINITY KAORU 3D Metal Grid Processor) tt_um_nikleberg_mixer (Mixer) tt_um_lahnb_sgdma (TinyDMA: A Descriptor-Based Dual-PSRAM Memory Mover) tt_um_gstj_lockin (Digital IQ Lock-in (IEEE)) tt_um_benpayne_ps2_decoder (PS/2 Keyboard Decoder for 68k) tt_um_cass_s_ui_neuron_lif (Neurona LIF con Aprendizaje STDP Dinamico (IEEE)) tt_um_vga_glyph_mode_CDM_Matrix (CDM Matrix) tt_um_qd39l_xor_stream (Fixed-ROM XOR Stream Engine) tt_um_conv3x3 (3x3 Clock Rate Streaming Input Convolution Engine) tt_um_mc14500b_soc_extended (MC14500B Extended 1-bit Microcontroller SoC) tt_um_vga_hypno_spiral (tt_um_vga_hypno_spiral) tt_um_mattizen_morse_tree (Morse Tree LED Decoder) tt_um_CDM (Colegio de Muntinlupa DVD-like Display) tt_um_romd_uart_loader (UART SPI RAM Loader) tt_um_TscherterJunior_stapel_geraet (stapel gerät) tt_um_das2225_dna_accel (DNA_Accel) tt_um_tinysoc (TinySoC) tt_um_barrel_shifter (Barrel Shifter) tt_um_approx_mac_coprocessor (Approximate DSP: Time-Multiplexed MAC Coprocessor) tt_um_joesagents_market_split_oracle (Market-split oracle) tt_um_mgpauly1458_ringmeter (Ring oscillator frequency meter) tt_um_pettit_prism_lite (PRISM with Risc-V (TinyQV) SoC) tt_um_workshop_cpu (IEEE Workshop Simple CPU) tt_um_algofoogle_analog_junk (Simple comparator + 2 DACs analog layout in a 1x1 tile) tt_um_lkhanh_cordic (TinyQV SoC (Dual Memory Backend)) tt_um_4x4npu (4x4NPU: Dual-Lane INT4 Neural Accelerator) tt_um_abiaselli_izh_bridge_3x2 (Izhikevich event bridge (4 contexts)) tt_um_fabulous_ihp_26b (Tiny FABulous FPGA) tt_um_zanderivo_voronoi (Four-Metric VGA Nearest-Prototype Visualizer)