|
CIRCT 24.0.0git
|
A helper class to facilitate the conversion from a Slang AST to MLIR operations. More...
#include <ImportVerilogInternals.h>

Classes | |
| struct | PendingMonitor |
Information about a pending $monitor call that needs to be converted after the current module's body has been processed. More... | |
| struct | ScanStringResult |
| Result of converting a scan format string. More... | |
Public Types | |
| using | InterfaceInstances = llvm::ScopedHashTable< const slang::ast::InstanceSymbol *, InterfaceLowering * > |
| Expanded interface instances, keyed by the InstanceSymbol pointer. | |
| using | InterfaceInstanceScope = InterfaceInstances::ScopeTy |
| using | ValueSymbols = llvm::ScopedHashTable< const slang::ast::ValueSymbol *, Value > |
| A table of defined values, such as variables, that may be referred to by name in expressions. | |
| using | ValueSymbolScope = ValueSymbols::ScopeTy |
| using | VirtualInterfaceMembers = llvm::ScopedHashTable< const slang::ast::ValueSymbol *, VirtualInterfaceMemberAccess > |
| A table mapping symbols for interface members accessed through a virtual interface to the virtual interface base value symbol. | |
| using | VirtualInterfaceMemberScope = VirtualInterfaceMembers::ScopeTy |
Public Member Functions | |
| Context (const ImportVerilogOptions &options, slang::ast::Compilation &compilation, mlir::ModuleOp intoModuleOp, const slang::SourceManager &sourceManager) | |
| Context (const Context &)=delete | |
| MLIRContext * | getContext () |
| Return the MLIR context. | |
| Location | convertLocation (slang::SourceLocation loc) |
Convert a slang SourceLocation into an MLIR Location. | |
| Location | convertLocation (slang::SourceRange range) |
Convert a slang SourceRange into an MLIR Location. | |
| Type | convertType (const slang::ast::Type &type, LocationAttr loc={}) |
| Convert a slang type into an MLIR type. | |
| Type | convertType (const slang::ast::DeclaredType &type) |
| LogicalResult | convertCompilation () |
| Convert hierarchy and structure AST nodes to MLIR ops. | |
| ModuleLowering * | convertModuleHeader (const slang::ast::InstanceBodySymbol *module) |
| Convert a module and its ports to an empty module op in the IR. | |
| LogicalResult | convertModuleBody (const slang::ast::InstanceBodySymbol *module) |
| Convert a module's body to the corresponding IR ops. | |
| LogicalResult | convertPackage (const slang::ast::PackageSymbol &package) |
| Convert a package and its contents. | |
| FunctionLowering * | declareFunction (const slang::ast::SubroutineSymbol &subroutine) |
| Convert a function and its arguments to a function declaration in the IR. | |
| LogicalResult | defineFunction (const slang::ast::SubroutineSymbol &subroutine) |
| Define a function’s body. | |
| LogicalResult | convertPrimitiveInstance (const slang::ast::PrimitiveInstanceSymbol &prim) |
| Convert a primitive instance. | |
| ClassLowering * | declareClass (const slang::ast::ClassType &cls) |
| LogicalResult | buildClassProperties (const slang::ast::ClassType &classdecl) |
| LogicalResult | materializeClassMethods (const slang::ast::ClassType &classdecl) |
| LogicalResult | convertGlobalVariable (const slang::ast::VariableSymbol &var) |
Convert a variable to a moore.global_variable operation. | |
| mlir::func::FuncOp | getOrCreateEnumHelper (const slang::ast::Type &type, slang::parsing::KnownSystemName method, Location loc) |
Get the helper function implementing one of the name, next, and prev built-in methods for the given enum type, creating it on first use. | |
| FailureOr< moore::UnpackedStructType > | convertVirtualInterfaceType (const slang::ast::VirtualInterfaceType &type, Location loc) |
| Convert a Slang virtual interface type into the Moore type used to represent virtual interface handles. | |
| FailureOr< Value > | materializeVirtualInterfaceValue (const slang::ast::VirtualInterfaceType &type, Location loc) |
| Materialize a Moore value representing a concrete interface instance as a virtual interface handle. | |
| LogicalResult | registerVirtualInterfaceMembers (const slang::ast::ValueSymbol &base, const slang::ast::VirtualInterfaceType &type, Location loc) |
| Register the interface members of a virtual interface base symbol for use in later expression conversion. | |
| bool | isClassDerivedFrom (const moore::ClassHandleType &actualTy, const moore::ClassHandleType &baseTy) |
| Checks whether one class (actualTy) is derived from another class (baseTy). | |
| moore::ClassHandleType | getAncestorClassWithProperty (const moore::ClassHandleType &actualTy, StringRef fieldName, Location loc) |
| Tries to find the closest base class of actualTy that carries a property with name fieldName. | |
| Value | getImplicitThisRef () const |
| void | populateSampledValueClocks () |
| Generates a map from sampled value system calls to clocks using Slang's analysis. | |
| Value | getIndexedQueue () const |
| LogicalResult | convertStatement (const slang::ast::Statement &stmt) |
| Value | convertRvalueExpression (const slang::ast::Expression &expr, Type requiredType={}) |
| Value | convertLvalueExpression (const slang::ast::Expression &expr) |
| Value | convertAssertionExpression (const slang::ast::AssertionExpr &expr, Location loc) |
| Value | convertSampledValueCallExpression (const slang::ast::CallExpression &expr, const slang::ast::CallExpression::SystemCallInfo &info, Location loc) |
| void | traverseInstanceBody (const slang::ast::InstanceSymbol &symbol) |
| std::optional< std::pair< const slang::ast::InstanceSymbol *, mlir::StringAttr > > | buildHierValueKey (const slang::ast::HierarchicalValueExpression &expr) |
| Build a composite key for hierValueSymbols from a hierarchical value expression. | |
| Value | resolveCapturedValue (const slang::ast::ValueSymbol &sym) |
If sym is captured by the function currently being converted, return the value it is bound to (the capture block argument); otherwise return null. | |
| LogicalResult | convertTimingControl (const slang::ast::TimingControl &ctrl) |
| LogicalResult | convertTimingControl (const slang::ast::TimingControl &ctrl, const slang::ast::Statement &stmt) |
| Value | convertToI1 (Value value) |
| Helper function to convert a value to a MLIR I1 value. | |
| Value | convertLTLTimingControl (const slang::ast::TimingControl &ctrl, const Value &seqOrPro) |
| LogicalResult | convertNInputPrimitive (const slang::ast::PrimitiveInstanceSymbol &prim) |
| LogicalResult | convertNOutputPrimitive (const slang::ast::PrimitiveInstanceSymbol &prim) |
| LogicalResult | convertFixedPrimitive (const slang::ast::PrimitiveInstanceSymbol &prim) |
| LogicalResult | convertPullGatePrimitive (const slang::ast::PrimitiveInstanceSymbol &prim) |
| Value | convertToBool (Value value) |
| Helper function to convert a value to its "truthy" boolean value. | |
| Value | convertToBool (Value value, Domain domain) |
| Helper function to convert a value to its "truthy" boolean value and convert it to the given domain. | |
| Value | convertToSimpleBitVector (Value value) |
| Helper function to convert a value to its simple bit vector representation, if it has one. | |
| Value | materializePackedToSBVConversion (Value value, Location loc, bool fallible) |
Helper function to convert a PackedType value to its simple bit vector representation, with special handling for time values which require scaling by the local timescale. | |
| Value | materializeConversion (Type type, Value value, bool isSigned, Location loc, bool fallible=false) |
| Helper function to insert the necessary operations to cast a value from one type to another. | |
| Value | materializeSVInt (const slang::SVInt &svint, const slang::ast::Type &type, Location loc) |
Helper function to materialize an SVInt as an SSA value. | |
| Value | materializeSVReal (const slang::ConstantValue &svreal, const slang::ast::Type &type, Location loc) |
| Helper function to materialize a real value as an SSA value. | |
| Value | materializeString (const slang::ConstantValue &string, const slang::ast::Type &astType, Location loc) |
| Helper function to materialize a string as an SSA value. | |
| Value | materializeFixedSizeUnpackedArrayType (const slang::ConstantValue &constant, const slang::ast::FixedSizeUnpackedArrayType &astType, Location loc) |
Helper function to materialize an unpacked array of SVInts as an SSA value. | |
| Value | materializeConstant (const slang::ConstantValue &constant, const slang::ast::Type &type, Location loc) |
Helper function to materialize a ConstantValue as an SSA value. | |
| FailureOr< Value > | convertFormatString (std::span< const slang::ast::Expression *const > arguments, Location loc, moore::IntFormat defaultFormat=moore::IntFormat::Decimal, bool appendNewline=false) |
Convert a list of string literal arguments with formatting specifiers and arguments to be interpolated into a !moore.format_string value. | |
| FailureOr< ScanStringResult > | convertScanString (StringRef formatStr, Value initialCursor, std::span< const slang::ast::Expression *const > destinations, Location loc) |
Convert a scan format string into a consuming chain of moore.scan. | |
| Value | convertSystemCall (const slang::ast::SystemSubroutine &subroutine, Location loc, std::span< const slang::ast::Expression *const > args) |
| Convert system function calls. | |
| FailureOr< Value > | convertSampledValueCallArity1 (const slang::ast::SystemSubroutine &subroutine, Location loc, Value value, Type originalType, Value clockVal) |
| Convert sampled value system function calls with a single argument. | |
| slang::ConstantValue | evaluateConstant (const slang::ast::Expression &expr) |
| Evaluate the constant value of an expression. | |
| Value | convertInsideCheck (Value insideLhs, Location loc, const slang::ast::Expression &expr) |
| Convert the inside/set-membership expression. | |
| void | ensureMonitorGlobals () |
Ensure that the global variables for $monitor state exist. | |
| void | ensureTimeFormatGlobal () |
Ensure that the global variable for $timeformat state exists. | |
| LogicalResult | flushPendingMonitors () |
Process any pending $monitor calls and generate the monitoring procedures at module level. | |
Public Attributes | |
| DenseMap< const slang::ast::CallExpression *, const slang::ast::TimingControl * > | sampledValueCallClocks |
| Maps sampled value system calls to their corresponding clocks. | |
| const ImportVerilogOptions & | options |
| slang::ast::Compilation & | compilation |
| mlir::ModuleOp | intoModuleOp |
| const slang::SourceManager & | sourceManager |
| OpBuilder | builder |
| The builder used to create IR operations. | |
| SymbolTable | symbolTable |
| A symbol table of the MLIR module we are emitting into. | |
| std::map< LocationKey, Operation * > | orderedRootOps |
| The top-level operations ordered by their Slang source location. | |
| DenseMap< const slang::ast::InstanceBodySymbol *, std::unique_ptr< ModuleLowering > > | modules |
| How we have lowered modules to MLIR. | |
| InterfaceInstances | interfaceInstances |
| SmallVector< std::unique_ptr< InterfaceLowering > > | interfaceInstanceStorage |
| Owning storage for InterfaceLowering objects because ScopedHashTable stores values by copy. | |
| DenseSet< const slang::ast::InstanceSymbol * > | predeclaredInstances |
| Module instances already emitted by the predeclaration pass. | |
| DenseMap< const slang::ast::InstanceBodySymbol *, VirtualInterfaceLowering > | virtualIfaceLowerings |
| Cached virtual interface layouts (type + field order). | |
| DenseMap< const slang::ast::ModportSymbol *, VirtualInterfaceLowering > | virtualIfaceModportLowerings |
| std::queue< const slang::ast::InstanceBodySymbol * > | moduleWorklist |
| A list of modules for which the header has been created, but the body has not been converted yet. | |
| std::queue< const slang::ast::SubroutineSymbol * > | functionWorklist |
| A list of functions for which the declaration has been created, but the body has not been defined yet. | |
| DenseMap< const slang::ast::SubroutineSymbol *, std::unique_ptr< FunctionLowering > > | functions |
| Functions that have already been converted. | |
| DenseMap< const slang::ast::SubroutineSymbol *, std::string > | dpiExportCNames |
| DPI-C export directives keyed by the SystemVerilog subroutine they expose. | |
| DenseMap< std::pair< const slang::ast::EnumType *, slang::parsing::KnownSystemName >, mlir::func::FuncOp > | enumHelpers |
| Helper functions generated for the enum built-in methods, keyed by the canonical enum type and the method they implement. | |
| DenseMap< const slang::ast::ClassType *, std::unique_ptr< ClassLowering > > | classes |
| Classes that have already been converted. | |
| ValueSymbols | valueSymbols |
| VirtualInterfaceMembers | virtualIfaceMembers |
| DenseMap< const slang::ast::ValueSymbol *, moore::GlobalVariableOp > | globalVariables |
| A table of defined global variables that may be referred to by name in expressions. | |
| SmallVector< const slang::ast::ValueSymbol * > | globalVariableWorklist |
| A list of global variables that still need their initializers to be converted. | |
| CaptureMap | functionCaptures |
| Pre-computed capture analysis: maps each function to the set of non-local, non-global variables it captures (directly or transitively). | |
| DenseMap< const slang::ast::InstanceBodySymbol *, SmallVector< HierPathInfo > > | hierPaths |
| Collect all hierarchical names used for the per module/instance. | |
| DenseMap< std::pair< const slang::ast::InstanceSymbol *, mlir::StringAttr >, Value > | hierValueSymbols |
| Persistent map for hierarchical value lookups. | |
| SmallVector< Value > | lvalueStack |
| A stack of assignment left-hand side values. | |
| SmallVector< LoopFrame > | loopStack |
| A stack of loop continuation and exit blocks. | |
| std::function< void(moore::ReadOp)> | rvalueReadCallback |
| A listener called for every variable or net being read. | |
| std::function< void(mlir::Operation *)> | variableAssignCallback |
| A listener called for every variable or net being assigned. | |
| bool | isInsideTimingControl = false |
Whether we are currently converting expressions inside a timing control, such as @(posedge clk). | |
| slang::TimeScale | timeScale |
| The time scale currently in effect. | |
| Value | currentThisRef = {} |
Variable to track the value of the current function's implicit this reference. | |
| FunctionLowering * | currentFunctionLowering = nullptr |
| The function currently being converted, if any. | |
| Value | currentQueue = {} |
| Variable that tracks the queue which we are currently converting the index expression for. | |
| const slang::ast::DefinitionSymbol * | currentDefinition = nullptr |
| The definition symbol of the module body currently being converted. | |
| moore::GlobalVariableOp | monitorActiveIdGlobal = nullptr |
Global variable ops for $monitor state management. | |
| moore::GlobalVariableOp | monitorEnabledGlobal = nullptr |
| moore::GlobalVariableOp | timeFormatGlobal = nullptr |
Global variable ops for $timeformat state management. | |
| unsigned | nextMonitorId = 1 |
| The next monitor ID to allocate. ID 0 is reserved for "no monitor active". | |
| SmallVector< PendingMonitor > | pendingMonitors |
Pending $monitor calls that need to be converted at module level. | |
Private Member Functions | |
| FunctionLowering * | declareCallableImpl (const slang::ast::SubroutineSymbol &subroutine, mlir::StringRef qualifiedName, llvm::SmallVectorImpl< Type > &extraParams) |
| Helper function to extract the commonalities in lowering of functions and methods. | |
A helper class to facilitate the conversion from a Slang AST to MLIR operations.
Keeps track of the destination MLIR module, builders, and various worklists and utilities needed for conversion.
Definition at line 217 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::InterfaceInstances = llvm::ScopedHashTable<const slang::ast::InstanceSymbol *, InterfaceLowering *> |
Expanded interface instances, keyed by the InstanceSymbol pointer.
Each entry maps body members to their expanded SSA values. Scoped per-module so entries are cleaned up when a module's conversion ends.
Definition at line 500 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::InterfaceInstanceScope = InterfaceInstances::ScopeTy |
Definition at line 503 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::ValueSymbols = llvm::ScopedHashTable<const slang::ast::ValueSymbol *, Value> |
A table of defined values, such as variables, that may be referred to by name in expressions.
The expressions use this table to lookup the MLIR value that was created for a given declaration in the Slang AST node.
Definition at line 549 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::ValueSymbolScope = ValueSymbols::ScopeTy |
Definition at line 551 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::VirtualInterfaceMembers = llvm::ScopedHashTable<const slang::ast::ValueSymbol *, VirtualInterfaceMemberAccess> |
A table mapping symbols for interface members accessed through a virtual interface to the virtual interface base value symbol.
Definition at line 556 of file ImportVerilogInternals.h.
| using circt::ImportVerilog::Context::VirtualInterfaceMemberScope = VirtualInterfaceMembers::ScopeTy |
Definition at line 559 of file ImportVerilogInternals.h.
|
inline |
Definition at line 218 of file ImportVerilogInternals.h.
|
delete |
| LogicalResult Context::buildClassProperties | ( | const slang::ast::ClassType & | classdecl | ) |
Definition at line 2839 of file Structure.cpp.
References buildClassProperties(), classes, declareClass(), and timeScale.
Referenced by buildClassProperties().
| std::optional< std::pair< const slang::ast::InstanceSymbol *, mlir::StringAttr > > Context::buildHierValueKey | ( | const slang::ast::HierarchicalValueExpression & | expr | ) |
Build a composite key for hierValueSymbols from a hierarchical value expression.
Returns {firstInstanceSymbol, dottedHierName} or std::nullopt if the expression has no instance path.
Definition at line 2774 of file Expressions.cpp.
References builder.
| Value Context::convertAssertionExpression | ( | const slang::ast::AssertionExpr & | expr, |
| Location | loc | ||
| ) |
Definition at line 473 of file AssertionExpr.cpp.
| LogicalResult Context::convertCompilation | ( | ) |
Convert hierarchy and structure AST nodes to MLIR ops.
Convert an entire Slang compilation to MLIR ops.
This is the main entry point for the conversion.
Definition at line 1271 of file Structure.cpp.
References circt::ImportVerilog::analyzeFunctionCaptures(), builder, classes, compilation, convertLocation(), convertModuleBody(), convertModuleHeader(), convertRvalueExpression(), defineFunction(), functionCaptures, functionWorklist, circt::ImportVerilog::getCanonicalBody(), globalVariables, globalVariableWorklist, materializeClassMethods(), moduleWorklist, populateSampledValueClocks(), recordDPIExportDirectives(), timeScale, and traverseInstanceBody().
| LogicalResult Context::convertFixedPrimitive | ( | const slang::ast::PrimitiveInstanceSymbol & | prim | ) |
Definition at line 2446 of file Structure.cpp.
References convertLocation(), and convertPullGatePrimitive().
Referenced by convertPrimitiveInstance().
| FailureOr< Value > Context::convertFormatString | ( | std::span< const slang::ast::Expression *const > | arguments, |
| Location | loc, | ||
| moore::IntFormat | defaultFormat = moore::IntFormat::Decimal, |
||
| bool | appendNewline = false |
||
| ) |
Convert a list of string literal arguments with formatting specifiers and arguments to be interpolated into a !moore.format_string value.
Returns failure if an error occurs. Returns a null value if the formatted string is trivially empty. Otherwise returns the formatted string.
Definition at line 346 of file FormatStrings.cpp.
Referenced by flushPendingMonitors().
| LogicalResult Context::convertGlobalVariable | ( | const slang::ast::VariableSymbol & | var | ) |
Convert a variable to a moore.global_variable operation.
Definition at line 2894 of file Structure.cpp.
References builder, convertLocation(), convertType(), circt::ImportVerilog::LocationKey::get(), globalVariables, globalVariableWorklist, guessNamespacePrefix(), intoModuleOp, orderedRootOps, sourceManager, and symbolTable.
| Value Context::convertInsideCheck | ( | Value | insideLhs, |
| Location | loc, | ||
| const slang::ast::Expression & | expr | ||
| ) |
Convert the inside/set-membership expression.
Definition at line 4354 of file Expressions.cpp.
References builder, convertRvalueExpression(), and convertToSimpleBitVector().
| Location Context::convertLocation | ( | slang::SourceLocation | loc | ) |
Convert a slang SourceLocation into an MLIR Location.
Definition at line 93 of file ImportVerilog.cpp.
References getContext(), and sourceManager.
Referenced by convertCompilation(), convertFixedPrimitive(), convertGlobalVariable(), convertLTLTimingControl(), convertLvalueExpression(), convertModuleHeader(), convertNInputPrimitive(), convertNOutputPrimitive(), convertPackage(), convertPrimitiveInstance(), convertPullGatePrimitive(), convertRvalueExpression(), convertStatement(), convertType(), convertType(), convertVirtualInterfaceType(), declareCallableImpl(), declareClass(), declareFunction(), defineFunction(), getOrCreateEnumHelper(), materializeVirtualInterfaceValue(), and registerVirtualInterfaceMembers().
| Location Context::convertLocation | ( | slang::SourceRange | range | ) |
Convert a slang SourceRange into an MLIR Location.
Definition at line 97 of file ImportVerilog.cpp.
References getContext(), and sourceManager.
| Value Context::convertLTLTimingControl | ( | const slang::ast::TimingControl & | ctrl, |
| const Value & | seqOrPro | ||
| ) |
Definition at line 267 of file TimingControls.cpp.
References builder, and convertLocation().
| Value Context::convertLvalueExpression | ( | const slang::ast::Expression & | expr | ) |
Definition at line 2812 of file Expressions.cpp.
References convertLocation().
Referenced by convertNInputPrimitive(), convertNOutputPrimitive(), convertPullGatePrimitive(), convertSystemCall(), and materializeVirtualInterfaceValue().
| LogicalResult Context::convertModuleBody | ( | const slang::ast::InstanceBodySymbol * | module | ) |
Convert a module's body to the corresponding IR ops.
The module op must have already been created earlier through a convertModuleHeader call. module must be the canonical module body if there is one.
Definition at line 1603 of file Structure.cpp.
References builder, currentDefinition, flushPendingMonitors(), hierPaths, interfaceInstances, interfaceInstanceStorage, modules, circt::hw::ModulePort::Output, predeclaredInstances, recordDPIExportDirectives(), timeScale, valueSymbols, and virtualIfaceMembers.
Referenced by convertCompilation().
| ModuleLowering * Context::convertModuleHeader | ( | const slang::ast::InstanceBodySymbol * | module | ) |
Convert a module and its ports to an empty module op in the IR.
Also adds the op to the worklist of module bodies to be lowered. This acts like a module "declaration", allowing instances to already refer to a module even before its body has been lowered. module must be the canonical module body if there is one.
Definition at line 1377 of file Structure.cpp.
References builder, convertLocation(), convertType(), circt::hw::ModulePort::Input, modules, circt::hw::ModulePort::Output, and timeScale.
Referenced by convertCompilation().
| LogicalResult Context::convertNInputPrimitive | ( | const slang::ast::PrimitiveInstanceSymbol & | prim | ) |
Definition at line 2263 of file Structure.cpp.
References assert(), builder, convertLocation(), convertLvalueExpression(), convertRvalueExpression(), getContext(), and materializeConversion().
Referenced by convertPrimitiveInstance().
| LogicalResult Context::convertNOutputPrimitive | ( | const slang::ast::PrimitiveInstanceSymbol & | prim | ) |
Definition at line 2369 of file Structure.cpp.
References assert(), builder, convertLocation(), convertLvalueExpression(), convertRvalueExpression(), getContext(), and materializeConversion().
Referenced by convertPrimitiveInstance().
| LogicalResult Context::convertPackage | ( | const slang::ast::PackageSymbol & | package | ) |
Convert a package and its contents.
Definition at line 1822 of file Structure.cpp.
References builder, convertLocation(), intoModuleOp, recordDPIExportDirectives(), timeScale, and valueSymbols.
| LogicalResult Context::convertPrimitiveInstance | ( | const slang::ast::PrimitiveInstanceSymbol & | prim | ) |
Convert a primitive instance.
Definition at line 2238 of file Structure.cpp.
References convertFixedPrimitive(), convertLocation(), convertNInputPrimitive(), and convertNOutputPrimitive().
| LogicalResult Context::convertPullGatePrimitive | ( | const slang::ast::PrimitiveInstanceSymbol & | prim | ) |
Definition at line 2461 of file Structure.cpp.
References assert(), builder, convertLocation(), convertLvalueExpression(), getContext(), and materializeConversion().
Referenced by convertFixedPrimitive().
| Value Context::convertRvalueExpression | ( | const slang::ast::Expression & | expr, |
| Type | requiredType = {} |
||
| ) |
Definition at line 2802 of file Expressions.cpp.
References convertLocation(), and materializeConversion().
Referenced by convertCompilation(), convertInsideCheck(), convertNInputPrimitive(), convertNOutputPrimitive(), convertSampledValueCallExpression(), and convertSystemCall().
| FailureOr< Value > Context::convertSampledValueCallArity1 | ( | const slang::ast::SystemSubroutine & | subroutine, |
| Location | loc, | ||
| Value | value, | ||
| Type | originalType, | ||
| Value | clockVal | ||
| ) |
Convert sampled value system function calls with a single argument.
Definition at line 304 of file AssertionExpr.cpp.
References builder.
Referenced by convertSampledValueCallExpression().
| Value Context::convertSampledValueCallExpression | ( | const slang::ast::CallExpression & | expr, |
| const slang::ast::CallExpression::SystemCallInfo & | info, | ||
| Location | loc | ||
| ) |
Definition at line 369 of file AssertionExpr.cpp.
References builder, convertRvalueExpression(), convertSampledValueCallArity1(), convertToI1(), convertType(), materializeConversion(), materializePackedToSBVConversion(), and sampledValueCallClocks.
| FailureOr< Context::ScanStringResult > Context::convertScanString | ( | StringRef | formatStr, |
| Value | initialCursor, | ||
| std::span< const slang::ast::Expression *const > | destinations, | ||
| Location | loc | ||
| ) |
Convert a scan format string into a consuming chain of moore.scan.
* operations starting from initialCursor. Each non-suppressed specifier produces an entry in assignments; the caller is responsible for emitting the corresponding moore.blocking_assign ops. Returns failur if an erro occurs.
Definition at line 404 of file ScanStrings.cpp.
Referenced by convertSystemCall().
| LogicalResult Context::convertStatement | ( | const slang::ast::Statement & | stmt | ) |
Definition at line 1799 of file Statements.cpp.
References assert(), builder, and convertLocation().
Referenced by convertTimingControl(), and defineFunction().
| Value Context::convertSystemCall | ( | const slang::ast::SystemSubroutine & | subroutine, |
| Location | loc, | ||
| std::span< const slang::ast::Expression *const > | args | ||
| ) |
Convert system function calls.
Returns a null Value on failure after emitting an error.
Definition at line 3568 of file Expressions.cpp.
References assert(), builder, coerceToBuiltinInt(), convertLvalueExpression(), convertRvalueExpression(), convertScanString(), convertToSimpleBitVector(), convertType(), hw.ConstantOp::create(), comb.ExtractOp::create(), emitScanAssignments(), circt::moore::f64, getContext(), getIsUnknown(), getOrCreateEnumHelper(), materializeConversion(), and materializePackedToSBVConversion().
| LogicalResult Context::convertTimingControl | ( | const slang::ast::TimingControl & | ctrl | ) |
Definition at line 213 of file TimingControls.cpp.
References handleRoot().
| LogicalResult Context::convertTimingControl | ( | const slang::ast::TimingControl & | ctrl, |
| const slang::ast::Statement & | stmt | ||
| ) |
Definition at line 218 of file TimingControls.cpp.
References builder, convertStatement(), handleRoot(), isInsideTimingControl, and rvalueReadCallback.
| Value Context::convertToBool | ( | Value | value | ) |
Helper function to convert a value to its "truthy" boolean value.
Definition at line 2819 of file Expressions.cpp.
References builder.
Referenced by convertToBool().
| Value Context::convertToBool | ( | Value | value, |
| Domain | domain | ||
| ) |
Helper function to convert a value to its "truthy" boolean value and convert it to the given domain.
Definition at line 2988 of file Expressions.cpp.
References convertToBool(), getContext(), and materializeConversion().
| Value Context::convertToI1 | ( | Value | value | ) |
Helper function to convert a value to a MLIR I1 value.
Helper function to convert a value to an i1 value.
Definition at line 481 of file AssertionExpr.cpp.
References builder.
Referenced by convertSampledValueCallExpression().
| Value Context::convertToSimpleBitVector | ( | Value | value | ) |
Helper function to convert a value to its simple bit vector representation, if it has one.
Otherwise returns null. Also returns null if the given value is null.
Definition at line 2996 of file Expressions.cpp.
References materializeConversion().
Referenced by convertInsideCheck(), and convertSystemCall().
| Type Context::convertType | ( | const slang::ast::DeclaredType & | type | ) |
Definition at line 230 of file Types.cpp.
References convertLocation(), and convertType().
| Type Context::convertType | ( | const slang::ast::Type & | type, |
| LocationAttr | loc = {} |
||
| ) |
Convert a slang type into an MLIR type.
Returns null on failure. Uses the provided location for error reporting, or tries to guess one from the given type. Types tend to have unreliable location information, so it's generally a good idea to pass in a location.
Definition at line 224 of file Types.cpp.
References convertLocation().
Referenced by convertGlobalVariable(), convertModuleHeader(), convertSampledValueCallExpression(), convertSystemCall(), convertType(), convertVirtualInterfaceType(), declareCallableImpl(), defineFunction(), getOrCreateEnumHelper(), materializeFixedSizeUnpackedArrayType(), and materializeSVInt().
| FailureOr< moore::UnpackedStructType > Context::convertVirtualInterfaceType | ( | const slang::ast::VirtualInterfaceType & | type, |
| Location | loc | ||
| ) |
Convert a Slang virtual interface type into the Moore type used to represent virtual interface handles.
Populates internal caches so that interface instance references can be materialized consistently.
Definition at line 238 of file Types.cpp.
References builder, convertLocation(), convertType(), getContext(), virtualIfaceLowerings, and virtualIfaceModportLowerings.
Referenced by materializeVirtualInterfaceValue().
|
private |
Helper function to extract the commonalities in lowering of functions and methods.
Convert a function and its arguments to a function declaration in the IR.
This does not convert the function body.
Definition at line 1978 of file Structure.cpp.
References builder, convertLocation(), convertType(), dpiExportAttrName, dpiExportCNames, functionCaptures, functions, functionWorklist, circt::ImportVerilog::LocationKey::get(), getContext(), getDPISignature(), getFunctionSignature(), intoModuleOp, orderedRootOps, sourceManager, and symbolTable.
Referenced by declareFunction().
| ClassLowering * Context::declareClass | ( | const slang::ast::ClassType & | cls | ) |
Definition at line 2805 of file Structure.cpp.
References builder, classes, convertLocation(), circt::ImportVerilog::LocationKey::get(), intoModuleOp, orderedRootOps, sourceManager, and symbolTable.
Referenced by buildClassProperties().
| FunctionLowering * Context::declareFunction | ( | const slang::ast::SubroutineSymbol & | subroutine | ) |
Convert a function and its arguments to a function declaration in the IR.
This does not convert the function body.
Definition at line 1845 of file Structure.cpp.
References classes, convertLocation(), declareCallableImpl(), functions, getContext(), and guessNamespacePrefix().
| LogicalResult Context::defineFunction | ( | const slang::ast::SubroutineSymbol & | subroutine | ) |
Define a function’s body.
The function must already have been declared via declareFunction. This is called from the function worklist after all declarations have been created, ensuring that all function prototypes are available for calls within the body.
Definition at line 2078 of file Structure.cpp.
References builder, convertLocation(), convertStatement(), convertType(), currentFunctionLowering, currentThisRef, functions, registerVirtualInterfaceMembers(), timeScale, valueSymbols, and virtualIfaceMembers.
Referenced by convertCompilation().
| void Context::ensureMonitorGlobals | ( | ) |
Ensure that the global variables for $monitor state exist.
This creates the __monitor_active_id and __monitor_enabled globals on first call.
Definition at line 1810 of file Statements.cpp.
References builder, getContext(), intoModuleOp, monitorActiveIdGlobal, monitorEnabledGlobal, symbolTable, and circt::moore::TwoValued.
| void Context::ensureTimeFormatGlobal | ( | ) |
Ensure that the global variable for $timeformat state exists.
This creates the __timeformat_state global on first call.
Definition at line 1931 of file Statements.cpp.
References builder, getContext(), getDefaultTimeFormatValues(), intoModuleOp, symbolTable, and timeFormatGlobal.
| slang::ConstantValue Context::evaluateConstant | ( | const slang::ast::Expression & | expr | ) |
Evaluate the constant value of an expression.
Definition at line 2977 of file Expressions.cpp.
References compilation.
| LogicalResult Context::flushPendingMonitors | ( | ) |
Process any pending $monitor calls and generate the monitoring procedures at module level.
Definition at line 1850 of file Statements.cpp.
References builder, convertFormatString(), getContext(), monitorActiveIdGlobal, monitorEnabledGlobal, and pendingMonitors.
Referenced by convertModuleBody().
| moore::ClassHandleType Context::getAncestorClassWithProperty | ( | const moore::ClassHandleType & | actualTy, |
| StringRef | fieldName, | ||
| Location | loc | ||
| ) |
Tries to find the closest base class of actualTy that carries a property with name fieldName.
The location is used for error reporting.
Definition at line 4316 of file Expressions.cpp.
References resolve().
|
inline |
Return the MLIR context.
Definition at line 228 of file ImportVerilogInternals.h.
References intoModuleOp.
Referenced by convertLocation(), convertLocation(), convertNInputPrimitive(), convertNOutputPrimitive(), convertPullGatePrimitive(), convertSystemCall(), convertToBool(), convertVirtualInterfaceType(), declareCallableImpl(), declareFunction(), ensureMonitorGlobals(), ensureTimeFormatGlobal(), flushPendingMonitors(), getOrCreateEnumHelper(), materializeConversion(), materializeFixedSizeUnpackedArrayType(), materializeString(), and materializeSVInt().
|
inline |
Definition at line 306 of file ImportVerilogInternals.h.
References currentThisRef.
|
inline |
Definition at line 319 of file ImportVerilogInternals.h.
References currentQueue.
| mlir::func::FuncOp Context::getOrCreateEnumHelper | ( | const slang::ast::Type & | type, |
| slang::parsing::KnownSystemName | method, | ||
| Location | loc | ||
| ) |
Get the helper function implementing one of the name, next, and prev built-in methods for the given enum type, creating it on first use.
The next, prev, and name built-in methods on enums have to locate the value they are called on in the list of enumerands at runtime.
Returns null and emits an error if the helper cannot be created.
Slang folds these calls away wherever the value is constant, so what remains are the cases that require an actual computation. Instead of inlining that computation at every call site, we emit one helper function per enum type and method, and turn the calls into plain function calls.
All helpers start with a chain of blocks that compares the value against each enumerand in turn. A match branches to a common match block, carrying what the comparison found along as a block argument. Running off the end of the chain means the value is not a member of the enumeration, in which case name returns an empty string and next/prev return the enum's default value, as mandated by IEEE 1800-2023 § 6.19.5.
For name the block argument is the enumerand's name, which the match block simply returns. For next and prev it is the position of the value among the enumerands. The match block offsets that position by the step count, which is only known at runtime, wraps it around at both ends of the enumerand list, and uses it to index an array of all enumerand values.
Definition at line 3412 of file Expressions.cpp.
References builder, convertLocation(), convertType(), empty, enumHelpers, circt::ImportVerilog::LocationKey::get(), getContext(), intoModuleOp, materializeConstant(), materializeSVInt(), orderedRootOps, sourceManager, and symbolTable.
Referenced by convertSystemCall().
| bool Context::isClassDerivedFrom | ( | const moore::ClassHandleType & | actualTy, |
| const moore::ClassHandleType & | baseTy | ||
| ) |
Checks whether one class (actualTy) is derived from another class (baseTy).
True if it's a subclass, false otherwise.
Definition at line 4290 of file Expressions.cpp.
References resolve().
| LogicalResult Context::materializeClassMethods | ( | const slang::ast::ClassType & | classdecl | ) |
Definition at line 2867 of file Structure.cpp.
References classes, materializeClassMethods(), and timeScale.
Referenced by convertCompilation(), and materializeClassMethods().
| Value Context::materializeConstant | ( | const slang::ConstantValue & | constant, |
| const slang::ast::Type & | type, | ||
| Location | loc | ||
| ) |
Helper function to materialize a ConstantValue as an SSA value.
Returns null if the constant cannot be materialized.
Definition at line 2961 of file Expressions.cpp.
References materializeFixedSizeUnpackedArrayType(), materializeString(), materializeSVInt(), and materializeSVReal().
Referenced by getOrCreateEnumHelper().
| Value Context::materializeConversion | ( | Type | type, |
| Value | value, | ||
| bool | isSigned, | ||
| Location | loc, | ||
| bool | fallible = false |
||
| ) |
Helper function to insert the necessary operations to cast a value from one type to another.
If fallible is true, conversion failures are reported by returning a null value without emitting diagnostics.
Definition at line 3121 of file Expressions.cpp.
References assert(), builder, circt::moore::f32, circt::moore::FourValued, getContext(), getTimeScaleInFemtoseconds(), materializeConversion(), materializePackedToSBVConversion(), materializeSBVToPackedConversion(), maybeUpcastHandle(), and circt::moore::TwoValued.
Referenced by convertNInputPrimitive(), convertNOutputPrimitive(), convertPullGatePrimitive(), convertRvalueExpression(), convertSampledValueCallExpression(), convertSystemCall(), convertToBool(), convertToSimpleBitVector(), materializeConversion(), and materializeSVInt().
| Value Context::materializeFixedSizeUnpackedArrayType | ( | const slang::ConstantValue & | constant, |
| const slang::ast::FixedSizeUnpackedArrayType & | astType, | ||
| Location | loc | ||
| ) |
Helper function to materialize an unpacked array of SVInts as an SSA value.
Definition at line 2888 of file Expressions.cpp.
References builder, convertSVIntToFVInt(), convertType(), circt::moore::FourValued, getContext(), materializeString(), and circt::moore::TwoValued.
Referenced by materializeConstant().
| Value Context::materializePackedToSBVConversion | ( | Value | value, |
| Location | loc, | ||
| bool | fallible | ||
| ) |
Helper function to convert a PackedType value to its simple bit vector representation, with special handling for time values which require scaling by the local timescale.
If fallible is true, conversion failures are reported by returning a null value without emitting diagnostics.
Definition at line 3015 of file Expressions.cpp.
References assert(), builder, circt::moore::FourValued, getTimeScaleInFemtoseconds(), and circt::moore::isIntType().
Referenced by convertSampledValueCallExpression(), convertSystemCall(), and materializeConversion().
| Value Context::materializeString | ( | const slang::ConstantValue & | string, |
| const slang::ast::Type & | astType, | ||
| Location | loc | ||
| ) |
Helper function to materialize a string as an SSA value.
Materialize a Slang string literal as a literal string constant op.
Definition at line 2855 of file Expressions.cpp.
References builder, and getContext().
Referenced by materializeConstant(), and materializeFixedSizeUnpackedArrayType().
| Value Context::materializeSVInt | ( | const slang::SVInt & | svint, |
| const slang::ast::Type & | type, | ||
| Location | loc | ||
| ) |
Helper function to materialize an SVInt as an SSA value.
Materialize a Slang integer literal as a constant op.
Definition at line 2869 of file Expressions.cpp.
References builder, convertSVIntToFVInt(), convertType(), circt::moore::FourValued, getContext(), materializeConversion(), and circt::moore::TwoValued.
Referenced by getOrCreateEnumHelper(), and materializeConstant().
| Value Context::materializeSVReal | ( | const slang::ConstantValue & | svreal, |
| const slang::ast::Type & | type, | ||
| Location | loc | ||
| ) |
Helper function to materialize a real value as an SSA value.
Materialize a Slang real literal as a constant op.
Definition at line 2833 of file Expressions.cpp.
References assert(), and builder.
Referenced by materializeConstant().
| FailureOr< Value > Context::materializeVirtualInterfaceValue | ( | const slang::ast::VirtualInterfaceType & | type, |
| Location | loc | ||
| ) |
Materialize a Moore value representing a concrete interface instance as a virtual interface handle.
This only succeeds for the Slang VirtualInterfaceType wrappers that refer to a real interface instance (isRealIface).
Definition at line 357 of file Types.cpp.
References builder, convertLocation(), convertLvalueExpression(), convertVirtualInterfaceType(), interfaceInstances, valueSymbols, virtualIfaceLowerings, and virtualIfaceModportLowerings.
| void Context::populateSampledValueClocks | ( | ) |
Generates a map from sampled value system calls to clocks using Slang's analysis.
Definition at line 526 of file AssertionExpr.cpp.
References compilation, and sampledValueCallClocks.
Referenced by convertCompilation().
| LogicalResult Context::registerVirtualInterfaceMembers | ( | const slang::ast::ValueSymbol & | base, |
| const slang::ast::VirtualInterfaceType & | type, | ||
| Location | loc | ||
| ) |
Register the interface members of a virtual interface base symbol for use in later expression conversion.
Definition at line 474 of file Types.cpp.
References circt::ImportVerilog::VirtualInterfaceMemberAccess::base, builder, convertLocation(), circt::ImportVerilog::VirtualInterfaceMemberAccess::fieldName, and virtualIfaceMembers.
Referenced by defineFunction().
| Value Context::resolveCapturedValue | ( | const slang::ast::ValueSymbol & | sym | ) |
If sym is captured by the function currently being converted, return the value it is bound to (the capture block argument); otherwise return null.
Definition at line 2765 of file Expressions.cpp.
References circt::ImportVerilog::FunctionLowering::capturedSymbols, currentFunctionLowering, and valueSymbols.
| void Context::traverseInstanceBody | ( | const slang::ast::InstanceSymbol & | symbol | ) |
Definition at line 154 of file HierarchicalNames.cpp.
Referenced by convertCompilation().
| OpBuilder circt::ImportVerilog::Context::builder |
The builder used to create IR operations.
Definition at line 483 of file ImportVerilogInternals.h.
Referenced by buildHierValueKey(), convertCompilation(), convertGlobalVariable(), convertInsideCheck(), convertLTLTimingControl(), convertModuleBody(), convertModuleHeader(), convertNInputPrimitive(), convertNOutputPrimitive(), convertPackage(), convertPullGatePrimitive(), convertSampledValueCallArity1(), convertSampledValueCallExpression(), convertStatement(), convertSystemCall(), convertTimingControl(), convertToBool(), convertToI1(), convertVirtualInterfaceType(), declareCallableImpl(), declareClass(), defineFunction(), ensureMonitorGlobals(), ensureTimeFormatGlobal(), flushPendingMonitors(), getOrCreateEnumHelper(), materializeConversion(), materializeFixedSizeUnpackedArrayType(), materializePackedToSBVConversion(), materializeString(), materializeSVInt(), materializeSVReal(), materializeVirtualInterfaceValue(), and registerVirtualInterfaceMembers().
| DenseMap<const slang::ast::ClassType *, std::unique_ptr<ClassLowering> > circt::ImportVerilog::Context::classes |
Classes that have already been converted.
Definition at line 544 of file ImportVerilogInternals.h.
Referenced by buildClassProperties(), convertCompilation(), declareClass(), declareFunction(), and materializeClassMethods().
| slang::ast::Compilation& circt::ImportVerilog::Context::compilation |
Definition at line 478 of file ImportVerilogInternals.h.
Referenced by convertCompilation(), evaluateConstant(), and populateSampledValueClocks().
| const slang::ast::DefinitionSymbol* circt::ImportVerilog::Context::currentDefinition = nullptr |
The definition symbol of the module body currently being converted.
Used to resolve the l/L library binding format specifier.
Definition at line 636 of file ImportVerilogInternals.h.
Referenced by convertModuleBody().
| FunctionLowering* circt::ImportVerilog::Context::currentFunctionLowering = nullptr |
The function currently being converted, if any.
Used to give captured symbols priority over module-level hierarchical values inside function bodies.
Definition at line 627 of file ImportVerilogInternals.h.
Referenced by defineFunction(), and resolveCapturedValue().
| Value circt::ImportVerilog::Context::currentQueue = {} |
Variable that tracks the queue which we are currently converting the index expression for.
This is necessary to implement the $ operator, which returns the index of the last element of the queue.
Definition at line 632 of file ImportVerilogInternals.h.
Referenced by getIndexedQueue().
| Value circt::ImportVerilog::Context::currentThisRef = {} |
Variable to track the value of the current function's implicit this reference.
Definition at line 622 of file ImportVerilogInternals.h.
Referenced by defineFunction(), and getImplicitThisRef().
| DenseMap<const slang::ast::SubroutineSymbol *, std::string> circt::ImportVerilog::Context::dpiExportCNames |
DPI-C export directives keyed by the SystemVerilog subroutine they expose.
Definition at line 533 of file ImportVerilogInternals.h.
Referenced by declareCallableImpl().
| DenseMap< std::pair<const slang::ast::EnumType *, slang::parsing::KnownSystemName>, mlir::func::FuncOp> circt::ImportVerilog::Context::enumHelpers |
Helper functions generated for the enum built-in methods, keyed by the canonical enum type and the method they implement.
Definition at line 540 of file ImportVerilogInternals.h.
Referenced by getOrCreateEnumHelper().
| CaptureMap circt::ImportVerilog::Context::functionCaptures |
Pre-computed capture analysis: maps each function to the set of non-local, non-global variables it captures (directly or transitively).
Definition at line 572 of file ImportVerilogInternals.h.
Referenced by convertCompilation(), and declareCallableImpl().
| DenseMap<const slang::ast::SubroutineSymbol *, std::unique_ptr<FunctionLowering> > circt::ImportVerilog::Context::functions |
Functions that have already been converted.
Definition at line 530 of file ImportVerilogInternals.h.
Referenced by declareCallableImpl(), declareFunction(), and defineFunction().
| std::queue<const slang::ast::SubroutineSymbol *> circt::ImportVerilog::Context::functionWorklist |
A list of functions for which the declaration has been created, but the body has not been defined yet.
Definition at line 525 of file ImportVerilogInternals.h.
Referenced by convertCompilation(), and declareCallableImpl().
| DenseMap<const slang::ast::ValueSymbol *, moore::GlobalVariableOp> circt::ImportVerilog::Context::globalVariables |
A table of defined global variables that may be referred to by name in expressions.
Definition at line 565 of file ImportVerilogInternals.h.
Referenced by convertCompilation(), and convertGlobalVariable().
| SmallVector<const slang::ast::ValueSymbol *> circt::ImportVerilog::Context::globalVariableWorklist |
A list of global variables that still need their initializers to be converted.
Definition at line 568 of file ImportVerilogInternals.h.
Referenced by convertCompilation(), and convertGlobalVariable().
| DenseMap<const slang::ast::InstanceBodySymbol *, SmallVector<HierPathInfo> > circt::ImportVerilog::Context::hierPaths |
Collect all hierarchical names used for the per module/instance.
The keys are the slang canonical instance bodies (or the real instance if slang's getCanonicalBody() returned null).
Definition at line 578 of file ImportVerilogInternals.h.
Referenced by convertModuleBody().
| DenseMap<std::pair<const slang::ast::InstanceSymbol *, mlir::StringAttr>, Value> circt::ImportVerilog::Context::hierValueSymbols |
Persistent map for hierarchical value lookups.
Keyed by a composite of the instance symbol (the specific instance being wired, e.g., p1 or p2) and the hierarchical path name (e.g., "child.child_val"). This ensures instance-specific resolution even when Slang shares or doesn't share instance bodies across multiple instances of the same module.
Definition at line 587 of file ImportVerilogInternals.h.
| InterfaceInstances circt::ImportVerilog::Context::interfaceInstances |
Definition at line 504 of file ImportVerilogInternals.h.
Referenced by convertModuleBody(), and materializeVirtualInterfaceValue().
| SmallVector<std::unique_ptr<InterfaceLowering> > circt::ImportVerilog::Context::interfaceInstanceStorage |
Owning storage for InterfaceLowering objects because ScopedHashTable stores values by copy.
Definition at line 507 of file ImportVerilogInternals.h.
Referenced by convertModuleBody().
| mlir::ModuleOp circt::ImportVerilog::Context::intoModuleOp |
Definition at line 479 of file ImportVerilogInternals.h.
Referenced by convertGlobalVariable(), convertPackage(), declareCallableImpl(), declareClass(), ensureMonitorGlobals(), ensureTimeFormatGlobal(), getContext(), and getOrCreateEnumHelper().
| bool circt::ImportVerilog::Context::isInsideTimingControl = false |
Whether we are currently converting expressions inside a timing control, such as @(posedge clk).
This is used by the implicit event control callback to avoid adding reads from explicit event controls to the implicit sensitivity list.
Definition at line 615 of file ImportVerilogInternals.h.
Referenced by convertTimingControl().
| SmallVector<LoopFrame> circt::ImportVerilog::Context::loopStack |
A stack of loop continuation and exit blocks.
Each loop will push the relevant info onto this stack, lower its loop body statements, and pop the info off the stack again. Continue and break statements encountered as part of the loop body statements will use this information to branch to the correct block.
Definition at line 600 of file ImportVerilogInternals.h.
| SmallVector<Value> circt::ImportVerilog::Context::lvalueStack |
A stack of assignment left-hand side values.
Each assignment will push its lowered left-hand side onto this stack before lowering its right-hand side. This allows expressions to resolve the opaque LValueReferenceExpressions in the AST.
Definition at line 593 of file ImportVerilogInternals.h.
| DenseMap<const slang::ast::InstanceBodySymbol *, std::unique_ptr<ModuleLowering> > circt::ImportVerilog::Context::modules |
How we have lowered modules to MLIR.
The keys must be the slang canonical module bodies where they exist.
Definition at line 495 of file ImportVerilogInternals.h.
Referenced by convertModuleBody(), and convertModuleHeader().
| std::queue<const slang::ast::InstanceBodySymbol *> circt::ImportVerilog::Context::moduleWorklist |
A list of modules for which the header has been created, but the body has not been converted yet.
Definition at line 521 of file ImportVerilogInternals.h.
Referenced by convertCompilation().
| moore::GlobalVariableOp circt::ImportVerilog::Context::monitorActiveIdGlobal = nullptr |
Global variable ops for $monitor state management.
These are created on demand by ensureMonitorGlobals().
Definition at line 652 of file ImportVerilogInternals.h.
Referenced by ensureMonitorGlobals(), and flushPendingMonitors().
| moore::GlobalVariableOp circt::ImportVerilog::Context::monitorEnabledGlobal = nullptr |
Definition at line 653 of file ImportVerilogInternals.h.
Referenced by ensureMonitorGlobals(), and flushPendingMonitors().
| unsigned circt::ImportVerilog::Context::nextMonitorId = 1 |
The next monitor ID to allocate. ID 0 is reserved for "no monitor active".
Definition at line 660 of file ImportVerilogInternals.h.
| const ImportVerilogOptions& circt::ImportVerilog::Context::options |
Definition at line 477 of file ImportVerilogInternals.h.
| std::map<LocationKey, Operation *> circt::ImportVerilog::Context::orderedRootOps |
The top-level operations ordered by their Slang source location.
This is used to produce IR that follows the source file order.
Definition at line 489 of file ImportVerilogInternals.h.
Referenced by convertGlobalVariable(), declareCallableImpl(), declareClass(), and getOrCreateEnumHelper().
| SmallVector<PendingMonitor> circt::ImportVerilog::Context::pendingMonitors |
Pending $monitor calls that need to be converted at module level.
Definition at line 671 of file ImportVerilogInternals.h.
Referenced by flushPendingMonitors().
| DenseSet<const slang::ast::InstanceSymbol *> circt::ImportVerilog::Context::predeclaredInstances |
Module instances already emitted by the predeclaration pass.
These are skipped during the later source-order module-body walk to avoid emitting duplicate instances.
Definition at line 512 of file ImportVerilogInternals.h.
Referenced by convertModuleBody().
| std::function<void(moore::ReadOp)> circt::ImportVerilog::Context::rvalueReadCallback |
A listener called for every variable or net being read.
This can be used to collect all variables read as part of an expression or statement, for example to populate the list of observed signals in an implicit event control @*.
Definition at line 606 of file ImportVerilogInternals.h.
Referenced by convertTimingControl().
| DenseMap<const slang::ast::CallExpression *, const slang::ast::TimingControl *> circt::ImportVerilog::Context::sampledValueCallClocks |
Maps sampled value system calls to their corresponding clocks.
Definition at line 313 of file ImportVerilogInternals.h.
Referenced by convertSampledValueCallExpression(), and populateSampledValueClocks().
| const slang::SourceManager& circt::ImportVerilog::Context::sourceManager |
Definition at line 480 of file ImportVerilogInternals.h.
Referenced by convertGlobalVariable(), convertLocation(), convertLocation(), declareCallableImpl(), declareClass(), and getOrCreateEnumHelper().
| SymbolTable circt::ImportVerilog::Context::symbolTable |
A symbol table of the MLIR module we are emitting into.
Definition at line 485 of file ImportVerilogInternals.h.
Referenced by convertGlobalVariable(), declareCallableImpl(), declareClass(), ensureMonitorGlobals(), ensureTimeFormatGlobal(), and getOrCreateEnumHelper().
| moore::GlobalVariableOp circt::ImportVerilog::Context::timeFormatGlobal = nullptr |
Global variable ops for $timeformat state management.
These are created on demand by ensureTimeFormatGlobal().
Definition at line 657 of file ImportVerilogInternals.h.
Referenced by ensureTimeFormatGlobal().
| slang::TimeScale circt::ImportVerilog::Context::timeScale |
The time scale currently in effect.
Definition at line 618 of file ImportVerilogInternals.h.
Referenced by buildClassProperties(), convertCompilation(), convertModuleBody(), convertModuleHeader(), convertPackage(), defineFunction(), and materializeClassMethods().
| ValueSymbols circt::ImportVerilog::Context::valueSymbols |
Definition at line 552 of file ImportVerilogInternals.h.
Referenced by convertModuleBody(), convertPackage(), defineFunction(), materializeVirtualInterfaceValue(), and resolveCapturedValue().
| std::function<void(mlir::Operation *)> circt::ImportVerilog::Context::variableAssignCallback |
A listener called for every variable or net being assigned.
This can be used to collect all variables assigned in a task scope.
Definition at line 609 of file ImportVerilogInternals.h.
| DenseMap<const slang::ast::InstanceBodySymbol *, VirtualInterfaceLowering> circt::ImportVerilog::Context::virtualIfaceLowerings |
Cached virtual interface layouts (type + field order).
Definition at line 516 of file ImportVerilogInternals.h.
Referenced by convertVirtualInterfaceType(), and materializeVirtualInterfaceValue().
| VirtualInterfaceMembers circt::ImportVerilog::Context::virtualIfaceMembers |
Definition at line 560 of file ImportVerilogInternals.h.
Referenced by convertModuleBody(), defineFunction(), and registerVirtualInterfaceMembers().
| DenseMap<const slang::ast::ModportSymbol *, VirtualInterfaceLowering> circt::ImportVerilog::Context::virtualIfaceModportLowerings |
Definition at line 518 of file ImportVerilogInternals.h.
Referenced by convertVirtualInterfaceType(), and materializeVirtualInterfaceValue().