slang::ast namespace

The SystemVerilog AST.

Classes

class AbortAssertionExpr
Represents an abort (accept_on / reject_on) property expression.
class ArbitrarySymbolExpression
Adapts an arbitrary symbol reference for use in an expression tree.
class AssertionExpr
The base class for assertion expressions (sequences and properties).
struct AssertionInstanceDetails
Information required to instantiate a sequence, property, or checker instance.
class AssertionInstanceExpression
Represents an instance of an assertion item, either a sequence, a property, or a formal argument that is being referenced and expanded.
class AssertionPortSymbol
Represents a formal argument / port of an assertion construct, such as a sequence, property, or let construct.
class AssignmentExpression
Represents an assignment expression.
class AssignmentPatternExpressionBase
Base class for assignment pattern expressions.
class AssociativeArrayType
Represents an unpacked array that provides associative lookup.
class ASTContext
Contains required context for binding syntax nodes with symbols to form an AST.
class ASTSerializer
A class that serializes AST nodes to JSON.
template<typename TDerived, bool VisitStatements, bool VisitExpressions, bool VisitBad = false>
class ASTVisitor
A base class for AST visitors.
class BinaryAssertionExpr
Represents a binary operator in a sequence or property expression.
class BinaryExpression
Represents a binary operator expression.
struct BindDirectiveInfo
Information about how a bind directive applies to some definition or specific target node.
class Bitstream
Provides utility methods for working with bitstream operations.
class BlockEventListControl
Represents a list of block events (used within coverage events).
class BlockStatement
Represents a sequential or parallel block statement.
class BreakStatement
Represents a break statement.
class CallExpression
Represents a subroutine call.
class CaseAssertionExpr
Represents a case operator in a property expression.
class CaseStatement
Represents a case statement.
class CHandleType
Represents storage for pointers passed using the DPI (a "C" compatible handle).
class CheckerSymbol
Represents a checker declaration.
class ClassBuilder
A helper class for constructing class types programmatically.
class ClassType
Represents a class definition type.
class ClockingAssertionExpr
Represents an assertion expression with attached clocking control.
class ClockingBlockSymbol
Represents a clocking block.
class ClockingEventExpression
Represents a clocking event expression.
class ClockingSkew
Represents a skew value that is applied to clocking block signals.
class ClockVarSymbol
Represents a clocking block signal.
class Compilation
A centralized location for creating and caching symbols.
struct CompilationOptions
Contains various options that can control compilation behavior.
class CompilationUnitSymbol
The root of a single compilation unit.
class ConcatenationExpression
Represents a concatenation expression.
class ConcurrentAssertionStatement
Represents a concurrent assertion statement.
class ConditionalAssertionExpr
Represents a conditional operator in a property expression.
class ConditionalConstraint
Represents a constraint defined by an if-else condition.
class ConditionalExpression
Represents a conditional operator expression.
class ConditionalStatement
Represents a conditional statement.
class ConfigBlockSymbol
Represents a config block declaration.
struct ConfigRule
A rule that controls how a specific cell or instance in the design is configured.
class ConstantPattern
Reresents a pattern that matches a given constant expression.
class Constraint
The base class for all constraints in SystemVerilog.
class ConstraintBlockSymbol
Represents a named constraint block declaration within a class.
class ConstraintList
Represents a list of constraints.
class ContinueStatement
Represents a continue statement.
class ContinuousAssignSymbol
Represents a continuous assignment statement.
class ConversionExpression
Represents a type conversion expression (implicit or explicit).
class CopyClassExpression
Represents a new expression that copies a class instance.
class CoverCrossBodySymbol
Represents the body of a cover cross type, separated out because the members of the cross body can't be accessed outside of the cross itself.
class CovergroupBodySymbol
Represents the body of a covergroup type, separated out because the arguments of a covergroup need to live in their own scope so that they can be shadowed by body members.
class CovergroupType
Represents a covergroup definition type.
class CycleDelayControl
Represents a cycle-based delay control.
class DataTypeExpression
Adapts a data type for use in an expression tree.
class DeclaredType
Ties together various syntax nodes that declare the type of some parent symbol along with the logic necessary to resolve that type.
class DefinitionSymbol
Represents a module, interface, or program definition.
class DefParamSymbol
Represents a defparam directive.
class Delay3Control
Represents multiple delays associated with a single gate primitive.
class DelayControl
Represents a delay time control.
class DisableForkStatement
Represents a disable fork statement.
class DisableIffAssertionExpr
Represents a disable iff condition in a property spec.
class DisableSoftConstraint
Represents a constraint that disables a soft random variable.
class DisableStatement
Represents a disable statement.
class DistExpression
Denotes an expression along with a distribution of probabilities for that expression.
class DoWhileLoopStatement
Represents a do while loop statement.
class DPIOpenArrayType
A special case for DPI imports that have "open array" typed arguments.
class DynamicArrayType
Represents a dynamically sized unpacked array.
class ElabSystemTaskSymbol
Represents an elaboration system task, such as $error or $warning.
class ElementSelectExpression
Represents a single element selection expression.
class EmptyArgumentExpression
Represents an empty argument.
class EmptyMemberSymbol
Represents an empty member, i.e.
class EmptyStatement
Represents an empty statement, used as a placeholder or an anchor for attributes.
class EnumType
Represents an enumerated type.
class EnumValueSymbol
Represents an enumerated value / member.
class ErrorType
An empty type symbol that indicates an error occurred while trying to resolve the type of some expression or declaration.
class EvalContext
A container for all context required to evaluate a statement or expression.
struct EvaluatedDimension
The result of evaluating dimension syntax nodes.
class EventListControl
Represents a list of timing controls to wait on.
class EventTriggerStatement
Represents an event triggering statement.
class EventType
Represents a SystemVerilog event handle, which is used for synchronization between asynchronous processes.
class ExplicitImportSymbol
Represents an explicit import from a package.
class Expression
The base class for all expressions in SystemVerilog.
class ExpressionConstraint
Represents a constraint defined by a logical expression.
class ExpressionStatement
Represents an expression that is executed as a standalone statement.
class FieldSymbol
Represents a field member of a struct or union.
class FirstMatchAssertionExpr
Represents a first_match operator in a sequence expression.
class FixedSizeUnpackedArrayType
Represents a fixed size unpacked array (as opposed to a dynamically sized unpacked array, associative array, or queue).
class FloatingType
Represents one of the predefined floating point types, which are used for representing real numbers.
class ForeachConstraint
Represents a constraint that iterates over the elements of an array.
class ForeachLoopStatement
Represents a foreach loop statement.
class ForeverLoopStatement
Represents a forever loop statement.
class ForLoopStatement
Represents a for loop statement.
class FormalArgumentSymbol
Represents a formal argument in subroutine (task or function).
class ForwardingTypedefSymbol
A forward declaration of a user-defined type name.
class GenerateBlockArraySymbol
Represents an array of generate blocks, as generated by a loop generate construct.
class GenerateBlockSymbol
Represents blocks that are instantiated by a loop generate or conditional generate construct.
class GenericClassDefSymbol
Represents a generic class definition, which is a parameterized class that has not yet had its parameter values specified.
class GenvarSymbol
Represents a genvar declaration.
class HierarchicalReference
Represents a hierarchical reference to a symbol.
class HierarchicalValueExpression
Represents an expression that references a named value via hierarchical path.
struct HierarchyOverrideNode
A node in a tree representing an instance in the design hierarchy where parameters should be overriden and/or bind directives should be applied.
class ImmediateAssertionStatement
Represents an immediate assertion statement.
class ImplicationConstraint
Represents a constraint defined by an implication.
class ImplicitEventControl
Represents an implicit event control (i.e. the @* construct).
class InsideExpression
Represents a set membership operator expression.
class InstanceSymbol
Represents an instance of a module, interface, or program.
class InstanceSymbolBase
Common functionality for module, interface, program, and primitive instances.
class IntegerLiteral
Represents an integer literal.
class IntegralType
A base class for integral types, which include all scalar types, predefined integer types, packed arrays, packed structures, packed unions, and enum types.
class InterfacePortSymbol
Represents the public-facing side of a module / program / interface port that is also a connection to an interface instance (optionally with a modport restriction).
class InvalidAssertionExpr
Represents an invalid expression.
class InvalidConstraint
Represents an invalid constraint.
class InvalidExpression
Represents an invalid expression.
class InvalidPattern
Represents an invalid pattern.
class InvalidStatement
Represents an invalid statement.
class InvalidTimingControl
Represents an invalid timing control.
class IteratorSymbol
Represents an iterator variable created for array manipulation methods.
class LetDeclSymbol
Represents a let declaration.
class LocalAssertionVarSymbol
Represents a local variable declared inside an assertion item, such as a sequence or property.
class Lookup
Centralized functionality for looking up symbols by name in the AST.
class LookupLocation
This type denotes the ordering of symbols within a particular scope, for the purposes of determining whether a found symbol is visible compared to the given location.
struct LookupResult
A structure that contains the results of a name lookup operation.
class LValue
A representation of an lvalue used for constant evaluation.
class LValueReferenceExpression
A placeholder expression that is generated to take the place of one side of a compound assignment expression's binary operator.
class MemberAccessExpression
Represents an access of a structure variable's members.
class MethodBuilder
A helper class for constructing method symbols programmatically.
class MinTypMaxExpression
Represents a min:typ:max expression.
class ModportClockingSymbol
Represents a clocking block port.
class ModportPortSymbol
Represents a single port specifier in a modport declaration.
class ModportSymbol
Represents a modport within an interface definition.
class MultiPortSymbol
Represents a multi-port, which is a port symbol that externally appears as a single connection but internally connects to multiple names, potentially with varying directions.
class NamedValueExpression
Represents an expression that references a named value.
class NetSymbol
Represents a net declaration.
class NetType
Base class for all net types in SystemVerilog.
class NewArrayExpression
Represents a new[] expression that creates a dynamic array.
class NewClassExpression
Represents a new expression that creates a class instance.
class NewCovergroupExpression
Represents a new expression that creates a covergroup instance.
class NonConstantFunction
An implementation of the SystemSubroutine interface that is also a "simple" subroutine that is also not allowed in constant contexts.
class NullLiteral
Represents a null literal.
class NullType
Represents the Null type.
class OneStepDelayControl
Represents the built-in 1step delay.
class OpaqueInstancePath
Represents a path to a specific instance in a design.
class PackageSymbol
A SystemVerilog package construct.
class PackedArrayType
Represents a packed array of some simple element type (vectors, packed structures, other packed arrays).
class PackedStructType
Represents a packed structure of members.
class PackedUnionType
Represents a packed union of members.
class ParameterSymbol
Represents a parameter value.
class Pattern
Base class for "patterns", as used in pattern matching conditional statements and expressions.
class PatternCaseStatement
Represents a pattern case statement.
class PatternVarSymbol
Represents a pattern variable materialized for a pattern matching expression.
class PortSymbol
Represents the public-facing side of a module / program / interface port.
class PredefinedIntegerType
Represents the predefined integer types, which are essentially predefined vector types.
class ProceduralAssignStatement
Represents a procedural assign statement.
class ProceduralCheckerStatement
Represents a procedural checker instantiation statement.
class ProceduralDeassignStatement
Represents a procedural deassign statement.
class PropertySymbol
Represents a named property object.
class PropertyType
Represents the type of property instances and arguments.
class QueueType
Represents an unpacked array that provides queue semantics.
class RandCaseStatement
Represents a randcase statement.
class RandSequenceStatement
Represents a randsequence statement.
class RangeSelectExpression
Represents a range selection expression.
class RealLiteral
Represents a real number literal.
class RepeatedEventControl
Represents a repeat event control.
class RepeatLoopStatement
Represents a repeat loop statement.
class ReplicatedAssignmentPatternExpression
Represents a replicated assignment pattern expression.
class ReplicationExpression
Represents a replication expression.
struct ResolvedConfig
Contains information about a resolved configuration rule that affects an instance and the hierarchy underneath it.
class ReturnStatement
Represents a return statement.
class RootSymbol
Represents the entirety of a design, along with all contained compilation units.
class ScalarType
Represents the single-bit scalar types.
class Scope
Base class for symbols that represent a name scope; that is, they contain children and can participate in name lookup.
class ScriptSession
A helper class that allows evaluating arbitrary snippets of SystemVerilog source code and maintaining state across multiple eval calls.
class SemanticFacts
A helper class that can extract semantic AST information from tokens and syntax nodes.
class SequenceConcatExpr
Represents an assertion expression defined as a delayed concatenation of other expressions.
struct SequenceRange
Represents a range of potential sequence matches.
struct SequenceRepetition
Encodes a repetition of some sub-sequence.
class SequenceSymbol
Represents a named sequence object.
class SequenceType
Represents the type of sequence instances and arguments.
class SequenceWithMatchExpr
Represents a sequence expression along with a list of actions to perform upon matching and/or instructions for repetition.
class SignalEventControl
Represents a signal event control.
class SimpleAssertionExpr
Represents an assertion expression defined as a simple regular expression.
class SimpleAssignmentPatternExpression
Represents a simple assignment pattern expression.
class SimpleSystemSubroutine
An implementation of the SystemSubroutine interface that has basic argument types and a well-defined return type.
class SolveBeforeConstraint
Represents a constraint that enforces ordering of solving variables.
class SpecparamSymbol
Represents a specify parameter.
class Statement
The base class for all statements in SystemVerilog.
class StatementList
Represents a list of statements.
class StreamingConcatenationExpression
Represents a streaming concatenation.
class StringLiteral
Represents a string literal.
class StringType
Represents the built-in ASCII string type.
class StrongWeakAssertionExpr
Represents a strong or weak operator in a property expression.
class StructBuilder
A helper class for constructing struct types programmatically.
class StructuredAssignmentPatternExpression
Represents a structured assignment pattern expression.
class StructurePattern
Represents a pattern that matches a structure.
class SubroutineSymbol
Represents a subroutine (task or function).
class Symbol
Base class for all symbols (logical code constructs) such as modules, types, functions, variables, etc.
class SystemSubroutine
The base class for built-in system subroutines.
class TaggedPattern
Represents a pattern that matches a member of a tagged union.
class TaggedUnionExpression
Represents a tagged union member setter expression.
class TempVarSymbol
Represents a temporary variable materialized within a limited scope such as a single expression.
class TimedStatement
Represents a statement that has an associated timing control.
class TimeLiteral
Represents a time literal.
class TimingControl
The base class for SystemVerilog timing controls (delay, event, etc).
class TransparentMemberSymbol
A class that wraps a hoisted transparent type member, such as an enum value or a symbol inherited from a base class, into a scope.
class Type
Base class for all data types in SystemVerilog.
class TypeAliasType
Represents a type alias, which is introduced via a typedef or type parameter.
class TypeArgFormatter
A diagnostic argument formatter specifically for formatting types.
class TypePrinter
A utility class that prints a SystemVerilog type to a string.
struct TypePrintingOptions
A collection of type printing options.
class TypeReferenceExpression
An expression that gets the type of a nested expression using the type() operator.
class TypeRefType
Represents the result of a type reference expression, i.e. the type() operator.
class UnaryAssertionExpr
Represents a unary operator in a property expression.
class UnaryExpression
Represents a unary operator expression.
class UnbasedUnsizedIntegerLiteral
Represents an unbased unsized integer literal, which fills all bits in an expression.
class UnboundedLiteral
Represents the unbounded queue or range literal.
class UnboundedType
Represents the '$' special token that is a standin for the unbounded end of a queue or range selection.
class UninstantiatedDefSymbol
Represents an instance of a definition (module / interface / program / checker) that is not actually instantiated in the design.
class UniquenessConstraint
Represents a constraint that enforces uniqueness of variables.
class UnpackedStructType
Represents an unpacked structure of members.
class UnpackedUnionType
Represents an unpacked union of members.
class UntypedType
Represents an 'untyped' type, which is used for e.g. arguments of sequences.
class ValueDriver
Represents an expression that drives a value by assigning to some range of its type.
class ValueExpressionBase
Common base class for both NamedValueExpression and HierarchicalValueExpression.
class ValueRangeExpression
Denotes a range of values by providing expressions for the lower and upper bounds of the range.
class ValueSymbol
A base class for symbols that represent a value (for example a variable or a parameter).
class VariableDeclStatement
Represents a variable declaration in a statement context.
class VariablePattern
Represents a pattern that stores its match in a pattern variable.
class VariableSymbol
Represents a variable declaration.
class VirtualInterfaceType
Represents a virtual interface type.
class VoidType
Represents the Void (or lack of a) type.
class WaitForkStatement
Represents a wait fork statement.
class WaitOrderStatement
Represents a wait_order statement.
class WaitStatement
Represents a wait statement.
class WhileLoopStatement
Represents a while loop statement.
class WildcardImportSymbol
Represents a wildcard import declaration.
class WildcardPattern
Represents a wildcard pattern that matches anything.

