CIRCT

Circuit IR Compilers and Tools

'comb' Dialect

Types and operations for comb dialect This dialect defines the comb dialect, which is intended to be a generic representation of combinational logic outside of a particular use-case.

Operations

comb.add (::circt::comb::AddOp)

Syntax:

operation ::= `comb.add` (`bin` $twoState^)? $inputs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.and (::circt::comb::AndOp)

Syntax:

operation ::= `comb.and` (`bin` $twoState^)? $inputs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.concat (::circt::comb::ConcatOp)

Concatenate a variadic list of operands together.

Syntax:

operation ::= `comb.concat` $inputs attr-dict `:` qualified(type($inputs))

See the comb rationale document for details on operand ordering.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.divs (::circt::comb::DivSOp)

Syntax:

operation ::= `comb.divs` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.divu (::circt::comb::DivUOp)

Syntax:

operation ::= `comb.divu` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.extract (::circt::comb::ExtractOp)

Extract a range of bits into a smaller value, lowBit specifies the lowest bit included.

Syntax:

operation ::= `comb.extract` $input `from` $lowBit attr-dict `:` functional-type($input, $result)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
lowBit::mlir::IntegerAttr32-bit signless integer attribute

Operands:

OperandDescription
inputa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.icmp (::circt::comb::ICmpOp)

Compare two integer values

Syntax:

operation ::= `comb.icmp` (`bin` $twoState^)? $predicate $lhs `,` $rhs attr-dict `:` qualified(type($lhs))

This operation compares two integers using a predicate. If the predicate is true, returns 1, otherwise returns 0. This operation always returns a one bit wide result.

    %r = comb.icmp eq %a, %b : i4

Traits: AlwaysSpeculatableImplTrait, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
predicatecirct::comb::ICmpPredicateAttrhw.icmp comparison predicate
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
result1-bit signless integer

comb.mods (::circt::comb::ModSOp)

Syntax:

operation ::= `comb.mods` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.modu (::circt::comb::ModUOp)

Syntax:

operation ::= `comb.modu` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.mul (::circt::comb::MulOp)

Syntax:

operation ::= `comb.mul` (`bin` $twoState^)? $inputs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.mux (::circt::comb::MuxOp)

Return one or the other operand depending on a selector bit

Syntax:

operation ::= `comb.mux` (`bin` $twoState^)? $cond `,` $trueValue `,` $falseValue  attr-dict `:` qualified(type($result))
  %0 = mux %pred, %tvalue, %fvalue : i4

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
cond1-bit signless integer
trueValueany type
falseValueany type

Results:

ResultDescription
resultany type

comb.or (::circt::comb::OrOp)

Syntax:

operation ::= `comb.or` (`bin` $twoState^)? $inputs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.parity (::circt::comb::ParityOp)

Syntax:

operation ::= `comb.parity` (`bin` $twoState^)? $input attr-dict `:` qualified(type($input))

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputa signless integer bitvector

Results:

ResultDescription
result1-bit signless integer

comb.replicate (::circt::comb::ReplicateOp)

Concatenate the operand a constant number of times

Syntax:

operation ::= `comb.replicate` $input attr-dict `:` functional-type($input, $result)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.shl (::circt::comb::ShlOp)

Syntax:

operation ::= `comb.shl` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.shrs (::circt::comb::ShrSOp)

Syntax:

operation ::= `comb.shrs` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.shru (::circt::comb::ShrUOp)

Syntax:

operation ::= `comb.shru` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.sub (::circt::comb::SubOp)

Syntax:

operation ::= `comb.sub` (`bin` $twoState^)? $lhs `,` $rhs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
lhsa signless integer bitvector
rhsa signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

comb.truth_table (::circt::comb::TruthTableOp)

Return a true/false based on a lookup table

Syntax:

operation ::= `comb.truth_table` $inputs `->` $lookupTable attr-dict
  %a = ... : i1
  %b = ... : i1
  %0 = comb.truth_table %a, %b -> [false, true, true, false]

This operation assumes a fully elaborated table – 2^n entries. Inputs are sorted MSB -> LSB from left to right and the offset into lookupTable is computed from them. The table is sorted from 0 -> (2^n - 1) from left to right.

No difference from array_get into an array of constants except for xprop behavior. If one of the inputs is unknown, but said input doesn’t make a difference in the output (based on the lookup table) the result should not be ‘x’ – it should be the well-known result.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
lookupTable::mlir::ArrayAttr1-bit boolean array attribute

Operands:

OperandDescription
inputsvariadic of 1-bit signless integer

Results:

ResultDescription
result1-bit signless integer

comb.xor (::circt::comb::XorOp)

Syntax:

operation ::= `comb.xor` (`bin` $twoState^)? $inputs attr-dict `:` qualified(type($result))

Traits: AlwaysSpeculatableImplTrait, Commutative, SameOperandsAndResultType, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
twoState::mlir::UnitAttrunit attribute

Operands:

OperandDescription
inputsvariadic of a signless integer bitvector

Results:

ResultDescription
resulta signless integer bitvector

Enums

ICmpPredicate

hw.icmp comparison predicate

Cases:

SymbolValueString
eq0eq
ne1ne
slt2slt
sle3sle
sgt4sgt
sge5sge
ult6ult
ule7ule
ugt8ugt
uge9uge
ceq10ceq
cne11cne
weq12weq
wne13wne

'comb' Dialect Docs