- \comment{
- 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. How \hs{xs} gets its value will be
- show in the next section about state.}
+
+ 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} 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 4-taps FIR filter based on the above definition
+ is depicted in \Cref{img:4tapfir}.
+
+ \begin{figure}
+ \centerline{\includegraphics{4tapfir}}
+ \caption{4-taps FIR Filter}
+ \label{img:4tapfir}
+ \end{figure}