Enums

enum class ASTFlags: uint64_t { None = 0, InsideConcatenation = 1ull << 0, UnevaluatedBranch = 1ull << 1, AllowDataType = 1ull << 2, NoAttributes = 1ull << 3, AssignmentAllowed = 1ull << 4, AssignmentDisallowed = 1ull << 5, NonProcedural = 1ull << 6, StaticInitializer = 1ull << 7, StreamingAllowed = 1ull << 8, TopLevelStatement = 1ull << 9, AllowUnboundedLiteral = 1ull << 10, AllowUnboundedLiteralArithmetic = 1ull << 11, Function = 1ull << 12, Final = 1ull << 13, NonBlockingTimingControl = 1ull << 14, EventExpression = 1ull << 15, AllowTypeReferences = 1ull << 16, AssertionExpr = 1ull << 17, AllowClockingBlock = 1ull << 18, AssertionInstanceArgCheck = 1ull << 19, AssertionDelayOrRepetition = 1ull << 20, LValue = 1ull << 21, PropertyNegation = 1ull << 22, PropertyTimeAdvance = 1ull << 23, RecursivePropertyArg = 1ull << 24, ConcurrentAssertActionBlock = 1ull << 25, AllowCoverageSampleFormal = 1ull << 26, AllowCoverpoint = 1ull << 27, AllowNetType = 1ull << 28, OutputArg = 1ull << 29, ProceduralAssign = 1ull << 30, ProceduralForceRelease = 1ull << 31, AllowInterconnect = 1ull << 32, NotADriver = 1ull << 33, StreamingWithRange = 1ull << 34, SpecifyBlock = 1ull << 35, SpecparamInitializer = 1ull << 36, DPIArg = 1ull << 37, AssertionDefaultArg = 1ull << 38, LAndRValue = 1ull << 39, NoReference = 1ull << 40, ConfigParam = 1ull << 41, TypeOperator = 1ull << 42, ForkJoinAnyNone = 1ull << 43, DisallowUDNT = 1ull << 44, BindInstantiation = 1ull << 45 }
Specifies flags that control expression and statement creation.
enum class EvalFlags: uint8_t { None = 0, IsScript = 1 << 0, CacheResults = 1 << 1, SpecparamsAllowed = 1 << 2, CovergroupExpr = 1 << 3, AllowUnboundedPlaceholder = 1 << 4 }
Various flags that can be applied to a constant expression evaluation.
enum class MinTypMax { Min, Typ, Max }
Specifies which set of min:typ:max expressions should be used during compilation.
enum class CompilationFlags { None = 0, AllowHierarchicalConst = 1 << 0, RelaxEnumConversions = 1 << 1, AllowUseBeforeDeclare = 1 << 2, AllowDupInitialDrivers = 1 << 3, AllowTopLevelIfacePorts = 1 << 4, StrictDriverChecking = 1 << 5, LintMode = 1 << 6, SuppressUnused = 1 << 7, IgnoreUnknownModules = 1 << 8, RelaxStringConversions = 1 << 9, AllowRecursiveImplicitCall = 1 << 10, AllowBareValParamAssignment = 1 << 11, AllowSelfDeterminedStreamConcat = 1 << 12, AllowMultiDrivenLocals = 1 << 13, AllowMergingAnsiPorts = 1 << 14, DisableInstanceCaching = 1 << 15 }
Defines flags that control compilation behavior.
enum class NondegeneracyStatus { None = 0, AdmitsEmpty = 1 << 0, AcceptsOnlyEmpty = 1 << 1, AdmitsNoMatch = 1 << 2 }
Specifies possible classifications of assertion expressions as they relate to "nondegeneracy", as described in the LRM.
enum class LookupFlags { None = 0, Type = 1 << 0, AllowDeclaredAfter = 1 << 1, DisallowWildcardImport = 1 << 2, NoUndeclaredError = 1 << 3, NoUndeclaredErrorIfUninstantiated = 1 << 4, AllowIncompleteForwardTypedefs = 1 << 5, NoParentScope = 1 << 6, NoSelectors = 1 << 7, AllowRoot = 1 << 8, AllowUnit = 1 << 9, IfacePortConn = 1 << 10, StaticInitializer = 1 << 11, TypeReference = 1 << 12, AlwaysAllowUpward = 1 << 13, DisallowUnitReferences = 1 << 14, ForceHierarchical = AllowDeclaredAfter | NoUndeclaredErrorIfUninstantiated }
Additional modifiers for a lookup operation.
enum class LookupResultFlags: uint8_t { None = 0, WasImported = 1 << 0, IsHierarchical = 1 << 1, SuppressUndeclared = 1 << 2, FromTypeParam = 1 << 3, FromForwardTypedef = 1 << 4 }
Flags that indicate additional details about the result of a lookup operation.
enum class AssignFlags: uint8_t { None = 0, NonBlocking = 1 << 0, InConcat = 1 << 1, InputPort = 1 << 2, OutputPort = 1 << 3, InOutPort = 1 << 4, ClockVar = 1 << 5, AssertionLocalVarFormalArg = 1 << 6, SlicedPort = 1 << 7 }
A set of flags that control how assignments are checked.
enum class StatementFlags { None = 0, InLoop = 1 << 0, InForkJoin = 1 << 1, InRandSeq = 1 << 2, InForLoop = 1 << 3, HasTimingError = 1 << 4 }
Various flags that control statement construction.
enum class SymbolIndex: uint32_t { }
A numeric index that can be used to compare the relative ordering of symbols within a single lexical scope.
enum class ConstraintBlockFlags: uint8_t { None = 0, Pure = 1 << 1, Static = 1 << 2, Extern = 1 << 3, ExplicitExtern = 1 << 4, Initial = 1 << 5, Extends = 1 << 6, Final = 1 << 7 }
Specifies various flags that can apply to constraint bocks.
enum class InstanceFlags: uint8_t { None = 0, Uninstantiated = 1 << 0, FromBind = 1 << 1, ParentFromBind = 1 << 2 }
Specifies various flags that describe instance behavior.
enum class MethodFlags: uint16_t { None = 0, Virtual = 1 << 0, Pure = 1 << 1, Static = 1 << 2, Constructor = 1 << 3, InterfaceExtern = 1 << 4, ModportImport = 1 << 5, ModportExport = 1 << 6, DPIImport = 1 << 7, DPIContext = 1 << 8, BuiltIn = 1 << 9, Randomize = 1 << 10, ForkJoin = 1 << 11, DefaultedSuperArg = 1 << 12, Initial = 1 << 13, Extends = 1 << 14, Final = 1 << 15 }
Specifies various flags that can apply to subroutines.
enum class VariableFlags: uint16_t { None = 0, Const = 1 << 0, CompilerGenerated = 1 << 1, ImmutableCoverageOption = 1 << 2, CoverageSampleFormal = 1 << 3, CheckerFreeVariable = 1 << 4, RefStatic = 1 << 5 }
Specifies various flags that can apply to variables.
enum class DeclaredTypeFlags { None = 0, InferImplicit = 1 << 0, InitializerCantSeeParent = 1 << 1, InitializerOverridden = 1 << 2, TypeOverridden = 1 << 3, AutomaticInitializer = 1 << 4, TypedefTarget = 1 << 5, NetType = 1 << 6, UserDefinedNetType = 1 << 7, FormalArgMergeVar = 1 << 8, Rand = 1 << 9, DPIReturnType = 1 << 10, DPIArg = 1 << 11, AllowUnboundedLiteral = 1 << 12, RequireSequenceType = 1 << 13, CoverageType = 1 << 14, InterconnectNet = 1 << 15, InterfaceVariable = 1 << 16, NeedsTypeCheck = NetType | UserDefinedNetType | FormalArgMergeVar | Rand | DPIReturnType | DPIArg | RequireSequenceType | CoverageType | InterfaceVariable }
Various flags that control declared type resolution.
enum class IntegralFlags: uint8_t { Unsigned = 0, TwoState = 0, Signed = 1, FourState = 2, Reg = 4 }
Specifies possible traits for integral types.

