FPGA-Piano

所属分类:游戏
开发工具:VHDL
文件大小:670KB
下载次数:0
上传日期:2023-02-06 23:10:42
上 传 者sh-1993
说明:  用VHDL构建的钢琴游戏和音乐播放器的FPGA实现。
(FPGA implementation of a piano game and music player built with VHDL.)

文件列表:
hardware (0, 2023-02-07)
hardware\.keep (0, 2023-02-07)
hardware\constr (0, 2023-02-07)
hardware\constr\Zybo-Z7-Master.xdc (17368, 2023-02-07)
hardware\data (0, 2023-02-07)
hardware\data\song1.txt (928, 2023-02-07)
hardware\data\song2.txt (1024, 2023-02-07)
hardware\data\song3.txt (976, 2023-02-07)
hardware\data\song4.txt (1024, 2023-02-07)
hardware\src (0, 2023-02-07)
hardware\src\LFSR.vhd (1978, 2023-02-07)
hardware\src\ROM_controller.vhd (2315, 2023-02-07)
hardware\src\clockDivider.vhd (1188, 2023-02-07)
hardware\src\debounce.vhd (2023, 2023-02-07)
hardware\src\music_controller.vhd (5553, 2023-02-07)
hardware\src\score_counter.vhd (2984, 2023-02-07)
hardware\src\sevSegDecoder.vhd (1032, 2023-02-07)
hardware\src\top.vhd (13207, 2023-02-07)
media (0, 2023-02-07)
media\hardware.png (512558, 2023-02-07)
media\implemented_design.png (43614, 2023-02-07)
media\script.png (49997, 2023-02-07)
media\state_diagram.png (74973, 2023-02-07)
software (0, 2023-02-07)
software\.keep (0, 2023-02-07)
software\ROM_gen.py (1174, 2023-02-07)
software\freq_gen.py (149, 2023-02-07)
software\twinkle-twinkle-little-star.txt (976, 2023-02-07)

# FPGA Piano - ECE 524 - Advanced FPGA Design Final Project - Professor: Saba Janamian - Semester: Fall 2022 ![hardware](https://github.com/almazarrafael/FPGA-Piano/blob/master/./media/hardware.png) This final project is based around a piezoelectric buzzer that can produce different sounds based on the frequencies being passed onto the buzzer. The overall idea is to construct a keyboard with different buttons that can be used to play different notes on the piano. Seven buttons were used because there are seven basic piano notes (C, E, D, F, G, A, B). As the project progressed, additional functions were included in order to incorporate more design functionality that were learned throughout the course. The first additional mode is a game mode. This game mode is inspired by piano tiles. The goal of the game is to press the corresponding buttons as the LED lights up. For each correct input, a score counter is incremented and respectively decremented for wrong inputs. After 10 seconds, the game ends and the project goes back to an idle state where you can freely play the piano. The final additional mode is a music player. The music player drives the buzzer according to different ROMs that is determined based on the switch values. A Python script was made in order to generate and encode songs into ROM files that is used in the HDL designs. ### State Machine ![state machine](https://github.com/almazarrafael/FPGA-Piano/blob/master/./media/state_diagram.png) A state machine is used in order to provide multiple functionalities. The three states are Idle, Game and Music Player. In the Idle state, the piano can be freely used. In order to produce the necessary frequencies for the buzzer, a reference piano frequency guide was used. With these values, an array of seven clock dividers were designed in order to produce the correct frequencies. This was then multiplexed based on the buttons being pressed. For the idle state and the game state, the buttons directly drive the frequency drivers. For the game state, an LFSR is used in order to generate the random number needed to choose which LED to turn on. Since an LFSR is a deterministic system, the same sequence is produced with the same seed. In order to circumvent this, a clock counter is used that is loaded as a seed into the LFSR when the game starts. The LFSR used has 8 stages but the seed is only loaded into the bottom three LSB. This means that it produces 8 different sequences. This can be updated by making the clock counter 8 bits long and fully loaded into the LFSR to produce more sequences. A counter is also used in order to keep track of time. It starts off as 0 and counts up to a maximum that is calculated based on the system clock of 125 MHz and the maximum time of 10 seconds. Once this maximum is reached, the game ends and goes back to idle state. Another counter is also used in order to keep score which is incremented/decremented depending on if the user presses the correct input or not. ### ROM For the final music player state, a ROM controller was used. It loads the different text files that were generated using the Python script. A counter is used that is incremented every half a second. This counter is used to choose a memory location address in the ROM. Each memory location corresponds to a seven digit binary number that is decoded and drives the buzzer and the LEDs. The counter is reset every time the switch changes in order to start the song from the beginning. ![script demo](https://github.com/almazarrafael/FPGA-Piano/blob/master/./media/script.png) ### Implemented Design Schema ![implemented design](https://github.com/almazarrafael/FPGA-Piano/blob/master/./media/implemented_design.png)

近期下载者

相关文件


收藏者