Created by: Andrew Nichols Friedman, Daniel Kyle George, Yuanning Liu, Hassaan Mamoun Mohammed
To use the AudioMonitor peripheral, A SCOMP programmer first needs an ADC interface peripheral that takes in ADC data and handles the serial-to-parallel data conversion and synchronization with the SCOMP system. This way, the AudioMonitor peripheral can access a simple 16-bit audio sample. The top-level schematic and inputs/outputs of the AudioMonitor peripheral are available in Figure 1 and Figure 2.
Figure 1. The Top-level SCOMP schematic of the AudioMonitor peripheral
Input/Output | Description (Relationship with SCOMP signals) |
---|---|
CS (IN) | System AUD_EN, enable the peripheral to transfer data to IO_DATA. |
IO_WRITE (IN) | System IO_WRITE. |
SYS_CLK (IN) | System clock signal. |
RESETN (IN) | System RESETN. |
AUD_DATA[15..0] (IN) | 16-bit audio data output from the ADC interface peripheral. |
AUD_NEW (IN) | A signal from the ADC interface peripheral indicating that a new signal is available for the AudioMonitor Peripheral. |
IO_DATA[15..0] (IN) | Ambient sound level output from the AudioMonitor peripheral. |
Figure 2. Description of the inputs and outputs of the AudioMonitor peripheral
To balance the response time of the peripheral, we chose to average the audio data of length 2.5 seconds. We accomplished this via four signals: PARSED_DATA, WINDOW_SUM, COUNT, and AVERAGE. After passing new data into the peripheral, AUD_DATA is converted to a signed format and stored in PARSED_DATA. Then, WINDOW_SUM updates by accumulating the absolute values for each new data up to 30,000,000 cycles. COUNT updates with the number of samples taken in and AVERAGE is updated by dividing WINDOW_SUM by COUNT. Once COUNT exceeds the window size of 30,000,000, the average recalculates in real-time via the above equation. This design is far from the original concept we ideated. Initially, we designed a rolling average on an array in which each item was data from AUD_DATA. An array of length 30,000,000 was required to reach the target of 2.5 seconds, and although the design functioned properly for smaller lengths, this was too large of a quantity for Quartus to compile. This compilation issue led us to focus on methods that did not require arrays, realizing itself in our finalized design.