Functions

template<typename... Functions>
auto makeVisitor(Functions... funcs) -> auto
Creates an ASTVisitor out of the provided handler functions.

Enum documentation

enum class slang::ast::ASTFlags: uint64_t

Specifies flags that control expression and statement creation.

Enumerators
None

No special behavior specified.

InsideConcatenation

The expression is inside a concatenation; this enables slightly different creation rules.

UnevaluatedBranch

The expression is inside the unevaluated side of a conditional branch.

This is used to avoid issuing warnings for things that won't happen.

AllowDataType

Allow the expression to also be a data type; used in a few places like the first argument to system methods like $bits.

NoAttributes

Attributes are disallowed on expressions in this context.

AssignmentAllowed

Assignment is allowed in this context.

This flag is cleared for nested subexpressions, unless they are directly parenthesized.

AssignmentDisallowed

Assignments are disallowed in this context.

As opposed to the AssignmentAllowed flag, this is not cleared and overrides that fact even if we are in a procedural context and would otherwise be allowed to modify variables.

NonProcedural

Expression is not inside a procedural context.

StaticInitializer

Expression is for a static variable's initializer.

References to automatic variables will be disallowed.

StreamingAllowed

Streaming operator is allowed in assignment target, assignment source, bit-stream casting argument, or stream expressions of another streaming concatenation.

