CIRCT

Circuit IR Compilers and Tools

'om' Dialect

The Object Model dialect captures design intent from various domains in an object model.

For more information about the Object Model dialect, see the Object Model Dialect Rationale.

Operations

om.any_cast (::circt::om::AnyCastOp)

Cast any value to any type.

Syntax:

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

Casts any value to AnyType. This is useful for situations where a value of AnyType is needed, but a value of some concrete type is known.

In the evaluator, this is a noop, and the value of concrete type is used.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputany type

Results:

ResultDescription
resultA type that represents any valid OM type.

om.basepath_create (::circt::om::BasePathCreateOp)

Produce a base path value

Syntax:

operation ::= `om.basepath_create` $basePath $target attr-dict

Produces a value which represents a fragment of a hierarchical path to a target. Given a base path, extend it with the name of a module instance, to produce a new base path. The instance is identified via an NLA. Once the final verilog name of the instance is known, this op can be converted into a FrozenBasePathOp.

Example:

hw.module @Foo() -> () {
  hw.inst "bar" sym @bar @Bar() -> ()
}
hw.hierpath @Path [@Foo::@bar]
om.class @OM(%basepath: !om.basepath) {
  %0 = om.basepath_create %base @Path
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
target::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:

OperandDescription
basePathA fragment of a path to a hardware component

Results:

ResultDescription
resultA fragment of a path to a hardware component

om.class (::circt::om::ClassOp)

Traits: NoTerminator, SingleBlock

Interfaces: ClassLike, OpAsmOpInterface, RegionKindInterface, Symbol

Attributes:

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
formalParamNames::mlir::ArrayAttrstring array attribute

om.class.extern (::circt::om::ClassExternOp)

Traits: NoTerminator, SingleBlock

Interfaces: ClassLike, OpAsmOpInterface, RegionKindInterface, Symbol

Attributes:

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
formalParamNames::mlir::ArrayAttrstring array attribute

om.class.extern.field (::circt::om::ClassExternFieldOp)

Syntax:

operation ::= `om.class.extern.field` $name attr-dict `:` $type

Traits: HasParent<ClassExternOp>

Interfaces: ClassFieldLike

Attributes:

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute
type::mlir::TypeAttrany type attribute

om.class.field (::circt::om::ClassFieldOp)

Syntax:

operation ::= `om.class.field` $name `,` $value  attr-dict `:` type($value)

Traits: HasParent<ClassOp>

Interfaces: ClassFieldLike

Attributes:

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute

Operands:

OperandDescription
valueany type

om.constant (::circt::om::ConstantOp)

Syntax:

operation ::= `om.constant` $value attr-dict

Traits: AlwaysSpeculatableImplTrait, ConstantLike

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
value::mlir::TypedAttrTypedAttr instance

Results:

ResultDescription
resultany type

om.frozenbasepath_create (::circt::om::FrozenBasePathCreateOp)

Produce a frozen base path value

Syntax:

operation ::= `om.frozenbasepath_create` $basePath custom<BasePathString>($path) attr-dict

Produces a value which represents a fragment of a hierarchical path to a target.

Example:

om.class @OM(%basepath: !om.basepath)
  %0 = om.frozenbasepath_create %basepath "Foo/bar:Bar/baz"
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
path::circt::om::PathAttrAn attribute that represents an instance path

Operands:

OperandDescription
basePathA frozen fragment of a path to a hardware component

Results:

ResultDescription
resultA frozen fragment of a path to a hardware component

om.frozenpath_create (::circt::om::FrozenPathCreateOp)

Produce a frozen path value

Syntax:

operation ::= `om.frozenpath_create` $targetKind $basePath custom<PathString>($path, $module, $ref, $field)
              attr-dict

Produces a value which represents a hierarchical path to a hardware component from a base path to a target.

Example:

om.class @OM(%basepath: !om.basepath)
  %0 = om.frozenpath_create reference %base "Foo/bar:Bar>w.a"
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
targetKind::circt::om::TargetKindAttrobject model target kind
path::circt::om::PathAttrAn attribute that represents an instance path
module::mlir::StringAttrstring attribute
ref::mlir::StringAttrstring attribute
field::mlir::StringAttrstring attribute

Operands:

OperandDescription
basePathA frozen fragment of a path to a hardware component

Results:

ResultDescription
resultA frozen path to a hardware component

om.frozenpath_empty (::circt::om::FrozenEmptyPathOp)

Produce a frozen path value to nothing

Syntax:

operation ::= `om.frozenpath_empty` attr-dict

Produces a value which represents a hierarchical path to nothing.

Example:

om.class @OM()
  %0 = om.frozenpath_empty
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Results:

ResultDescription
resultA frozen path to a hardware component

om.integer.add (::circt::om::IntegerAddOp)

Add two OMIntegerType values

Syntax:

operation ::= `om.integer.add` $lhs `,` $rhs attr-dict `:` type($result)

Perform arbitrary precision signed integer addition of two OMIntegerType values.

Example:

%2 = om.integer.add %0, %1 : !om.integer

Traits: AlwaysSpeculatableImplTrait, Commutative

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, IntegerBinaryArithmeticOp, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
lhsA type that represents an arbitrary width integer.
rhsA type that represents an arbitrary width integer.

Results:

ResultDescription
resultA type that represents an arbitrary width integer.

om.integer.mul (::circt::om::IntegerMulOp)

Multiply two OMIntegerType values

Syntax:

operation ::= `om.integer.mul` $lhs `,` $rhs attr-dict `:` type($result)

Perform arbitrary prevision signed integer multiplication of two OMIntegerType values.

Example:

%2 = om.integer.mul %0, %1 : !om.integer

Traits: AlwaysSpeculatableImplTrait, Commutative

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, IntegerBinaryArithmeticOp, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
lhsA type that represents an arbitrary width integer.
rhsA type that represents an arbitrary width integer.

Results:

ResultDescription
resultA type that represents an arbitrary width integer.

om.integer.shr (::circt::om::IntegerShrOp)

Shift an OMIntegerType value right by an OMIntegerType value

Syntax:

operation ::= `om.integer.shr` $lhs `,` $rhs attr-dict `:` type($result)

Perform arbitrary precision signed integer arithmetic shift right of the lhs OMIntegerType value by the rhs OMIntegerType value. The rhs value must be non-negative.

Example:

%2 = om.integer.shr %0, %1 : !om.integer

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, IntegerBinaryArithmeticOp, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
lhsA type that represents an arbitrary width integer.
rhsA type that represents an arbitrary width integer.

Results:

ResultDescription
resultA type that represents an arbitrary width integer.

om.list_create (::circt::om::ListCreateOp)

Create a list of values

Creates a list from a sequence of inputs.

%list = om.list_create %a, %b, %c : !om.ref

Traits: AlwaysSpeculatableImplTrait, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
resultA type that represents a list.

om.map_create (::circt::om::MapCreateOp)

Create a map

Creates a map from a sequence of inputs.

%map = om.map_create %e1, %e2 : !om.string, i8

where %e1 and e2 have !om.tuple<!om.string, i8> and %map has !om.map<!om.string, i8> type.

Traits: AlwaysSpeculatableImplTrait, SameTypeOperands

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputsvariadic of a pair whose first element is an attribute

Results:

ResultDescription
resultA type that represents a map. A key type must be either
an integer or string type

om.object (::circt::om::ObjectOp)

Syntax:

operation ::= `om.object` $className `(` $actualParams `)`  attr-dict `:`
              functional-type($actualParams, $result)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
className::mlir::StringAttrstring attribute

Operands:

OperandDescription
actualParamsvariadic of any type

Results:

ResultDescription
resultA type that represents a reference to a Class.

om.object.field (::circt::om::ObjectFieldOp)

Syntax:

operation ::= `om.object.field` $object `,` $fieldPath attr-dict `:` functional-type($object, $result)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
fieldPath::mlir::ArrayAttrflat symbol ref array attribute

Operands:

OperandDescription
objectA type that represents a reference to a Class.

Results:

ResultDescription
resultany type

om.path_create (::circt::om::PathCreateOp)

Produce a path value

Syntax:

operation ::= `om.path_create` $targetKind $basePath $target attr-dict

Produces a value which represents a hierarchical path to a hardware target. from a base path to a target.

Example:

hw.module @Foo() -> () {
  %wire = hw.wire sym @w: !i1
}
hw.hierpath @Path [@Foo::@w]
om.class @OM(%basepath: !om.basepath)
  %0 = om.path_create reference %basepath @Path
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface), SymbolUserOpInterface

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
targetKind::circt::om::TargetKindAttrobject model target kind
target::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:

