Skip to content

Commit

Permalink
[HandshakeToDC] Allow pass to run in mixed dialect module
Browse files Browse the repository at this point in the history
HandshakeToDC was trying to convert everything instead of just
`handshake.func`s and operations inside of them. Limit the conversion to
just things related to handshake.
  • Loading branch information
teqdruid committed Nov 21, 2024
1 parent 2b76cf8 commit 9172a2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Conversion/HandshakeToDC/HandshakeToDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,11 @@ LogicalResult circt::handshaketodc::runHandshakeToDC(
// same type as the newly inserted operations). To do this, we mark all
// operations which have been converted as legal, and all other operations
// as illegal.
target.markUnknownOpDynamicallyLegal(
[&](Operation *op) { return convertedOps.contains(op); });
target.markUnknownOpDynamicallyLegal([&](Operation *op) {
return convertedOps.contains(op) ||
// Allow any ops which weren't in a `handshake.func` to pass through.
!convertedOps.contains(op->getParentOfType<hw::HWModuleOp>());
});

DCTypeConverter typeConverter;
RewritePatternSet patterns(ctx);
Expand Down
3 changes: 3 additions & 0 deletions test/Conversion/HandshakeToDC/basic.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,6 @@ hw.module @esi_outer(in %clk: !seq.clock, in %rst: i1, in %arg0: !esi.channel<i3
%ret0, %ret1 = handshake.esi_instance @pack_unpack "pack_unpack_inst" clk %clk rst %rst (%arg0, %arg1) : (!esi.channel<i32>, !esi.channel<i1>) -> (!esi.channel<i32>, !esi.channel<i1>)
hw.output %ret0 : !esi.channel<i32>
}

// CHECK: sv.verbatim "// Blah"
sv.verbatim "// Blah"

0 comments on commit 9172a2d

Please sign in to comment.