CIRCT

Circuit IR Compilers and Tools

'systemc' Dialect

Types and operations for the SystemC dialect This dialect defines the systemc dialect, which represents various constructs of the SystemC library (IEEE 1666-2011) useful for emission.

Operation definition

systemc.alias (::circt::systemc::AliasOp)

Declare two SSA values equivalent.

Syntax:

operation ::= `systemc.alias` $lhs `,` $rhs attr-dict `:` type($lhs)

This operation does not model a specific construct in the SystemC spec, but is required to ‘connect’ an SSA value to a module output SSA value. It can, however, also be used to declare any two SSA values to be aliases which means that ExportSystemC will generate at most one variable name for all SSA values in the alias set.

Traits: SameTypeOperands

Operands:

OperandDescription
lhsany type
rhsany type

systemc.ctor (::circt::systemc::CtorOp)

A constructor definition.

Syntax:

operation ::= `systemc.ctor` $body attr-dict

Represents the SC_CTOR macro as described in IEEE 1666-2011 §5.2.7. The name of the module being constructed does not have to be passed to this operation, but is automatically added during emission.

Traits: HasParent, NoTerminator, SingleBlock

systemc.method (::circt::systemc::MethodOp)

Represents the SystemC SC_METHOD macro.

Syntax:

operation ::= `systemc.method` $funcHandle attr-dict

Represents the SC_METHOD macro as described in IEEE 1666-2011 §5.2.9.

Operands:

OperandDescription
funcHandleFuncHandleType

systemc.func (::circt::systemc::SCFuncOp)

A (void)->void member function of a SC_MODULE.

Syntax:

operation ::= `systemc.func` custom<ImplicitSSAName>($name) $body attr-dict

This operation does not represent a specific SystemC construct, but a regular C++ member function with no arguments and a void return type. These are used to implement module-internal logic and are registered to the module using the SC_METHOD, SC_THREAD, and SC_CTHREAD macros.

Traits: HasParent, NoTerminator

Interfaces: HasCustomSSAName, SystemCNameDeclOpInterface

Attributes:

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute

Results:

ResultDescription
handleFuncHandleType

systemc.module (::circt::systemc::SCModuleOp)

Define a SystemC SC_MODULE.

Represents the SC_MODULE macro as described in IEEE 1666-2011 §5.2.5. Models input, output and inout ports as module arguments (as opposed to sc_signals which are modeled by a separate systemc.signal operation), but are nonetheless emitted as regular struct fields.

Traits: HasParent mlir::ModuleOp, IsolatedFromAbove, NoTerminator, SingleBlock

Interfaces: CallableOpInterface, FunctionOpInterface, OpAsmOpInterface, RegionKindInterface, Symbol

Attributes:

AttributeMLIR TypeDescription
portDirections::circt::systemc::PortDirectionsAttrPort directions attribute
portNames::mlir::ArrayAttrstring array attribute

systemc.signal (::circt::systemc::SignalOp)

Declares a SystemC sc_signal<T>.

Syntax:

operation ::= `systemc.signal` custom<ImplicitSSAName>($name) attr-dict `:` type($signal)

Represents the sc_signal template as described in IEEE 1666-2011 §6.4.

Traits: HasParent

Interfaces: HasCustomSSAName, SystemCNameDeclOpInterface

Attributes:

AttributeMLIR TypeDescription
name::mlir::StringAttrstring attribute

Results:

ResultDescription
signalsignless integer

systemc.thread (::circt::systemc::ThreadOp)

Represents the SystemC SC_THREAD macro.

Syntax:

operation ::= `systemc.thread` $funcHandle attr-dict

Represents the SC_THREAD macro as described in IEEE 1666-2011 §5.2.9.

Operands:

OperandDescription
funcHandleFuncHandleType

Attribute definition

PortDirectionsAttr

Port directions attribute

An attribute to store an array of PortDirection.

Parameters:

ParameterC++ typeDescription
storage::mlir::IntegerAttr

Type constraint definition

FuncHandleType

Type definition

FuncHandleType

A function handle type

Syntax: !systemc.func_handle

Represents a handle to a SystemC module’s member function that can be used in places like SC_METHOD, SC_THREAD, etc.

'systemc' Dialect Docs