OperandDescription
basePathA fragment of a path to a hardware component

Results:

ResultDescription
resultA path to a hardware component

om.path_empty (::circt::om::EmptyPathOp)

Produce a path value to nothing

Syntax:

operation ::= `om.path_empty` attr-dict

Produces a value which represents a hierarchical path to nothing.

Example:

om.class @OM()
  %0 = om.path_empty
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Results:

ResultDescription
resultA path to a hardware component

om.tuple_create (::circt::om::TupleCreateOp)

Create a tuple of values

Syntax:

operation ::= `om.tuple_create` $inputs attr-dict `:` type($inputs)

Create a tuple from a sequence of inputs.

%tuple = om.tuple_create %a, %b, %c : !om.ref, !om.string, !om.list<i32>

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
resulttuple with any combination of any type values

om.tuple_get (::circt::om::TupleGetOp)

Extract a value from a tuple

Syntax:

operation ::= `om.tuple_get` $input `[` $index `]` attr-dict `:` type($input)

Extract a value from a tuple.

%value = om.tuple_get %a[0] : tuple<!om.ref, !om.string, !om.list<i32>>

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

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

Operands:

OperandDescription
inputtuple with any combination of any type values

Results:

ResultDescription
resultany type

Attributes

MapAttr

An attribute that represents a string map

