This repository contains our design for osu! on the Basys3 FPGA. We wrote this game entirely in Verilog/SystemVerilog hardware modules. This is our final project for the CS 152b capstone at UCLA.
The following peripherals are used:
- Pmod AMP2: Plays sound to aux, using a PWM waveform from
pwm_generator_2.sv - Pmod KYPD: Used to "click" circles, driven by
kypd.v - PS/2 Mouse over USB, driven by
MouseCtl.vhdandPs2Interface.vhd - VGA display, driven by
vga_sync.vandvga.sv
To play, press the center button (btnC) to reset. Then, use the mouse to aim at a circle, and use the keypad to click the circle when the larger, shrinking circle intersects with the smaller, static circles. Points will be awarded based on the timing accuracy of this click. Points are displayed to the 7-segment LED display on the Basys3.
Due to memory limitations, we can currently only store one beatmap in the FPGA. This beatmap is generated from example-song.wav. There is only enough memory to store ~30 seconds of 8-bit music.
To generate a new beatmap, first get an 8-bit, 8KHz sampling rate .wav file. Then, using the BPM of the song you choose, use generate_beatmap.py to emit the Verilog code for the beatmap used in osu.sv. For example, if we want to generate a beatmap for example-song.wav:
python3 generate_beatmap.py --bpm 128 --length-seconds 13Then, convert the .wav file to a .mem file that Vivado can use to read into BRAM onto the FPGA.
python3 convert_mem.py example-song.wav song.mem