
basic_national_anthem_buzzer is a digital melody player that outputs the Turkish National Anthem (İstiklâl Marşı) as a square-wave audio signal. A piezo buzzer connected to uo_out[0] will play the melody.
The design consists of five main blocks:
Prescaler (9-bit): Divides the 50 MHz input clock by 512, producing a ~97.6 kHz internal tick used by all other blocks.
Tone Generator (8-bit variable divider): Divides the prescaler tick by a note-specific value to produce a square wave at the correct musical pitch. For example, the note A4 (440 Hz) uses a divider of 111: 97656 / (2 × 111) ≈ 440 Hz.
Tempo Counter (14-bit): Further divides the prescaler tick to produce a ~6 Hz tempo tick (~168 ms period), which controls how long each note is held.
Note Sequencer: A 6-bit address counter steps through the melody ROM. Each note has a programmable duration measured in tempo ticks. When the duration expires, the sequencer advances to the next note.
Melody ROM (combinational logic): Stores 90 note entries encoding the first two stanzas of İstiklâl Marşı in E minor (based on Osman Zeki Üngör's arrangement at 120 BPM). Each entry contains a 4-bit note code and a 4-bit duration value.
B3, C4, D4, D♯4, E4, F4, F♯4, G4, G♯4, A4, A♯4, B4, C5, D5, E5, and REST.
uo_out[0] and GND through a 100 Ω resistor.uo_out[1] to see the "playing" indicator.ui_in[0] (rising edge) to restart the melody from the beginning.ui_in[1] HIGH to enable loop mode (melody repeats continuously).uo_out[7:2] for debugging.uo_out[0])uo_out[1])ui_in[0])ui_in[1])| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | start / restart button | square-wave audio output | |
| 1 | loop mode (1=repeat, 0=once) | playing indicator LED | |
| 2 | note address bit 0 | ||
| 3 | note address bit 1 | ||
| 4 | note address bit 2 | ||
| 5 | note address bit 3 | ||
| 6 | note address bit 4 | ||
| 7 | note address bit 5 |