[Haskell-cafe] ANN: clash- (Functional Hardware Descriptions)

Christiaan Baaij christiaan.baaij at gmail.com
Tue Mar 22 18:43:25 CET 2011


I am pleased to announce an incremental update to CLaSH, version

CLaSH can translate a (semantic) subset of Haskell to RTL-style VHDL. Instead of being an embedded DSL like Lava or ForSyDe, CLaSH takes are more 'traditional' approach to synthesis/compilation. It uses the GHC API as a front-end for parsing, type-checking and desugaring the Haskell source. It then exhaustively applies a list of meaning-preserving transformations to the intermediate GHC Core representation until it is in the desired normal form. The normalized Core/System Fc is then 'trivially' translated to RTL-style VHDL.

The new version of CLaSH has the following updates:
- Support for simulation and synthesis of multi-clock hardware [6]
- Significant synthesis speed-up (4x to 10x)

CLaSH already supported synthesis of:
- User-defined Higher-Order functions [1]
- User-defined ADTs (GADTs are not tested, but *might* work)
- All of Haskell's choice constructs (Guards, Pattern Matching, etc.)
- Lambda-abstraction / Anonymous Functions

You can use CLaSH as a library, but the use of the adapted GHC interpreter (added the :vhdl command) is recommended. The interpreter can be found on the CLaSH website [2], where you will also find examples, papers, tutorials, etc. The library can be downloaded from Hackage [3].

I recently gave a demo of CLaSH at the DATE'11 conference in grenoble, this demo already made use of the multi-clock feature (and is actually the only reference if you want to experiment with multi-clock hardware yourself). The source for the demo (audio spectrum analyzer programmed on an Altera Cyclone II FPGA board) can be downloaded from my github page [4].

Do note that CLaSH only works when you have the 6.12.* branch of GHC installed! I am currently analyzing the impact of the GHC API changes made in the 7.0.* brach, and hope to make the transition to the new API within the next month. Although the compiler is already used by 2 other phd's in our group [5], it is not a thoroughly tested product, so your coding style might not be anticipated by the current version of CLaSH ;-)

-- Christiaan Baaij

[1] There is hard-coded support for a set of recursively defined higher-order functions such as map, fold, zipWith, etc.
[2] http://clash.ewi.utwente.nl
[3] http://hackage.haskell.org/package/clash-
[4] http://github.com/christiaanb/DE1-Cyclone-II-FPGA-Board-Support-Package
[5] http://caes.ewi.utwente.nl
[6] Simulation does not show meta-stability, you will have to take care of synchronization (dual flipflop) yourself

More information about the Haskell-Cafe mailing list