Version Matrix

Chisel / Firrtl to ELK Graph

This project can generate ELK Graph files, which can be rendered by icviewer as an interactive diagram to represent Chisel generated Firrtl circuits.

The main idea is that the layout of graphs use a layer-based algorithm provided by the Eclipse Layout Kernel, and the graph rendering is implemented by Sprotty diagramming framework. The combination of the two gives us a very intuitive circuit schematics.

The logic of circuit serialization comes from diagrammer and adapted to elk data generation.

Example

Graph

Using

Install

git clone https://github.com/easysoc/layered-firrtl
cd layered-firrtl

Creating graph from Firrtl file

To create a set of graphs of a Firrtl Circuit all you need is this project and a Firrtl file (typically a file generated by Chisel with a .fir extension). Let's say you have a Firrtl file ~/projects/output/circuit.fir. From the command line you while in this directory for this project

./elk.sh -i ~/projects/output/circuit.fir

or run through fat jar

sbt assembly
./utils/bin/elk -i ~/projects/output/circuit.fir

This will create a number of files in the test_run_dir/${circuit.main} directory that representing the firrtl circuit. Each file will be a elk graph for each module contained in the firrtl file.

Creating graph from Chisel code

  val targetDir = "test_run_dir/gcd"
  (new ElkStage).execute(
    Array("--target-dir", targetDir),
    Seq(ChiselGeneratorAnnotation(() => new GCD))
  )

Options

  • -i, set the source firrtl to work on
  • -td,--target-dir work directory (default: '.')
  • --module-name the module in the hierarchy to start, default is the circuit top
  • --flatten the maxDepth of the flatten levels

TODO

  • rendering the graph directly and navigate the subgraph by double-clicking