Clash is a functional hardware description language that borrows both its syntax and semantics from the functional programming language Haskell. It provides a familiar structural design approach to both combinational and synchronous sequential circuits. The Clash compiler transforms these high-level descriptions to low-level synthesizable VHDL, Verilog, or SystemVerilog.

Clash is an open-source project, licensed under the permissive BSD2 license, and actively maintained by QBayLogic.

pipeline status Hackage


Strongly typed

Clash is built on Haskell which provides an excellent foundation for well-typed code. Together with Clash's standard library it is easy to build scalable and reusable hardware designs.

Interactive REPL

Load your designs in an interpreter and easily test all your component without needing to setup a test bench.

Low-level access

Although Clash offers many features, you sometimes need to directly access VHDL, Verilog, or SystemVerilog directly. Clash allows you to do this with its own templating system.


FIR Filter

Clash allows programmers to write function without hardcoded length or element type information, such as this FIR filter:

fir coeffs x = dotp coeffs (window x)
    dotp as bs = sum (zipWith (*) as bs)

Clash will figure out the type of this function through its powerful type inference system. To "lock" types in place, we can partially apply `fir`:

-- inferred: Signal dom Int -> Signal dom Int
fir3int = fir (3 :> 4 :> 5 :> Nil)

-- inferred: Signal dom Float -> Signal dom Float
fir4float = fir (3.5 :> 4.2 :> 3.0 :> 6.1 :> Nil)

Matrix multiplication

If you do choose to write types explicitely, you can add additional constraints. Clash will check these constraints and refuse to compile if they are not met. The following example implements a fully parallel matrix multiplication algorithm:

  -- Dimension constraints:
  :: na ~ mb
  => 1 <= mb
  -- Allow simulation to access mb/nb:
  => KnownNat mb
  => KnownNat nb
  -- Arguments:
  => Vec ma (Vec na Int)
  -> Vec mb (Vec nb Int)
  -- Result:
  -> Vec ma (Vec nb Int)

mmult mA mB = result
    mBT      = transpose mB
    dot a b  = sum $ zipWith (*) a b
    result   = map (\ar -> dot ar <$> mBT) mA

Open-source community

Clash benefits from an active community. Whether you need a question answered or want to contribute to open-source features, browse the features below to make the most of Clash.

Mailing list
Issue tracker
Slack: (Invite yourself at
IRC: freenode#clash-lang


If you need professional support from the original developers of Clash, check out the support plan.