CIRCT

Circuit IR Compilers and Tools

'kanagawa' Dialect

Types and operations for Kanagawa dialect

The kanagawa dialect is intended to support porting and eventual open sourcing of an internal hardware development language.

Operations

kanagawa.call (::circt::kanagawa::CallOp)

Kanagawa method call

Syntax:

operation ::= `kanagawa.call` $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)

Dispatch a call to an Kanagawa method.

Interfaces: CallOpInterface, InnerRefUserOpInterface

Attributes:

AttributeMLIR TypeDescription
callee::circt::hw::InnerRefAttrRefer to a name inside a module

Operands:

OperandDescription
operandsvariadic of any type

Results:

ResultDescription
«unnamed»variadic of any type

kanagawa.class (::circt::kanagawa::ClassOp)

Kanagawa class

Syntax:

operation ::= `kanagawa.class` ($name^)? `sym` $inner_sym attr-dict-with-keyword $body

Kanagawa has the notion of a class which can contain methods and member variables.

In the low-level Kanagawa representation, the ClassOp becomes a container for kanagawa.ports, kanagawa.containers, and contain logic for member variables.

Traits: HasParent<DesignOp>, IsolatedFromAbove, NoTerminator, SingleBlock

Interfaces: InnerSymbol, InstanceGraphModuleOpInterface, NamedInnerSymbol, RegionKindInterface, ScopeOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
name::mlir::StringAttrstring attribute

kanagawa.container (::circt::kanagawa::ContainerOp)

Kanagawa container

Syntax:

operation ::= `kanagawa.container` ($name^)? `sym` $inner_sym (`top_level` $isTopLevel^)? attr-dict-with-keyword $body

An kanagawa container describes a collection of logic nested within an Kanagawa class.

Traits: HasParent<DesignOp, ClassOp>, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock

Interfaces: InnerSymbol, InstanceGraphModuleOpInterface, NamedInnerSymbolInterface, NamedInnerSymbol, RegionKindInterface, ScopeOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
isTopLevel::mlir::UnitAttrunit attribute
name::mlir::StringAttrstring attribute

kanagawa.container.instance (::circt::kanagawa::ContainerInstanceOp)

Kanagawa container instance

Syntax:

operation ::= `kanagawa.container.instance` $inner_sym `,` $targetName attr-dict
              custom<ScopeRefFromName>(type($scopeRef), ref($targetName))

Instantiates an Kanagawa container.

Interfaces: HasCustomSSAName, InnerRefUserOpInterface, InnerSymbolOpInterface, InstanceGraphInstanceOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
targetName::circt::hw::InnerRefAttrRefer to a name inside a module

Results:

ResultDescription
scopeRef

kanagawa.design (::circt::kanagawa::DesignOp)

All Kanagawa containers must be inside this op

Syntax:

operation ::= `kanagawa.design` $sym_name attr-dict-with-keyword $body

Traits: InnerSymbolTable, IsolatedFromAbove, NoRegionArguments, NoTerminator, SingleBlock

Interfaces: Symbol

Attributes:

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute

kanagawa.get_port (::circt::kanagawa::GetPortOp)

Kanagawa get port

Syntax:

operation ::= `kanagawa.get_port` $instance `,` $portSymbol `:` qualified(type($instance)) `->`
              qualified(type($port)) attr-dict

Given an Kanagawa class reference, returns a port of said class. The port is specified by the symbol name of the port in the referenced class.

Importantly, the user must specify how they intend to use the op, by specifying the direction of the portref type that this op is generated with. If the request port is to be read from, the type must be !kanagawa.portref<out T> and if the port is to be written to, the type must be !kanagawa.portref<in T>. This is to ensure that the usage is reflected in the get_port type which in turn is used by the tunneling passes to create the proper ports through the hierarchy.

This implies that the portref direction of the get_port op is independent of the actual direction of the target port, and only the inner portref type must match.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, HasCustomSSAName, InnerRefUserOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

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

Operands:

OperandDescription
instance

Results:

ResultDescription
port

kanagawa.get_var (::circt::kanagawa::GetVarOp)

Dereferences an kanagawa member variable through a scoperef

Syntax:

operation ::= `kanagawa.get_var` $instance `,` $varName attr-dict `:` qualified(type($instance)) `->` qualified(type($var))

Interfaces: HasCustomSSAName, InnerRefUserOpInterface

Attributes:

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

