Flexible Intermediate Representation for RTL
Switch branches/tags
Clone or download
Failed to load latest commit information.
.github Remove checkboxes from issue/pr templates Jun 22, 2018
notes WIP Jan 16, 2016
project Protobuf (#832) Jun 28, 2018
regress Change primop arg type (#587) Feb 21, 2018
scripts Bump sbt (#703) Dec 18, 2017
spec Fix some typos in leftovers.txt (#822) Jun 11, 2018
src Do not remove ExtMods with no ports by default (#888) Sep 14, 2018
test/integration Protobuf (#832) Jun 28, 2018
utils/bin Remove stanza (#231) Aug 15, 2016
.fix_yosys_abc.patch Improve Travis configuration and revert Yosys version May 30, 2018
.gitignore WiringTransform Refactor (#648) Jan 15, 2018
.install_verilator.sh Bump version of Verilator used in Travis to 3.922 (#784) May 16, 2018
.install_yosys.sh Improve Travis configuration and revert Yosys version May 30, 2018
.run_chisel_tests.sh Make Scala 2.12.4 the default. (#848) Aug 21, 2018
.run_formal_checks.sh API change: out-of-bounds vec accesses now invalid, not first element ( Dec 23, 2017
.travis.yml Make Scala 2.12.4 the default. (#848) Aug 21, 2018
Makefile Add jenkins-build target to check scalastyle and coverage. (#445) Feb 22, 2017
README.md add link to repo for firrtl syntax highlighting in sublime text 3 Aug 3, 2018
TODO WIP getting through tests Jan 16, 2016
_config.yml Set theme jekyll-theme-minimal Mar 10, 2017
build.sbt Bump scopt from 3.6.0 -> 3.7.0 Aug 29, 2018
root-doc.txt Fix ScalaDoc complaints; add sbt-site, sbt-ghpages boilerplate. Jan 5, 2017
scalastyle-config.xml Add scala-style checkers (#386) Dec 1, 2016
scalastyle-test-config.xml Add scala-style checkers (#386) Dec 1, 2016



Join the chat at https://gitter.im/freechipsproject/firrtl Build Status

Flexible Internal Representation for RTL

Firrtl is an intermediate representation (IR) for digital circuits designed as a platform for writing circuit-level transformations. This repository consists of a collection of transformations (written in Scala) which simplify, verify, transform, or emit their input circuit.

A Firrtl compiler is constructed by chaining together these transformations, then writing the final circuit to a file.

For a detailed description of Firrtl's intermediate representation, see the document "Specification of the Firrtl Language" located in spec/spec.pdf.

Wiki Pages and Tutorials

Useful information is on our wiki, located here:

Some important pages to read, before writing your own transform:

To write a Firrtl transform, please start with the tutorial here: src/main/scala/tutorial. To run these examples:

sbt assembly
./utils/bin/firrtl -td regress -tn rocket --custom-transforms tutorial.lesson1.AnalyzeCircuit
./utils/bin/firrtl -td regress -tn rocket --custom-transforms tutorial.lesson2.AnalyzeCircuit

Other Tools

Installation Instructions

Disclaimer: The installation instructions should work for OSX/Linux machines. Other environments may not be tested.

  1. If not already installed, install verilator (Requires at least v3.886)
  2. If not already installed, install sbt (Requires at least v0.13.6)
  1. Clone the repository: git clone https://github.com/freechipsproject/firrtl.git && cd firrtl
  2. Compile firrtl: sbt compile
  3. Run tests: sbt test
  4. Build executable (utils/bin/firrtl): sbt assembly
    • Note: You can add utils/bin to your path to call firrtl from other processes
  5. Publish this version locally in order to satisfy other tool chain library dependencies:
sbt publish-local
Useful sbt Tips
  1. Run a single test suite: sbt "testOnly firrtlTests.UnitTests"
  2. Continually execute a command: sbt ~compile
  3. Only invoke sbt once:
> compile
> test
Using Firrtl as a commandline tool
utils/bin/firrtl -i regress/rocket.fir -o regress/rocket.v -X verilog // Compiles rocket-chip to Verilog
utils/bin/firrtl --help // Returns usage string
Citing Firrtl

If you use Firrtl in a paper, please cite the following technical report: https://www2.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-9.html

    Author = {Li, Patrick S. and Izraelevitz, Adam M. and Bachrach, Jonathan},
    Title = {Specification for the FIRRTL Language},
    Institution = {EECS Department, University of California, Berkeley},
    Year = {2016},
    Month = {Feb},
    URL = {http://www2.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-9.html},
    Number = {UCB/EECS-2016-9}