View on GitHub

CλaSH

CAES Language for Synchronous Hardware

Introduction

CλaSH (pronounced ‘clash’) is a functional hardware description language that borrows both its syntax and semantics from the functional programming language Haskell. The merits of using a functional language to describe hardware comes from the fact that combinational circuits can be directly modeled as mathematical functions and that functional languages lend themselves very well at describing and (de-)composing mathematical functions. The CλaSH compiler transforms these high-level descriptions to low-level synthesizable VHDL.

An experimental version of the new CλaSH compiler and some examples can be found below.
!! The compiler and the CλaSH Prelude library are subject to change !!

Installation

The CλaSH compiler and Prelude library for circuit design only work with the GHC Haskell compiler version 7.8.* and up.

  1. Install GHC (version 7.8.* or higher)

    • Download and install GHC for your platform. Unix user can use ./configure prefix=<LOCATION> to set the installation location.

    • Make sure that the bin directory of GHC is in your PATH.

  1. Install Cabal

    • Windows and OS X Mavericks:

    • Other Unix systems:

      • Download the sources for cabal-install
      • Unpack (tar xf) the archive and cd to the directory
      • Run sh bootstrap.sh
      • Follow the instructions to add cabal to your PATH
    • Run cabal update

  1. Install CλaSH

    • Run cabal install clash-ghc
  1. Verify that everything is working by:

    • Downloading the FIR.hs example
    • Run clash --interactive FIR.hs
    • Execute, in the interpreter, the :vhdl command.
    • Exit the interpreter using :q
    • Examine the VHDL code in the vhdl directory

Documentation

Reference Manual / Tutorial

Tutorial
Reference documentation

Examples

FIR.hs
Calculator.hs

Publications
  1. Baaij, C.P.R. and Kuper, J. (2014) Using Rewriting to Synthesize Functional Languages to Digital Circuits. In: Jay McCarthy, editor, Trends in Functional Programming (TFP), Provo, UT, USA, May 14-16, 2013. Volume 8322 of Lecture Notes in Computer Science (LNCS). pages 17–33. Springer-Verlag. ISBN 978-3-642-45340-3. paper.pdf
  2. Wester, R. and Baaij, C.P.R. and Kuper, J. (2012) A two step hardware design method using CλaSH.. In: Proceedings of the 22nd International Conference on Field Programmable Logic and Applications (FPL), Aug 29-31, 2012, Oslo, Norway. pages 181-188. IEEE Computer Society. ISBN 978-1-4673-2257-7. paper.pdf
  3. Gerards, M.E.T. and Baaij, C.P.R. and Kuper, J. and Kooijman, M. (2011) Higher-Order Abstraction in Hardware Descriptions with CλaSH. In: Proceedings of the 14th Conference on Digital System Design (DSD), Oulu, Finland. pages 495-502, 31 Aug - 2 Sept, 2011. IEEE Computer Society. ISBN 978-0-7695-4494-6. paper.pdf
  4. Kuper, J. and Baaij, C.P.R. and Kooijman, M. and Gerards, M.E.T. (2010) Exercises in architecture specification using CλaSH. In: Proceedings of Forum on Specification and Design Languages (FDL), 2010, Southampton, England, Sept 13-16. pages 178-183. Electronic Chips & Systems design Initiative (ECSI). ISSN 1636-9874. paper.pdf
  5. Baaij, C.P.R. and Kooijman, M. and Kuper, J. and Boeijink, W.A. and Gerards, M.E.T. (2010) CλaSH: Structural Descriptions of Synchronous Hardware using Haskell. In: Proceedings of the 13th Conference on Digital System Design (DSD), Lille, France, Sept 1-3, 2010. pages 714-721. IEEE Computer Society. ISBN 978-0-7695-4171-6. paper.pdf

Support

For updates and questions join the mailing list clash-language+subscribe@googlegroups.com or read the forum.
Bug reports for the CLaSH compiler: http://github.com/christiaanb/clash2/issues
Bug reports for the CLaSH prelude library: http://github.com/christiaanb/clash-prelude/issues