Operands:

OperandDescription
instance

Results:

ResultDescription
varmemref of any type values

kanagawa.instance (::circt::kanagawa::InstanceOp)

Kanagawa class instance

Syntax:

operation ::= `kanagawa.instance` $inner_sym `,` $targetName attr-dict
              custom<ScopeRefFromName>(type($scopeRef), ref($targetName))

Instantiates an Kanagawa class.

Interfaces: HasCustomSSAName, InnerRefUserOpInterface, InnerSymbolOpInterface, InstanceGraphInstanceOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
targetName::circt::hw::InnerRefAttrRefer to a name inside a module

Results:

ResultDescription
scopeRef

kanagawa.method (::circt::kanagawa::MethodOp)

Kanagawa method

Kanagawa methods are a lot like software functions: a list of named arguments and unnamed return values with imperative control flow.

Traits: AutomaticAllocationScope, HasParent<ClassOp>, IsolatedFromAbove

Interfaces: InnerSymbolOpInterface, MethodLikeOpInterface, OpAsmOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
function_type::mlir::TypeAttrtype attribute of function type
argNames::mlir::ArrayAttrarray attribute
arg_attrs::mlir::ArrayAttrArray of dictionary attributes
res_attrs::mlir::ArrayAttrArray of dictionary attributes

kanagawa.method.df (::circt::kanagawa::DataflowMethodOp)

Kanagawa dataflow method

Kanagawa dataflow methods share the same interface as an kanagawa.method but without imperative CFG-based control flow. Instead, this method implements a graph region, and control flow is expected to be defined by dataflow operations.

Traits: HasParent<ClassOp>, IsolatedFromAbove, SingleBlockImplicitTerminator<kanagawa::ReturnOp>, SingleBlock

Interfaces: FineGrainedDataflowRegionOpInterface, InnerSymbolOpInterface, MethodLikeOpInterface, RegionKindInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
function_type::mlir::TypeAttrtype attribute of function type
argNames::mlir::ArrayAttrarray attribute
arg_attrs::mlir::ArrayAttrArray of dictionary attributes
res_attrs::mlir::ArrayAttrArray of dictionary attributes

kanagawa.path (::circt::kanagawa::PathOp)

Kanagawa path

Syntax:

operation ::= `kanagawa.path` $path attr-dict

The kanagawa.path operation describes an instance hierarchy path relative to the current scope. The path is specified by a list of either parent or child identifiers (navigating up or down the hierarchy, respectively).

Scopes along the path are optionally typed, however, An kanagawa.path must lways terminate in a fully typed specifier, i.e. never an !kanagawa.scoperef<>.

The operation returns a single !kanagawa.scoperef-typed value representing the scope at the end of the path.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, HasCustomSSAName, InferTypeOpInterface, InnerRefUserOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
path::mlir::ArrayAttrPath step array attribute

Results:

ResultDescription
instance

kanagawa.pipeline.header (::circt::kanagawa::PipelineHeaderOp)

Kanagawa pipeline header operation

Syntax:

operation ::= `kanagawa.pipeline.header` attr-dict

This operation defines the hardware-like values used to drive a pipeline, such as clock and reset. This is an intermediate operation, meaning that it’s strictly used to facilitate progressive lowering of kanagawa static blocks to scheduled pipelines.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Results:

ResultDescription
clockA type for clock-carrying wires
reset1-bit signless integer
go1-bit signless integer
stall1-bit signless integer

kanagawa.port.input (::circt::kanagawa::InputPortOp)

Kanagawa input port

Syntax:

operation ::= `kanagawa.port.input` ($name^)? `sym` $inner_sym `:` $type attr-dict

An kanagawa port has an attached ’name’ attribute. This is a name-hint used to generate the final port name. The port name and port symbol are not related, and all references to a port is done through the port symbol.

Traits: HasParent<ClassOp, ContainerOp>

Interfaces: HasCustomSSAName, InferTypeOpInterface, InnerSymbol, NamedInnerSymbol, PortOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
type::mlir::TypeAttrtype attribute of any type
name::mlir::StringAttrstring attribute

Results:

ResultDescription
port

kanagawa.port.output (::circt::kanagawa::OutputPortOp)

Kanagawa output port

Syntax:

operation ::= `kanagawa.port.output` ($name^)? `sym` $inner_sym `:` $type attr-dict

