slang::ast namespace

The SystemVerilog AST.

Classes

class AbortAssertionExpr
Represents an abort (accept_on / reject_on) property expression.
class ArbitrarySymbolExpression
class AssertionInstanceExpression
class AssertionPortSymbol
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
template<typename TDerived, bool VisitStatements, bool VisitExpressions>
struct ASTVisitor
class BinaryAssertionExpr
Represents a binary operator in a sequence or property expression.
class BinaryExpression
Represents a binary operator expression.
class BlockStatement
Represents a sequential or parallel block statement.
class CallExpression
Represents a subroutine call.
class CaseAssertionExpr
Represents a case operator in a property expression.
class CHandleType
Represents storage for pointers passed using the DPI (a "C" compatible handle).
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
class ClockingSkew
Represents a skew value that is applied to clocking block signals.
class ClockVarSymbol
Represents a clocking block signal.
class Compilation
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 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 ConstraintBlockSymbol
Represents a named constraint block declaration within a class.
class ConstraintList
Represents a list of constraints.
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
class CovergroupBodySymbol
class CovergroupType
Represents a covergroup definition type.
class DataTypeExpression
class DeclaredType
class DefParamSymbol
Represents a defparam directive.
class DisableIffAssertionExpr
Represents a disable iff condition in a property spec.
class DisableSoftConstraint
Represents a constraint that disables a soft random variable.
class DistExpression
class DPIOpenArrayType
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
class EmptyMemberSymbol
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
class EvalContext
class EventType
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 FieldSymbol
Represents a field member of a struct or union.
class FirstMatchAssertionExpr
Represents a first_match operator in a sequence expression.
class FixedSizeUnpackedArrayType
class FloatingType
class ForeachConstraint
Represents a constraint that iterates over the elements of an array.
class FormalArgumentSymbol
Represents a formal argument in subroutine (task or function).
class ForwardingTypedefSymbol
class GenerateBlockArraySymbol
Represents an array of generate blocks, as generated by a loop generate construct.
class GenerateBlockSymbol
class GenericClassDefSymbol
class GenvarSymbol
Represents a genvar declaration.
class HierarchicalValueExpression
Represents an expression that references a named value via hierarchical path.
struct HierarchyOverrideNode
class ImplicationConstraint
Represents a constraint defined by an implication.
class InsideExpression
Represents a set membership operator expression.
class InstanceSymbolBase
Common functionality for module, interface, program, and primitive instances.
class IntegerLiteral
Represents an integer literal.
class IntegralType
class InterfacePortSymbol
class InvalidExpression
class InvalidStatement
class IteratorSymbol
Represents an iterator variable created for array manipulation methods.
class LetDeclSymbol
Represents a let declaration.
class LocalAssertionVarSymbol
class Lookup
Centralized functionality for looking up symbols by name in the AST.
class LookupLocation
struct LookupResult
A structure that contains the results of a name lookup operation.
class LValue
class LValueReferenceExpression
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
class NamedValueExpression
Represents an expression that references a named value.
class NetSymbol
Represents a net declaration.
class NetType
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 NullLiteral
Represents a null literal.
class NullType
class OpenRangeExpression
class PackageSymbol
A SystemVerilog package construct.
class PackedArrayType
class PackedStructType
Represents a packed structure of members.
class PackedUnionType
Represents a packed union of members.
class ParameterSymbol
Represents a parameter value.
class Pattern
class PatternVarSymbol
Represents a pattern variable materialized for a pattern matching expression.
class PortSymbol
class PredefinedIntegerType
Represents the predefined integer types, which are essentially predefined vector types.
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 RangeSelectExpression
Represents a range selection expression.
class RealLiteral
Represents a real number literal.
class ReplicatedAssignmentPatternExpression
Represents a replicated assignment pattern expression.
class ReplicationExpression
Represents a replication expression.
class RootSymbol
Represents the entirety of a design, along with all contained compilation units.
class ScalarType
Represents the single-bit scalar types.
class Scope
class ScriptSession
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
class SimpleAssertionExpr
Represents an assertion expression defined as a simple regular expression.
class SimpleAssignmentPatternExpression
Represents an assignment pattern expression.
class SimpleSystemSubroutine
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 an 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 an assignment pattern expression.
class SubroutineSymbol
Represents a subroutine (task or function).
class Symbol
class TaggedUnionExpression
Represents a tagged union member setter expression.
class TempVarSymbol
class TimeLiteral
Represents a time literal.
class TransparentMemberSymbol
class Type
class TypeAliasType
Represents a type alias, which is introduced via a typedef or type parameter.
class TypeReferenceExpression
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 unboudned queue or range literal.
class UnboundedType
class UninstantiatedDefSymbol
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
class ValueExpressionBase
Common base class for both NamedValueExpression and HierarchicalValueExpression.
class ValueSymbol
class VariableSymbol
Represents a variable declaration.
class VirtualInterfaceType
Represents a virtual interface type.
class VoidType
class WildcardImportSymbol

