Lab 3: Music Player
Part D: FPGA Prototype V2
Lab 3 will give you experience designing, implementing, testing, and prototyping combinational and sequential logic using the Verilog hardware description language. The lab will continue to leverage concepts from Topic 2: Combinational Logic, Topic 3: Boolean Algebra, and Topic 4: Combinational Building Blocks but will also leverage concepts from Topic 6: Sequential Logic, Topic 7: Finite-State Machines, and Topic 8: Sequential Building Blocks. More specifically, the lab will give students experience with: latches, flip-flops, and registers; Moore and Mealy FSMs; and counters. The lab will continue to reinforce three key abstraction principles: modularity, hierarchy, and regularity.
You will be implementing a music player that takes as input a song selection (via the switches) and a start song signal (via a push button). The music player will then play the chosen song by generating a square wave at appropriate note frequencies suitable for use with a piezoelectric buzzer. An idle signal is displayed using an LED so that the user knows when the player is ready to play a new song. The music player will make use of the adders and muxes from Lab 2. The song selection and the current note are both displayed using seven-segment displays from Lab 1. This lab also serves as a transition from lower-level gate-level (GL) modeling to higher-level register-transfer-level (RTL) modeling. Some of parts of your design will use explicit GL modeling, while other parts of your design will use RTL modeling. Students will have a chance to appreciate how RTL modeling can improve productivity but with less control over the final hardware implementation. The lab includes six parts:
-
Part A: Counters
- Due 10/15 @ 11:59pm via GitHub
- Students should work on Part A before, during, and after your assigned lab section during the week of 10/5
- Pre-lab survey on Canvas is (roughly) due by end of lab section during the week of 10/5
-
Part B: Breadboard, FPGA, and Simulation
- Due week of 10/5 during assigned lab section
- Even though completed with a partner, every student must turn in their own paper check-off sheet in their lab section!
-
Part C: Music Player
- Due 10/22 @ 11:59pm via GitHub
- It is ok if students need a little more time to complete the music player and clock divider as long as they are pushed to GitHub by 10/25 @ 11:59pm
- Plan to work on Part C after fall break and during the week of 10/19
-
Part D: FPGA Prototype v1
- Due week of 10/19 during assigned lab section
- This part will focus on prototyping the code developed in Part A
- Even though completed with a partner, every student must turn in their own paper check-off sheet in their lab section!
-
Part E: FPGA Prototype v2
- Due week of 10/26 during assigned lab section
- This part will focus on prototyping the code developed in Part C
- Even though completed with a partner, every student must turn in their own paper check-off sheet in their lab section!
-
Part F: Datasheets and Report
- Due week of 10/26, three days after lab section @ 11:59pm via Canvas
- Post-lab survey on Canvas is due at the same time as the report
This handout assumes that you have read and understand the course tutorials and that you have attended the discussion sections. This handout assumes you have successfully completed Parts A-D, meaning your counter, note player, multi-note player, and music player are all working in simulation and your counter worked as an FPGA prototype.
What do we do if Part C is not done?
We assume students have completed Part C. If your note player and/or multi-note player are not working then you will need to get them working first before you can do anything in Part E. If your note player and multi-note player are both working but your music player is not working, then we do not recommend trying to get the music player working first. Instead first show a TA your note player and multi-note player passing the tests in Task 2 and then go ahead and focus on Lab Check-Off Task 3. Once that is done you can go back and try to get your music player working and thus complete Lab Check-Off Tasks 2 and 4.
Here are the steps to get started:
- Step 1. Find your lab partner
- Step 2. Find a free workstation
- Step 3. Ask the TAs for a lab check-off sheet (each student needs their own check-off sheet)
For each lab check-off task you must raise your hand and have a TA come to check-off your work. The TA will ask you the questions included as part of the lab check-off task and the assess your understanding using the following rubric: mastery; accomplished; emerging; beginning. If the TA and students together feel the students have not mastered the lab check-off task, the students are encouraged to take a few minutes and try again.
When the lab handout requires you to collect data or save a screenshot, place it in the corresponding location in your group's Lab 3 datasheet. These datasheets will be used to organize important information for the modules you are evaluating in lab. We provided you a template for your datasheets in Part D. You must continue to fill out the same datasheet.
What do we do if the TAs are busy?
Students must maintain a sense of urgency throughout the three hour lab section. When you get to a lab check-off task, raise your hand for 2-3 minutes. If no TA is available you must keep going; if nothing else read ahead and make a plan for the next section of the lab handout. If you do nothing and wait 20-30mins with your hand raised for a TA then you will not be able to finish all of this part. You must be strategic. Keep moving through the handout and bring over a TA when they are free to possibly look at multiple lab check-off tasks. If you are truly stuck and no TA is available, ask your neighbors. We need to all work together to make sure every student can complete this part. There are no extensions and students cannot complete this part at any other time except during their assigned lab section.
Lab Check-Off Task 1: Setup Lab Kit
The TAs will pass out an ECE 2300 Lab Kit to each group. The TAs will record the kit number on your check-off sheet. For this lab, you will receive the FPGA board, a USB cable, and a component box with a piezo buzzer, jumper wires, and a USB flash drive. Use the USB cable to plug the FPGA board into the workstation.
1. Simulate the Multi-Note Player and Music Player
Before starting to work on an FPGA prototype, you must make sure you have
a working Verilog hardware design that has been thoroughly tested in
simulation. One student should start VS Code on the workstation, log into
the ecelinux servers, source the setup script, and make sure their
group repository is up to date.
Where XX is your group number. Now run all of the tests from a clean
build to ensure your design is fully functional.
We now need to get the files for your design from ecelinux onto the
workstation. This requires multiple steps.
-
Step 1. Click Microsoft Edge on the desktop to open a web-browser on the workstation to log into GitHub and then find your repository
-
Step 2. Start PowerShell by clicking the Start menu then searching for Windows PowerShell
-
Step 3. Use the following command to change to your home directory on the workstation in the lab (where
netidis your Cornell NetID)
- Step 4. Clone your repo onto the workstation by using this command in
PowerShell (where
netidis your Cornell NetID, notice we are using https!):
If your group repo already exists then you need to instead do a pull!
-
Step 5. In the Connect to GitHub pop-up, click Sign in with your browser
-
Step 6. You may be asked for your GitHub username again and you may be asked to authorize the Git Credential Manager; click authorize git-ecosystem
-
Step 7. Verify that you have successfully cloned your repo by changing into your repo and using
treeon the workstation:
Lab Check-Off Task 2: Verify Design in Simulation
Show a TA that your hardware designs are passing all of test benches
on ecelinux. If your note-player and multi-note player are working
but the music player is not working, then the TA will tentatively
mark this task with a 3, but you can come back and try to get the
music player working at the end of the lab to potentially increase
your score to a 5. You cannot continue to the next tasks unless you
have at least showed your note player and multi-note player working
in simulation.
2. Setup Quartus Project
Click Quartus (Quartus Prime 18.1) on the desktop to start Quartus. Important: Ensure that the Quartus Version is 18.1 and not 23.1. Then, click Run the Quartus Prime software. You might need to try starting Quartus twice. Setup a new Quartus project using the New Project Wizard:
- Directory, Name, Top-Level Entity
- You must enter the working directory as follows with your NetID!
- Working directory:
C:\Users\netid\lab3e - Name of this project:
lab3e - Name of top-level design entity:
lab3e - Click Next
- Directory does not exist. Do you want to create it?
- Click yes
- Project Type
- Choose Empty Project
- Click Next
- Add Files
- Click User Libraries...
- Click triple dots to the right of Project library name
- Click on This PC, then navigate to your cloned repo by choosing Windows (C:) > Users > netid > groupXX where XX is your group number
- Click Select Folder
- Click Add
- Click OK
- Click triple dots to right of File name
- Click on This PC, then navigate to your cloned repo by choosing Windows (C:) > Users > netid > groupXX > lab3 where XX is your group number
- Shift-click on every Verilog hardware design file (do not include
any files in the
testorsimsubdirectories) - Click Open
- Click Next
- Family, Device, and Board Settings
- Click Board tab
- Family: Cyclone V
- Select DE0-CV Development Board
- Make sure Create top-level design file is checked
- Click Next
- EDA Tool Settings
- Click Next
- Summary
- Click Finish
As in Lab 2, you must use the following steps to ensure Quartus knows your design includes RTL modeling:
- Choose Assignments > Settings from the menu
- Select the category Compiler Settings > Verilog HDL Input
- Under Verilog version click SystemVerilog
- Click OK
3. Music Background
Recall from Part C, that we will be using a piezoelectric ("piezo") buzzer to make music. A piezo buzzer is a two-terminal device where one terminal is connected to ground and the other side is connected to a digital signal.