This flag is cleared for nested subexpressions, unless they are directly parenthesized.

TopLevelStatement

This is the first expression appearing as an expression statement; potentially this indicates whether a subroutine invocation is as a task (if set) or as a function (unset).

Cleared for nested subexpressions.

AllowUnboundedLiteral

Expression is allowed to be the unbounded literal '$' such as inside a queue select.

AllowUnboundedLiteralArithmetic

Expression is allowed to do arithmetic with an unbounded literal.

Function

AST creation is happening within a function body.

Final

AST creation is happening within a final block.

NonBlockingTimingControl

AST creation is happening within the intra-assignment timing control of a non-blocking assignment expression.

EventExpression

AST creation is happening within an event expression.

AllowTypeReferences

AST creation is in a context where type reference expressions are allowed.

AssertionExpr

AST creation is happening within an assertion expression (sequence or property).

AllowClockingBlock

Allow binding a clocking block as part of a top-level event expression.

AssertionInstanceArgCheck

AST creation is for checking an assertion argument, prior to it being expanded as part of an actual instance.

AssertionDelayOrRepetition

AST creation is for a cycle delay or sequence repetition, where references to assertion formal ports have specific type requirements.

LValue

AST creation is for the left hand side of an assignment operation.

PropertyNegation

AST creation is for the negation of a property, which disallows recursive instantiations.

