|
| 1 | +# Chisel Local Setup |
| 2 | +Instructions for setting up your environment to run Chisel locally. |
| 3 | + |
| 4 | +For a minimal setup, you only need to install [SBT (the Scala Build Tool)](http://www.scala-sbt.org), which will automatically fetch the appropriate version of Scala and Chisel based on on your project configuration. |
| 5 | + |
| 6 | +[Firtool](https://github.com/llvm/circt) is required to generate Verilog. |
| 7 | + |
| 8 | +[Verilator](https://www.veripool.org/wiki/verilator) is installation is required to simulate your Verilog designs. |
| 9 | + |
| 10 | +[FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html) is used by many of the unit tests. |
| 11 | +Please see the FileCheck link for documentation about FileCheck's syntax with examples. |
| 12 | +Alternatively you can search the tests for examples by searching for `CHECK:` which is used to tell FileCheck to attempt to match the following text in the generated output. |
| 13 | + |
| 14 | +## Ubuntu Linux |
| 15 | + |
| 16 | +1. Install the JVM |
| 17 | + ```bash |
| 18 | + sudo apt-get install default-jdk |
| 19 | + ``` |
| 20 | + |
| 21 | +1. Install sbt according to the instructions from [sbt download](https://www.scala-sbt.org/download.html). |
| 22 | + |
| 23 | +1. Install Firtool |
| 24 | + |
| 25 | + Choose whatever version is being [used in continuous integration](.github/workflows/install-circt/action.yml) |
| 26 | + ```bash |
| 27 | + wget -q -O - https://github.com/llvm/circt/releases/download/firtool-1.56.1/circt-full-shared-linux-x64.tar.gz | tar -zx |
| 28 | + ``` |
| 29 | + This will give you a directory called `firtool-1.56.1` containing the firtool binary, add this to your PATH as appropriate. |
| 30 | + ```bash |
| 31 | + export PATH=$PATH:$PWD/firtool-1.56.1/bin |
| 32 | + ``` |
| 33 | + Alternatively, you can install the binary to a standard location by simply moving the binary (if you have root access). |
| 34 | + ```bash |
| 35 | + mv firtool-1.56.1/bin/firtool /usr/local/bin/ |
| 36 | + ``` |
| 37 | + |
| 38 | + |
| 39 | +1. Install Verilator. |
| 40 | + We recommend relatively recent verilator |
| 41 | + Follow these instructions to compile it from source. |
| 42 | + |
| 43 | + 1. Install prerequisites (if not installed already): |
| 44 | + ```bash |
| 45 | + sudo apt-get install git make autoconf g++ flex bison |
| 46 | + ``` |
| 47 | + |
| 48 | + 2. Clone the Verilator repository: |
| 49 | + ```bash |
| 50 | + git clone https://github.com/verilator/verilator |
| 51 | + ``` |
| 52 | + |
| 53 | + 3. In the Verilator repository directory, check out a known good version: |
| 54 | + ```bash |
| 55 | + git pull |
| 56 | + git checkout v5.004 |
| 57 | + ``` |
| 58 | + |
| 59 | + 4. In the Verilator repository directory, build and install: |
| 60 | + ```bash |
| 61 | + unset VERILATOR_ROOT # For bash, unsetenv for csh |
| 62 | + autoconf # Create ./configure script |
| 63 | + ./configure |
| 64 | + make |
| 65 | + sudo make install |
| 66 | + ``` |
| 67 | + |
| 68 | +1. Install FileCheck. |
| 69 | + FileCheck can usually be found in llvm-\*-tools packages, eg. |
| 70 | + ``` |
| 71 | + sudo apt-get install llvm-12-tools |
| 72 | + export PATH=$PATH:/usr/lib/llvm-12/bin |
| 73 | + ``` |
| 74 | + |
| 75 | + You can alternatively download a statically-ish linked binary from https://github.com/jackkoenig/FileCheck |
| 76 | + ``` |
| 77 | + mkdir filecheck |
| 78 | + cd filecheck |
| 79 | + wget -q https://github.com/jackkoenig/FileCheck/releases/download/FileCheck-16.0.6/FileCheck-linux-x64 |
| 80 | + mv FileCheck-linux-x64 FileCheck |
| 81 | + chmod +x FileCheck |
| 82 | + export PATH=$PATH:$PWD |
| 83 | + ``` |
| 84 | + Similarly to firtool, you can install the binary to a more standard location by moving it. |
| 85 | + ``` |
| 86 | + mv FileCheck /usr/local/bin |
| 87 | + ``` |
| 88 | + |
| 89 | +## Arch Linux |
| 90 | +1. Install Verilator and SBT |
| 91 | + ```bash |
| 92 | + pacman -Sy verilator sbt |
| 93 | + ``` |
| 94 | + |
| 95 | +1. Install firtool |
| 96 | + |
| 97 | + See the instructions for Ubuntu above, the firtool Ubuntu binary is a "many Linux" mostly statically linked binary. |
| 98 | + |
| 99 | +## Windows |
| 100 | +1. [Download and install sbt for Windows](https://www.scala-sbt.org/download.html). |
| 101 | + |
| 102 | +Verilator does not appear to have native Windows support. |
| 103 | +However, Verilator works in [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10) or in other Linux-compatible environments like Cygwin. |
| 104 | + |
| 105 | +There are no issues with generating Verilog from Chisel, which can be pushed to FPGA or ASIC tools. |
| 106 | + |
| 107 | +## Mac OS X |
| 108 | +1. Install Verilator and SBT |
| 109 | + ```bash |
| 110 | + brew install sbt verilator |
| 111 | + ``` |
| 112 | + |
| 113 | +1. Install firtool |
| 114 | + |
| 115 | + ```bash |
| 116 | + wget -q -O - https://github.com/llvm/circt/releases/download/firtool-1.56.1/circt-full-shared-macos-x64.tar.gz | tar -zx |
| 117 | + ``` |
| 118 | + This will give you a directory called `firtool-1.56.1` containing the firtool binary, add this to your PATH as appropriate. |
| 119 | + ```bash |
| 120 | + export PATH=$PATH:$PWD/firtool-1.56.1/bin |
| 121 | + ``` |
| 122 | + Alternatively, you can install the binary to a standard location by simply moving the binary. |
| 123 | + ```bash |
| 124 | + mv firtool-1.56.1/bin/firtool /usr/local/bin/ |
| 125 | + ``` |
| 126 | + |
| 127 | +1. Install FileCheck. |
| 128 | + You can download a statically-ish linked binary from https://github.com/jackkoenig/FileCheck |
| 129 | + ``` |
| 130 | + mkdir filecheck |
| 131 | + cd filecheck |
| 132 | + wget -q https://github.com/jackkoenig/FileCheck/releases/download/FileCheck-16.0.6/FileCheck-macos-x64 |
| 133 | + mv FileCheck-macos-x64 FileCheck |
| 134 | + chmod +x FileCheck |
| 135 | + export PATH=$PATH:$PWD |
| 136 | + ``` |
| 137 | + Similarly to firtool, you can install the binary to a more standard location by moving it. |
| 138 | + ``` |
| 139 | + mv FileCheck /usr/local/bin |
| 140 | + ``` |
0 commit comments