From d1e388950fe94bf42ca031458633e4785750b4e8 Mon Sep 17 00:00:00 2001
From: Christiaan Baaij
Date: Thu, 25 Feb 2010 14:08:32 +0100
Subject: [PATCH] Move FIR example to use case section

4tapfir.svg  4 +
"c\316\273ash.lhs"  84 +++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions()
diff git a/4tapfir.svg b/4tapfir.svg
index d9a33db..b6a3f23 100644
 a/4tapfir.svg
+++ b/4tapfir.svg
@@ 15,7 +15,7 @@
id="svg2"
version="1.1"
inkscape:version="0.47 r22583"
 sodipodi:docname="choicecase.svg">
+ sodipodi:docname="4tapfir.svg">
> xs = x +> tail xs
 \end{code}

 Where the \hs{tail} functions returns all but the first element of a
 vector, and the concatenate operator ($\succ$) adds the new element to the
 left of a vector. The complete definition of the FIR filter then becomes:

 \begin{code}
 fir (State (xs,hs)) x = (State (x >> xs,hs), xs *+* hs)
 \end{code}

 The resulting netlist of a 4taps FIR filter based on the above definition
 is depicted in \Cref{img:4tapfir}.

 \begin{figure}
 \centerline{\includegraphics{4tapfir}}
 \caption{4taps FIR Filter}
 \label{img:4tapfir}
 \end{figure}

+ choice constructs, as state values are just normal values.
\section{\CLaSH\ prototype}
foo\par bar
+\section{Use cases}
+Returning to the example of the FIR filter, we will slightly change the
+equation belong to it, so as to make the translation to code more obvious.
+What we will do is change the definition of the vector of input samples.
+So, instead of having the input sample received at time
+$t$ stored in $x_t$, $x_0$ now always stores the current sample, and $x_i$
+stores the $ith$ previous sample. This changes the equation to the
+following (Note that this is completely equivalent to the original
+equation, just with a different definition of $x$ that will better suit
+the the transformation to code):
+
+\begin{equation}
+y_t = \sum\nolimits_{i = 0}^{n  1} {x_i \cdot h_i }
+\end{equation}
+
+Consider that the vector \hs{hs} contains the FIR coefficients and the
+vector \hs{xs} contains the current input sample in front and older
+samples behind. The function that does this shifting of the input samples
+is shown below:
+
+\begin{code}
+x >> xs = x +> tail xs
+\end{code}
+
+Where the \hs{tail} function returns all but the first element of a
+vector, and the concatenate operator ($\succ$) adds a new element to the
+left of a vector. The complete definition of the FIR filter then becomes:
+
+\begin{code}
+fir (State (xs,hs)) x = (State (x >> xs,hs), xs *+* hs)
+\end{code}
+
+The resulting netlist of a 4taps FIR filter based on the above definition
+is depicted in \Cref{img:4tapfir}.
+
+\begin{figure}
+\centerline{\includegraphics{4tapfir}}
+\caption{4taps FIR Filter}
+\label{img:4tapfir}
+\end{figure}
+
\section{Related work}
Many functional hardware description languages have been developed over the
years. Early work includes such languages as $\mu$\acro{FP}~\cite{muFP}, an

2.30.2