X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fdsd-paper.git;a=blobdiff_plain;f=c%CE%BBash.lhs;h=b43aca82384bfb88c678106dc94b2f1ca7ee3bef;hp=362fe5831c8679cd38292a76c03381bbf84456b6;hb=a11a4de9164d4b7a77401939512d4be161878340;hpb=f513b84e02a6bd0215334379dda9b74a19d178ab diff --git "a/c\316\273ash.lhs" "b/c\316\273ash.lhs" index 362fe58..b43aca8 100644 --- "a/c\316\273ash.lhs" +++ "b/c\316\273ash.lhs" @@ -606,10 +606,7 @@ by an (optimizing) \VHDL\ synthesis tool. % against the constructors in the \hs{case} expressions. We can see two versions of a contrived example below, the first using a \hs{case} construct and the other using a \hs{if-then-else} - constructs, in the code below. The example sums two values when they are - equal or non-equal (depending on the predicate given) and returns 0 - otherwise. Both versions of the example roughly correspond to the same - netlist, which is depicted in \Cref{img:choice}. + constructs, in the code below. \begin{code} sumif pred a b = case pred of @@ -634,6 +631,11 @@ by an (optimizing) \VHDL\ synthesis tool. \caption{Choice - sumif} \label{img:choice} \end{figure} + + The example sums two values when they are equal or non-equal (depending on + the predicate given) and returns 0 otherwise. Both versions of the example + roughly correspond to the same netlist, which is depicted in + \Cref{img:choice}. A slightly more complex (but very powerful) form of choice is pattern matching. A function can be defined in multiple clauses, where each clause @@ -808,8 +810,8 @@ by an (optimizing) \VHDL\ synthesis tool. % value. \item[\bf{Multiple constructors with fields}] Algebraic datatypes with multiple constructors, where at least - one of these constructors has one or more fields are not - currently supported. + one of these constructors has one or more fields are currently not + supported. \end{xlist} \subsection{Polymorphism} @@ -1011,18 +1013,23 @@ by an (optimizing) \VHDL\ synthesis tool. \section{\CLaSH\ prototype} -The \CLaSH language as presented above can be translated to \VHDL using -the prototype \CLaSH compiler. This compiler allows experimentation with -the \CLaSH language and allows for running \CLaSH designs on actual FPGA +The \CLaSH\ language as presented above can be translated to \VHDL\ using +the prototype \CLaSH\ compiler. This compiler allows experimentation with +the \CLaSH\ language and allows for running \CLaSH\ designs on actual FPGA hardware. -\comment{Add clash pipeline image} -The prototype heavily uses \GHC, the Glasgow Haskell Compiler. Figure -TODO shows the \CLaSH compiler pipeline. As you can see, the frontend -is completely reused from \GHC, which allows the \CLaSH prototype to -support most of the Haskell Language. The \GHC frontend produces the -program in the \emph{Core} format, which is a very small, functional, -typed language which is relatively easy to process. +\begin{figure} +\centerline{\includegraphics{compilerpipeline.svg}} +\caption{\CLaSH\ compiler pipeline} +\label{img:compilerpipeline} +\end{figure} + +The prototype heavily uses \GHC, the Glasgow Haskell Compiler. +\Cref{img:compilerpipeline} shows the \CLaSH\ compiler pipeline. As you can +see, the front-end is completely reused from \GHC, which allows the \CLaSH\ +prototype to support most of the Haskell Language. The \GHC\ front-end +produces the program in the \emph{Core} format, which is a very small, +functional, typed language which is relatively easy to process. The second step in the compilation process is \emph{normalization}. This step runs a number of \emph{meaning preserving} transformations on the @@ -1144,7 +1151,7 @@ synchronous and untimed models of computation. Using so-called domain interfaces a designer can simulate electronic systems which have both analog as digital parts. ForSyDe has several simulation and synthesis backends, though synthesis is restricted to the synchronous subset of the ForSyDe -language. Unlike \CLaSH\ there is no support for the automated synthesis of description that contain polymorphism or higher-order functions. +language. Unlike \CLaSH\ there is no support for the automated synthesis of descriptions that contain polymorphism or higher-order functions. Lava~\cite{Lava} is a hardware description language that focuses on the structural representation of hardware. Besides support for simulation and @@ -1153,7 +1160,7 @@ tools for formal verification. Lava descriptions are actually circuit generators when viewed from a synthesis viewpoint, in that the language elements of Haskell, such as choice, can be used to guide the circuit generation. If a developer wants to insert a choice element inside an actual -circuit he will have to specify this explicitly as a component. +circuit he will have to explicitly instantiate a multiplexer-like component. In this respect \CLaSH\ differs from Lava, in that all the choice elements, such as case-statements and pattern matching, are synthesized to choice @@ -1163,11 +1170,9 @@ mentioned in this section. The merits of polymorphic typing, combined with higher-order functions, are now also recognized in the `main-stream' hardware description languages, -exemplified by the new \VHDL-2008 standard~\cite{VHDL2008}. \VHDL-2008 has -support to specify types as generics, thus allowing a developer to describe +exemplified by the new \VHDL-2008 standard~\cite{VHDL2008}. \VHDL-2008 support for generics has been extended to types, allowing a developer to describe polymorphic components. Note that those types still require an explicit -generic map, whereas type-inference and type-specialization are implicit in -\CLaSH. +generic map, whereas types can be automatically inferred in \CLaSH. % Wired~\cite{Wired},, T-Ruby~\cite{T-Ruby}, Hydra~\cite{Hydra}. %