418 OctoPWM

418 : OctoPWM

Design render

How it works

This is an 8 channel PWM driver which is controlled over SPI. It was designed for a 10MHz clock but other input frequencies should also work.

SPI CS and both enable inputs are active-low. The SPI interface expects a 16 bit word per transaction. SPI polarity/phase CPOL=0, CPHA=0.

The PWM driver takes an input clock and increments a 10 bit counter by one each clock cycle. The driver also has a 10 bit user-configurable compare threshold register. Driver output is high when the counter starts at zero. When the counter exceeds the value in the threshold register, the driver output will go low until the counter resets. There are 8 instances of the PWM driver in this design.

The system clock passes through a clock divider which can be configured to divide the clock frequency by any power of 2 from 2^0 - 2^15 before it is passed into the PWM drivers.

The SPI interface resets when CS is asserted so it must be held low for the entirety of the transaction. The design expects one 16 bit word per transaction of the following form.

Bits 15:12 11:10 9:0
Field Write Address Not used Write Value

The PWM drivers are address 0-7, the specific address corresponding to which uo_out pin it drives. Address 8 is the clock divider which accepts only the lower 4 bits of the write value (the upper 6 bits have no effect for the clock divider). When 16 bits are clocked in, the write will immediately take effect. When the compare threshold is changed for a channel, it will set its output low for the remainder of the cycle until the counter resets to zero after which the newly-written compare threshold will take effect on waveform generation. All 8 PWM drivers are fixed to be in-phase with each other. When writting to the clock divider, the lower 4 bits of the value defines the division factor N in a 2^N divisor.

The reset pin will reset all PWM compare thresholds to zero (so 0% duty cycle) and set the clock divider to 0 (i.e. no division).

ui_in0 is a global active-low output enable pin. Pull this pin high to disable output for all the PWM drivers (note that this does not stop the internal counters).

uio_out7 is the internal clock divider output. This signal can be toggled on/off with the active-low enable pin at ui_in1.

I made this in one night with no HDL experience and the testbench is woefully lacking so hopefully it works ;)

How to test

Make sure ui_in0 is low and feed in a 10MHz clock to clk. Hold the rst_n pin low for at least one clock cycle after selecting the design with the TT mux. Do a simple 16 bit transaction to one of the PWM drivers over the SPI bus to set its duty cycle (the POR reset compare threshold is zero). To match testbench behavior, assert CS at least one system clock cycle before shifting in the first bit with SCK/MISO. For example, to set PWM0 to 50% duty cycle, write 0x01FF. After writing that value, there should be a 50% duty cycle waveform on uo_out.

External hardware

No external hardware

IO

#InputOutputBidirectional
0out_enablePWM 0SPI CS
1clk_div_out_enablePWM 1
2PWM 2SPI MISO
3PWM 3SPI SCK
4PWM 4
5PWM 5
6PWM 6
7PWM 7clock_div_out

Chip location

