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

[ImportVerilog] Support for Procedural assign statements #8010

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/Conversion/ImportVerilog/Statements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,21 @@ struct StmtVisitor {
return false;
}

/// Handle procedural assign statements.
LogicalResult visit(const slang::ast::ProceduralAssignStatement &stmt) {
if (stmt.isForce) {
auto loc = context.convertLocation(stmt.sourceRange);
mlir::emitError(loc, "force assignments not supported.");
return mlir::failure();
}

auto value = context.convertRvalueExpression(stmt.assignment);
if (!value)
return mlir::failure();

return mlir::success();
}

/// Create the optional diagnostic message print for finish-like ops.
void createFinishMessage(const slang::ast::Expression *verbosityExpr) {
unsigned verbosity = 1;
Expand Down
4 changes: 4 additions & 0 deletions test/Conversion/ImportVerilog/basic.sv
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@ module Statements;
// CHECK: [[TMP1:%.+]] = moore.read %y
// CHECK: moore.nonblocking_assign %x, [[TMP1]] : i1
x <= y;

// CHECK: [[TMP1:%.+]] = moore.read %y
// CHECK: moore.blocking_assign %x, [[TMP1]] : i1
assign x = y;
Comment on lines +598 to +601
Copy link
Member

Choose a reason for hiding this comment

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

Based on SystemVerilog IEEE Std 1800-2017 § 10.6 "Procedural continuous assignments", the assign x = y; should be treated as a continuous assignment.
image

Therefore, I think maybe we should translate this into moore.assign, rather than moore.blocking_assign. WDYH 🤔? @fabianschuiki

end
endmodule

Expand Down
Loading