Christiaan Baaij edited this page Feb 13, 2018 · 24 revisions

Questions:

How do I run and install clash using stack?

NB: The following commands should not be run in a directory containing a stack.yaml file

You can globally install clash using stack by:

$ stack setup --resolver=lts-8.12
$ stack install --resolver=lts-8.12 clash-ghc-0.7.1
Run from outside a project, using implicit global project config
...
Copied executables to /Users/baaijcpr/.local/bin:
- clash

What you should remember is:

  • The location of the clash executable, which in the above case is: /Users/baaijcpr/.local/bin

Now, given the situation where:

  • The code you want to compile is in: ./foo/bar
  • The module containing the topEntity function is: Baz.hs

To subsequently run in interactive mode do:

$ cd foo/bar
$ stack exec --resolver=lts-8.12 -- /Users/baaijcpr/.local/bin/clash --interactive Baz.hs
clash> :vhdl

To run in batch mode do:

$ cd foo/bar
$ stack exec --resolver=lts-8.12 -- /Users/baaijcpr/.local/bin/clash --vhdl Baz.hs

How do I run the development version of clash?

NB: The following instructions assume you have already installed a released version of clash

  • Download and install git.

  • Download and install cabal-install-head.

  • Clone the clash repository:

    $ git clone https://github.com/clash-lang/clash-compiler.git
    $ cd clash-compiler
    $ git submodule update --init
    
  • Install clash in the clash-compiler directory:

    $ cabal new-build all
    

Now, given the situation where:

  • You are currently in the ./clash-compiler directory.
  • The code you want to compile is in the ../foo/bar directory.
  • The module containing the topEntity function is Baz.hs.

To run in interactive mode do:

$ cabal new-run clashi
clash> :cd ../foo/bar
clash> :l Baz.hs
clash> :vhdl

To run in batch mode do:

$ cabal new-run -- clash --vhdl -i../foo/bar ../foo/bar/Baz.hs

How do I run clash within a cabal sandbox?

Given the situation where:

  • Your sandbox dir is: ./.cabal-sandbox
  • The code you want to compile is in: ./foo/bar
  • The module containing the topEntity function is: Baz.hs

To run in interactive mode do:

$ cabal exec clash -- --interactive
clash> :cd foo/bar
clash> :l Baz.hs
clash> :vhdl

To run in batch mode do:

$ cabal exec clash -- -ifoo/bar --vhdl foo/bar/Baz.hs

How can I make Xilinx Vivado infer BlockRAMs for the CLaSH blockRam function?

If Vivado fails to infer BlockRAMs for the HDL generated by CLaSH, run clash with the -clash-hdlsyn Vivado flag.

How do I solve Xilinx Vivado error [Synth 8-4556]?

Sometimes, for (System)Verilog code generated by CLaSH, you will get the error:

[Synth 8-4556] size of variable 'ram_init' is too large to handle; the size of the variable is 1048576, the limit is 1000000 ["/home/baaijcpr/devel/clash-compiler/verilog/BramVivado/BramVivado_topEntity_0.v":37]

This usually happens when you are using BlockRAMs in your design. If this happens, in the Vivado TCL console, enter:

set_param synth.elaboration.rodinMoreOptions "rt::set_parameter var_size_limit 4194304"

Where the number (4194304 in the above case) should be equal or larger than the number of bits in your RAM.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.