Skip to content
Generator Bootcamp Material: Learn Chisel the Right Way
Jupyter Notebook Other
Branch: master
Clone or download
Latest commit 73e4f39 Sep 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
binder
images Merge pull request #27 from ucb-bar/firrtl Aug 27, 2018
source Merge branch 'master' into testers2-first-step May 14, 2019
.gitignore [stevo]: add arbiter picture Dec 6, 2017
1_intro_to_scala.ipynb Fix usage of util.Random. Feb 18, 2019
2.1_first_module.ipynb Tone down from crazy Scala to sound less scary Feb 22, 2019
2.2_comb_logic.ipynb
2.3_control_flow.ipynb
2.4_sequential_logic.ipynb Be consistent with the rest of the file Sep 6, 2018
2.5_exercise.ipynb Remove soln that was accidentally left in. Feb 18, 2019
2.6_testers2.ipynb More text cleanup May 14, 2019
3.1_parameters.ipynb
3.2_collections.ipynb
3.2_interlude.ipynb Fix old website links Sep 20, 2019
3.3_higher-order_functions.ipynb
3.4_functional_programming.ipynb
3.5_object_oriented_programming.ipynb
3.6_types.ipynb
4.1_firrtl_ast.ipynb Tweak 4.1 Aug 28, 2018
4.2_firrtl_ast_traversal.ipynb Clean up some typos. May 9, 2018
4.3_firrtl_common_idioms.ipynb
4.4_firrtl_add_ops_per_module.ipynb Be consistent with the explanation blurb Aug 29, 2018
Install.md
LICENSE Initial commit Jul 26, 2017
README.md Update README.md Sep 19, 2019
runtest.py

README.md

Binder

For previous users of the bootcamp, we have upgraded from Scala 2.11 to Scala 2.12. If you are encountering errors, please follow the installation instructions to upgrade to 2.12.

Chisel Bootcamp

Elevate the level of your hardware design from instances to generators! This bootcamp teaches you Chisel, a Berkeley hardware construction DSL written in Scala. It teaches you Scala along the way, and it frames the learning of Chisel on the idea of hardware generators.

What you'll learn

  • Why hardware designs are better expressed as generators, not instances
  • Basics and some advanced features of Scala, a modern programming language
  • Basics and some advanced features of Chisel, a hardware description language embedded in Scala
  • How to write unit tests for Chisel designs
  • Basic introduction to some useful features in Chisel libraries, including dsptools and rocketchip.

Prerequisites

  • Familiarity with Verilog, VHDL, or at least some digital hardware design
  • Programming experience in with a "high-level" language, be it in Python, Java, C++, etc.
  • An earnest desire to learn

Getting Started

Try it out HERE! No local installation required!

If you want to try it out locally, look at installation instructions here.

Outline

The bootcamp is divided into modules, which are further subdivided. This README serves as Module 0, an introduction and motivation to learning the material contained within. Module 1 gives a quick introduction to Scala. It teaches you enough to start writing Chisel, but many more Scala concepts are taught along the way. Chisel is introduced in Module 2, starting with a hardware example and breaking it down. The rest of Module 2 covers combinational and sequential logic, as well as software and hardware control flow. Module 3 teaches you how to write hardware generators in Chisel that take advantage of Scala's high-level programming language features. By the end, you will be able to read and understand most of the Chisel code base and begin using Rocket Chip. This tutorial does not yet cover SBT, build systems, backend flows for FPGA or ASIC processes, or analog circuits.

Motivation

All hardware description languages support writing single instances. However, writing instances is tedious. Why make the same mistakes writing a slightly modified version of something somebody else has likely already designed? Verilog supports limited parameterization, such as bitwidths and generate statements, but this only gets you so far. If we can't write a Verilog generator, we need to write a new instance, thus doubling our code size. As a better option, we should write one program that generates both hardware instances, which would reduce our code size and make tedious things easier. These programs are called generators.

Ideally, we want our generators to be (1) composable, (2) powerful, and (3) enable fine-grained control over the generated design. Error checking is necessary to make sure a composition is legal; without it, debugging is difficult. This requires a generator language to understand the semantics of the design (to know what’s legal and what’s not). Also, the generator should not be overly verbose! We want the generator program to concisely express many different designs, without rewriting it in if statements for each instance. Finally, it should be a zero-cost abstraction. Hardware design performance is very sensitive to small changes, and because of that, you need to be able to exactly specify the microarchitecture. Generators are very different than high-level-synthesis (HLS).

The benefits of Chisel are in how you use it, not in the language itself. If you decide to write instances instead of generators, you will see fewer advantages of Chisel over Verilog. But if you take the time to learn how to write generators, then the power of Chisel will become apparent and you will realize you can never go back to writing Verilog. Learning to write generators is difficult, but we hope this tutorial will pave the way for you to become a better hardware designer, programmer, and thinker!

FAQ

Kernel Crashes Upon Startup

I get the following error upon launching a Scala notebook and Jupyter says that the kernel has crashed:

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
	at jupyter.kernel.server.ServerApp$.apply(ServerApp.scala:174)
	at jupyter.scala.JupyterScalaApp.delayedEndpoint$jupyter$scala$JupyterScalaApp$1(JupyterScala.scala:93)
	at jupyter.scala.JupyterScalaApp$delayedInit$body.apply(JupyterScala.scala:13)
  ...

Caused by: java.lang.NullPointerException
	at ammonite.runtime.Classpath$.classpath(Classpath.scala:31)
	at ammonite.interp.Interpreter.init(Interpreter.scala:93)
	at ammonite.interp.Interpreter.processModule(Interpreter.scala:409)
	at ammonite.interp.Interpreter$$anonfun$10.apply(Interpreter.scala:151)
	at ammonite.interp.Interpreter$$anonfun$10.apply(Interpreter.scala:148)
  ...

Make sure that you have Java 8 selected for running Jupyter (see the instructions above).

Contributors

You can’t perform that action at this time.