Chisel Project Template
More and more users are finding IntelliJ to be a powerful tool for Chisel coding. See theIntelliJ Installation Guidefor how to install it.
Make your own Chisel3 project
How to get started
The first thing you want to do is clone this repo into a directory of your own. I'd recommend creating a chisel projects directory somewhere
mkdir~/ChiselProjectscd~/ChiselProjectsgit clone https://github.com/ucb-bar/chisel-template.git MyChiselProjectcdMyChiselProject
Make your project into a fresh git repo
There may be more elegant way to do it, but the following works for me.Note:this project comes with a magnificent 339 line (at this writing) .gitignore file.You may want to edit that first in case we missed something, whack away at it, or start it from scratch.
Clear out the old git stuff
rm -rf .gitgit initgit add .gitignore*
Rename project in build.sbt file
Use your favorite text editor to change the first line of thebuild.sbtfile(it ships as
name := "chisel-module-template") to correspondto your project.
name := "my-chisel-project"
Clean up the README.md file
Again use you editor of choice to make the README specific to your project.Be sure to update (or delete) the License section and add a LICENSE file of your own.
Commit your changes
git commit -m 'Starting MyChiselProject'
Connecting this up to github or some other remote host is an exercise left to the reader.
Did it work?
You should now have a project based on Chisel3 that can be run.
So go for it, at the command line in the project root.
sbt'testOnly gcd.GCDTester -- -z Basic'
This tells the test harness to only run the test in GCDTester that contains the word BasicThere are a number of other examples of ways to run tests in there, but we just want to see thatone works.
You should see a whole bunch of output that ends with something like the following lines
[info] [0.001] SEED 1540570744913test GCD Success: 168 tests passed in 1107 cycles in 0.067751 seconds 16339.24 Hz[info] [0.050] RAN 1102 CYCLES PASSED[info] GCDTester:[info] GCD[info] Basic test using Driver.execute[info] - should be used as an alternative way to run specification[info] using --backend-name verilator[info] running with --is-verbose[info] running with --generate-vcd-output on[info] running with --generate-vcd-output off[info] ScalaTest[info] Run completed in 3 seconds, 184 milliseconds.[info] Total number of tests run: 1[info] Suites: completed 1, aborted 0[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0[info] All tests passed.[info] Passed: Total 1, Failed 0, Errors 0, Passed 1[success] Total time: 5 s, completed Oct 26, 2018 9:19:07 AM
If you see the above then...
You are ready to go. We have a few recommended practices and things to do.
- Use packages and following conventions forstructureandnaming
- Package names should be clearly reflected in the testing hierarchy
- Build tests for all your work.
- This template includes a dependency on the Chisel3 IOTesters, this is a reasonable starting point for most tests
- You can remove this dependency in the build.sbt file if necessary
- Change the name of your project in the build.sbt file
- Change your README.md
There areinstructions for generating Verilogon the Chisel wiki.
Some backends (verilator for example) produce VCD files by default, while other backends (firrtl and treadle) do not.You can control the generation of VCD files with the
To run the simulation and generate a VCD output file regardless of the backend:
sbt'test:runMain gcd.GCDMain --generate-vcd-output on'
To run the simulation and suppress the generation of a VCD output file:
sbt'test:runMain gcd.GCDMain --generate-vcd-output off'
This is the release version of chisel-template. If you have bug fixes orchanges you would like to see incorporated in this repo, please checkoutthe master branch and submit pull requests against it.