X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=matthijs%2Fintroduction.lhs;h=039d265357f929f6b24b1afe12ac4d585b8d47d9;hb=e5b7438deb24871d58755733b301a692f99c0c55;hp=37a12cd05eb35f12882bd8cb2e3366e9719b0364;hpb=763ae6d1733a619ad6cf7252a94bdc5eb041f186;p=matthijs%2Fmaster-project%2Ffinal-presentation.git diff --git a/matthijs/introduction.lhs b/matthijs/introduction.lhs index 37a12cd..039d265 100644 --- a/matthijs/introduction.lhs +++ b/matthijs/introduction.lhs @@ -112,12 +112,94 @@ \frame { - TODO: Impure (stateful) example. + \frametitle{Multiply-accumulate} + \begin{columns} + \begin{column}{4cm} + \begin{tabular}{lll} + Input A & Input B & Output \\ + \hline + 1 & 1 & 1 \\ + 1 & 2 & 3 \\ + 1 & 1 & 4 \\ + 2 & 2 & 8 \\ + \end{tabular} + \end{column} + \begin{column}{6cm} + \begin{figure} + \includegraphics[width=7cm]{figures/archs/Mac} + \end{figure} + \end{column} + \end{columns} } \note[itemize] { - \item TODO + \item Next sheet: MAC circuit and I/O values + \item MAC is common circuit + \item Multiplies pairs, one pair at a time + \item Stores sum so far + \item Not pure! + \item Depends on inputs \emph{and} current register value + \item Solution: Put register value (state) in argument +} + +\frame +{ + \frametitle{Multiply-accumulate} + \begin{columns} + \begin{column}{4cm} + \begin{block}{} + \vspace{-0.5cm} +\begin{verbatim} +mac (a, b) (State s) = let + sum = s + (a * b) +in (State sum, sum) +\end{verbatim} + \end{block} + \end{column} + \begin{column}{6cm} + \begin{figure} + \includegraphics[width=7cm]{figures/archs/MacExternal} + \end{figure} + \end{column} + \end{columns} +} + +\note[itemize] +{ + \item Next sheet: MAC implementation + \item Current state as argument (annotated) + \item Two parts in the result: New state and output + \item Register is placed ``outside'' + \item We want it inside! + \item Annotation allows compiler to put it inside +} + +\begin{frame}[fragile] + \frametitle{Simulating} + + \begin{block}{Recursive run function} + run f (i:is) s = let + (s', o) = f i s + in o : (run f is s') + \end{block} + + \begin{block}{Remember \texttt{mac}} +\vspace{-0.5cm} +\begin{verbatim} +mac (a, b) (State s) = let + sum = s + (a * b) +in (State sum, sum) +\end{verbatim} + \end{block} +\end{frame} + +\note[itemize] +{ + \item Next sheet: run function + \item Used for simulation only + \item Recursion ``stores'' state + \item Each recursion step, \texttt{f} is evaluated once. } \subsection{\texorpdfstring{\clash{}}{CLasH}} @@ -157,7 +239,8 @@ \item Core: simpele functionale taal, niet minder expressief (vergelijk: taal zonder synoniemen) \item VHDL: Complexe HDL, gebruiken alleen netlist onderdelen. - \item Normalisatie: Nog simpeler maken. + \item Normalisatie: Nog simpeler maken (Polymorphisme, hogere orde eruit, + eenduidige vorm). } \subsection{Normalization} @@ -304,8 +387,7 @@ \subsection{Thanks} \frame { - {\Huge Thanks!} - +\vspace{2cm}\centerline{\Huge{Thanks!}} } % vim: set filetype=tex sw=2 sts=2 expandtab: