Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
298f74a
Added description of Synth dialect from the circt project
Carmine50 Jan 8, 2026
e35babb
Added synth in the compilation structure of dynamatic
Carmine50 Jan 8, 2026
81f3cb7
Added conversion pass from Handshake to Synth
Carmine50 Jan 8, 2026
660b564
Improved comments and restructured code for removing cast operations
Carmine50 Jan 8, 2026
57cf458
Restructured code to create a cast operation to connect bundled type …
Carmine50 Jan 8, 2026
cb0720f
Restructured creation of cast for operation results
Carmine50 Jan 8, 2026
3af418a
Re-structured code to instantiate synth operations in hw module repre…
Carmine50 Jan 8, 2026
fcf9dc9
Improved comments
Carmine50 Jan 8, 2026
01b535b
Improved comments and cleaned up unused section of code
Carmine50 Jan 8, 2026
3fca47c
Added a new class to invert the ready signals of hw modules
Carmine50 Jan 13, 2026
f34bb17
Re-structured main pass function
Carmine50 Jan 13, 2026
08b11b3
Added next step in the pass
Carmine50 Jan 13, 2026
ab524d4
Added documentation for the conversion pass
Carmine50 Jan 13, 2026
7a6053d
Changed doc structure
Carmine50 Jan 13, 2026
95c55d5
Added doc for synth dialect
Carmine50 Jan 13, 2026
8236cf7
Added new docs to summary
Carmine50 Jan 13, 2026
3e3460f
Merge branch 'main' into feature/crizzi/handshake-to-aig-conversion-pass
Carmine50 Jan 13, 2026
4dc1fa5
Modified headers to mention circt in a consistent way with the rest o…
Carmine50 Jan 13, 2026
849925d
Added support for splitting data signals in multiple single bits
Carmine50 Jan 13, 2026
cbdefa0
Added small comments related to the new feature in the doc and in the…
Carmine50 Jan 13, 2026
35458f8
Changed naming convention for ready inverter to be more generically s…
Carmine50 Jan 13, 2026
16354b0
Changed naming convention for ready inverter to be more generically s…
Carmine50 Jan 13, 2026
a5e5412
Added support to add the same naming convention as the ports in hw
Carmine50 Jan 14, 2026
2cbb07e
Added new option to pass the directory containing blif files and hard…
Carmine50 Jan 14, 2026
44c6d4f
Added code to pass blif_path attribute across the different stages of…
Carmine50 Jan 14, 2026
f3918be
Added defintion for strings referring to blif path, clk and rst
Carmine50 Jan 16, 2026
9883dab
Added support to correctly generate the clk and rst signals and corre…
Carmine50 Jan 16, 2026
23bc1fa
Added last section of the documentation
Carmine50 Jan 16, 2026
fa4ce3f
Added important information relative to the marking of blif paths for…
Carmine50 Jan 16, 2026
c794572
Merge branch 'main' into feature/crizzi/handshake-to-aig-conversion-pass
Carmine50 Jan 16, 2026
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Synth dialect


The **Synth** dialect is a low-level synthesis-oriented dialect that provides a common in-MLIR interface for logic synthesis operations and data structures. It is intended as an intermediate representation between higher-level hardware IR (e.g., Handshake or HW) and concrete synthesis backends, capturing both logic networks (such as AIGs and MIGs) and meta-operations that steer synthesis decisions.

In Dynamatic, the Synth dialect is the target of the [Handshake-to-Synth lowering pass](ConversionHandshakeToSynth.md): each Handshake operation is wrapped in a `synth.subckt` (or similar Synth operation) inside an `hw.module`, and later passes are free to refine these subcircuits into more detailed networks and optimization steps.

---

## Design and role in the flow

The Synth dialect has three core responsibilities:

- Provide **operations and types for logic synthesis**, i.e., operations that manipulate logic-level representations and synthesis state.
- Include **meta operations** that encode synthesis decisions (e.g., which implementation, which optimization pass, or which strategy to apply on a given subcircuit).
- Support **logic network representations** such as AIG (And-Inverter Graph) and MIG (Majority-Inverter Graph), as well as the infrastructure to represent synthesis pipelines in MLIR.

In other words, the Synth dialect is not tied to a particular hardware backend or HDL; instead, it serves as an abstraction layer where logic-level manipulations can be expressed, analyzed, and transformed before being committed to a specific RTL or gate-level format.

---

## Operations and types (conceptual overview)

This dialect focuses on three aspects:

- **Logic representations:**
- AIG-style networks, where logic is modeled as AND gates and inverters.
- MIG-style networks, where logic is modeled as majority nodes with optional inversion on edges.
- **Meta operations for synthesis decisions:**
- Operations that encode choices such as:
- Which implementation variant to use for a given functionality.
- Which optimization passes or strategies have been applied or should be applied.
- How to annotate subcircuits for later backend-specific handling.
- **Synthesis pipeline infrastructure:**
- Operations that describe, parameterize, or orchestrate sequences of synthesis steps.
- Potential hooks for external tools or generators that operate on Synth-level IR.

