\section{DSP implementation and optimization of the ANR algorithm}
This section aims to be the main part of this thesis. The first subchapter describes the hardware, on which the \ac{ANR} algorithm is implemented, including its environment, which serves as a link to the CI system itself. The following subchapter continues with the basic implementation of the \ac{ANR} algorithm on the hardware itself and shall provide the reader with a basic understanding of its efficiency, which shall serve as a baseline for the following optimizations.\\
During the third chapter, this initial implementation is further optimized in order to achieve an improved real-time performance on the \ac{DSP}. The last subchapter picks the final optimizations of the \ac{ANR} algorithm itself as a central theme, especially with respect to the capabilities of a hybrid \ac{ANR} approach.
\subsection{Description of the low-power DSP and its environment}
This thesis considers a low-power system-on-chip architecture that integrates a general-purpose \ac{ARM} core with a dedicated \ac{DSP} core. The system combines the flexibility of an \ac{ARM}-based control processor with the computational efficiency of a specialized \ac{DSP}, splitting general computing tasks from real-time signal processing workloads.
\subsubsection{Hardware overview}
The \ac{ARM} core serves as the primary control unit of the system. It is responsible for high-level application logic, system configuration, peripheral management, and scheduling. Due to its general-purpose instruction set and extensive software ecosystem, the \ac{ARM} core is well suited for handling general tasks and the interaction with the \ac{CI} system. Time-critical numerical processing is intentionally offloaded to the \ac{DSP} core in order to reduce computational load and power consumption on the control processor.\\ \\
The \ac{DSP} used for the implementation is a 32-bit fixed-point processor primarily designed for audio signal-processing applications in low-power embedded systems. It is developed using a retargetable processor design methodology and is typically programmed in the C language. The used compiler is highly efficient and generates optimized assembler code, which is then translated in machine code to execute the \ac{ANR} algorithm on incoming samples.\\ \\
The processor is equipped with load/store architecture, meaning that, initially all operands need to be moved from the memory to the registers, before any operation can be performed. After this task is performed, the execution units (\ac{ALU} and multiplier) can perform their operations on the data and write back the results into the registers. Finally, the results need to be explicitly moved back to the memory.\\ \\
The \ac{DSP} includes a three stage pipeline consisting of fetch, decode, and execute stages, allowing for overlapping instruction execution and improved throughput. The architecture is optimized for high cycle efficiency when executing computationally intensive signal-processing workloads. It features a dual Harvard load store architecture and two separate \ac{ALU}s, which enables the execution of two \ac{MAC} operations, two memory operations (load/store) and two pointer updates in a single processor cycle.\\ \\
The \ac{DSP} includes a set of registers, including
\subsubsection{Communication between the ARM core and the DSP}
Communication between the \ac{ARM} core and the \ac{DSP} is realized through a shared memory region accessible by both processing units. This shared memory enables the exchange of data without the need for separate communication protocols. Synchronization between the cores is achieved using interrupt-based signaling: the \ac{ARM} core initiates processing requests by triggering an interrupt on the \ac{DSP}, while the \ac{DSP} notifies the \ac{ARM} core upon completion of a task via a dedicated signaling mechanism. This approach ensures efficient coordination while minimizing active waiting and unnecessary power consumption.
\begin{figure}[H]
    \centering
    \includegraphics[width=1.0\linewidth]{Bilder/fig_dsp_setup.jpg}
    \caption{Simplified visualization of the communication between the \ac{ARM} core and the \ac{DSP} core}
    \label{fig:fig_dsp_setup.jpg}
\end{figure}
\noindent The \ac{ARM} Core receives the audio data from the CI system via a \ac{PCM} interface, which offers one input and one output register. An interrupt trigger the integrated \ac{DMA} controller, which transfers the audio data from the \ac{PCM} interface to buffer in a predefined memory location. Once the buffer is filled with  enough samples, another interrupt is triggered, notifying the \ac{DSP} core to start processing the audio data. The \ac{DSP} core then reads the audio samples from the shared memory, processes them using the implemented \ac{ANR} algorithm, and writes the processed samples back to an output buffer, also located in the shared memory. Finally, the \ac{ARM} core is notified via an interrupt from the \ac{DSP} core, that the processing is complete - the \ac{DMA} controller then transfers the processed audio samples from the output buffer back to the \ac{PCM} interface for playback.\\ \\ 
\begin{figure}[H]
    \centering
    \includegraphics[width=0.9\linewidth]{Bilder/fig_dsp_interrupt.jpg}
    \caption{Simplified flowchart of the sample processing between the \ac{ARM} core and the \ac{DSP} core via interrupts and shared memory. For simplification, the registers of the \ac{DSP} core are not visualized.}
    \label{fig:fig_dsp_interrupt.jpg}
\end{figure}

\subsection{Implementation of the ANR algorithm on the DSP}
\subsection{First optimization approach: algorithm implementation}
\subsection{Second optimization approach: hybrid ANR algorithm}

