\title{Abstract}

Functional hardware description languages have been around for a while,
but never saw adoption on a large scale. Even though advanced features
like higher order functions and polymorphism could enable very natural
parameterization of hardware descriptions, the conventional hardware
description languages \VHDL\ and Verilog are still most widely used.

Cλash is a new functional hardware description language using Haskell's
syntax and semantics. It allows structurally describing synchronous
hardware, using normal Haskell syntax combined with a selection of
built-in functions for operations like addition or list operations. More
complex constructions like higher order functions and polymorphism are
fully supported.

Cλash supports stateful descriptions through explicit descriptions of a
function's state. Every function accepts an argument containing its
current state and returns its updated state as a part of its result.
This means every function is called exactly once for each cycle,
limiting Cλash to synchronous systems with a single clock domain.

A prototype compiler for Cλash has been implemented that can generate
an equivalent \VHDL\ description (using mostly structural \VHDL). The
prototype uses the frontend (parser, typechecker, desugarer) of the
existing \GHC\ Haskell compiler. This frontend generates a \emph{Core}
version of the description, which is a very small typed functional
language. A normalizing system of transformations brings this Core
version into a normal form that has any complex parts (higher order
functions, polymorphism, complex nested structures) removed. The normal
form can then be easily translated to \VHDL. This design has proven to
be very suitable. In particular the transformation system allows for
some theoretical analysis and proofs about the compiler design itself
(which have been left as future work).

Using Haskell syntax, semantics and existing tools has enabled the rapid
creation of the prototype, but it also became clear that Haskell is not
the ideal language for hardware specification. The problems encountered
could be solved with syntax extensions and major improvements to
Haskell's dependent typing support, or be circumvented entirely by
developing a completely new language.

Cλash already allows for implementing real world systems, but has not
seen much testing yet. There is much room for improvement, but there is
also a clear path forward for further research.
