-
Notifications
You must be signed in to change notification settings - Fork 643
Add Serializer for ChiselIR #4748
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
Conversation
de34960 to
104f96f
Compare
|
I think this is good to go to get the ball rolling. I think the TODO items should be done in separate PRs. |
5300633 to
86fcf32
Compare
86fcf32 to
7c7e78f
Compare
seldridge
left a comment
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.
Superficial review given the mechanical nature of this.
Thank you for doing this tedious work.
What is the path now to deprecate the emission flows that we don't want to support?
|
|
||
| case class ULit(n: BigInt, w: Width) extends LitArg(n, w) { | ||
| def name: String = "UInt" + width + "(0h0" + num.toString(16) + ")" | ||
| def name: String = "UInt" + width + "(0h" + num.toString(16) + ")" |
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 the kind of thing that could cause a bug. However, this looks fine. This should also cause simulations to fail if it was a problem (hopefully).
This is 💯 cleaner output, though.
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.
Yeah I could back this out--this change will be needed once I updated Properties to stop using FIRRTL IR and the converter, but it seems I backed out the rest of that change but not this. I do think we should still do this because it makes it consistent with what the serializer is doing (and ultimately we can call this from the serializer). I'll check for issues though of course.
| import chisel3.reflect.DataMirror | ||
| import chisel3.simulator.scalatest.ChiselSim | ||
| import chisel3.simulator.stimulus.RunUntilFinished | ||
| import chisel3.testing.scalatest.FileCheck |
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.
🐐
Deprecate the The other piece is to just make sure nothing about the Converter nor firrtl.ir.Serializer are load bearing. There's a couple of small pieces that are (types in Properties as I've mentioned). |
|
I tested this on a large set of designs and found no Verilog diff except like a dozen literal assignments reordered (out of millions of lines of Verilog). Obviously identical by inspection. Note that the emitted FIRRTL will differ slightly, primarily in these 3 ways:
|
Future work TODO:
Contributor Checklist
docs/src?Type of Improvement
Desired Merge Strategy
Release Notes
This reduces peak memory use when serializing to
.fir. It heavily depends on the design, but for designs with a single very large module, we have measured 20-25% reductions in peak memory use. For most cases, the reduction will likely be more modest.Reviewer Checklist (only modified by reviewer)
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)?Enable auto-merge (squash)and clean up the commit message.Create a merge commit.