If the digital signal is a square wave then the frequency of the square wave will cause the piezo buzzer to play a note at that frequency. Essentially the piezo buzzer is a tiny speaker that can play notes.
Here is a table showing all of the notes and their corresponding frequencies and periods on a 25-key keyboard:

Here are the notes we will be using with our music player.
freq period
note (Hz) (ms)
G3 196.00 5.102
A3 220.00 4.545
B3 246.94 4.050
C4 261.63 3.822
D4 293.67 3.405
E4 329.63 3.034
F4 349.23 2.863
We will need to use counters to create notes (i.e., square waves) with
the appropriate period. Unlike the counter FPGA prototype which used a
push button as a manual clock signal, here we will be using a real 50MHz
clock on the FPGA board. This clock is named CLOCK_50 in the
DE0_CV_golden_top.v Verilog file. A 50MHz clock has a 20ns period, but
we want to create square waves with periods on the order of milliseconds.
So we will use a clock divider to slow down the 50MHz clock by a factor
of 1024 resulting in an effective clock frequency of 20,480ns (i.e.,
0.02048ms). If we want a counter that is operating at a 0.02048ms clock
period to wait for roughly 1ms it would need to count (1/0.02048) =
48.828 clock cycles. So if we want a counter to wait for roughly 1 second
it would need to count 1000*48.828 = 48,828 clock cycles.
If we want a counter that is operating at a 0.02048ms clock period to wait for roughly 1ms it would need to count (1/0.02048) = 48.828 clock cycles. So if we want a counter to wait for roughly 1 second it would need to count 1000*48.828 = 48,828 clock cycles. We can now calculate how many the square wave period in cycles assuming a 50MHz clock divided by 1024. This spreadsheet shows all possible periods and identifies which periods are the closest to the target periods shown above.
Here are the final periods in cycles we will be using for each note in this lab.
freq period period
note (Hz) (ms) (cycs)
G3 195.31 5.12 250
A3 219.95 4.55 222
B3 246.61 4.06 198
C4 262.52 3.81 186
D4 294.15 3.40 166
E4 329.92 3.03 148
F4 348.77 2.87 140
Recall that our note players actually add four extra cycles to the provided input period, so we will need to adjust accordingly.
actual note player
freq period period period input
note (Hz) (ms) (cycs) (cycs)
G3 195.31 5.12 250 246
A3 219.95 4.55 222 218
B3 246.61 4.06 198 194
C4 262.52 3.81 186 182
D4 294.15 3.40 166 162
E4 329.92 3.03 148 144
F4 348.77 2.87 140 136
4. Multi-Note FPGA Prototype
We will start by building a multi-note player FPGA prototype and use it to experiment with playing notes and visualizing the notes on an oscilloscope.
4.1. Integrate
We want to implement a multi-note player FPGA prototype with the following specification:
- input to clock divider should be connected to the 50MHz clock on the FPGA board
rstshould be connected to the reset button on the board (ACTIVE LOW!)note1_period,note2_period, etc are set based on the background section above- The right three switches are for
play_note_num - The first push button is for
play_note_val(ACTIVE LOW!) - The first LED is for
play_note_rdy - The two seven-segment displays in the middle are for
play_note_num play_note_duris set to16'd8192(resulting in short 167ms duration notes)- The two seven-segment displays on the right are for
note_sel(currently playing note) - The general-purpose pins will be used to connect the
noteoutput to the the piezo buzzer on the breadboard
Note that a key difference from Part B and D is that we will no longer be using a push button as the clock. We will instead a real 50MHz clock which is generated on the FPGA board.

