The approach taken in this research is not to make another domain specific
language embedded in Haskell, but to use (a subset) of the Haskell language
-itself to be used as hardware description language.
+itself to be used as hardware description language. By taking this approach,
+we can capture certain language constructs, such as Haskell's choice elements
+(if-statement, case-statment, etc.), which are not available in the functional
+hardware description languages that are embedded in Haskell. As far as the
+authors know, such extensive support for choice-elements is new in the domain
+of functional hardware description language. As the hardware descriptions are
+plain Haskell functions, these descriptions can be compiled for simulation
+using using the optimizing Haskell compiler \GHC.
+
+Like the standard hardware description languages, descriptions made in a
+functional hardware description languages must eventually be converted into a
+netlist. This research also features an a prototype translater called \CLaSH\
+(pronounced: Clash), which converts the Haskell code to equivalently behaving synthesizable \VHDL\ code, ready to be converted to an actual netlist format by optimizing \VHDL\ synthesis tools.
\section{Hardware description in Haskell}
Example that defines the \texttt{mac} function by applying the
\texttt{add} and \texttt{mul} functions to calculate $a * b + c$:
-\begin{verbatim}
+\begin{code}
mac a b c = add (mul a b) c
-\end{verbatim}
+\end{code}
TODO: Pretty picture
matching and guards.
\begin{code}
-sumif pred a b = if pred == Eq && a == b
- || pred == Neq && a != b
- then a + b
- else 0
+sumif pred a b = if pred == Eq && a == b ||
+ pred == Neq && a != b
+ then a + b
+ else 0
sumif pred a b = case pred of
Eq -> case a == b of
length type, so you can define an unsigned word of 32 bits wide as
follows:
-\begin{verbatim}
+\begin{code}
type Word32 = SizedWord D32
-\end{verbatim}
+\end{code}
Here, a type synonym \hs{Word32} is defined that is equal to the
\hs{SizedWord} type constructor applied to the type \hs{D32}. \hs{D32}
of the vector and the type of the elements contained in it. The state
type of an 8 element register bank would then for example be:
-\begin{verbatim}
+\begin{code}
type RegisterState = Vector D8 Word32
-\end{verbatim}
+\end{code}
Here, a type synonym \hs{RegisterState} is defined that is equal to
the \hs{Vector} type constructor applied to the types \hs{D8} (The type
To define an index for the 8 element vector above, we would do:
-\begin{verbatim}
+\begin{code}
type RegisterIndex = RangedWord D7
-\end{verbatim}
+\end{code}
Here, a type synonym \hs{RegisterIndex} is defined that is equal to
the \hs{RangedWord} type constructor applied to the type \hs{D7}. In
An example of such a type is the following pair of integers:
-\begin{verbatim}
+\begin{code}
data IntPair = IntPair Int Int
-\end{verbatim}
+\end{code}
Haskell's builtin tuple types are also defined as single
constructor algebraic types and are translated according to this