PropertyTimeAdvance

AST creation is for a property that has come after a positive advancement of time within the parent property definition.

RecursivePropertyArg

AST creation is for an argument passed to a recursive property instance.

ConcurrentAssertActionBlock

AST creation is inside a concurrent assertion's action block.

AllowCoverageSampleFormal

AST creation is for a covergroup expression that permits referencing a formal argument of an overridden sample method.

AllowCoverpoint

Expressions are allowed to reference coverpoint objects directly.

AllowNetType

User-defined nettypes are allowed to be looked up in this context.

OutputArg

AST creation is for an output (or inout) port or function argument.

ProceduralAssign

AST creation is for a procedural assign statement.

ProceduralForceRelease

AST creation is for a procedural force / release / deassign statement.

AllowInterconnect

AST creation is in a context that allows interconnect nets.

NotADriver

AST creation is in a context where drivers should not be registered for lvalues, even if they otherwise would normally be.

This is used, for example, in potentially unrollable for loops to let the loop unroller handle the drivers.

StreamingWithRange

AST creation is for a range expression inside a streaming concatenation operator.

SpecifyBlock

AST creation is happening inside a specify block.

SpecparamInitializer

AST creation is for a specparam initializer expression.

DPIArg

AST creation is for a DPI argument type.

AssertionDefaultArg

