[Tutorial] Develop Chisel with Dev Container in Idea.

Published: by Creative Commons Licence (Last updated: )

Why Dev Container?

The Dev Container is a lightweight, self-contained environment that allows you to develop in a containerized environment. It is a good choice for developing Chisel, because it can provide a consistent development environment for all developers.

Why IntelliJ Idea?

IntelliJ Idea is a powerful IDE for Scala development. It supports Chisel highlighting and definition navigation well.

How to use Dev Container in Idea?

Here we use the chisel-chipware project as an example.

Step 1: Enable Dev Container Plugin

From the official document, we need to enable the Dev Containers plugin first.

Then open the chisel-chipware project in Idea, open the .devcontainer/devcontainer.json file, and click the Create Dev Container and Mount button.

Create Dev Container and Mount

Then wait for the Dev Container to be built.

Step 2: Open the Project in Dev Container and generate bsp

After the Dev Container is built, we can open the project in the Dev Container.

Build Dev Container

We need to generate the bsp file first. Execute the following command in the terminal:

mill -i -j 0 mill.bsp.BSP/install

Generate bsp

Then we open any .scala file and install the Scala plugin. Then we restart the Idea.

Step 3: Open the Project in Dev Container again and import bsp

After the bsp file is generated, we can open the project in the Dev Container again. Then we can import the bsp file for Chisel development.

You may either search for the Project from Existing Sources action or select File > New > Project (Module) from Existing Sources.

Select file

Then we can select the bsp file to import.

Import module from bsp

After the import is complete, we can develop Chisel in the Dev Container and navigate the definitions.