'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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
lowBit | ::mlir::IntegerAttr | 32-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
input | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
predicate | circt::comb::ICmpPredicateAttr | hw.icmp comparison predicate |
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | 1-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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
cond | 1-bit signless integer |
trueValue | any type |
falseValue | any type |
Results:
| Result | Description |
|---|---|
result | any 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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
input | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | 1-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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
| Operand | Description |
|---|---|
input | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a signless integer bitvector |
comb.reverse (::circt::comb::ReverseOp)
Reverses the bit order of an integer value
Syntax:
operation ::= `comb.reverse` $input attr-dict `:` type($input)
Reverses the bit ordering of a value. The LSB becomes the MSB and vice versa.
Example:
%out = comb.reverse %in : i4
If %in is 4’b1101, then %out is 4’b1011.
Traits: AlwaysSpeculatableImplTrait, SameOperandsAndResultType
Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
| Operand | Description |
|---|---|
input | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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, InferIntRangeInterface, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
lhs | a signless integer bitvector |
rhs | a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a 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:
| Attribute | MLIR Type | Description |
|---|---|---|
lookupTable | ::mlir::ArrayAttr | 1-bit boolean array attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of 1-bit signless integer |
Results:
| Result | Description |
|---|---|
result | 1-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, InferIntRangeInterface, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
twoState | ::mlir::UnitAttr | unit attribute |
Operands:
| Operand | Description |
|---|---|
inputs | variadic of a signless integer bitvector |
Results:
| Result | Description |
|---|---|
result | a signless integer bitvector |
Enums
ICmpPredicate
Hw.icmp comparison predicate
Cases:
| Symbol | Value | String |
|---|---|---|
| eq | 0 | eq |
| ne | 1 | ne |
| slt | 2 | slt |
| sle | 3 | sle |
| sgt | 4 | sgt |
| sge | 5 | sge |
| ult | 6 | ult |
| ule | 7 | ule |
| ugt | 8 | ugt |
| uge | 9 | uge |
| ceq | 10 | ceq |
| cne | 11 | cne |
| weq | 12 | weq |
| wne | 13 | wne |