AST creation is for an assertion instance's default argument.

LAndRValue

AST creation is for an lvalue that also counts as an rvalue.

Only valid when combined with the LValue flag – used for things like the pre & post increment and decrement operators.

NoReference

AST binding should not count symbol references towards that symbol being "used".

If this flag is not set, accessing a variable or net in an expression will count that symbol as being "used".

ConfigParam

AST binding is for a parameter inside a SystemVerilog configuration.

TypeOperator

AST binding is for the contents of the type() operator.

ForkJoinAnyNone

AST binding is inside a fork-join_any or fork-join_none block.

DisallowUDNT

AST binding disallows nets with a user-defined nettype (UDNT).

BindInstantiation

AST binding is for a bind instantiation (port connection or param value).

enum class slang::ast::EvalFlags: uint8_t

Various flags that can be applied to a constant expression evaluation.

Enumerators
None

No special flags specified.

IsScript

This evaluation is happening inside of a script, so some language rules should be relaxed.

CacheResults

The results of the evaluation can be cached in each expression's constant pointer.

SpecparamsAllowed

Specparams are allowed during evaluation.

CovergroupExpr

Evaluation is for a covergroup expression, which allows some forms of non-constant variables to be referenced.

AllowUnboundedPlaceholder

For parameter evaluation, allow unbounded literals to evaluate to the placeholder value.

Other expressions that have an unbounded literal without a queue target will return an invalid value.

enum class slang::ast::MinTypMax

Specifies which set of min:typ:max expressions should be used during compilation.

Enumerators
Min

Use the "min" delay expressions.

Typ

Use the "typical" delay expressions.

Max

Use the "max" delay expressions.

enum class slang::ast::CompilationFlags

Defines flags that control compilation behavior.

Enumerators
None

No flags specified.

AllowHierarchicalConst

Allow hierarchical names in constant expressions.

RelaxEnumConversions

Allow all integral types to convert implicitly to enum types.

AllowUseBeforeDeclare

Allow symbols to be referenced before they're declared, even if that would otherwise be an error in SystemVerilog.

AllowDupInitialDrivers

Signals driven by an always_comb are normally not allowed to be driven by any other process.

This flag allows initial blocks to also drive such signals.

AllowTopLevelIfacePorts

Allow top-level modules to have interface ports.

This is not allowed in standard SystemVerilog but it defaults to true to make using the API in scripting / programmatic modes more convenient.

StrictDriverChecking

Perform strict checking of variable drivers, which currently means not taking into account procedural for loop unrolling.

LintMode

Compile in "linting" mode where we suppress errors that could be caused by not having an elaborated design.

SuppressUnused

Suppress warnings about unused code elements.

IgnoreUnknownModules

Don't issue an error when encountering an instantiation for an unknown definition.

RelaxStringConversions

Allow strings to implicitly convert to integers.

AllowRecursiveImplicitCall

Allow implicit call expressions (lacking parentheses) to be recursive function calls.

AllowBareValParamAssignment

Allow module parameter assignments to elide the parentheses.

AllowSelfDeterminedStreamConcat

Allow self-determined streaming concatenation expressions; normally these can only be used in specific assignment-like contexts.

AllowMultiDrivenLocals

Allow multi-driven subroutine local variables.

AllowMergingAnsiPorts

Allow merging ANSI port declarations with nets and variables declared in the module body.

DisableInstanceCaching

Disable the use of instance caching, which normally allows skipping duplicate instance bodies to save time when elaborating.

enum class slang::ast::NondegeneracyStatus

Specifies possible classifications of assertion expressions as they relate to "nondegeneracy", as described in the LRM.

Enumerators
None

No factors related to nondegeneracy (i.e.

the expression is nondegenerate).

AdmitsEmpty

The sequence admits empty matches.

AcceptsOnlyEmpty

The sequence accepts only empty matches.

AdmitsNoMatch

The sequence definitely admits no match.

enum class slang::ast::LookupFlags

Additional modifiers for a lookup operation.

Enumerators
None

No special modifiers.

Type

A lookup for a type name, as opposed to a value.

These names cannot be hierarchical but can be package or class scoped.

AllowDeclaredAfter

Usually lookups require that the found symbol be declared before the lookup location.

This flag removes that restriction.

DisallowWildcardImport

Don't search through wildcard imports to satisfy the lookup.

NoUndeclaredError

Don't report an error if the lookup is for a simple identifier that cannot be found.

NoUndeclaredErrorIfUninstantiated

Don't report an error if the lookup is for a simple identifier that cannot be found and the context in which we are searching is an uninstantiated module.

AllowIncompleteForwardTypedefs

Allow lookup to resolve to incomplete forward class types.

NoParentScope

The lookup should not continue looking into parent scopes if the name is not found in the initial search scope.

NoSelectors

Additional name selectors are not allowed in the final result.

AllowRoot

Lookup is allowed to return the root symbol via the '$root' scope specifier.

AllowUnit

Lookup is allowed to return the nearest compilation unit via the '$unit' scope specifier.

IfacePortConn

Lookup is resolving an interface port connection expression.

StaticInitializer

Lookup is within a static initializer expression.

TypeReference

Lookup is happening within a type reference expression.

AlwaysAllowUpward

Always allow upward name lookup to occur, even with simple identifiers.

DisallowUnitReferences

Disallow resolving a name to a member declared or imported into the $unit compilation unit scope.

ForceHierarchical

Treat this lookup as hierarchical even if it's a simple name.

enum class slang::ast::LookupResultFlags: uint8_t

Flags that indicate additional details about the result of a lookup operation.

Enumerators
None

No extra result information.

WasImported

The found symbol was imported from a package.

IsHierarchical

The symbol was found via hierarchical lookup.

SuppressUndeclared

There were problems during lookup that indicate we should ignore the lack of a found symbol, because we're in a context where such a failure may be expected (for example, within a default instantiation of a generic class where the base class fails to resolve).

FromTypeParam

The lookup was resolved through a type parameter.

Some language rules restrict where this can be done.

FromForwardTypedef

The lookup was resolved through a forwarded typedef.

Some language rules restrict where this can be done.

enum class slang::ast::AssignFlags: uint8_t

A set of flags that control how assignments are checked.

Enumerators
None

No special assignment behavior specified.

NonBlocking

The assignment is non-blocking.

InConcat

The assignment is occurring inside a concatenation.

InputPort

The assignment is for an input port of a module / interface / program (the assignment to the internal symbol from the port itself).

OutputPort

The assignment is for an output port of a module / interface / program (the assignment from the internal symbol from the port itself).

InOutPort

The assignment is for an inout port of a module / interface / program.

ClockVar

The assignment is from a clocking block signal.

AssertionLocalVarFormalArg

The assignment is from an assertion instance's local variable formal argument.

SlicedPort

The assignment is for an output port that was sliced due to an array of instances being connected to an array argument.

enum class slang::ast::StatementFlags

Various flags that control statement construction.

Enumerators
None

No specific flags specified.

InLoop

Statement creation is happening inside a loop.

InForkJoin

Statement creation is happening inside a fork-join block.

InRandSeq

Statement creation is happening inside a randseq block.

InForLoop

Statement creation is happening inside a for loop.

HasTimingError

Statement creation has seen a timing-related error (and so should not issue another).

enum class slang::ast::SymbolIndex: uint32_t

A numeric index that can be used to compare the relative ordering of symbols within a single lexical scope.

enum class slang::ast::ConstraintBlockFlags: uint8_t

Specifies various flags that can apply to constraint bocks.

Enumerators
None

No specific flags specified.

Pure

The constraint is 'pure', meaning it requires an implementation in derived classes.

Static

The conbstraint is static, meaning it is shared across all object instances.

Extern

