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.

Operations 

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

Define a new combinational memory

Syntax:

operation ::= `chirrtl.combmem` (`sym` $inner_sym^)? `` custom<NameKind>($nameKind)
              `` 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: FNamableOp, HasCustomSSAName, InnerSymbolOpInterface

Attributes: 

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute
nameKind::circt::firrtl::NameKindEnumAttrname kind
annotations::mlir::ArrayAttrAnnotation array attribute
inner_sym::circt::hw::InnerSymAttrInner symbol definition
init::circt::firrtl::MemoryInitAttrInformation about the initial state of a memory
prefix::mlir::StringAttrstring attribute

Results: 

ResultDescription
resulta behavioral memory

chirrtl.debugport (::circt::chirrtl::MemoryDebugPortOp) 

Defines a debug memory port on CHIRRTL memory

Syntax:

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

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

Interfaces: HasCustomSSAName, InferTypeOpInterface

Attributes: 

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute
annotations::mlir::ArrayAttrAnnotation array attribute

Operands: 

OperandDescription
memorya behavioral memory

Results: 

ResultDescription
datareference type

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::circt::firrtl::MemDirAttrAttrMemory Direction Enum
name::mlir::StringAttrstring attribute
annotations::mlir::ArrayAttrAnnotation array attribute

Operands: 

OperandDescription
memorya behavioral memory

Results: 

ResultDescription
dataa base type
porta behavioral memory port

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.seqmem (::circt::chirrtl::SeqMemOp) 

Define a new sequential memory

Syntax:

operation ::= `chirrtl.seqmem` (`sym` $inner_sym^)? `` custom<NameKind>($nameKind) $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: FNamableOp, HasCustomSSAName, InnerSymbolOpInterface

Attributes: 

AttributeMLIR TypeDescription
ruw::circt::firrtl::RUWAttrAttrRead Under Write Enum
name::mlir::StringAttrstring attribute
nameKind::circt::firrtl::NameKindEnumAttrname kind
annotations::mlir::ArrayAttrAnnotation array attribute
inner_sym::circt::hw::InnerSymAttrInner symbol definition
init::circt::firrtl::MemoryInitAttrInformation about the initial state of a memory
prefix::mlir::StringAttrstring attribute

Results: 

ResultDescription
resulta behavioral memory

Types 

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::FIRRTLBaseType
numElementsuint64_t

Enums 

Convention 

lowering convention

Cases: 

SymbolValueString
Internal0internal
Scalarized1scalarized

EventControl 

edge control trigger

Cases: 

SymbolValueString
AtPosEdge0posedge
AtNegEdge1negedge
AtEdge2edge

LayerConvention 

layer convention

Cases: 

SymbolValueString
Bind0bind
Inline1inline

LayerSpecialization 

layer specialization

Cases: 

SymbolValueString
Enable0enable
Disable1disable

MemDirAttr 

Memory Direction Enum

Cases: 

SymbolValueString
Infer0Infer
Read1Read
Write2Write
ReadWrite3ReadWrite

NameKindEnum 

name kind

Cases: 

SymbolValueString
DroppableName0droppable_name
InterestingName1interesting_name

RUWAttr 

Read Under Write Enum

Cases: 

SymbolValueString
Undefined0Undefined
Old1Old
New2New

TargetKind 

object model target kind

Cases: 

SymbolValueString
DontTouch0dont_touch
Instance1instance
MemberInstance2member_instance
MemberReference3member_reference
Reference4reference