How to install chisel with docker ?

chisel_logo

Hello FPGAmigos ! I promise this is the last tool installation with docker I do… for now. In this ticket you will find a link to my GitHub with a Dockerfile that will allow you to install the hardware description language CHISEL.

Next week I will write an article on how to use chisel with Yosys, Icestorm and NextPnR by modify what I did with my article “From HDL to FPGA Bitstream with Open Source toolchain”. Do not hesitate to subscribe to the newsletter down below if you want to be notify 😉

Ubuntu Installation

If you are using Ubuntu on you computer or VM you can simply install Scala and SBT by reusing the dockerfile installation process:

sudo apt-get install -y openjdk-8-jdk curl
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup -y
./cs install sbt
# put the "exort" command in your .bashrc an reload your terminal
sbt --version

Check that sbt is in your PATH. I add the following line to my .bashrc file:

export PATH="$PATH:/home/$USER/.local/share/coursier/bin"

The DockerFile

You can find the dockerfile on my github here.

You can copy/paste the following code since you are here:

FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris

RUN apt-get update
RUN apt-get install -y openjdk-8-jdk curl
RUN curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup -y
RUN ./cs install sbt
ENV PATH="$PATH:/root/.local/share/coursier/bin"

To build the image, run the following command:

docker build -t chisel .

Hello world project

There is a hello world project in the repository on my github page. After cloning the repo and building the docker image you can test your installation with the following command line:

docker run -v $PWD/hello/:/project/ -w="/project" chisel /bin/bash -c "sbt run" 

If you want to create your own project you will need and build.sbt file and follow the same folder tree than the hello world project. Here my `build.sbt` to copy/paste (change the organization name and project name 😉 ):

ThisBuild / scalaVersion     := "2.13.8"
ThisBuild / version          := "0.1.0"
ThisBuild / organization     := "LearnFPGAeasily"

val chiselVersion = "3.5.4"

lazy val root = (project in file("."))
  .settings(
    name := "Hello",
    libraryDependencies ++= Seq(
      "edu.berkeley.cs" %% "chisel3" % chiselVersion,
      "edu.berkeley.cs" %% "chiseltest" % "0.5.4" % "test"
    ),
    scalacOptions ++= Seq(
      "-language:reflectiveCalls",
      "-deprecation",
      "-feature",
      "-Xcheckinit",
      "-P:chiselplugin:genBundleElements",
    ),
    addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full),
  )

Leave a Reply

Your email address will not be published. Required fields are marked *

How to install chisel with docker ?

dark blue dot

Summary

Share it !

Get my Ebook ?

ebook_hero-home

Jumpstart you FPGA journey by

• Understanding the place of FPGA in industry
• Learn about internal composition of an FPGA
• A simple beginner friendly project
• An overview of the FPGA workflow
ebook_banner_11