• Checkout the code according to instructions here.
$ git clone https://github.com/ucb-bar/rocket-chip.git
$ cd rocket-chip
$ git submodule update --init
$ export ROCKET_CHIP=`realpath ./rocket-chip`
• Build and publish FIRRTL, as usual:
$ cd $ROCKET_CHIP/firrtl
$ sbt clean publishLocal
• Verify that Rocket Chip can be compiled outside of IDE:
$ cd $ROCKET_CHIP
$ sbt clean publishLocal
• Wipe existing IDE configuration .idea, if necessary:
$ rm -rf $ROCKET_CHIP/.idea
• Import project into IntelliJ
Navigate to build.sbt, select default settings.
• (Optional) Attempt to compile using sbt, within IntelliJ:
• Rebuild project using IntelliJ
• Now for the secret sauce, write your generator object:
Start with running freechips.rocketchip.groundtest.Generator.
It will fail. That is good.
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Usage: sbt> run TargetDir TopModuleProjectName TopModuleName ConfigProjectName ConfigNameString
at scala.Predef$.require(Predef.scala:224)
at freechips.rocketchip.util.GeneratorApp$class.names(GeneratorUtils.scala:76)
at freechips.rocketchip.groundtest.Generator$.names$lzycompute(Generator.scala:7)
at freechips.rocketchip.groundtest.Generator$.names(Generator.scala:7)
at freechips.rocketchip.groundtest.Generator$.delayedEndpoint$freechips$rocketchip$groundtest$Generator$1(Generator.scala:8)
at freechips.rocketchip.groundtest.Generator$delayedInit$body.apply(Generator.scala:7)
Fixing this is left as an exercise to the reader, but I will provide this simple (and, oh so powerful, tip).
Right click on 'GeneratorApp' from line 'object Generator extends App' and click 'Go To'. This will bring you the definition of the GeneratorApp trait.
So, why not add a breakpoint and debug yourself? The process is outside of the scope of this post.
• Tips for advanced users:
I typically do not do work inside the rocket-chip repo. Similar to the firrtl publishLocal step, I do a publishLocal of rocketchip and import the jar into my project. My generator function is highly customized.
See the following for more information: