Skip to content
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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Add the BLIF dialect. #8019

wants to merge 15 commits into from

Conversation

darthscsi
Copy link
Contributor

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.

Andrew Lenharth added 2 commits December 29, 2024 00:53
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.
@darthscsi
Copy link
Contributor Author

Will join with #8018 to push an fpga-mapped design to nextpnr.

@darthscsi darthscsi marked this pull request as ready for review January 3, 2025 21:54
@darthscsi darthscsi mentioned this pull request Jan 5, 2025
Copy link
Contributor

@fabianschuiki fabianschuiki left a 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">]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: overly long line

Comment on lines 34 to 37
OpBuilder<(ins "StringRef":$name,
"ArrayRef<StringRef>":$inputs,
"ArrayRef<StringRef>":$outputs,
"ArrayRef<StringRef>":$clocks)>
Copy link
Contributor

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.
Copy link
Contributor

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?

Copy link
Contributor

@Max-astro Max-astro left a 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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants