New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add firrtl tutorial #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Overall, things look good to me and I don't have a problem with merging it. I made some small comments and cleaned up some typos.
Some higher level thoughts:
- It would be good to connect this to Chisel more, even without having annotations. Something where you run a test on a transformed design would be good.
- It might be good to mention your vim syntax highlighting for firrtl
- I think we should talk a bit about reading serialized firrtl. Do we ever talk about source locators? GEN* and how they come to be?
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This is the internal datastructure that holds the FIRRTL AST. It is a tree structure whose root node is **Circuit**, which has 3 children: **@[file.fir@2.0]**, **ArrayBuffer**, and **cmd5WrapperHelperDelayBy2**. The following is the definition of `Circuit`'s actual Scala class that was serialized:<a name=\"circuit\"></a><img src=\"images/circuit.png\" alt=\"Circuit case class\" />\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be done in a markdown code block.
"collapsed": true | ||
}, | ||
"source": [ | ||
"# FIRRTL Node Descriptions\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also use colors for these headings?
" }\n", | ||
"```\n", | ||
"\n", | ||
"While the traversal ordering is different between these two examples, it makes no difference for this use case (and many others). However, it is an important tool to keep in your back pocket for when the traversal ordering matters." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever do in-order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never had a need for it.
4.3_firrtl_common_idioms.ipynb
Outdated
"We first need to traverse the AST to every Statement and Expression. Then, when we see a DoPrim, we need to add a new DefNode to the module's body and insert a reference to that DefNode in place of the DoPrim. The code below implements this (and preserves the Info token). Note that `Namespace` is a utility function located in (Namespace.scala)[https://github.com/ucb-bar/firrtl/blob/master/src/main/scala/firrtl/Namespace.scala].\n", | ||
"\n", | ||
"```scala\n", | ||
"object Splitter extends Pass {\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want these to be in code blocks?
Goes through the AST, how to traverse it, common pass idioms, and a simple Transform. Also bumps the version of Chisel and company.