Skip to content

Commit 9172a2d

Browse files
committed
[HandshakeToDC] Allow pass to run in mixed dialect module
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.
1 parent 2b76cf8 commit 9172a2d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/Conversion/HandshakeToDC/HandshakeToDC.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,11 @@ LogicalResult circt::handshaketodc::runHandshakeToDC(
819819
// same type as the newly inserted operations). To do this, we mark all
820820
// operations which have been converted as legal, and all other operations
821821
// as illegal.
822-
target.markUnknownOpDynamicallyLegal(
823-
[&](Operation *op) { return convertedOps.contains(op); });
822+
target.markUnknownOpDynamicallyLegal([&](Operation *op) {
823+
return convertedOps.contains(op) ||
824+
// Allow any ops which weren't in a `handshake.func` to pass through.
825+
!convertedOps.contains(op->getParentOfType<hw::HWModuleOp>());
826+
});
824827

825828
DCTypeConverter typeConverter;
826829
RewritePatternSet patterns(ctx);

test/Conversion/HandshakeToDC/basic.mlir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,6 @@ hw.module @esi_outer(in %clk: !seq.clock, in %rst: i1, in %arg0: !esi.channel<i3
261261
%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>)
262262
hw.output %ret0 : !esi.channel<i32>
263263
}
264+
265+
// CHECK: sv.verbatim "// Blah"
266+
sv.verbatim "// Blah"

0 commit comments

Comments
 (0)