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]).
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.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | input pin 0 | ui[0] | piezo_speaker_p (uio_out[0]) |
1 | input pin 1 | ui[1] | piezo_speaker_n (uio_out[1]) |
2 | input pin 2 | ui[2] | GND |
3 | input pin 3 | ui[3] | GND |
4 | input pin 4 | ui[4] | GND |
5 | input pin 5 | ui[5] | GND |
6 | input pin 6 | ui[6] | GND |
7 | input pin 7 | ui[7] | piezo_speaker_n (uio_out[7]) |