-
Notifications
You must be signed in to change notification settings - Fork 324
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 the BLIF dialect. #8019
base: main
Are you sure you want to change the base?
Add the BLIF dialect. #8019
Conversation
The BLIF dialect implements the extended berkely logic interchange format. This is a format used by some OSS tools, such as some place-and-route tools. This is the format used by yosys to interchange with nextpnr.
Will join with #8018 to push an fpga-mapped design to nextpnr. |
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.
Haven't gone through every single line of code in detail, but having both import and export support for BLIF and a BLIF ingress/egress dialect is a really cool thing for CIRCT! 🥳
include "mlir/IR/EnumAttr.td" | ||
include "mlir/IR/RegionKindInterface.td" | ||
|
||
def ModelOp : BLIFOp<"model", [IsolatedFromAbove, RegionKindInterface, SingleBlockImplicitTerminator<"OutputOp">]> { |
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.
Nit: overly long line
OpBuilder<(ins "StringRef":$name, | ||
"ArrayRef<StringRef>":$inputs, | ||
"ArrayRef<StringRef>":$outputs, | ||
"ArrayRef<StringRef>":$clocks)> |
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.
Omega-nit: "
alignment
namespace circt { | ||
namespace blif { | ||
|
||
/// This represents a specific token for .fir files. |
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.
Should it be ".blif" files?
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.
Thank you so much for implementing the BLIF parser. It's great to see the CIRCT project can handle .blif
files, and your implementation is a good example of how to implement a lexer and parser. I'm currently implementing a liberty parser based on your BLIF parser, and I want you to know that I found some incorrect descriptions in your comments.
|
||
class BLIFLexerCursor; | ||
|
||
/// This implements a lexer for .fir files. |
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.
And .fir
-> .blif
here.
// NOLINTBEGIN(misc-no-recursion) | ||
namespace { | ||
|
||
/// An emitter for FIRRTL dialect operations to .fir output. |
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.
Nit: FIRRTL and .fir
|
||
class BLIFLexerCursor; | ||
|
||
/// This implements a lexer for .fir files. |
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.
And here.
bool encounteredError = false; | ||
|
||
/// The names used to emit values already encountered. Anything that gets a | ||
/// name in the output FIR is listed here, such that future expressions can |
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.
FIR
TOK_LITERAL(cover) // 0--1- | ||
TOK_LITERAL(bit) // 0 || 1 | ||
|
||
// Keywords. These turn "foo" into FIRToken::kw_foo enums. |
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.
nit: Update comment or remove this line.
The BLIF dialect implements the extended berkely logic interchange format. This is a format used by some OSS tools, such as some place-and-route tools. This is the format used by yosys to interchange with nextpnr.