Syntax:

#om.map<
  mlir::Type,   # valueType
  mlir::DictionaryAttr   # elements
>

Parameters:

ParameterC++ typeDescription
valueTypemlir::Type
elementsmlir::DictionaryAttr

IntegerAttr

An attribute that represents an arbitrary integer

Syntax:

#om.integer<
  mlir::IntegerAttr   # value
>

Parameters:

ParameterC++ typeDescription
valuemlir::IntegerAttr

ListAttr

An attribute that represents a list

Syntax:

#om.list<
  mlir::Type,   # elementType
  mlir::ArrayAttr   # elements
>

Parameters:

ParameterC++ typeDescription
elementTypemlir::Type
elementsmlir::ArrayAttr

PathAttr

An attribute that represents an instance path

Parameters:

ParameterC++ typeDescription
path::llvm::ArrayRef<::circt::om::PathElement>

SymbolRefAttr

An attribute that wraps a FlatSymbolRefAttr type

Syntax:

#om.sym_ref<
  mlir::FlatSymbolRefAttr   # ref
>

Parameters:

ParameterC++ typeDescription
refmlir::FlatSymbolRefAttr

ReferenceAttr

An attribute that wraps a #hw.innerNameRef with !om.ref type

Syntax:

#om.ref<
  circt::hw::InnerRefAttr   # innerRef
>

Parameters:

ParameterC++ typeDescription
innerRefcirct::hw::InnerRefAttr

Types

BasePathType

A fragment of a path to a hardware component

Syntax: !om.basepath

ClassType

A type that represents a reference to a Class.

Syntax:

!om.class.type<
  mlir::FlatSymbolRefAttr   # className
>

Parameters:

ParameterC++ typeDescription
classNamemlir::FlatSymbolRefAttr

FrozenBasePathType

A frozen fragment of a path to a hardware component

Syntax: !om.frozenbasepath

FrozenPathType

A frozen path to a hardware component

Syntax: !om.frozenpath

ListType

A type that represents a list.

Syntax:

!om.list<
  mlir::Type   # elementType
>

Parameters:

ParameterC++ typeDescription
elementTypemlir::Type

MapType

A type that represents a map. A key type must be either an integer or string type

Syntax:

!om.map<
  mlir::Type,   # keyType
  mlir::Type   # valueType
>

Parameters:

ParameterC++ typeDescription
keyTypemlir::Type
valueTypemlir::Type

AnyType

A type that represents any valid OM type.

Syntax: !om.any

OMIntegerType

A type that represents an arbitrary width integer.

Syntax: !om.integer

PathType

A path to a hardware component

Syntax: !om.path

ReferenceType

A type that represents a reference to a hardware entity.

Syntax: !om.ref

StringType

A type that represents a string.

Syntax: !om.string

SymbolRefType

A type that represents a reference to a flat symbol reference.

Syntax: !om.sym_ref

'om' Dialect Docs