FPGA Lab 6

AbstractLab 6 instructed us to design a digital to analog converter in order to generate a square wave which would drive a speaker connected to the supplied FPGA. We also needed to be able to set the amplitude of the generated signal using the DIP switches present. This lab was very useful to show the basic theory behind digital to analog converters which need to turn digital values into actual signals. Also, this square wave generator is very useful in creating complicated audio signals which are composed of square waves of varying frequency.


In order to build the DAC I needed to find a way to have the binary number turn into a longer pulse width. Luckily, the FPGAs already connected the VGA output to an pulse width modulated audio codec. This meant that all I needed to do was send the correct signal and the board would take care of the rest. After setting the frequency using the select bit on a MUX, the final task was to be able to modulate the volume of the tone with the on board DIP switches. In order to do this I connected the switches to the same MUX that was being used to select the frequency as shown in figure \ref{fig:circuit}.


\label{fig:circuit} As discussion in section 2, the digital to audio converter was built by connecting the on board DIP switches to a MUX which allowed me to choose when I was playing the provided tone or nothing. By attaching the selection bit to a specific bit in a counter, I was able to force it to play zero for the rest of the duration. This can be thought of a a cout pin for a modulus counter that doesn’t rest when the total hits the modulus (it stays high as the counter counts). Choosing the right pin allowed me to select a particular frequency for the generated square wave. I also needed to attach the VGA connection to my clock in order to be able to read the signal.