CIRCT

Circuit IR Compilers and Tools

'datapath' Dialect

Datapath Optimization

This dialect defines the datapath dialect, which is about the efficient construction of arithmetic circuits via low-level datapath optimizations.

Operations

datapath.compress (::circt::datapath::CompressOp)

Reduce a set of bitvectors to a carry-save representation

Syntax:

operation ::= `datapath.compress` $inputs attr-dict `:` custom<CompressFormat>(type($inputs), type($results))

Reduce an array of bitvectors to a smaller set of bitvectors (at least 2). A compressor tree sums multiple bitvectors (often partial products in multipliers or adders). Instead of adding all bitvectors sequentially, a compressor tree reduces the number of operands in parallel stages. The result is stored in a redundant (carry-save) representation, deferring the compressor tree implementation to a later stage.

Example:

%0:2 = datapath.compress %a, %b, %c : i16 [3 -> 2]

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resultsvariadic of a signless integer bitvector

datapath.partial_product (::circt::datapath::PartialProductOp)

Generate partial products from multiplying the operands

Syntax:

operation ::= `datapath.partial_product` $lhs `,` $rhs attr-dict `:` functional-type(operands, results)

The first step in a multiplication is to generate partial products, which when summed, yield the product of the two operands. The partial product operator does not specify an implementation, only that summing the results will yield the product of the two operands. The number of results corresponds to the rows of a partial product array, which by default is equal to the width of the inputs.

Verilog Example 4-bit multiplication:

partial_product[0][3:0] = {4{a[0]}} & b
...
partial_product[3][3:0] = {4{a[3]}} & b
ab[3:0] = partial_product[0] + ... + partial_product[3] // = a*b

Example using datapath dialect:

%0:4 = datapath.partial_product %a, %b : (i4, i4) -> (i4, i4, i4, i4)

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resultsvariadic of a signless integer bitvector

'datapath' Dialect Docs