The constraint block was declared extern, either implicitly or explicitly.

ExplicitExtern

The constraint block was explicitly declared extern, which means an out-of-block body is required instead of optional.

Initial

The constraint is marked 'initial', which means it should not override a base class constraint.

Extends

The constraint is marked 'extends', which means it must override a base class constraint.

Final

The constraint is marked 'final', which means it cannot be overridden in a derived class.

enum class slang::ast::InstanceFlags: uint8_t

Specifies various flags that describe instance behavior.

Enumerators
None

No flags specified.

Uninstantiated

The module isn't actually instantiated in the design.

This might be because it was created with invalid parameters simply to check name lookup rules but it's never actually referenced elsewhere in the user's code.

FromBind

The instance was created from a bind directive instead of a typical instantiation.

ParentFromBind

The instance resides in a parent instance that itself is from a bind directive.

This applies recursively for the entire bound hierarchy.

enum class slang::ast::MethodFlags: uint16_t

Specifies various flags that can apply to subroutines.

Enumerators
None

No specific flags specified.

Virtual

The method is virtual.

Pure

The method is 'pure' virtual, meaning it requires an implementation in derived classes.

Static

The method is static, meaning it is invocable without an object instance handle.

Constructor

The method is a class constructor.

InterfaceExtern

The method is declared extern from an interface, and so its body must be exported by a module elsewhere.

ModportImport

The method is imported via a modport.

ModportExport

The method is exported via a modport.

DPIImport

The method is a DPI import.

DPIContext

The method is a DPI import marked 'context'.

BuiltIn

The method is built-in via language rules, as opposed to defined by the user.

Randomize

This method is a std::randomize built-in.

These are declared as normal subroutines so they can be found via name lookup, and then a special case translates the calls into the appropriate system subroutine call.

ForkJoin

Used with InterfaceExtern methods to indicate that more than one module is allowed to export the same task.

DefaultedSuperArg

The method is a constructor that has a 'default' argument indicating that the parent class's argument list should be inserted.

Initial

The method is marked 'initial', which means it should not override a base class method.

Extends

The method is marked 'extends', which means it must override a base class method (and also it will be virtual).

Final

The method is marked 'final', which means it cannot be overridden in a derived class.

enum class slang::ast::VariableFlags: uint16_t

Specifies various flags that can apply to variables.

Enumerators
None

No specific flags specified.

Const

The variable is a constant, i.e. not modifiable after initialization.

CompilerGenerated

The variable was not declared by the user but created during compilation.

ImmutableCoverageOption

The variable is a coverage option that is not modifiable outside of the covergroup declaration.

CoverageSampleFormal

The variable is a formal argument of an overridden sample method in a covergroup.

CheckerFreeVariable

This is a checker "free variable", which may behave nondeterministically in simulation and participate differently in formal verification.

RefStatic

The variable is a function port with direction 'ref static'.

enum class slang::ast::DeclaredTypeFlags

Various flags that control declared type resolution.

Enumerators
None

No special flags specified.

InferImplicit

If the declared type is implicit, the actual type should be inferred from the initializer.

If this is not set, the type will be resolved as 'logic' if implicit syntax is provided.

InitializerCantSeeParent

The initializer expression cannot refer to the parent symbol.

This is used for parameters which would otherwise be infinitely recursive if they referenced themselves.

InitializerOverridden

The initializer expression has been overridden via a parameter in a hierarchical instantation.

TypeOverridden

The type has been overridden via a type parameter in a hierarchical instantation.

AutomaticInitializer

The initializer is for an automatic variable.

TypedefTarget

The declared type is the target of a typedef.

NetType

The declared type is a net type.

UserDefinedNetType

The declared type is a user-defined net type.

FormalArgMergeVar

The declared type is part of a port I/O declaration and should be merged with the formal argument declared elsewhere in the scope.

Rand

The declared type is for a random variable.

DPIReturnType

The declared type is a DPI return type.

DPIArg

The declared type is for a DPI argument.

AllowUnboundedLiteral

Allow use of the unbounded literal '$' in the initializer expression.

RequireSequenceType

The type must be one allowed in a sequence expression.

CoverageType

The type must be valid in a coverage expression.

InterconnectNet

The type is for an interconnect net, which has special rules.

InterfaceVariable

The type is for a variable declaration inside an interface.

NeedsTypeCheck

A mask of flags that indicate additional type rules are needed to be checked after the type itself is resolved.

enum class slang::ast::IntegralFlags: uint8_t

Specifies possible traits for integral types.

Enumerators
Unsigned

The type is unsigned. This is the default.

TwoState

The type is two state. This is the default.

Signed

The type is signed.

FourState

The type is four state.

Reg

The type used the 'reg' keyword instead of 'logic'; they are semantically identical but preserve the distinction to allow more useful messaging.

Function documentation

template<typename... Functions>
auto slang::ast::makeVisitor(Functions... funcs)

Creates an ASTVisitor out of the provided handler functions.

The provided callable arguments must take two parameters, the first of which is the visitor object itself (so that you can call visitDefault on it if desired) and the second is the AST type to match against.

For example, to create a visitor that will count all of the BinaryExpressions in an AST:

int count = 0;
makeVisitor([&](auto& visitor, const BinaryExpression& expr) {
    count++;
    visitor.visitDefault(expr);
})