The Synth dialect is therefore designed as a *synthesis workbench* inside MLIR: it is where logic-level structures and decisions live, separate from higher-level behavioral IR and lower-level RTL or gate-level netlists.

---

## Relationship with Handshake and HW

In the Dynamatic flow, the Synth dialect is tightly coupled to Handshake and HW through the [Handshake-to-Synth lowering pass](ConversionHandshakeToSynth.md):

- Handshake operations are first converted to `hw.module`/`hw.instance` structures with flat ports.
- Each module’s behavior is described by synth operations inside the HW module, making Synth describe the logic function of each operation.
- Later passes can:
- Refine `synth.subckt` into more detailed Synth operations (e.g., explicit AIG/MIG nodes).
- Apply logic optimization and technology mapping in terms of Synth operations, with HW only providing the module/instance hierarchy and IO ports.

This separation of concerns allows Dynamatic to keep Handshake-level reasoning, module hierarchy (HW dialect), and synthesis-specific logic (Synth dialect) cleanly partitioned, while still enabling tight interaction through well-defined IR boundaries.


3 changes: 3 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
- [Commit Unit Placement Algorithm](DeveloperGuide/DynamaticFeaturesAndOptimizations/Speculation/CommitUnitPlacementAlgorithm.md)
- [Integration Tests](DeveloperGuide/DynamaticFeaturesAndOptimizations/Speculation/IntegrationTests.md)
- [Save Commit Behavior](DeveloperGuide/DynamaticFeaturesAndOptimizations/Speculation/SaveCommitBehavior.md)
- [Synth]()
- [Synth Dialect](DeveloperGuide/DynamaticFeaturesAndOptimizations/Synth.md)
- [Conversion Pass from Handshake to Synth Dialect](DeveloperGuide/DynamaticFeaturesAndOptimizations/ConversionHandshakeToSynth.md)

- [Specs]()
- [Floating Point Units](DeveloperGuide/Specs/FloatingPointUnits.md)
Expand Down
54 changes: 54 additions & 0 deletions include/dynamatic/Conversion/HandshakeToSynth.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//===- HandshakeToSynth.h - Convert Handshake to Synth ----------------*- C++
//-*-===//
//
// Dynamatic is under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares the --lower-handshake-to-synth conversion pass.
//
//===----------------------------------------------------------------------===//

#ifndef DYNAMATIC_CONVERSION_HANDSHAKETOSYNTH_H
#define DYNAMATIC_CONVERSION_HANDSHAKETOSYNTH_H

#include "dynamatic/Support/DynamaticPass.h"

namespace dynamatic {

namespace synth {
/// Forward declare the Synth dialect which the pass depends on.
class SynthDialect;
} // namespace synth

namespace hw {
/// Forward declare the HW dialect which the pass depends on.
class HWDialect;
} // namespace hw

// Keywords for data and control signals when unbundling Handshake types using
// enums.
enum SignalKind {
DATA_SIGNAL = 0,
VALID_SIGNAL = 1,
READY_SIGNAL = 2,
};

// String of the blif path attribute
static const std::string blifPathAttrStr = "blif_path";

// Strings representing the name of the clock and reset signals
static const std::string clockSignal = "clk";
static const std::string resetSignal = "rst";

#define GEN_PASS_DECL_HANDSHAKETOSYNTH
#define GEN_PASS_DEF_HANDSHAKETOSYNTH
#include "dynamatic/Conversion/Passes.h.inc"

std::unique_ptr<dynamatic::DynamaticPass> createHandshakeToSynthPass();

} // namespace dynamatic

#endif // DYNAMATIC_CONVERSION_HANDSHAKETOSYNTH_H
1 change: 1 addition & 0 deletions include/dynamatic/Conversion/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "dynamatic/Conversion/AffineToScf.h"
#include "dynamatic/Conversion/CfToHandshake.h"
#include "dynamatic/Conversion/HandshakeToHW.h"
#include "dynamatic/Conversion/HandshakeToSynth.h"
#include "dynamatic/Conversion/ScfToCf.h"
#include "mlir/IR/DialectRegistry.h"
#include "mlir/Pass/Pass.h"
Expand Down
19 changes: 18 additions & 1 deletion include/dynamatic/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,22 @@ def HandshakeToHW
}];
let constructor = "dynamatic::createHandshakeToHWPass()";
}


//===----------------------------------------------------------------------===//
// HandshakeToSynth
//===----------------------------------------------------------------------===//