Enums

enum class ASTFlags: uint64_t { None = 0, InsideConcatenation = 1ull << 0, UnevaluatedBranch = 1ull << 1, AllowDataType = 1ull << 2, EnumInitializer = 1ull << 3, NoAttributes = 1ull << 4, AssignmentAllowed = 1ull << 5, AssignmentDisallowed = 1ull << 6, NonProcedural = 1ull << 7, StaticInitializer = 1ull << 8, StreamingAllowed = 1ull << 9, TopLevelStatement = 1ull << 10, AllowUnboundedLiteral = 1ull << 11, AllowUnboundedLiteralArithmetic = 1ull << 12, Function = 1ull << 13, Final = 1ull << 14, NonBlockingTimingControl = 1ull << 15, EventExpression = 1ull << 16, AllowTypeReferences = 1ull << 17, AssertionExpr = 1ull << 18, AllowClockingBlock = 1ull << 19, AssertionInstanceArgCheck = 1ull << 20, AssertionDelayOrRepetition = 1ull << 21, LValue = 1ull << 22, PropertyNegation = 1ull << 23, PropertyTimeAdvance = 1ull << 24, RecursivePropertyArg = 1ull << 25, ConcurrentAssertActionBlock = 1ull << 26, AllowCoverageSampleFormal = 1ull << 27, AllowCoverpoint = 1ull << 28, AllowNetType = 1ull << 29, OutputArg = 1ull << 30, ProceduralAssign = 1ull << 31, ProceduralForceRelease = 1ull << 32, AllowInterconnect = 1ull << 33, UnrollableForLoop = 1ull << 34, StreamingWithRange = 1ull << 35, SpecifyBlock = 1ull << 36, DPIArg = 1ull << 37, AssertionDefaultArg = 1ull << 38, LAndRValue = 1ull << 39 }
Specifies flags that control expression and statement creation.
enum class MinTypMax { Min, Typ, Max }
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 LookupFlags { None = 0, Type = 1 << 0, AllowDeclaredAfter = 1 << 1, DisallowWildcardImport = 1 << 2, NoUndeclaredError = 1 << 3, NoUndeclaredErrorIfUninstantiated = 1 << 4, TypedefTarget = 1 << 5, NoParentScope = 1 << 6, NoSelectors = 1 << 7, AllowRoot = 1 << 8, ForceHierarchical = AllowDeclaredAfter | NoUndeclaredErrorIfUninstantiated }
Additional modifiers for a lookup operation.
enum class AssignFlags: uint16_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, NotADriver = 1 << 8 }
A set of flags that control how assignments are checked.
enum class SymbolIndex: uint32_t { }
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, NotConst = 1 << 9, Randomize = 1 << 10, ForkJoin = 1 << 11 }
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 }
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.

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

EnumInitializer

The expression being created is an enum value initializer.

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.

UnrollableForLoop

AST creation is inside a potentially unrollable for loop, which means we should skip registering drivers and let the loop unroller do it.

StreamingWithRange

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

SpecifyBlock

AST creation is happening inside a specify block.

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.

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::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::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.

TypedefTarget

The lookup is for a typedef target type, which has a special exemption to allow scoped access 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.

ForceHierarchical

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

enum class slang::ast::AssignFlags: uint16_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.

NotADriver

The assignment should not be considered a driver.

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::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'.

NotConst

The method is known not to be constant, even if it otherwise meets all of the requirements for a constant function. Used for built-in methods only.

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.

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.

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.