The Audio Synthesizer Lab Summary In this laboratory, you will construct an audio synthesizer. The synthesizer generates signals for various tones that you will use for your Simon push buttons and win/lose state. The synthesizer generates waveforms by cycling through a ROM file which defines one period of the wave. The rate at which the ROM addresses are changed, determines the frequency of the waveform. Lab Supplies DE2 Board Simon Game Box Speaker
Part 1: Sine Wave Synthesizer Watch the Synthesizer video. Open your latest SimonGame project to continue the design this week. In Add an additional schematic file, and recreate the 32-bit Sine Wave Synthesizer seen in the video and schematic below. Name the file Audio. The sin_16bit.mif file can be downloaded from the lab website and should be copied into your project folder and added to your project. Figure 1. 32-bit Sine Wave Synthesizer After creating the schematic, calculate the P-value you will need to generate a 200 Hz sine wave and replace the random 320000 constant value with that value. Create a symbol file of your Sine Wave Synthesizer and name it Audio. Place the Audio symbol next to the CODEC and connect the AUD_DACLRCK clock to the clock input of the Audio block. Name the output bus sound[15..0] and bit shift the output to the AUD_outL/R inputs as seen in the video or schematic below. Figure 2. Audio Symbol
Next, we will look at the 200 Hz Sine Wave using Signal Tap. 1. First, compile your project ensuring that the CODEC is set as the top-level entity. 2. Once the project is compiled, go to Tools -> Signal Tap Logic Analyzer. 3. In the Signal Tap Logic Analyzer screen, set the Hardware to USB-Blaster. 4. Next, Signal Tap: pre-synthesis as Filter, then click List. 5. Select AUD_DACLRCK from the list. 6. Set the Sample Depth to 8k. 7. Under the Setup (or Data) window double-click or right-click and select Add Nodes Add the sound output to the list the same way you added the AUD_DACLRCK. 8. Uncheck both Trigger Conditions and Trigger Enable. 9. Save your file if you haven t already. Use the default name that is assigned. 10. Start the compilation by clicking on the icon. 11. Once the project has recompiled, reprogram the project as well. 12. Finally, run the analysis by clicking on the Run Analysis button. 13. Under the Data tab, right-click sound, select Bus Display Format -> Signed Line Chart. You should now be able to observe the sine wave output. Checkpoint 1: Show the 200 Hz sine wave on Signal Tap to the Lab Monitor or TA.
Part 2: Audio Synthesizer Now modify your Audio schematic to include five different constant values like the in the schematic below. Figure 3. Modified Audio Schematic The constant values are: Wrong 13000000, Green 41696974, Red 31227991, Yellow 24785540, Blue 20848487. Update the symbol file for Audio and delete and replace the Audio symbol at the toplevel with the new Audio symbol. Next, you will create a block to take the 4 outputs from the debounce block that you created last week, as inputs and select the appropriate sound output based on which input is selected. The following are the GPIO and LED relations: GPIO[7] green, GPIO[6] red, GPIO[5] yellow, GPIO[4] blue. There are multiple ways this can be done, however an easy way to do this is to create a new vhdl block similar to how the seven segment display block was designed using when/else assignments. Start by creating a new VHDL file and call it SoundDecoder. Your code should be very similar to the file that you created in Lab 2 part 3. After writing the VHDL code, create a symbol file and add it to the CODEC schematic and make the appropriate connections. Compile and program the project and check to see if the project works as intended. Checkpoint 2: Show the working audio project along with your VHDL code to the lab monitor or TA. Checkpoint 3: Clean up and show your workbench to the lab monitor or TA.
Discussion Questions 1. Describe how the content of a ROM (.mif file) is converted to a continuous synthesized waveform. 2. How would the Matlab mif_write_sine.m file code change if you were to design a ROM with 16- bit values and 512 points of a square wave? 3. What P value would you use to create a 500 Hz sine wave for a width of 16-bit and a 16 KHz sampling rate? 4. For the parameters used in the lab, what frequency would we get for a P value of 447,392,427?