An kanagawa port has an attached ’name’ attribute. This is a name-hint used to generate the final port name. The port name and port symbol are not related, and all references to a port is done through the port symbol.

Traits: HasParent<ClassOp, ContainerOp>

Interfaces: HasCustomSSAName, InferTypeOpInterface, InnerSymbol, NamedInnerSymbol, PortOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
type::mlir::TypeAttrtype attribute of any type
name::mlir::StringAttrstring attribute

Results:

ResultDescription
port

kanagawa.port.read (::circt::kanagawa::PortReadOp)

Kanagawa port read

Syntax:

operation ::= `kanagawa.port.read` $port attr-dict `:` qualified(type($port))

Read the value of a port reference.

Traits: AlwaysSpeculatableImplTrait

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

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
port

Results:

ResultDescription
outputany type

kanagawa.port.write (::circt::kanagawa::PortWriteOp)

Kanagawa port write

Syntax:

operation ::= `kanagawa.port.write` $port `,` $value attr-dict `:` qualified(type($port))

Write a value to a port reference.

Operands:

OperandDescription
port
valueany type

kanagawa.return (::circt::kanagawa::ReturnOp)

Kanagawa method terminator

Syntax:

operation ::= `kanagawa.return` ($retValues^)? attr-dict (`:` type($retValues)^)?

Traits: AlwaysSpeculatableImplTrait, HasParent<MethodOp, DataflowMethodOp>, ReturnLike, Terminator

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), RegionBranchTerminatorOpInterface

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
retValuesvariadic of any type

kanagawa.sblock (::circt::kanagawa::StaticBlockOp)

Kanagawa block

The kanagawa.sblock operation defines a block wherein a group of operations are expected to be statically scheduleable. The operation is not isolated from above to facilitate ease of construction. However, once a program has been constructed and lowered to a sufficient level, the user may run --kanagawa-argify-blocks to effectively isolate the block from above, by converting SSA values referenced through dominanes into arguments of the block

The block may contain additional attributes to specify constraints on the block further down the compilation pipeline.

Traits: AutomaticAllocationScope, SingleBlockImplicitTerminator<BlockReturnOp>, SingleBlock

Interfaces: BlockOpInterface

Attributes:

AttributeMLIR TypeDescription
maxThreads::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 1

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
outputsvariadic of any type

kanagawa.sblock.dc (::circt::kanagawa::DCBlockOp)

DC-interfaced Kanagawa block

The kanagawa.sblock.dc operation is like an kanagawa.sblock operation with a few differences, being:

  1. The operation is DC-interfaced, meaning that all arguments and results are dc-value typed.
  2. The operation is IsolatedFromAbove.

Traits: AutomaticAllocationScope, IsolatedFromAbove, SingleBlockImplicitTerminator<BlockReturnOp>, SingleBlock

Interfaces: BlockOpInterface

Attributes:

AttributeMLIR TypeDescription
maxThreads::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 1

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
outputsvariadic of any type

kanagawa.sblock.inline.begin (::circt::kanagawa::InlineStaticBlockBeginOp)

Kanagawa inline static block begin marker

Syntax:

operation ::= `kanagawa.sblock.inline.begin` attr-dict

The kanagawa.sblock.inline.begin operation is a marker that indicates the begin of an inline static block. The operation is used to maintain kanagawa.sblocks while in the Kanagawa inline phase (to facilitate e.g. mem2reg).

The operation:

  1. denotes the begin of the sblock
  2. carries whatever attributes that the source kanagawa.sblock carried.
  3. is considered side-effectfull.

Traits: HasParent<MethodOp>

kanagawa.sblock.inline.end (::circt::kanagawa::InlineStaticBlockEndOp)

Kanagawa inline static block end marker

Syntax:

operation ::= `kanagawa.sblock.inline.end` attr-dict

The kanagawa.sblock.inline.end operation is a marker that indicates the end of an inline static block. The operation is used to maintain kanagawa.sblocks while in the Kanagawa inline phase (to facilitate e.g. mem2reg).

Traits: HasParent<MethodOp>

kanagawa.sblock.isolated (::circt::kanagawa::IsolatedStaticBlockOp)

Kanagawa isolated block

The kanagawa.sblock.isolated operation is like an kanagawa.sblock operation but with an IsolatedFromAbove condition, meaning that all arguments and results are passed through the block as arguments and results.

Traits: AutomaticAllocationScope, IsolatedFromAbove, SingleBlockImplicitTerminator<BlockReturnOp>, SingleBlock

