613 Dyadic PWM

613 : Dyadic PWM

Design render

How it works

This is a digital PWM (DPWM) generator with selectable resolution, dyadic modulation and dithering. A 12-bit control word sets the duty cycle; the design produces complementary high-/low-side outputs with dead-time, plus a sync clock.

Selectable width. The PWM resolution is configurable to 5, 6, 7, 8 or 9 bits. All widths share the same 513-cycle switching period (~97.5 kHz at a 50 MHz clock); the chosen B-bit duty is scaled onto that period by scaled = duty·2^(9−B) + max(1, 2^(8−B)).

Modes. Beyond plain Normal PWM, the design adds:

  • Dyadic — the lower m bits of the control word are distributed as a +1 sequence across a 2^m-period window (the bit selected each period is lsb[highest_set_bit(counter)]), raising the effective resolution by up to ~7 bits without extra base width.
  • Dithering v1/v2/v3 — a sigma-delta-style +1 decision (lsb ≥ counter); v2 samples the LSB once per 2^m window, v3 also samples the base duty once per window.
  • A constant dyadic word can replace the control LSBs as the modulation source.

Configuration interface. Static settings live in a small register file written over the pins. uio_in[7] selects the mode:

uio_in[7] Meaning ui_in[7:0] uio_in[6:4] uio_in[3:0]
0 (run) drive control word ctrl[11:4] ctrl[3:0]
1 (config) write a register write data reg address

Config registers (written while uio_in[7]=1):

Addr (uio_in[6:4]) Data (ui_in)
0 [2:0]=dyadic_len (0–7), [5:3]=mode (0=Normal,1=Dyadic,2–4=Dither v1–v3), [6]=const_dyadic_flag
1 [2:0]=pwm_bits_sel (0→5-bit … 4→9-bit)
2 [6:0]=dyadic_word (constant modulation word)

After reset the design defaults to 8-bit Normal PWM (dyadic_len=0), so it behaves as a plain 8-bit PWM until configured. Outputs: uo_out[0]=high-side, uo_out[1]=low-side (complementary, 6-cycle / 120 ns dead-time), uo_out[2]=sync clock, uo_out[7:3]=duty MSBs (debug, normalised to the 9-bit domain). All uio pins are inputs.

How to test

  1. Hold rst_n low for several clocks, then release. With no configuration the design is an 8-bit PWM: drive ui_in with the duty (e.g. 0x80 ≈ 50 %), keep uio_in = 0x00, and observe uo_out[0]/uo_out[1] (complementary) and the ~97.5 kHz sync clock on uo_out[2].
  2. Configure features by pulsing the config interface: set uio_in[7]=1, put the register address on uio_in[6:4] and the data on ui_in, clock once, then drop uio_in[7] back to 0.
    • Select 5-bit width: write addr 1 = 0x00.
    • Dyadic, 4-bit: write addr 0 = 0x0C (mode=1, dyadic_len=4); then run with uio_in[3:0] as the LSB word — the average duty shifts by lsb/16 over 16 periods.
    • Dithering v1: write addr 0 = 0x14 (mode=2, dyadic_len=4).
    • Constant dyadic word: write addr 0 = 0x4C (const flag + dyadic mode, len 4) and addr 2 = the 7-bit word; the modulation then ignores the control LSBs.
  3. The cocotb testbench (test/test.py) exercises reset, all five widths, max-duty/dead-time, the sync clock, dyadic mode, the three dithering modes and the constant-word path.

External hardware

None required for bench testing. For power-electronics use, wire uo_out[0] (high-side) and uo_out[1] (low-side) to a half-bridge gate driver — the built-in dead-time prevents shoot-through in, e.g., a synchronous buck converter or class-D stage.

IO

