Skip to content

Commit 395dec6

Browse files
authored
[hlstool] Add option to use the DC lowering flow (#7819)
Adds a `--dc` flag to use HandshakeToDC (and the DC lowering flow) instead of HandshakeToHW.
1 parent 2fd0b29 commit 395dec6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tools/hlstool/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ llvm_update_compile_flags(hlstool)
99
target_link_libraries(hlstool
1010
PRIVATE
1111

12+
CIRCTDC
13+
CIRCTDCTransforms
14+
CIRCTDCToHW
1215
CIRCTESI
1316
CIRCTExportChiselInterface
1417
CIRCTExportVerilog
1518
CIRCTHandshake
19+
CIRCTHandshakeToDC
1620
CIRCTHandshakeToHW
1721
CIRCTHandshakeTransforms
1822
CIRCTHW

tools/hlstool/hlstool.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "circt/Conversion/SCFToCalyx.h"
4747
#include "circt/Dialect/Calyx/CalyxDialect.h"
4848
#include "circt/Dialect/Calyx/CalyxPasses.h"
49+
#include "circt/Dialect/DC/DCPasses.h"
4950
#include "circt/Dialect/ESI/ESIDialect.h"
5051
#include "circt/Dialect/ESI/ESIPasses.h"
5152
#include "circt/Dialect/SV/SVDialect.h"
@@ -218,6 +219,9 @@ static cl::opt<bool> withESI("with-esi",
218219
cl::desc("Create ESI compatible modules"),
219220
cl::init(false), cl::cat(mainCategory));
220221

222+
static cl::opt<bool> withDC("dc", cl::desc("Use the DC flow"), cl::init(false),
223+
cl::cat(mainCategory));
224+
221225
static LoweringOptionsOption loweringOptions(mainCategory);
222226

223227
// --------------------------------------------------------------------------
@@ -332,7 +336,14 @@ static LogicalResult doHLSFlowDynamic(
332336

333337
addIRLevel(IRLevel::RTL, [&]() {
334338
pm.nest<handshake::FuncOp>().addPass(createSimpleCanonicalizerPass());
335-
pm.addPass(circt::createHandshakeToHWPass());
339+
if (withDC) {
340+
pm.addPass(circt::createHandshakeToDCPass());
341+
pm.addPass(circt::dc::createDCMaterializeForksSinksPass());
342+
pm.addPass(createSimpleCanonicalizerPass());
343+
pm.addPass(circt::createDCToHWPass());
344+
} else {
345+
pm.addPass(circt::createHandshakeToHWPass());
346+
}
336347
pm.addPass(createSimpleCanonicalizerPass());
337348
loadESILoweringPipeline(pm);
338349
});

0 commit comments

Comments
 (0)