Commit 2dfb670f authored by Antonin Dudermel's avatar Antonin Dudermel
Browse files

reread intro and MSB

parent 8bfe4412
......@@ -172,6 +172,7 @@
year = {1992},
doi = {10.1109/ISCAS.1992.230401},
abstract = {Results on limit cycle oscillations in floating-point implementations of recursive filters are reviewed. Special attention is paid to structures with a single floating-point nonlinearity in the recursive filter loop, for which efficient criteria are proposed to guarantee the absence of limit cycles. Both unlimited exponent range limit cycles and underflow limit cycles are considered. Also results on wave digital filters and related structures are discussed.\<\<ETX\>\>},
file = {/home/antonin/Zotero/storage/9AZ4A2H3/Laakso et Zeng - 1992 - Limit cycles in floating-point implementations of .pdf},
journal = {[Proceedings] 1992 IEEE International Symposium on Circuits and Systems}
}
......
......@@ -88,8 +88,8 @@
\section{Introduction}
\begin{frame}{What is Signal Processing?}
The mathematical abstraction representing a physical quantity varying in one
or many dimensions.
Signal: the mathematical abstraction representing a physical quantity varying
in one or many dimensions.
\begin{itemize}
\item Temperature varying in time
\item Color varying in \(x\) and \(y\) axis: a picture
......@@ -105,12 +105,16 @@
\begin{frame}{Quick Faust Tutorial by example}
A functional domain-specific language describing sound processors.
\faustexfig{Stereo-to-Mono converter}{\label{fig:plus-simple}}
\faustex{Stereo-to-Mono converter}{\label{fig:plus-simple}}
{0.4}{../code/plus-block.png}
{0.5}{../code/plus-sig-old.png}
{\(y(t) = \frac{1}{2} (x_0(t) + x_1(t))\)}{../code/plus.dsp}
Describes signal processors by patching primitives together, with a block-diagram algebra.
Describes signal processors by patching primitives together, with a
block-diagram algebra.
\lstinline{f : g} stands for \(y(t) = g(f(x(t)))\) but can also be read
\emph{``plug the outputs of the block f to the inputs the block g"}.
% \scalebox{1.5}{\begin{tikzpicture}
% \altfaustlogo
% \end{tikzpicture}
......@@ -120,96 +124,113 @@
\begin{frame}{Recursive signals}
Necessary to define a signal depending on its previous values (e.g. echoes)
\faustexfig{Ramp}{\label{fig:ramp}}
\faustex{Ramp}{\label{fig:ramp}}
{0.3}{../code/ramp-block.png}
{0.3}{../code/ramp-sig-old.png}
{\(s(t) = 1 + s(t-1)\)}{../code/ramp.dsp}
\lstinline{\_} is the identity block (a wire)
\lstinline{f ~ g} stands for \(y(t) = f(x(t), g(y(t-1)))\)
Leads to loops in the signal graph
\end{frame}
\begin{frame}{FAST: Faust on FPGA}
Low-latency programs can't be executed on computers.
\begin{figure}
\centering
\subfloat[on computers]{
\scalebox{.5}\computeraudio
}
\hspace{\stretch{1}}
\subfloat[using ASIC]{
\scalebox{.5}\asicaudio
}
\caption{Different platforms}
\label{fig:difffix}
\end{figure}
\begin{minipage}{.3\linewidth}
Computers
\begin{itemize}\small
\item General Purpose
\item High latency
\item Reprogrammable
\item Easy to code
\end{itemize}
\end{minipage} \hspace{\stretch{1}}
\uncover<2>{
\begin{center}
\scalebox{0.8}{\computeraudio}\\
\vspace{10px}
\uncover<2->{\scalebox{0.8}{\asicaudio}}\\
\end{center}
\begin{minipage}{.3\linewidth}
FPGA
Computers
\begin{itemize}\small
\item General Purpose
\item Buffer Latency
\item Reprogrammable
\item Easy to program
\end{itemize}
\end{minipage} \hspace{\stretch{1}}
\uncover<3>{
\begin{minipage}{.3\linewidth}
FPGA
\begin{itemize}\small
\item Single-Purpose
\item Low latency?
\item Reprogrammable
\item Hard to program
\end{itemize}
\end{minipage} \hspace{\stretch{1}}
}
\uncover<2->{\begin{minipage}{.3\linewidth}
ASIC
\begin{itemize}\small
\item Single-Purpose
\item Low latency
\item Reprogrammable
\item Hard to code
\end{itemize}
\end{minipage} \hspace{\stretch{1}}
}
\begin{minipage}{.3\linewidth}
ASIC
\begin{itemize}\small
\item Single-Purpose
\item Low latency
\item Once for all
\item Hard to code
\end{itemize}
\end{minipage}
\end{frame}
\item Once for all
\item Hard to build
\end{itemize}
\end{minipage}
}\end{frame}
\begin{frame}{Representing the Reals}
Floating-point numbers (\(x = M \cdot 2^E\)) are
\begin{itemize}
\item Huge
\todo{insérer ici (ou pas ici) l'image d'un additioneur flottant vs entier}
\item often overaccurate or mostly scrambled
\item often overaccurate, sometimes not accurate at all
\item hard to analyse
\end{itemize}
Alternative: fixed-point numbers (\(\ufix(\msb,\lsb)\))
\begin{figure}
\centering
\subfloat[integers on 8 bits]{
\begin{minipage}{.48\linewidth}
\begin{center}
\small
8 bit integers
\end{center}
\begin{tikzpicture}[scale=0.25]
\tiny
\fixpointnumber{0}{7}{0}{0}
\fixpointpositions{0}{7}{0}{0}
\end{tikzpicture}
}
% \hspace{\stretch{1}}
\subfloat[\(\ufix(3, -4)\)]{
\begin{tikzpicture}[scale=0.25]
\end{minipage}
\hspace{\stretch{1}}
\begin{minipage}{.48\linewidth}
\begin{center}
\small
\(\ufix(3,-4)\)
\end{center}
\begin{tikzpicture}[scale=0.25]
\tiny
\fixpointnumber{0}{3}{-4}{0}
\fixpointpositions{0}{3}{-4}{0}
\end{tikzpicture}
}
% \caption{different fixed-point formats}
\end{figure}
\end{minipage}
Representable numbers: \\
Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
(accuracy): \(2^{\lsb}\)
\end{frame}
\begin{frame}{Objective of this work: Faust compiler to fixed-point}
Faust uses only floating-point numbers to represent reals.
Having a compiler using fixed-point numbers would allow
\begin{itemize}
\item C/C++ High-Level synthesis for FPGA
\item Direct translation from signal graph to FPGA circuit
\item C for hardware without floating-point arithmetic unit
\end{itemize}
The aim of this internship: automatically devise adapted most significant bit
and least significant bit for each signal.
\end{frame}
\section{Bounding Signals to Avoid Overflow (MSB)}
\begin{frame}[t]{Interval Arithmetic}
......@@ -240,24 +261,28 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
\item \lstinline{frac(n) = n - floor(n)}
\end{itemize}
\item Information may be hidden in the code
\[ x (1 - x) = 1/4 - (x-1/2)^2\]
\end{itemize}
\begin{eqnarray*}
x(1-x) & = & 1/4 - (x - 1/2)^2\\
\text{bad}& & \text{good}\\
\left[-1, 1\right] & & \left[0, 1/4\right]\\
\end{eqnarray*}
\end{itemize}
\end{frame}
\begin{frame}{Recursive Signals Problem}
Int phaser : \lstinline{process = \%(10)~ +(1);}
Int phaser : \lstinline{process = \%(10)~ +(1);} (\% is the modulo operator)
\begin{figure}
\centering
\subfloat[blocks]{\includegraphics[width = 0.4\textwidth, valign=c]{../code/rec-block.png}}
\hspace{\stretch{1}}
\subfloat[graph]{\includegraphics[width = 0.5\textwidth, valign=c]{../code/rec-sig-old.png}}
\end{figure}
Problem: The sample \(s(t)\) of the signal at time \(t\) relies on the
previous sample \(s(t-1)\).
Problem: The interval of the sample \(s(t)\) of the signal at time \(t\)
relies on the interval of the previous sample \(s(t-1)\).
\end{frame}
\begin{frame}{Abstract Analysis on signals}
Adapt \emph{Abstract analysis} to signals:
\begin{frame}{Abstract Interpretation on signals}
Adapt \emph{abstract interpretation} to signals and apply it to intervals
for each time \(t\), find an
interval \(S(t)\) containing \(s(t)\)
......@@ -266,8 +291,8 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
\recSig{t}{S(t) = [0, 0]}{S(t) = f(S(t-1)) \bigcup S(t)}
\]
\(\bar{S} = \bigcup_{t\in\Rel} S(t)\) upperbounds the signal \(s(t)\) at each time
\pause
\(\bar{S} = \bigcup_{t\in\Rel} S(t)\) upperbounds the signal \(s(t)\) at each
time \pause
From lattice theory:
\begin{itemize}
......@@ -275,29 +300,45 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
\item Such fixpoint can sometimes be found by simply iterating
\(S(N+1) = S(N) \Rightarrow \forall k \geq N, S(k) = S(N)\)
\end{itemize}
\end{itemize}
Sometimes… Will it be lucky with Faust programs?
\end{frame}
\begin{frame}{Example}
On example \only<1-3>{\lstinline{process = \%(10)~ +(1);}
\(f:z \mapsto z + 1 \mod 10 \)}
\only<4>{\lstinline{process = \_~ +(1);}
\(f:z \mapsto z + 1\)}
\begin{frame}{Good Example}
On example \lstinline{process = \%(10)~ +(1);}
\(f:z \mapsto z + 1 \mod 10 \)
\begin{figure}
\centering
\only<1-3>{\includegraphics[width = 0.5\textwidth]{../code/rec-block.png}}
\only<4>{\includegraphics[width = 0.5\textwidth]{../code/ramp-block.png}}
\includegraphics[width = 0.5\textwidth]{../code/rec-block.png}
\end{figure}
\only<1>{Step 0 : \([0, 0]\)}
\only<2>{Step 1 : \(f([0, 0]) \cup [0,0] = [1,1] \cup [0,0] = [0,1]\)}
\only<3>{Step 10 : \(f([0, 10]) \cup [0,10] = [0, 10] \cup [0, 10] = [0, 10]\) Done !}
\only<4>{Step 18752 : \(f([0, 18752]) \cup [0,18752] = [0, 18753] \cup [0, 18752] = [0, 18753]\)\\
used solution: \emph{widening}, set to \(\IntR\)} then
\(f(\IntR) \cup \IntR = \IntR \)
\only<3>{Step 10 : \(f([0, 10]) \cup [0,10] = [0, 10] \cup [0, 10] = [0, 10]\) Done!}
\end{frame}
\begin{frame}{Bad Example}
On example \lstinline{process = \_~ +(1);}
\(f:z \mapsto z + 1\)
\begin{figure}
\centering
\includegraphics[width = 0.5\textwidth]{../code/ramp-block.png}
\end{figure}
\uncover<4->{Implemented solution: use widening\\}
\only<1>{Step 0: \([0, 0]\)}
\only<2>{Step 1:
\(f([0, 0]) \cup [0,0] = [1,1] \cup [0,0] = [0,1]\)}
\only<3>{Step 752:
\(f([0, 752]) \cup [0,752] = [0, 753] \cup [0, 752] = [0, 753]\)}
\only<4>{Step \(\infty\):
\(f(\IntR) \cup \IntR = \IntR \) Done!}
\only<5>{
{Step \(\infty\):
\(f([0, \infty]) \cup [0, \infty] = [0, \infty]\) Done also!}
}
\end{frame}
\begin{frame}{Limitations}
\faustexfig{A smoother}{\label{fig:smooth}}
\faustex{A smoother}{\label{fig:smooth}}
{0.4}{../code/smooth-block.png}
{0.5}{../code/smooth-sig-old.png}
{\(y(t) = x(t) + \frac{1}{2} y(t-1)\)}{../code/smooth.dsp}
......@@ -305,7 +346,10 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
\only<1>{Step 0 : \([0, 0]\)}
\only<2>{Step 1 : \(f([0, 0]) \cup [0,0] = [-1,1] \cup [0,0] = [-1,1]\)}
\only<3>{Step 2 : \(f([-1, 1]) \cup [-1, 1] = [-1.5, 1.5] \cup [-1, 1] = [-1.5, 1.5]\)}
\only<4>{Step 3 : \(f([-1.5, 1.5]) \cup [-1.5, 1.5] = [-1.75, 1.75] \)}
\only<4>{Step 3 : \(f([-1.5, 1.5]) \cup [-1.5, 1.5] = [-1.75, 1.75] \)}\\
\only<5>{Step \(\infty\) : \(f(\IntR) \cup \IntR = \IntR \)}\\
\uncover<4->{Infinite converging sum!\\}
\uncover<5>{Implemented workaround: signal annotation}
% \only<5>{Step \(t\) : \(f([- 2 + 2^{-t-1}, 2 - 2^{-t-1}]) \cup
% [- 2 + 2^{-t-1}, 2 - 2^{-t-1}] = [- 2 + 2^{-t}, 2 - 2^{-t}] \)}
\end{frame}
......@@ -317,7 +361,6 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
\lstinline{(a + b) * c} implements \emph{exactly} \(\rnd(\rnd(a + b) \times c)\)\\
Absolute error \(\abserr_f = (a + b) \times c - \rnd(\rnd(a + b) \times c)\)
\begin{eqnarray*}
\footnotesize
\abserr_f &=& (a + b)\times c - \rnd(\rnd(a + b)\times c) \pause\\
&=& (a + b)\times c - \rnd(a + b)\times c
+ \rnd(a + b)\times c -\rnd(\rnd(a + b)\times c)\pause\\
......@@ -339,7 +382,7 @@ Biggest (range): \(2^{\msb+1} - 2^{\lsb}\) \hspace{\stretch{1}} Smallest
Local rule: devising the LSB of a processor depending only on its type
\(+, \times\dots\) and the LSB of its inputs/outputs.
\faustexfig{Weighted sum}{\label{fig:pond}}%
\faustex{Weighted sum}{\label{fig:pond}}%
{0.4}{../code/pond-block.png}%
{0.5}{../code/pond-sig-old.png}%
{}{../code/pond.dsp}%
......
......@@ -52,6 +52,19 @@
\end{figure}
}
\newcommand{\faustex}[8]{ %useless %useless
% size, png of the block diagram
% size, png of the signal graph
% formula, address of the code
\begin{center}
\smallcode{#8}
\hspace{\stretch{1}}#7 \hspace{\stretch{1}}\\
\includegraphics[width=#3\textwidth, valign=c]{#4}
\hspace{\stretch{1}}
\includegraphics[width=#5 \textwidth, valign=c]{#6}
\end{center}
}
% \usepackage{endfloat}
% \renewcommand{\processdelayedfloats}{}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment