Skip to content

Commit

Permalink
[hlstool] Add option to use the DC lowering flow (#7819)
Browse files Browse the repository at this point in the history
Adds a `--dc` flag to use HandshakeToDC (and the DC lowering flow)
instead of HandshakeToHW.
  • Loading branch information
teqdruid authored Nov 15, 2024
1 parent 2fd0b29 commit 395dec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/hlstool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ llvm_update_compile_flags(hlstool)
target_link_libraries(hlstool
PRIVATE

CIRCTDC
CIRCTDCTransforms
CIRCTDCToHW
CIRCTESI
CIRCTExportChiselInterface
CIRCTExportVerilog
CIRCTHandshake
CIRCTHandshakeToDC
CIRCTHandshakeToHW
CIRCTHandshakeTransforms
CIRCTHW
Expand Down
13 changes: 12 additions & 1 deletion tools/hlstool/hlstool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "circt/Conversion/SCFToCalyx.h"
#include "circt/Dialect/Calyx/CalyxDialect.h"
#include "circt/Dialect/Calyx/CalyxPasses.h"
#include "circt/Dialect/DC/DCPasses.h"
#include "circt/Dialect/ESI/ESIDialect.h"
#include "circt/Dialect/ESI/ESIPasses.h"
#include "circt/Dialect/SV/SVDialect.h"
Expand Down Expand Up @@ -218,6 +219,9 @@ static cl::opt<bool> withESI("with-esi",
cl::desc("Create ESI compatible modules"),
cl::init(false), cl::cat(mainCategory));

static cl::opt<bool> withDC("dc", cl::desc("Use the DC flow"), cl::init(false),
cl::cat(mainCategory));

static LoweringOptionsOption loweringOptions(mainCategory);

// --------------------------------------------------------------------------
Expand Down Expand Up @@ -332,7 +336,14 @@ static LogicalResult doHLSFlowDynamic(

addIRLevel(IRLevel::RTL, [&]() {
pm.nest<handshake::FuncOp>().addPass(createSimpleCanonicalizerPass());
pm.addPass(circt::createHandshakeToHWPass());
if (withDC) {
pm.addPass(circt::createHandshakeToDCPass());
pm.addPass(circt::dc::createDCMaterializeForksSinksPass());
pm.addPass(createSimpleCanonicalizerPass());
pm.addPass(circt::createDCToHWPass());
} else {
pm.addPass(circt::createHandshakeToHWPass());
}
pm.addPass(createSimpleCanonicalizerPass());
loadESILoweringPipeline(pm);
});
Expand Down

0 comments on commit 395dec6

Please sign in to comment.