Interfaces: BlockOpInterface

Attributes:

AttributeMLIR TypeDescription
maxThreads::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 1

Operands:

OperandDescription
inputsvariadic of any type

Results:

ResultDescription
outputsvariadic of any type

kanagawa.sblock.return (::circt::kanagawa::BlockReturnOp)

Kanagawa static block terminator

Syntax:

operation ::= `kanagawa.sblock.return` ($retValues^)? attr-dict (`:` type($retValues)^)?

Traits: AlwaysSpeculatableImplTrait, HasParent<StaticBlockOp, IsolatedStaticBlockOp, DCBlockOp>, ReturnLike, Terminator

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), RegionBranchTerminatorOpInterface

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
retValuesvariadic of any type

kanagawa.this (::circt::kanagawa::ThisOp)

Return a handle to the current scope !kanagawa.scoperef

Syntax:

operation ::= `kanagawa.this` $scopeName attr-dict custom<ScopeRefFromName>(type($thisRef), ref($scopeName))

Interfaces: HasCustomSSAName, InnerRefUserOpInterface

Attributes:

AttributeMLIR TypeDescription
scopeName::circt::hw::InnerRefAttrRefer to a name inside a module

Results:

ResultDescription
thisRef

kanagawa.var (::circt::kanagawa::VarOp)

Kanagawa variable definition

Syntax:

operation ::= `kanagawa.var` $inner_sym `:` $type attr-dict

Defines an Kanagawa class member variable. The variable is typed with a memref.memref type, and may define either a singleton or uni-dimensional array of values. kanagawa.var defines a symbol within the encompassing class scope which can be dereferenced through a !kanagawa.scoperef value of the parent class.

Interfaces: InnerSymbolOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
type::mlir::TypeAttrany memref type

kanagawa.wire.input (::circt::kanagawa::InputWireOp)

Kanagawa input wire

Syntax:

operation ::= `kanagawa.wire.input` $inner_sym `:` qualified(type($output)) attr-dict

An input wire defines an kanagawa.portref<in T> port alongside a value of type T which represents the value to-be-written to the wire.

Traits: HasParent<ClassOp, ContainerOp>

Interfaces: HasCustomSSAName, InnerSymbolOpInterface, InnerSymbol, NamedInnerSymbol, PortOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
name::mlir::StringAttrstring attribute

Results:

ResultDescription
port
outputany type

kanagawa.wire.output (::circt::kanagawa::OutputWireOp)

Kanagawa output wire

Syntax:

operation ::= `kanagawa.wire.output` $inner_sym `,` $input `:` qualified(type($input)) attr-dict

An output wire defines an kanagawa.portref<out T> port that can be read. The operation takes an input value of type T which represents the value on the output portref.

Traits: HasParent<ClassOp, ContainerOp>

Interfaces: HasCustomSSAName, InferTypeOpInterface, InnerSymbolOpInterface, InnerSymbol, NamedInnerSymbol, PortOpInterface

Attributes:

AttributeMLIR TypeDescription
inner_sym::circt::hw::InnerSymAttrInner symbol definition
name::mlir::StringAttrstring attribute

Operands:

OperandDescription
inputany type

Results:

ResultDescription
port

Attributes

PathStepAttr

Syntax:

#kanagawa.step<
  PathDirection,   # direction
  ::mlir::Type,   # type
  mlir::FlatSymbolRefAttr   # child
>

Used to describe a single step in a path

Parameters:

ParameterC++ typeDescription
directionPathDirection
type::mlir::Type
childmlir::FlatSymbolRefAttr

Types

PortRefType

Syntax:

!kanagawa.portref<
  TypeAttr,   # portTypeAttr
  kanagawa::Direction   # direction
>

A reference to an Kanagawa port.

Parameters:

ParameterC++ typeDescription
portTypeAttrTypeAttr
directionkanagawa::Direction

ScopeRefType

A reference to an Kanagawa scope. May be either a reference to a specific scope (given a $scopeName argument) or an opaque reference.

Parameters:

ParameterC++ typeDescription
scopeRef::circt::hw::InnerRefAttr

Enums

Direction

Kanagawa port direction

Cases:

SymbolValueString
Input0in
Output1out

PathDirection

path direction

Cases:

SymbolValueString
Parent0parent
Child1child

'kanagawa' Dialect Docs