Skip to content
Flexible Intermediate Representation for RTL
Scala TeX ANTLR Shell C++ LLVM Other
Branch: master
Clone or download
seldridge Merge pull request #1160 from freechipsproject/fix-info-mode-option
Remove incorrect short option for --info-mode
Latest commit 9fbe7e4 Aug 20, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add CODEOWNERS file (#895) Sep 21, 2018
doc/images Add FIRRTL logo to repo and README (#938) Nov 13, 2018
notes WIP Jan 16, 2016
project Use scalafix to remove unused import and deprecated procedure syntax (#… Jun 18, 2019
regress Faster reg constprop (#1067) Mar 30, 2019
scripts Bump yosys to 0.8 (#1029) Feb 22, 2019
spec Check mems for legal latencies; ban zero write latency. (#1147) Aug 7, 2019
src Remove incorrect short option for --info-mode Aug 20, 2019
test/integration Protobuf (#832) Jun 28, 2018
utils/bin Add FirrtlStage, make Driver compatibility layer Apr 25, 2019
.gitignore WiringTransform Refactor (#648) Jan 15, 2018 Bump version of Verilator used in Travis to 3.922 (#784) May 16, 2018 Bump yosys to 0.8 (#1029) Feb 22, 2019
.mergify.yml Make mergify run when no reviews request changes (#1043) Feb 28, 2019 Fix TRAVIS_COMMIT_RANGE in .run_chisel_tests, replace ... with .. (#924) Oct 28, 2018 API change: out-of-bounds vec accesses now invalid, not first element ( Dec 23, 2017
.travis.yml Fix $TRAVIS_COMMIT_RANGE (#927) Oct 31, 2018
Makefile Make "build" the default make target rather than "clean" (#1152) Aug 13, 2019 Fix custom transform example for Stage/Phase Jul 17, 2019
TODO WIP getting through tests Jan 16, 2016
_config.yml Set theme jekyll-theme-minimal Mar 10, 2017
build.sbt Followup to PR #1142 Aug 1, 2019
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 Build Status Mergify 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 -i regress/RocketCore.fir --custom-transforms tutorial.lesson1.AnalyzeCircuit
./utils/bin/firrtl -td regress -i regress/RocketCore.fir --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 yosys (Requires at least v0.8)
  3. If not already installed, install sbt (Requires at least v0.13.6)
  1. Clone the repository: git clone && 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 publishLocal
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
Use scalafix to remove unused import and deprecated procedure syntax
  1. Remove unused import:
sbt "firrtl/scalafix RemoveUnused"
  1. Remove deprecated procedure syntax
sbt "firrtl/scalafix ProcedureSyntax"
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 ICCAD paper and technical report:

author={A. Izraelevitz and J. Koenig and P. Li and R. Lin and A. Wang and A. Magyar and D. Kim and C. Schmidt and C. Markley and J. Lawson and J. Bachrach}, 
booktitle={2017 IEEE/ACM International Conference on Computer-Aided Design (ICCAD)}, 
title={Reusability is FIRRTL ground: Hardware construction languages, compiler frameworks, and transformations}, 
keywords={field programmable gate arrays;hardware description languages;program compilers;software reusability;hardware development practices;hardware libraries;open-source hardware intermediate representation;hardware compiler transformations;Hardware construction languages;retargetable compilers;software development;virtual Cambrian explosion;hardware compiler frameworks;parameterized libraries;FIRRTL;FPGA mappings;Chisel;Flexible Intermediate Representation for RTL;Reusability;Hardware;Libraries;Hardware design languages;Field programmable gate arrays;Tools;Open source software;RTL;Design;FPGA;ASIC;Hardware;Modeling;Reusability;Hardware Design Language;Hardware Construction Language;Intermediate Representation;Compiler;Transformations;Chisel;FIRRTL}, 

    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 = {},
    Number = {UCB/EECS-2016-9}
You can’t perform that action at this time.