Controller Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Analog Mux Mux Mux Mux Mux Mux Mux Mux Mux Mux Analog 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_oscillating_bones (Oscillating Bones) tt_um_sonos_flash_party (SONOS Flash Party) tt_um_tinyflash (Tiny Chaos) tt_um_tnt_rf_test (TTSKY25A Register File Test) tt_um_wokwi_442983115801432065 (TimosChip) tt_um_wokwi_442977603880750081 (My first Wokwi project) tt_um_wokwi_442980274206980097 (Lauflicht_HTL_Leonding) tt_um_wokwi_442985235137668097 (Chip) tt_um_wokwi_442977476137901057 (Paircheck) tt_um_seven_segment_games (7-segment-games) tt_um_wokwi_442977465750697985 (Auberger tiny tapeout) tt_um_wokwi_442983567899298817 (Template copy) tt_um_wokwi_442977846716359681 (Tiny Tapeout) tt_um_wokwi_442983760106473473 (Tiny Tapeout Test) tt_um_Max00Ker_Traffic_Light (Traffic Light Controller) tt_um_wokwi_442983721200099329 (Piffl first Wokwi project) tt_um_strasti (8-Bit ALU) tt_um_wokwi_442977509323262977 (simple adder and subtractor) tt_um_wokwi_442977852139597825 (The Ultimate ASIC) tt_um_wokwi_442984105081776129 (Test project) tt_um_wokwi_442977495241922561 (First Wokwi design) tt_um_wokwi_442977534651634689 (Tiny Tapeout Wokwi Bsp) tt_um_pwm_led_top (PWM_LED_dimmer) tt_um_classic_vga_clock (tt_classic_vga_clock_by_TT) tt_um_wokwi_442977463421808641 (Patrick first TT chip) tt_um_wokwi_442983748797580289 (Simple Logic-Gate Controlled LEDs) tt_um_timba307_LEDSpinner (jku-sky-LEDSpinner) tt_um_wokwi_442977533467790337 (4 Bit Counter) tt_um_wokwi_442977645972707329 (Davids first Wokwi design) tt_um_wokwi_442977436543634433 (2 Bit Counter) tt_um_wokwi_442977452121292801 (Shift_Register) tt_um_wokwi_442976058838162433 (7segCounter) tt_um_wokwi_442977493563151361 (7SegDec) tt_um_Lukasseirl (Tiny_Tapeout_Scoreboard) tt_um_dip_switch_game_TobiasPfaffeneder (Can you count binary?) tt_um_wokwi_442977704392041473 (test-project.) tt_um_wokwi_442984054310760449 (TinyTapeout Wokwi) tt_um_cpu_fabianp1704 (8-Bit-CPU) tt_um_wokwi_442977579441572865 (Hamming (7,4) Encoder and Decoder) tt_um_wokwi_442977842875423745 (Tiny Tapeout) tt_um_wokwi_442977476963131393 (Test) tt_um_s_grundner (Polyphonic MIDI-Synth) tt_um_wokwi_442987128372461569 (counter7seg) tt_um_wokwi_442977648674888705 (tt-test) tt_um_wokwi_442977792040445953 (tiny tapeout test gates) tt_um_lukasdragoste_vga_patterns (VGA Pattern Generator) tt_um_wokwi_442983161563395073 (tt_primitiv_rotating_7segment) tt_um_attention_top (transformer-attention-engine) tt_um_wokwi_442977515486800897 (Austrochip 2025 Tiny Tapeout Project) tt_um_endecoder_workfefra (EnDecoder) tt_um_wokwi_442977774857423873 (first-chip-project) tt_um_wokwi_442983487202965505 (EmilsChip) tt_um_wokwi_442984104166367233 (Austrochip 2025 Workshop Design) tt_um_wokwi_442978797853619201 (Full Adder) tt_um_wokwi_442983541057844225 (First Wokwi design) tt_um_df_top (Digital Filter) tt_um_tiny_4bit_alu (4-Bit ALU) tt_um_wokwi_442987944543304705 (Lauflichterweitung) tt_um_rebeccargb_universal_decoder (Universal Binary to Segment Decoder) tt_um_rebeccargb_hardware_utf8 (Hardware UTF Encoder/Decoder) tt_um_rebeccargb_intercal_alu (INTERCAL ALU) tt_um_rebeccargb_vga_pride (VGA Pride) tt_um_wokwi_442987201599784961 (Tiny tapeout test gates) tt_um_wokwi_442977606409919489 (Tiney Tapeout Test Gates) tt_um_wokwi_442977490552687617 (Tiny Tapeout Projekt) tt_um_wokwi_442987575358494721 (Tiny Tapeout Template) tt_um_wokwi_442987960046504961 (Lauflicht_Erweiteung_HTL_LEONDING) tt_um_urish_simon (Simon Says memory game) tt_um_FG_TOP_Dominik_Brandstetter (Function Generator) tt_um_vga_clock (VGA clock) tt_um_z2a_rgb_mixer (RGB Mixer demo) tt_um_felixzhou_spi_slave_ctrl (spi_slave_ctrl) tt_um_Jsilicon (Jsilicon) tt_um_wokwi_413387009513254913 (SimplePattern) tt_um_wokwi_445165988923203585 (Crazy logic gates) tt_um_wokwi_445172771884208129 (TinyTapeoutProject) tt_um_wokwi_445163720250008577 (base-4-circuit-addition) tt_um_wokwi_445163803460843521 (tiny tapeout) tt_um_wokwi_445163742018450433 (Simon Memory Game) tt_um_wokwi_445163652263454721 (Minhala's tinytapeout) tt_um_wokwi_445163607540610049 (Leena and Gabby's coding masterpiece) tt_um_wokwi_445163940815949825 (doritos) tt_um_wokwi_445164514940747777 (DAMTinyTape) tt_um_wokwi_445163656445179905 (Test) tt_um_wokwi_445163922612663297 (Chip Design (Working title)) tt_um_wokwi_445171727534897153 (FlippyFlop) tt_um_wokwi_445172053537213441 (Chip-Test) tt_um_wokwi_445163628668378113 (4 switch, seven segment display) tt_um_wokwi_445174163497792513 (T Flip Flop) tt_um_wokwi_445164196289996801 (Tiny Tapeout Test Gates) tt_um_wokwi_445165735970991105 (tiny tapout test gates) tt_um_wokwi_445163669892121601 (Nicky - Tiny Tapeout) tt_um_wokwi_445163874814362625 (Tiny Tapeout Test Gates) tt_um_wokwi_445163790648286209 (AnalogClockTest1) tt_um_wokwi_445173979376212993 (EJ Wokwi proj.) tt_um_wokwi_445172860504617985 (Tiny_Tapeout_Test_Gates) tt_um_wokwi_445163677488010241 (Bob design) tt_um_wokwi_445171420903985153 (Fawwaz's Project) tt_um_wokwi_445256090314494977 (Tiny Tapeout Hackathon UofT Day 2 Template) tt_um_wokwi_445254767859645441 (flipper 1 to 5) tt_um_wokwi_445256131623154689 (Tiny tapeout test gates) tt_um_wokwi_445254731311517697 (Single Digit Sums by Mark Angelov) tt_um_wokwi_445255383410583553 (Overly Complicated Light Switch) tt_um_wokwi_445254813154997249 (Tiny Tapeout Gates) tt_um_wokwi_445255110472500225 (chipchip) tt_um_wokwi_445255067501843457 (Semi-Conductor Design) tt_um_wokwi_445254767711795201 (WOKWI Design - Joelle) tt_um_wokwi_445254845860088833 (Johans Wokwi design) tt_um_wokwi_445254714007910401 (Arjun's 1st Wokwi design) tt_um_wokwi_445254980988014593 (Tiny Tapeout Test Gates) tt_um_wokwi_445254976953093121 (Inverting Numbers) tt_um_wokwi_445254908700218369 (Tinytapeoutchipnikki) tt_um_wokwi_445254867374774273 (Hardware Hackday Test Gates) tt_um_wokwi_445255496359022593 (gds) tt_um_wokwi_445265377104476161 (WokwiDesign) tt_um_wokwi_445256528755654657 (sigma uncount) tt_um_wokwi_445255578007454721 (Tiny Tapeout Test Gates) tt_um_wokwi_445265925317879809 (tinytapeout) tt_um_wokwi_445260761196909569 (Tiny Tapeout Template Copy) tt_um_wokwi_446565876953355265 (Tiny Tapeout Project - Binary to Decimal Display) tt_um_wokwi_445255326319805441 (Svens Woki design) tt_um_wokwi_445255081544375297 (Tiney Tapeout Semiconduxtor) tt_um_wokwi_445266058506969089 (Wowki) tt_um_wokwi_445262455513487361 (Tiny Tapeout Test Games) tt_um_wokwi_445264784091688961 (Wokwicreation) tt_um_wokwi_445276353959823361 (Jarle Chip) tt_um_wokwi_444910895295771649 (Project Title) tt_um_wokwi_445263189281882113 (FullAdder) tt_um_wokwi_445254953748100097 (Tiny Tapeout Test Gates) tt_um_wokwi_444269677791635457 (Ring Counter) tt_um_rebeccargb_arrow_board (Arrow Board) tt_um_sergejsumnovs_spi_slave (Cynergy4MIE SPI Slave Component) tt_um_rebelmike_femtorv (FemtoRV register file test) tt_um_wokwi_445163733427466241 (my first wokwi design) tt_um_tnt_rf_validation (TTSKY25B Register File Validation) tt_um_pongsagon_tinygpu_v2 (Tiniest GPU V2) tt_um_rc_servo_motor_xy_ea (rc_servo_motor_xy) tt_um_htfab_asicle2 (Asicle v2) tt_um_dumb_turing_yliu_hashed (DUMB-Turing) tt_um_wokwi_446363696828310529 (sparkhom SR flip flop) tt_um_wokwi_446364165240923137 (TinyTapeout) tt_um_wokwi_446645853372820481 (JBs first chip) tt_um_wokwi_446907838117673985 (miloh-tinytapeout-supercon2025) tt_um_wokwi_446363880417243137 (test) tt_um_wokwi_446363782054494209 (4-bit Johnson Counter) tt_um_wokwi_446847576277095425 (Tiny Tapeout 20251031) tt_um_wokwi_446363829539267585 (AndNand) tt_um_wokwi_446363784753530881 (LeviathonGds) tt_um_wokwi_446363928119066625 (mysteryform) tt_um_wokwi_447138553926768641 (Digit Fidgit) tt_um_6502_chip_select (6502 Chip Selector) tt_um_wokwi_446363731295014913 (Tiny Tapeout Binary to Decimal) tt_um_wokwi_446363984157070337 (HAD TT) tt_um_wokwi_446364133350576129 (Tiny Tapeout Workshop Supercon 25) tt_um_bmellor_lightsout (Lights-Out) tt_um_wokwi_446363771447095297 (Simple Tapped Delay Line) tt_um_sleepy_module (Sleepy Chip) tt_um_camdenmil_sky25b (OctoPWM) tt_um_wokwi_446363844132307969 (wokwi-adder) tt_um_wokwi_446362347802682369 (DETDFF (Tiny Tapeout)) tt_um_arko (Arko) tt_um_wokwi_446363696538901505 (Fastest Finger First) tt_um_wokwi_446363830909757441 (My Tiny Tapeout) tt_um_wokwi_446363833426340865 (First WOWKI Project) tt_um_wokwi_446364777751946241 (Seven Segment Display Driver) tt_um_wokwi_446359782214875137 (Jon_And_Angie_08281999) tt_um_wokwi_446368563224770561 (TinyTapeout2) tt_um_wokwi_446373432938861569 (j-initial-cycler) tt_um_kianV_rv32ima_uLinux_SoC (KianV uLinux SoC) tt_um_kercrafter_leds_racer (LEDs Racer) tt_um_four_bit_cpu_top_level (4Bit_CPU) tt_um_yorimichi_kittscanner (kitt_scanner) tt_um_devmonk_ay8913 (Classic 8-bit era Programmable Sound Generator AY-3-8913) tt_um_tinytapeout_logo_screensaver (VGA Screensaver with Tiny Tapeout Logo) tt_um_TinyWhisper (Tiny Whisper) tt_um_markr_transientshaper (Audio Transient Shaper) tt_um_urish_sic1 (SIC-1 8-bit SUBLEQ Single Instruction Computer) tt_um_essen (Blake2s) tt_um_baud_rate_cdr (Baud-Rate PAM4 Clock and Data Recovery (CDR)) tt_um_b2nch_DreiMann_top (DreiMann) tt_um_tt05_analog_test (TT25 3B DAC and RingO) tt_um_wokwi_446424200424416257 (JK flip-flop) tt_um_willwhang (60/50Hz AC clock) tt_um_toivoh_delta_sigma (Noise shaping delta-sigma DAC) tt_um_wokwi_444123325639097345 (tinytapeout test gates) tt_um_lime_cic_filter (lime_cic_filter) tt_um_VHDL_PWM_DEMUX (PWM Generator) tt_um_VHDL_FSM (FSM) tt_um_vhdl_ALU_top (6bit ALU) tt_um_proppy_bytebeat (bytebeat) tt_um_femto (UNAL's RISCV ) tt_um_ag2048_tiny_calculator (Tiny Calculator) tt_um_alexlowl_myTTproject (myTTproject) tt_um_relax (Relax_Oscillator) tt_um_tiny_shader_v2_mole99 (Tiny Shader v2) tt_um_mattvenn_r2r_dac_3v3 (Analog 8 bit 3.3v R2R DAC) tt_um_evm (Electronic Voting Machine) tt_um_top_axis_uart (AXIS_UART_TTO) tt_um_nco (Numerically Controlled Oscillator) tt_um_morse (Morse Code Converter) tt_um_tiny_hardware_authentication_engine (Tiny Hardware Authentication Engine) tt_um_mattvenn_analog_ring_osc (Ring Oscillators) tt_um_eestevez3_SAR_ADC (8 Bit SAR ADC) tt_um_wokwi_446992736864284673 (Binary Counter) tt_um_patrick_lin_git_mcht_trx (Manchester Encode/Decode with built-in 5X PLL) tt_um_bleeptrack_nn1 (Negative Nature #1) tt_um_bleeptrack_nn2 (Negative Nature #2) tt_um_bleeptrack_nn3 (Negative Nature #3) tt_um_bleeptrack_nn4 (Negative Nature #4) tt_um_underserved (TTSKY25b-RISCV-Core) tt_um_axc1271_tinypong (Tiny Pong) tt_um_Electom_cla_4bits (4-bit CLA) tt_um_zerotoasic_logo_screensaver (VGA Screensaver with Zero to ASIC Logo) tt_um_wokwi_446364830841352193 (Flip the Flop) tt_um_instrumented_ring_oscillator_two (instrumented_ring_oscillator_two) tt_um_tadc_its (Time Domain ADC) tt_um_seven_segment_animations (7-Segment-Animations) tt_um_urish_spell (SPELL) tt_um_algofoogle_vga_matrix_dac (Analog VGA CSDAC experiments (TTSKY25b)) tt_um_cejmu_wspr (CEJMU WSPR Encoder) tt_um_wokwi_442987636779898881 (tt-wokwi) tt_um_wokwi_442977691824856065 (Numbers) tt_um_wokwi_442988211554861057 (Siebensegment_Chip) tt_um_wokwi_442982978057266177 (Kleine Tapeout Vorlagen-Kopie) tt_um_wokwi_442977531497515009 (Tiny Tapeout meli) tt_um_wokwi_442985098452614145 (Template) tt_um_wokwi_442983461306274817 (Tiny tapeout test) tt_um_wokwi_442983243536903169 (Tiny Tapeout Template Hammer) tt_um_wokwi_442979151350678529 (TestGDS) tt_um_wokwi_442982637762839553 (Arjun's First Template Copy) tt_um_tnt_mosbius (tnt's variant of SKY130 mini-MOSbius) tt_um_project (in-81004-1 silicon) tt_um_wokwi_442977548950021121 (Digital_gate) tt_um_wokwi_442987226036856833 (TinyTapeoutTest) tt_um_wokwi_442987174502478849 (4 bit adder) tt_um_wokwi_442984695522496513 (Test) tt_um_wokwi_442977682425413633 (JKU Matt Venn workshop simple project) tt_um_wokwi_442987801460891649 (Tiny Tapeout Template Copy) tt_um_rh_bf_top (TinyBF) tt_um_wokwi_442977585335625729 (WokWi Test) tt_um_wokwi_442977456053457921 (Wokwi Template) tt_um_wokwi_442979336364610561 (ShilpaTinytapeout) tt_um_kianv_rv32_regfile (KianV uLinux RISC-V regfile edition) tt_um_PWM (PWM_selector) tt_um_wokwi_445338187869298689 (WokwiPWM) tt_um_wokwi_447051835034957825 (TicTacToe) tt_um_chrimenz_tinyturing (Tiny Turing Machine) tt_um_emilian_opamp_3v3 (3V3 Opamp and DRAM cell) tt_um_jakedrew_qei (QEI (Quadrature Encoder Interface)) tt_um_wokwi_442977503814034433 (Tiny Tapeout Test Gates) tt_um_wokwi_442978871257096193 (fdfs) tt_um_wokwi_445163636148924417 (not a dumpster fire ) tt_um_wokwi_445175272109059073 (Tiny Takeout Test Gates) tt_um_wokwi_445163800203964417 (Four-bit adder tiny tapeout) tt_um_wokwi_445163606906219521 (Secret Password) tt_um_wokwi_445172222101072897 (Tiny Tapeout Template Project) tt_um_wokwi_445163763917969409 (Tiny Tapeout Binary to 7SD) tt_um_wokwi_445172941748296705 (Anushka and Tina Wokwi) tt_um_wokwi_445163964149915649 (Tahmid and Sunny's First Wokwi Design) tt_um_verilog_meetup_template_project_example (Verilog Meetup Template Project Example) tt_um_brainfck_asic (Brainf*ck ASIC) tt_um_wokwi_446363834407809025 (RHYTHM LOOPER and RANDOMIZER 9000) tt_um_technology_characterization (SKY130 technology characterization) tt_um_mosbius (mini mosbius) tt_um_bouncing_squares (Bouncing squares) tt_um_PseudoSM_ASIC (PSM_asic) tt_um_enjimneering_tts_top (TinyTapeStation) tt_um_morse_it (MORSEASCII) tt_um_vga_projekt_ed_nkpng (vga_projekt_ed_nkpng) tt_um_uart_temp_sens (Uart and Temperature sensor) tt_um_ragnar_lucasnilsson954 (RagnarMegaRaknare) tt_um_react_test_saksh156 (React Chip) tt_um_mastermind (Mastermind) tt_um_synth_magmusson (hardcoded sequencer) tt_um_hammal_fir_filter (FIR Filter) tt_um_tinytone (tt-tinytone) tt_um_julke_gussinatorn2 (JulkeGussinatorn 2.0) tt_um_se_opamps (ttsky25_se_opamps) tt_um_unclegravity_7seg_counter (7-Segment Counter) tt_um_wokwi_445256658591419393 (Andrew chip design) tt_um_counter_isaharp (Counter) tt_um_wokwi_445254959452357633 (Anton's-Hardware-Hack) tt_um_wokwi_445256643197274113 (SignalSorter) tt_um_wokwi_445265826672030721 (The Adder) tt_um_wokwi_445175605912766465 (Tiny Tapeout Hradware Workshop Vaibhav) tt_um_fkd_xorshift (xorshift) tt_um_wokwi_445255035084055553 (Tiny Tapeouts Chip Design) tt_um_wokwi_445254913718704129 (Tiny Tapeout Test Gates) tt_um_wokwi_445254916601240577 (cirucuit) tt_um_wokwi_442988784492711937 (test) tt_um_rejunity_ym2413_ika_opll (YM2413 FM synthesis audio chip) tt_um_top_general (Dual-Channel PWM with SPI Control + Extra Test Logic) tt_um_proppy_megabytebeat (megabytebeat) tt_um_rom_vga_screensaver (VGA Screensaver with embedded bitmap ROM) tt_um_sky25a_nurirfansyah_nauta (Nauta OTA with digital trimming) tt_um_mattvenn_relax_osc (Relaxation oscillator) tt_um_pantelis300_nco (NCO) tt_um_ieeeuoftasic_simproc (SimProc (Simple Processor)) tt_um_rejunity_vga_playground (My (S)VGA Playground) tt_um_Onchip_VCOx2 (Onchip - Ring VCO 11 stages x2) tt_um_dlmiles_dffram32x8_2r1w (Tiny RAM DFF 2r1w) tt_um_Onchip_BandGap (OnChip - Bandgap Reference) tt_um_kianv_bare_metal (KianV RISC-V RV32E Baremetal SoC) tt_um_pommarkus_i2c_slave (I2C Slave) tt_um_MichaelBell_tinyQV (TinyQV Risc-V SoC) tt_um_reservoir (EZ Reservoir) tt_um_morse_w_serial (Morse Code Detector (With Serial RX)) tt_um_dyno (dyno-tt) tt_um_libokuohai_asap_cpu_v1 (ASAP CPU v1) tt_um_2048_vga_game (2048 sliding tile puzzle game (VGA)) tt_um_quick_cpu (4 hour CPU) tt_um_tv_b_gone_rom (TV-B-Gone-EU (ROM Macro variant)) tt_um_flappy_vga_cutout1 (Flappy VGA) tt_um_Sai222777 (XOR Stream Cipher) tt_um_ring_osc3 (Verilog Multistage Oscillator with Enable and Counter) Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available Available