This design will play Super Mario Tune over a Piezo Speaker connected across bidir[0:1] and bidir[7]. The speaker is driven in differential PWM mode to increase its output power. The changed pinout accomodates for the Tiny Tapeout Audio Pmod.
(see also the interactive version of this design)
Additionally - for testing purposes, the inputs ui[7:0] are copied to the hex segment display 1:1 (uo[7:0]).
- Playback Logic
- Autogenerated Super Mario Tune Storage. This project contains a Python-based script for converting a RTTL ringtone into optimized Verilog. An additional script converts TIM-file waveforms from the Verilog simulator back to a WAV-sound file to verify the correctness of the hardware-based player's sound.
Using GTKWave for visualization of Simulation Results:
Provide 100kHz clock on clk, briefly lower reset (rst_n) and bidir[1:0]/bidir[7] will play a differential sound wave over piezo speaker (Super Mario Tune).
Piezo speaker connected across bidir[1:0] (loud) or between bidir[7] and GND (less loud). Alternatively you can connect the Tiny Tapeout Audio Pmod to the bidir port to listen to the music.