CIRCT

Circuit IR Compilers and Tools

'synth' Dialect

Synthesis dialect for logic synthesis operations

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.

Operations

synth.aig.and_inv (::circt::synth::aig::AndInverterOp)

AIG dialect AND operation

Syntax:

operation ::= `synth.aig.and_inv` custom<VariadicInvertibleOperands>($inputs, type($result), $inverted, attr-dict)

The synth.aig.and_inv operation represents an And-Inverter in the AIG dialect. Unlike comb.and, operands can be inverted respectively.

Example:

  %r1 = synth.aig.and_inv %a, %b: i3
  %r2 = synth.aig.and_inv not %a, %b, not %c : i3
  %r3 = synth.aig.and_inv not %a : i3

Traditionally, an And-Node in AIG has two operands. However, synth.aig.and_inv extends this concept by allowing variadic operands and non-i1 integer types. Although the final stage of the synthesis pipeline requires lowering everything to i1-binary operands, it’s more efficient to progressively lower the variadic multibit operations.

Variadic operands have demonstrated their utility in low-level optimizations within the comb dialect. Furthermore, in synthesis, it’s common practice to re-balance the logic path. Variadic operands enable the compiler to select more efficient solutions without the need to traverse binary trees multiple times.

The ability to represent multibit operations during synthesis is crucial for scalability. This approach enables a form of vectorization, allowing for batch processing of logic synthesis when multibit operations are constructed in a similar manner.

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
inverted::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
resultany type

synth.mig.maj_inv (::circt::synth::mig::MajorityInverterOp)

Majority-Inverter operation

Syntax:

operation ::= `synth.mig.maj_inv` custom<VariadicInvertibleOperands>($inputs, type($result), $inverted,
              attr-dict)

The synth.mig.maj_inv operation represents a Majority-Inverter in the Synth dialect. This is used to represent majority inverter graph in synthesis. This operation computes the majority function of its inputs, where operands can be inverted respectively.

The majority function returns 1 when more than half of the inputs are 1, and 0 otherwise. For three inputs, it’s equivalent to: (a & b) | (a & c) | (b & c).

Example:

  %r1 = synth.mig.maj_inv %a, %b, %c : i1
  %r2 = synth.mig.maj_inv not %a, %b, not %c : i1
  %r3 = synth.mig.maj_inv %a, %b, %c, %d, %e : i3

The number of inputs must be odd to avoid ties.

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
inverted::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
resultany type

'synth' Dialect Docs