CIRCT

Circuit IR Compilers and Tools

'aig' Dialect

Representation of AIGs

Operations

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

AIG dialect AND operation

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

Example:

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

Traditionally, an And-Node in AIG has two operands. However, 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

aig.cut (::circt::aig::CutOp)

AIG dialect Cut operation

Syntax:

operation ::= `aig.cut` $inputs attr-dict `:` functional-type($inputs, $results) $bodyRegion

The aig.cut operation represents a cut in the And-Inverter-Graph. This operation is variadic and can take multiple inputs and outputs, which corresponds to the input and output edges in AIG conceptually.

%0, %1 = aig.cut %a, %b, %c, %d : (i1, i1, i1, i1) -> (i1, i1) {
^bb0(%arg0: i1, %arg1: i1, %arg2: i1, %arg3: i1):
  %0 = aig.and_inv not %arg0, %arg1 : i1
  %1 = aig.and_inv %arg1, %arg3 : i1
  aig.output %0, %1 : i1 }

This operation is designed to be particularly useful for progressive LUT mapping. For instance, a k-input cut can be readily mapped to a k-input LUT. Consequently, the subsequent stages of the pipeline can concentrate on replacing combinational logic with k-input Cut operations, simplifying the overall process.

Traits: IsolatedFromAbove, SingleBlock

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
resultsvariadic of any type

aig.output (::circt::aig::OutputOp)

AIG dialect Output operation

Syntax:

operation ::= `aig.output` attr-dict ($outputs^ `:` qualified(type($outputs)))?

The aig.output operation represents out edges of a cut.

Traits: HasParent<CutOp>, ReturnLike, Terminator

Interfaces: RegionBranchTerminatorOpInterface

Operands:

OperandDescription
outputsvariadic of any type

'aig' Dialect Docs