Skip to content

Transform Writing Manual

Adam Izraelevitz edited this page Sep 16, 2016 · 6 revisions

Introduction

Before writing a transform, please be sure to go through, in detail, the following pages (or else nothing will make sense!):

While writing a transform, the following pages will likely save you a lot of pain and confusion:

So you want to write a transform....

... where do you start? Well, hopefully you familiarized yourself with the IR, the compiler, and the basic structure of other passes and transforms.

Secondly, pick an IR form as your input: Chirrtl, High Firrtl, Middle Firrtl, and Low Firrtl. This will tell you where to insert your transform into the compiler.

Thirdly, decide whether you can get by with the minimal IR datastructure, want to reuse the working-IR datastructure, or need to invent your own. If you aren't sure, start with the minimal IR datastructure and go from there.

Fourthly, is this Transform something useful for many other Firrtl users? If so, you may want to submit a pull request with your transform, and can work directly in a clone/fork of this repository. If this is something very specialized, then you need to use this repository as a library, and construct your own Driver and Compiler that includes your transform (see next section)

Now you are ready to start writing! Good luck ;)

Creating your own Driver