def HandshakeToSynth
: DynamaticPass<"lower-handshake-to-synth", ["dynamatic::synth::SynthDialect", "dynamatic::hw::HWDialect"]> {
let summary = "Lowers Handshake to Synth.";
let description = [{
Lowers Handshake IR into Synth IR, which is a hardware representation
that focuses on logic synthesis constructs.
}];
let constructor = "dynamatic::createHandshakeToSynthPass()";
let options =
[Option<"blifDirPath", "blif-dir-path", "std::string", "",
"Path to directory containing BLIF files for logic synthesis representations.">];
}

#endif // DYNAMATIC_CONVERSION_PASSES_TD
1 change: 1 addition & 0 deletions include/dynamatic/Dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(Handshake)
add_subdirectory(HW)
add_subdirectory(Synth)
11 changes: 11 additions & 0 deletions include/dynamatic/Dialect/Synth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
##===----------------------------------------------------------------------===//
##
## Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
## See https://llvm.org/LICENSE.txt for license information.
## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
##
##===----------------------------------------------------------------------===//

add_dynamatic_dialect(Synth synth)

set(LLVM_TARGET_DEFINITIONS Synth.td)
38 changes: 38 additions & 0 deletions include/dynamatic/Dialect/Synth/Synth.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file originates from the CIRCT project (https://github.com/llvm/circt).
// It includes modifications made as part of Dynamatic.
//
//===----------------------------------------------------------------------===//
//
// This is the top level file for the Synth dialect.
//
//===----------------------------------------------------------------------===//

#ifndef DYNAMATIC_SYNTH_DIALECT_TD
#define DYNAMATIC_SYNTH_DIALECT_TD

include "mlir/IR/DialectBase.td"

def Synth_Dialect : Dialect {
let name = "synth";
let cppNamespace = "::dynamatic::synth";
let summary = "Synthesis dialect for logic synthesis operations";
let description = [{
The Synth dialect provides operations and types for logic synthesis,
including meta operations for synthesis decisions, logic representations
like AIG and MIG, and synthesis pipeline infrastructure.
}];

let hasConstantMaterializer = 1;
}

include "dynamatic/Dialect/Synth/SynthOps.td"

#endif // DYNAMATIC_SYNTH_DIALECT_TD
25 changes: 25 additions & 0 deletions include/dynamatic/Dialect/Synth/SynthDialect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file originates from the CIRCT project (https://github.com/llvm/circt).
// It includes modifications made as part of Dynamatic.
//
//===----------------------------------------------------------------------===//
//
// This is the top level file for the Synth dialect.
//
//===----------------------------------------------------------------------===//
#ifndef DYNAMATIC_DIALECT_SYNTH_SYNTHDIALECT_H
#define DYNAMATIC_DIALECT_SYNTH_SYNTHDIALECT_H

#include "dynamatic/Support/LLVM.h"
#include "mlir/IR/Dialect.h"

#include "dynamatic/Dialect/Synth/SynthDialect.h.inc"

#endif // DYNAMATIC_DIALECT_SYNTH_SYNTHDIALECT_H
58 changes: 58 additions & 0 deletions include/dynamatic/Dialect/Synth/SynthOps.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file originates from the CIRCT project (https://github.com/llvm/circt).
// It includes modifications made as part of Dynamatic.
//
//===----------------------------------------------------------------------===//
//
// This is the top level file for the Synth dialect.
//
//===----------------------------------------------------------------------===//

#ifndef DYNAMATIC_DIALECT_SYNTH_SYNTHOPS_H
#define DYNAMATIC_DIALECT_SYNTH_SYNTHOPS_H

#include "dynamatic/Dialect/Synth/SynthDialect.h"
#include "dynamatic/Support/LLVM.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Rewrite/PatternApplicator.h"

#define GET_OP_CLASSES
#include "dynamatic/Dialect/Synth/Synth.h.inc"

namespace dynamatic {
namespace synth {
struct AndInverterVariadicOpConversion
: mlir::OpRewritePattern<aig::AndInverterOp> {
using OpRewritePattern<aig::AndInverterOp>::OpRewritePattern;
mlir::LogicalResult
matchAndRewrite(aig::AndInverterOp op,
mlir::PatternRewriter &rewriter) const override;
};

} // namespace synth
ParseResult parseVariadicInvertibleOperands(
OpAsmParser &parser,
SmallVectorImpl<OpAsmParser::UnresolvedOperand> &operands, Type &resultType,
mlir::DenseBoolArrayAttr &inverted, NamedAttrList &attrDict);
void printVariadicInvertibleOperands(OpAsmPrinter &printer, Operation *op,
OperandRange operands, Type resultType,
mlir::DenseBoolArrayAttr inverted,
DictionaryAttr attrDict);

} // namespace dynamatic

#endif // DYNAMATIC_DIALECT_SYNTH_SYNTHOPS_H
Loading
Loading