-
If you need help on making a pull request, follow this guide.
-
To understand how to compile and test chisel3 from the source code, install the required dependencies.
-
In order to contribute to chisel3, you'll need to sign the CLA agreement. You will be asked to sign it upon your first pull request.
-
To introduce yourself and get help, you can join the gitter forum. If you have any questions or concerns, you can get help there.
-
You can peruse the good-first-issues for easy tasks to start with. Another easy thing to start with is doing your own pass of the website looking for typos, pages missing their titles, etc. The sources for the website are here.
-
Please make your PRs against the
main
branch. The project admins, when reviewing your PR, will decide which stable version (if any) your change should be backported to. They will apply the appropriatemilestone
marker which controls which branches the backport will be opened to. The backports will be opened automatically on your behalf once yourmain
PR is merged. -
The PR template will require you to select "Type of Improvement." A reviewer or someone with write access will add the appropriate label to your PR based on this type of improvement which will include your PR in the correct category in the release notes.
-
If your backport PR(s) get labeled with
bp-conflict
, it means they cannot be automatically be merged. You can help get them merged by openening a PR against the already-existing backport branch (will be named something likemergify/bp/3.5.x/pr-2512
) with the necessary cleanup changes. The admins will merge your cleanup PR and remove thebp-conflict
label if appropriate.
Chisel uses the Mill build tool.
You can install it as described on the Chisel installation instructions, or just use the bootstrap script in this repository: ./mill
.
Developers should read the Mill documentation to understand the basic commands and use.
The main dependencies for development are the JDK and git. Any JDK 8 or newer will work for most development, but note that developing the CIRCT Panama bindings requires Java 21. Coursier's command-line is useful for hot swapping JDKs. For example:
eval $(cs java --jvm graalvm-java21 --env)
This will swap the JDK in your shell to the latest release of GraalVM Java 21.
Mill's resolve
command plus the wildcard _
are useful for discovering available projects, tasks, and commands.
# See all projects
./mill resolve _
# See all cross-compile versions for the 'chisel' build unit
./mill resolve chisel._
# See all available tasks and commands for all 'chisel' build unit
./mill resolve chisel.__
You can compile everything with (note this includes the CIRCT Panama bindings so requires Java 21):
./mill __.compile
Most testing can be done on just the Chisel build unit:
./mill chisel[2.13.15].test.test
You can test everything with:
./mill __.test
Note the cross-version will likely change in the future, use ./mill resolve chisel._
to see latest version.
Chisel uses ScalaTest so you can run individual tests using standard ScalaTest commands and arguments, e.g.
./mill chisel[2.13.15].test.testOnly chiselTests.VecLiteralSpec -- -z "lits must fit in vec element width"
Chisel enforces formatting using Scalafmt. To format the code, run:
# Reformat normal source files
./mill __.reformat
# Reformat mill build files
./mill --meta-level 1 mill.scalalib.scalafmt.ScalafmtModule/reformatAll sources
This section describes the internal Chisel components for contributors.
There is a highly experimental component CIRCT Converter (a.k.a. Panama Converter). It is powered by Java's Panama framework to interact directly with CIRCT by calling the C-APIs of MLIR and CIRCT directly from Scala, enabling seamless emitting Chisel IR to CIRCT FIRRTL Dialect IR (no serialization and deserialization for FIRRTL), flexible executing Passes with PassManager, lowering to / exporting SystemVerilog, accesing OM data, and more.
Here defines the needed CIRCT items that will be processed by the Panama framework's jextract tool for codegen FFI Java code to use in Scala.
When you need to use new APIs, add their names to the corresponding files according to the category, then recompile, and the mill build system will automatically process these files, invoking jextract
to generate Java FFI code for you.
The Panama framework requires exact Java 21, and requires extra javac
options to link libraries --enable-native-access=ALL-UNNAMED --enable-preview -Djava.library.path=<lib-path>
. See examples from lit tests, e.g. SmokeTest.sc.
It provides a type-safe wrapper for the FFI code generated by jextract.
Here is the implementation of how each Chisel IR will be emitted to the CIRCT.
It needs to be highly synchronized with CIRCT upstream. When updating it, you can refer to CIRCT's FIRRTL Dialect documentation. Some dialect-specific types, conversions may require a specialized C-API function to return from CIRCT, in which case you can open a PR in CIRCT upstream to add it and use it here.
It provides a PassManager, which is used in place of the firtool cli.
After using PassManager to lowering the FIRRTL Dialect to the HW Dialect, you will be able to access the OM data in it.
The data types of the OM are defined here, as well as the way to access them. This is an example of printing out all the Top_Class
fields.
val pm = converter.passManager()
assert(pm.populateFinalizeIR())
assert(pm.run())
val om = converter.om()
val evaluator = om.evaluator()
val top = evaluator.instantiate("Top_Class", Seq(om.newBasePathEmpty)).get
top.foreachField((name, value) => println(s".$name => { ${value.toString} }"))