Reset button and push buttons are active low!
In previous labs, we learned that the push buttons on the FPGA board
are active low. This means when not pressed they produce a logic
one, and when pressed they produce a logic zero. The FPGA's reset
button (which is connected to the RESET_N port) is also active low.
You must take this into account when you connect your top-level
ports!
Here is a template you can use for your top-level design. Replace every
__TODO__ with the correct connection to the top-level pins on the FPGA.
Use the following steps when you are ready to integrate the counter.
- Double-click on DE0_CV_golden_top
- Instantiate the template shown above
- Fill in the connections to the top-level ports
- Be sure to use
`include "lab1/DisplayOpt_GL.v"at the top - Choose File > Save from the menu
Then make sure to hook up the piezo buzzer on the breadboard as shown.
Lab Check-Off Task 3: Discuss Multi-Note Player Integration
Show a TA your top-level integration. Discuss how you connected your prototype ports to either constant values or the FPGA's switches, push buttons, LEDs, and seven-segment displays.
4.2. Synthesize
We need to create a timing constraint file using the following steps:
- Choose File > New from the menu
- Click Synopsys Design Constraints File
- Click OK
- Enter the constraints shown below
- Click File > Save from the menu
- Name the file timing.sdc
- Save the file in the lab3e directory
We will use the following constraints:
# Constrain paths that start at an input port and end at an output port
set_max_delay -from [all_inputs] -to [all_outputs] 20
set_min_delay -from [all_inputs] -to [all_outputs] 0
# Constrain paths that start at a flip-flop and end at a flip-flop
create_clock -name CLOCK_50 -period 20 [get_ports {CLOCK_50}]
create_generated_clock -name clk -divide_by 1024 -source CLOCK_50 \
[get_nets {clock_div|*|q[9]}]
# Constrain paths that start at an input port and end at a flip-flop
set_input_delay -add_delay -clock clk -max 0 [all_inputs]
set_input_delay -add_delay -clock clk -min 0 [all_inputs]
# Constrain paths that start at a flip-flop and end at an output port
set_output_delay -add_delay -clock clk -max 0 [all_outputs]
set_output_delay -add_delay -clock clk -min 0 [all_outputs]
The only difference from Part D is we must specify the clock constraints
in two steps. First, we create specify that the top-level CLOCK_50 port
has a clock period of 20ns. Then, we must carefully constrain the output
of the clock divider so the tools know that this is also a clock signal.
Now use the following steps to synthesize your design.
- Choose Processing > Start Compilation from the menu
- Wait 1-2 minutes for synthesis to complete
How do I fix "can't open Verilog Design File" errors?
This probably means you did not setup the user library correctly, so
Quartus cannot find the files you are including using the include
Verilog preprocessor directive. You can use the following steps to
fix this:
- Choose Assignments > Settings from the menu
- Select the category Libraries
- Click triple dots to the right of Project library name
- Click on This PC, then navigate to your cloned repo by choosing Windows (C:) > Users > netid > groupXX where XX is your group number
- Click Select Folder
- Click Add
- Click OK
- Choose Processing > Start Compilation from the menu to see if this fixes the issue
How do I fix "Verilog HDL syntax" errors?
This might be because you did not configure Quartus to use SystemVerilog! You can use the following steps to ensure Quartus knows your design includes RTL modeling:
- Choose Assignments > Settings from the menu
- Select the category Compiler Settings > Verilog HDL Input
- Under Verilog version click SystemVerilog
- Click OK
Now let's collect the data you need for your datasheet.
-
Chip Planner
- Choose Tools > Chip Planner from the menu
- Identify where the logic used to implement your design is located in the FPGA
- Save a screenshot of the Chip Planner (just the rectangular view of the FPGA) using WindowsKEY+SHIFT+S for your datasheet
- Choose File > Close from the menu to close the chip planner
-
Area
- Choose Processing -> Compilation Report from the menu
- Under Table of Contents choose Fitter > Resource Section > Resource Usage Summary
- Record the number of logic gates (i.e., combinational ALUT usage for logic) in the Area section of the datasheet.
- Record the number of flip-flops (i.e., each dedicated logic registers in the report is one flip-flop) in the Area section of the datasheet.
-
Timing
- Choose Tools > Timing Analyzer from the menu
- Double-click Update Timing Netlist
- Choose Reports > Custom Reports > Report Timing from the menu
- Report Timing
- Clocks - From clock: clk
- Clocks - To clock: clk
- Targets - From: [get_registers *]
- Targets - To: [get_registers *]
- Report number of paths: 100
- Detail level: Path Only (click Set Default)
- Click Report Timing
Update Datasheet for Multi-Note Player
You will need to use what have learned in the previous labs to collect the data for your multi-note player datasheet. Make sure the module name, designers, group number, chip planner, area, timing, and critical path sections of your datasheet are finished. The block diagram for the multi-note player is already provided for you in the datasheet. You will add the waveforms in the next section. You can update the interface and functionality later as you prepare your datasheets for submission in Part F. Do not copy/paste screenshots into the datasheet. Use Insert > Insert image in Cell from the menubar to insert screenshots.
4.3. Configure
Now we are finally ready to configure the FPGA for our multi-note player demo.
- Choose Tools > Programmer from the menu
- Click Hardware Setup
- Currently selected hardware: USB-Blaster [USB-0]
- Click Close
- Click Start
Try playing all seven notes. Use the input switches to set the note number then press the push button to playe the note. Make sure that the notes sound like they are increasing from lower notes to higher notes as you increase the note number.
Once you are sure your multi-note player FPGA prototype is playing notes, we will confirm that the prototype is playing the right notes by using the oscilloscope. Connect the oscilloscope probe to your protoype as shown below. The green jumper wire connects from GPIO_1[1] from the FPGA to one side of the pizeo buzzer and the black jumper wire connects the other side of the piezo buzzer to ground. We have inserted two additional jumper wires on either side of the piezo buzzer to connect our prototype up to the oscilloscope. The yellow wire is connected to the primary probe point and the blue wire is connected to the ground probe point. You can obviosuly use any color jumper wires you like.

We will only be using a limited subset of the oscilloscope features. The buttons we will be using are highlighted below.

The following video by Prof. Batten provides a walk-through of how we will use the oscilloscope for Lab 3. A key difference from how we used the oscilloscope earlier is we will now be using the cursor and measure features of the oscilloscope.
Turn on the oscilloscope using the power button on top of the scope. You can always reset the oscilloscope to its default configuration by pressing the "Default Setup" button so do that now. After pressing "Default Setup" you need to press the "Menu On/Off" button to get the pop-up on the right side of the screen to go away.
The scope shows voltage on the Y-axis and time on the X-axis. The default
configuration has 1V per grid line on the Y-axis and 4us per grid line on
the X-axis. Now try playing a note by pressing the play_note_val
button. You should see a signal briefly appear on the scope. We need to
zoom out for a longer time window to better see the signal from our
prototype. Rotate the Horizontal Scale knob counter clockwise to change
the time scale to 1ms per grid line on the X-axis. The screenshot below
shows you where the time scale is displayed.

We also need to adjust the Trigger which is used to tell the oscilloscope when it should capture a waveform. Rotate the Trigger Level knob clockwise a bit so that the trigger is about 1V higher than the baseline voltage level.
Now play the note again and you should be able to see a few periods of the note square wave. You can center the waveform vertically by adjusting the Vertical Position knob.
Now let's use the scope's measure feature to automatically measure the frequency and period of the note square wave. Press the Measure button. Use the Multipurpose knob to highlight Frequency. Then press the Multipurpose know and a little yellow square should appear next to Frequency indicating it is selected. Do the same thing to select Period. The following screen shot shows both Frequency and Period selected.

Then press the Menu On/Off Button twice to get the menu to go away. Now play a note again. In the lower left-hand corner of the screen the oscilloscope will tell you the measured frequency and period of the note square. Try all seven notes and confirm they match the expected note frequency and period as discussed in the above background section.
Now we will capture a screenshot of the waveform. Press the Single button and the play a note. The oscilloscope will capture the begining of the note square wave. To see more of the square wave, rotate the Horizontal Position knob counter clockwise. Then press the Single button and play a note again. You might see the first phase of the note square truncated. This is to be expected, because the note players are constantly playing a note and we are just caputuring when the multi-note player mux switches to the desired note. However, this does mean that the frequency and period measurements at the bottom of the screen are invalid when analyzing a single captured waveform.
We can use cursors to accurately measure the note square wave period after capturing a single waveform as follows:
- Press the Cursor button
- Rotate the Multipurpose button until the left cursor is roughly aligned with a rising edge of the note
- By default, the cursor is moves at a coase grain; if you press and hold the Multipurpose knob you can move the the cursor at a fine grain; press and hold again to switch back to coarse grain
- Once you are done with the first cursor, press the Multipurpose knob quickly and adjust the right cursor until it is roughly aligned with the next rising edge of the note
- The oscilloscope will display the time between these cursors
- Continue to adjust the cursors to get a good measurement
- Press the Menu On/Off button to hide the cursor menu
- Confirm that this time matches the expected note square wave period
To save a screen capture, insert the USB flash drive into the port on the front of the oscilloscope. Wait a few seconds. Then press the Save button. Wait a few seconds. Remove the USB flash drive, insert it into your laptop, and confirm that you have captured the waveform. Once you have copied the screenshot to your laptop please delete it from the USB flash drive!
Note that if you press the Run/Stop button to make it green you can go back to viewing the "live" signal.
Now we want to make sure the multi-note player interactive simulator is
working on ecelinux.
% cd ${HOME}/ece2300/groupXX/build
% make multi-note-player-sim
% ./multi-note-player-sim +switches=000
Pick a note (not note 000 which is a rest!) that you want to use for your
check-off task and lab report. Play this note first using the interactive
simulator which will generate a VCD file. Use Surfer to view the clk,
note_sel, and note. Measure the period for the simulated note using
the following steps:
- Choose Settings > Time Unit > ms to display time in milliseconds
- Left-click on the name "note" next to the waveform, it should be highlighted in blue
- Use the left/right arrow keys to navigate your cursor to a rising edge; you cannot measure the very first period!
- When the red cursor is at the rising edge, press 'M' on your keyboard to add a marker
- Left-click on the name "note" next to the waveform again, and using the left/right arrow keys, navigate your cursor to the next rising edge
- When the red cursor is at the next rising edge Surfer shows you the delta which is the period of the note (one rising edge to the next)
- Take a screen shot and record the period
The reason you cannot measure the first period is because the note players are continuously running, and switching notes is not synchronized to the actual note period square waves. Then measure the period for the real multi-note player FPGA prototype using the oscilloscope.
Update Datasheet for Multi-Note Player
You need to add the simulation waveform and oscilloscope waveform for a single selected note to the datasheet for your multi-note player. You can update the interface and functionality later as you prepare your datasheets for submission in Part F. Do not copy/paste screenshots into the datasheet. Use Insert > Insert image in Cell from the menubar to insert screenshots.
Lab Check-Off Task 4: Demonstrate the Multi-Note Player
Show a TA the progress you have made on your datasheet for the multi-note player. The TA will ask you to explain if the number of flip-flops is as expected. The TA will want to see your waveforms which clearly show the period for your selected note both in simulation (using Surfer) and on the real multi-note player FPGA prototype (using the oscilloscope). The TA will ask you to play all seven notes on your FPGA prototype. For each note, we want to hear note on the piezo buzzer and also see the waveforms on the oscilloscope.
5. Music Player FPGA Prototype
We will now build the final music player prototype!
5.1. Integrate
We want to implement a music player FPGA prototype with the following specification:
- input to clock divider should be connected to the 50MHz clock on the FPGA board
rstshould be connected to the reset button on the board (ACTIVE LOW!)note_durationis set to16'd8192(resulting in short 167ms duration notes)note1_period,note2_period, etc are set based on the background section above- The right two switches are for
play_song_num - The first push button is for
play_song_val(ACTIVE LOW!) - The first LED is for
play_song_rdy - The two seven-segment displays in the middle are for
play_song_num - The two seven-segment displays on the right are for
note_sel(currently playing note) - The general-purpose pins will be used to connect the
noteoutput to the the piezo buzzer on the breadboard

Here is a template you can use for your top-level design.
Use the following steps when you are ready to integrate the counter.
- Double-click on DE0_CV_golden_top
- Instantiate the template shown above
- Fill in the connections to the top-level ports
- Be sure to use
`include "lab1/DisplayOpt_GL.v"at the top - Choose File > Save from the menu
The piezo buzzer should be hooked up the same as with the multi-note player FPGA prototype.
Lab Check-Off Task 5: Discuss Music Player Integration
Show a TA your top-level integration. Discuss how you connected your prototype ports to either constant values or the FPGA's switches, push buttons, LEDs, and seven-segment displays.
5.2. Synthesize
You should be able to use the same timing constraints as for the multi-note player FPGA prototype. Use the following steps to synthesize your design.
- Choose Processing > Start Compilation from the menu
- Wait 1-2 minutes for synthesis to complete
Now let's look collect the data you need for your datasheet.
-
Chip Planner
- Choose Tools > Chip Planner from the menu
- Identify where the logic used to implement your design is located in the FPGA
- Save a screenshot of the Chip Planner (just the rectangular view of the FPGA) using WindowsKEY+SHIFT+S for your datasheet
- Choose File > Close from the menu to close the chip planner
-
Area
- Choose Processing -> Compilation Report from the menu
- Under Table of Contents choose Fitter > Resource Section > Resource Usage Summary
- Record the number of logic gates (i.e., combinational ALUT usage for logic) in the Area section of the datasheet.
- Record the number of flip-flops (i.e., each dedicated logic registers in the report is one flip-flop) in the Area section of the datasheet.
-
Timing
- Choose Tools > Timing Analyzer from the menu
- Double-click Update Timing Netlist
- Choose Reports > Custom Reports > Report Timing from the menu
- Report Timing
- Clocks - From clock: clk
- Clocks - To clock: clk
- Targets - From: [get_registers *]
- Targets - To: [get_registers *]
- Report number of paths: 100
- Detail level: Path Only (click Set Default)
- Click Report Timing
Update Datasheet for Music Player
You will need to use what have learned in the previous labs to collect the data for your music player datasheet. Make sure the module name, designers, group number, chip planner, area, timing, and critical path sections of your datasheet are finished. The block diagram for the music player is already provided for you in the datasheet. You will add the waveforms in the next section. You can update the interface and functionality later as you prepare your datasheets for submission in Part F. Do not copy/paste screenshots into the datasheet. Use Insert > Insert image in Cell from the menubar to insert screenshots.
5.3. Configure
Now we are finally ready to configure the FPGA for our music player demo.
- Choose Tools > Programmer from the menu
- Click Hardware Setup
- Currently selected hardware: USB-Blaster [USB-0]
- Click Close
- Click Start
Use the input switches to choose the song number. Try playing song 0 and song 1. You need to figure out the names of both songs.
Once you are sure your music player FPGA prototype is playing songs, we want to also see these songs on the oscilloscope. The oscilloscope should be connected in the same was as for the multi-note FPGA prototype. Use the same process as for the multi-note FPGA prototype to view both songs on the scope.
Note that if you press the Run/Stop button to make it green you can go back to viewing the "live" signal. You will need to adjust the time per Y-axis to zoom out even further to see many notes. Rotate the Horizontal Scale knob counter clockwise to change the time scale to 400ms per grid line on the X-axis. View both songs and then pick either song 0 or song 1 that you want to use for your datasheet. Take a screenshot of the first few notes of the song using the oscilloscope.
Now we want to make sure the music player interactive simulator is
working on ecelinux.
Play the same song you chose to look at using the oscilloscope, but now
use the interactive simulator which will generate a VCD file. Use Surfer
to view the clk, note_sel, and note. Make sure the note numbers (as
indicated with note_sel match what you expect to see if you look in
MusicROM_2KB_RTL.v. Zoom in out to see all the notes; can you see the
long notes? Zoom in to see the note frequencies; can you tell the
difference between the high and low notes?
Update Datasheet for Multi-Note Player
You need to add the simulation waveform and oscilloscope waveform for the first few notes of the selected song to the datasheet for your music player. You can update the interface and functionality later as you prepare your datasheets for submission in Part F. Do not copy/paste screenshots into the datasheet. Use Insert > Insert image in Cell from the menubar to insert screenshots.
Lab Check-Off Task 6: Demonstrate the Music Player
Show a TA the progress you have made on your datasheet for the music player. The TA will ask you to compare the area (i.e., number of logic gates and number of flip-flops) for your Lab 1, Lab 2, and Lab 3 prototypes. Look back at your previous datasheets so you have the data ready. For Lab 1, use your data from the optimized display. For Lab 2, use your data from the calculator prototype. For Lab 3, use your data from the music player prototype. The TA will want to see your waveforms which clearly show the first few notes of the selected son both in simulation (using Surfer) and on the real music player FPGA prototype (using the oscilloscope). The TA will ask you the names of both songs. The TA will then ask you to play the secret song. You must figure out the name of the secret song. You can search online, ask other students, or even record the song on your phone and go outside the lab to find someone that knows the name of the secret song. The TAs will not tell you the name. You have to figure it out!
Lab Check-Off Task 7: Turn in Lab Kit
When you are finished with your demo, pack up your ECE 2300 Lab Kit. Put the piezo buzzer and wires back in the component box. Return the FPGA board, USB cable, and component box to a TA who will then record the kit number on your check-off sheet, initial the final check-off, and then collect your check-off sheet.
6. Optional Extension: Custom Song
This section is an optional extension to the main lab and is meant for
students who have already completed all of the above tasks. Students can
play a song of their creation on their music player by modifying the
provided music memory in MusicROM_2KB_RTL.v. Open this file and you
will see a large case statement that looks like this:
The case statement implements a large read-only memory. The notes are
defined as NOTE_G up to NOTE_F, with REST signifying to play no
sound. When MusicROM_2KB_RTL gets a request, it checks the address
given by memreq_addr, and sets memresp_data to be the corresponding
note. You'll see that the memory range for each song ends with
SONG_END, to signify to our player that the song is finished.
As part of this memory, we've left a range (corresponding to song 2) for
you as the student to implement a song of your choice, if you'd like. In
MusicROM_2KB_RTL, you can find the following section:
//----------------------------------------------------------------
// Song 2
//----------------------------------------------------------------
// OPTIONAL: Replace note values to make a new song!
32'h0400: mem_rdata_pre = SONG_END;
32'h0404: mem_rdata_pre = SONG_END;
32'h0408: mem_rdata_pre = SONG_END;
32'h040C: mem_rdata_pre = SONG_END;
32'h0410: mem_rdata_pre = SONG_END;
32'h0414: mem_rdata_pre = SONG_END;
32'h0418: mem_rdata_pre = SONG_END;
32'h041C: mem_rdata_pre = SONG_END;
...
You can see that each note in the song is currently SONG_END. To write
a custom song, you should replace as many of these values as needed with
the notes for your song. Keep in mind that notes will lead directly into
each other; if you want a break between notes, you will have to include
a REST between them
Once you've created your custom song, you can re-synthesize your overall
design (including MusicROM_2KB_RTL.v) and put your design on the FPGA,
as described in earlier in this handout. From there, use the switches to
select song 2. You should hopefully be able to hear your song being
played by your music player!