CIRCT

Circuit IR Compilers and Tools

'dc' Dialect

Dynamic Control This is the dc dialect, used to represent dynamic control constructs with handshaking semantics.

Operations

dc.branch (circt::dc::BranchOp)

Branch operation

Syntax:

operation ::= `dc.branch` $condition attr-dict

The incoming select token is propagated to the selected output based on the value of the condition.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
conditionmust be a !dc.value type

Results:

ResultDescription
trueToken
falseToken

dc.buffer (circt::dc::BufferOp)

Buffer operation

Syntax:

operation ::= `dc.buffer` `[` $size `]` $input ($initValues^)? attr-dict `:` type($input)

The buffer operation may buffer a dc.value or dc.token typed SSA value. In practice, this provides a mechanism to buffer data-side values in a control-sensitive manner.

Example:

%value_out = dc.buffer [2] %value : !dc.value<i32, i1, i4>

Hardware/CIRCT context note: buffers have no dialect-side notion of cycles/stages/implementation. It is up to the generating pass to interpret buffer semantics - some may want to add attributes to a single buffer, some may want to stagger dc.buffers sequentially.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
size::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 1
initValues::mlir::ArrayAttrarray attribute

Operands:

OperandDescription
inputmust be a !dc.value or !dc.token type

Results:

ResultDescription
outputmust be a !dc.value or !dc.token type

dc.fork (circt::dc::ForkOp)

Splits the incoming token into multiple outgoing tokens

This operator splits the incoming token into multiple outgoing tokens.

Example:

%0, %1 = dc.fork [2] %a : !dc.token, !dc.token

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
token

Results:

ResultDescription
outputsvariadic of

dc.from_esi (circt::dc::FromESIOp)

Convert an ESI-typed value to a DC-typed value

Syntax:

operation ::= `dc.from_esi` $input attr-dict `:` type($input)

Convert an ESI channel to a dc.token/dc.value.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputan ESI channel

Results:

ResultDescription
outputmust be a !dc.value or !dc.token type

dc.join (circt::dc::JoinOp)

Synchronizes the incoming tokens with the outgoing token

Syntax:

operation ::= `dc.join` $tokens attr-dict

This operator synchronizes all incoming tokens. Synchronization implies applying join semantics in between all in- and output ports.

Example:

%0 = dc.join %a, %b

Traits: AlwaysSpeculatableImplTrait, Commutative

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
tokensvariadic of

Results:

ResultDescription
output

dc.merge (circt::dc::MergeOp)

Merge operation

Syntax:

operation ::= `dc.merge` $first `,` $second attr-dict

Select one of the incoming tokens and emits an output stating which token was selected. If multiple tokens are ready to transact at the same time, the tokens are selected with priority, from first to last (i.e. left to right in the IR). This property ensures deterministic behavior.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
first
second

Results:

ResultDescription
outputmust be a !dc.value type

dc.pack (circt::dc::PackOp)

Pack operation

Syntax:

operation ::= `dc.pack` $token `,` $input attr-dict `:` type($input)

An operation which packs together a !dc.token value with some other value.

Typically, a dc.pack op will be used to facilitate data-dependent control flow, wherein a dc.value<i1> is to be generated as a select signal for either a dc.branch or dc.select operation.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
token
inputany type

Results:

ResultDescription
output

dc.select (circt::dc::SelectOp)

Select operation

Syntax:

operation ::= `dc.select` $condition `,` $trueToken `,` $falseToken attr-dict

An input token is selected based on the value of the incoming select signal, and propagated to the single output. Only the condition value, the selected input, and the output will be transacted.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
conditionmust be a !dc.value type
trueToken
falseToken

Results:

ResultDescription
output

dc.sink (circt::dc::SinkOp)

Sink operation

Syntax:

operation ::= `dc.sink` $token attr-dict

The sink operation will always accept any incoming tokens, and discard them.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
token

dc.source (circt::dc::SourceOp)

Source operation

Syntax:

operation ::= `dc.source` attr-dict

The source operation will always produce a token.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Results:

ResultDescription
output

dc.to_esi (circt::dc::ToESIOp)

Convert a DC-typed value to an ESI-typed value

Syntax:

operation ::= `dc.to_esi` $input attr-dict `:` type($input)

Convert a dc.token/dc.value to an ESI channel.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputmust be a !dc.value or !dc.token type

Results:

ResultDescription
outputan ESI channel

dc.unpack (circt::dc::UnpackOp)

Unpack operation

Syntax:

operation ::= `dc.unpack` $input attr-dict `:` qualified(type($input))

An operation which unpacks a !dc.value value into a !dc.token value and its constituent values.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
input

Results:

ResultDescription
token
outputany type

Types

TokenType

Syntax: !dc.token

A !dc.token-typed value represents a control value with handshake semantics.

ValueType

Syntax:

!dc.value<
  Type   # innerType
>

A !dc.value-typed value represents a value which is wrapped with !dc.token semantics. This type is used to attach control semantics to values. The inner value may be of any type.

Parameters:

ParameterC++ typeDescription
innerTypeType

'dc' Dialect Docs