CIRCT

Circuit IR Compilers and Tools

'chirrtl' Dialect

Types and operations for the chirrtl dialect This dialect defines the chirrtl dialect, which contains high-level memory defintions which can be lowered to FIRRTL.

Type constraint definition 

a behavioral memory port 

Syntax:

cmemoryport-type ::= `cmemoryport`

The value of a cmemoryport type represents a port which has been declared on a cmemory. This value is used to set the memory port access conditions.

a behavioral memory 

Syntax:

cmemory-type ::= `cmemory` `<` element-type, element-count `>`

The value of a cmemory type represents a behavioral memory with unknown ports. This is produced by combmem and seqmem declarations and used by memoryport declarations to define memories and their ports. A CMemory is similar to a vector of passive element types.

Examples:

!chirrtl.cmemory<uint<32>, 16>
!chirrtl.cmemory<bundle<a : uint<1>>, 16>

Operation definition 

chirrtl.combmem (::circt::chirrtl::CombMemOp) 

Define a new combinational memory

Syntax:

operation ::= `chirrtl.combmem` (`sym` $inner_sym^)? custom<CombMemOp>(attr-dict) `:` qualified(type($result))

Define a new behavioral combinational memory. Combinational memories have a write latency of 1 and a read latency of 0.

Interfaces: HasCustomSSAName

Attributes: 

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute
annotations::mlir::ArrayAttrall elements must be DictionaryAttr or SubAnnotationAttr
inner_sym::mlir::StringAttrstring attribute

Results: 

ResultDescription
resulta behavioral memory

chirrtl.memoryport.access (::circt::chirrtl::MemoryPortAccessOp) 

Enables a memory port

Syntax:

operation ::= `chirrtl.memoryport.access` $port `[` $index `]` `,` $clock attr-dict `:` qualified(type(operands))

This operation is used to conditionally enable a memory port, and associate it with a clock and index. The memory port will be actuve on the positive edge of the clock. The index is the address of the memory accessed. See the FIRRTL rational for more information about why this operation exists.

Operands: 

OperandDescription
porta behavioral memory port
indexsint or uint type
clockclock

chirrtl.memoryport (::circt::chirrtl::MemoryPortOp) 

Defines a memory port on CHIRRTL memory

Syntax:

operation ::= `chirrtl.memoryport` $direction $memory custom<MemoryPortOp>(attr-dict) `:`
              functional-type(operands, results)

This operation defines a new memory port on a seqmem or combmemCHISEL. data is the data returned from the memory port.

The memory port requires an access point, which sets the enable condition of the port, the clock, and the address. This is done by passing the the port argument to a chirrtl.memoryport.access operation.

Interfaces: HasCustomSSAName, InferTypeOpInterface

Attributes: 

AttributeMLIR TypeDescription
direction::MemDirAttrAttrMemory Direction Enum
name::mlir::StringAttrstring attribute
annotations::mlir::ArrayAttrall elements must be DictionaryAttr or SubAnnotationAttr

Operands: 

OperandDescription
memorya behavioral memory

Results: 

ResultDescription
dataFIRRTLType
porta behavioral memory port

chirrtl.seqmem (::circt::chirrtl::SeqMemOp) 

Define a new sequential memory

Syntax:

operation ::= `chirrtl.seqmem` (`sym` $inner_sym^)? $ruw custom<SeqMemOp>(attr-dict) `:` qualified(type($result))

Define a new behavioral sequential memory. Sequential memories have a write latency and a read latency of 1.

Interfaces: HasCustomSSAName

Attributes: 

AttributeMLIR TypeDescription
ruw::RUWAttrAttrRead Under Write Enum
name::mlir::StringAttrstring attribute
annotations::mlir::ArrayAttrall elements must be DictionaryAttr or SubAnnotationAttr
inner_sym::mlir::StringAttrstring attribute

Results: 

ResultDescription
resulta behavioral memory

Type definition 

CMemoryPortType 

a behavioral memory port

Syntax: !chirrtl.cmemoryport

Syntax:

cmemoryport-type ::= `cmemoryport`

The value of a cmemoryport type represents a port which has been declared on a cmemory. This value is used to set the memory port access conditions.

CMemoryType 

a behavioral memory

Syntax:

cmemory-type ::= `cmemory` `<` element-type, element-count `>`

The value of a cmemory type represents a behavioral memory with unknown ports. This is produced by combmem and seqmem declarations and used by memoryport declarations to define memories and their ports. A CMemory is similar to a vector of passive element types.

Examples:

!chirrtl.cmemory<uint<32>, 16>
!chirrtl.cmemory<bundle<a : uint<1>>, 16>

Parameters: 

ParameterC++ typeDescription
elementTypefirrtl::FIRRTLType
numElementsuint64_t