#InputOutputBidirectional
0ctrl[4] / cfg_data[0]pwm_highctrl[0] / -
1ctrl[5] / cfg_data[1]pwm_lowctrl[1] / -
2ctrl[6] / cfg_data[2]sync_clkctrl[2] / -
3ctrl[7] / cfg_data[3]duty[4]ctrl[3] / -
4ctrl[8] / cfg_data[4]duty[5]cfg_addr[0]
5ctrl[9] / cfg_data[5]duty[6]cfg_addr[1]
6ctrl[10] / cfg_data[6]duty[7]cfg_addr[2]
7ctrl[11] / cfg_data[7]duty[8]cfg_we (1=config write)

Chip location

Controller Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux tt_um_chip_rom (Chip ROM) tt_um_factory_test (Tiny Tapeout Factory Test) tt_um_utoss_riscv (UTOSS RISC-V core) tt_um_memory_game_top (Number Memory Game) tt_um_danielpenas42 (Ball Display) tt_um_machinelearning (7-Segment Neural Predictor) tt_um_microlane_demo (microlane demo project) tt_um_pixel_processor (Tiny Pixel Processor) tt_um_jpigdon_gps_accelerator_top (GPS_Accelerator) tt_um_rgb_mixer (rgb_mixer) tt_um_bgao43 (Tiny TPU Systolic Array) tt_um_main (Pong in Verilog) tt_um_joannec34_teenytpu (teenytpu) tt_um_apa102_ws2812_squidgeefish (APA102 to WS2812 Translator) tt_um_uacj_bouncing_DVD_screensaver (Custom DVD Screensaver for VGA) tt_um_logoUACJ_MOGA (VGA_screensaver_UACJ) tt_um_grace_spi_led_driver (SPI-Controlled 8-Channel LED Driver) tt_um_rebeccargb_universal_decoder (Universal Binary to Segment Decoder) tt_um_rebeccargb_hardware_utf8 (Hardware UTF Encoder/Decoder) tt_um_happyhop_deadcast2 (happyhop) tt_um_dino7 (Dino-7: 7-Segment Runner Game) tt_um_arty3_mac_engine (Simple MAC Engine w/ Postproc) tt_um_uacj (Custom DVD Screensaver for VGA) tt_um_algofoogle_dottee (DOTTEE VGA demo (TTGF26a)) tt_um_mattvenn_signal_generator (Simple Signal Generator) tt_um_urish_simon (Simon Says memory game) tt_um_tpu (Tensor Processing Unit For GF) tt_um_gojimmypi_ttgf_UART_FSM_TRNG_Lab (Hardware Entropy Explorer: UART/SPI TRNG and PUF) tt_um_wokwi_465483277165299713 (First Tinytapeout) tt_um_prem_pipeline_test (Programmable_Pipeline-RISC-V) tt_um_wokwi_467219410242853889 (Tiny Tapeout testtest 111233) tt_um_wokwi_465549494272929793 (Pacos first design) tt_um_wokwi_465731371445677057 (Arturo's first Wokwi design) tt_um_wokwi_465732744934845441 (Tiny Tapeout Template_1234) tt_um_wokwi_465736492859711489 (Tiny Tapeout Workshop JuanF) tt_um_wokwi_465731430225727489 (Rafa’s first Wokwi design) tt_um_wokwi_465731458365332481 (7 segment Display Fli-Flop Try-out) tt_um_wokwi_465732744245929985 (DiseñoCursoTiny) tt_um_wokwi_465731490568160257 (Matt’s first Wokwi design) tt_um_wokwi_465736691688630273 (test1) tt_um_wokwi_465731458628527105 (Mi copia del Tiny Tapeout) tt_um_wokwi_465731520738845697 (El primer diseño) tt_um_wokwi_465731521356457985 (Tiny Tapeout Template Copy) tt_um_gen1_digital_companion_tile (Gen1 Digital Companion Tile) tt_um_wokwi_465732827753495553 (Tiny Tapeout Template Ayman) tt_um_wokwi_465731394728267777 (Julian_Proyecto) tt_um_wokwi_465731458535202817 (Tiny Tapeout Template Copy) tt_um_wokwi_465732847401723905 (Basic Circuit) tt_um_wokwi_465731452481768449 (El primer diseño de Matt para Wokwi) tt_um_wokwi_465731502018614273 (Tiny Tapeout Template flip flop) tt_um_wokwi_465732616714924033 (Tiny Tapeout RJAP) tt_um_wokwi_465731575275296769 (ocxpkeWokwiDesign) tt_um_wokwi_465732880722332673 (Pedro Template) tt_um_wokwi_465731858252480513 (Paula's first Wokwi design) tt_um_wokwi_465731455677830145 (Tiny Tapeout JMCG) tt_um_wokwi_465737601403996161 (Tiny Number Simon) tt_um_ttmul (Balanced Ternary Multiplier) tt_um_wokwi_465731466664816641 (Tiny Tapeout Workshop Malaga 2jun2026) tt_um_8bit_risc_cpu (8-bit RISC CPU) tt_um_wokwi_451184391728659457 (Simple Sprinkler) tt_um_fhw_appel_spiPWMio (spiPWMio) tt_um_divadnauj_GB_serv_soc_wb (serv_soc_wb) tt_um_8bitcustomcomputer (SAP 8 Bit Computer) tt_um_bioimpedance (Very Low Resource Digital Implementation of Bioimpedance Analysis) tt_um_mgj_bist8 (BIST-8: Built-In Self-Test for 8-bit CLA Adder) tt_um_roberto_tiny_radar_tile (BioPulse Tile) tt_um_systolic_mac_2x2 (2x2 Systolic Array Matrix Multiplier) tt_um_peg_top (2x2 CNN Accelerator PE Grid with UART) tt_um_AlvaroRub_ringcounter (Counter16Outputs) tt_um_wokwi_465731440267947009 (Antonio's first Wokwi design) tt_um_wokwi_465732706576877569 (Guille's first Wokwi design.) tt_um_wokwi_465731481873367041 (MIPS-Lite 8-bit Processor) tt_um_wokwi_465736612213902337 (Juan`s first Worki design) tt_um_wokwi_465731439156454401 (Rhyloo’s first Wokwi design) tt_um_wokwi_465732536551273473 (Tiny Tapeout Marcos Fernandez) tt_um_wokwi_465737290543084545 (Tiny Tapeout Template) tt_um_wokwi_465630130495825921 (ram 1 bit Copy) tt_um_wokwi_465731403724006401 (sdft wokwi 1) tt_um_top (RHD2164-MCU-SPI Bridge) tt_um_line_follower_arvaloez (Line Follower Robot controller) tt_um_xoroshiro64plus_v2 (xoroshiro64) tt_um_ohuettenhofer_tiny_qsim (Tiny Quantum Circuit Simulator) tt_um_santhosh_ring_osc_gf (Ring Oscillator PVT Sensor & TRNG (GF180)) tt_um_santhosh_stoch_stdp_pair_gf (Stochastic neuron + STDP controller (merged, GF180)) tt_um_santhosh_rsd_char_gf (RRAM Characterization Platform (DC sweep + endurance + retention + histogram, GF180)) tt_um_santhosh_xbar_ctrl_gf (Memristive Crossbar Peripheral Controller (GF180)) tt_um_joseph_bf (BF) tt_um_hydrocomms (FSK Modem) tt_um_systolic_array (2x2 MAC Systolic array with DFT) tt_um_kluterirv_rv32e_core (Minimal RV32E SoC with UART Loader) tt_um_algofoogle_ttgf26a_vco (VCO driven by DAC) tt_um_fer_logo_music_vga (UNIZG-FER VGA project) tt_um_maqsudbek_dyadic_pwm (Dyadic PWM) tt_um_waferspace_vga_screensaver (Wafer.space Logo VGA Screensaver) tt_um_htfab_vga_tester (Video mode tester)