slang::ast::AssertionExpr class

The base class for assertion expressions (sequences and properties).

Derived classes

class AbortAssertionExpr
Represents an abort (accept_on / reject_on) property expression.
class BinaryAssertionExpr
Represents a binary operator in a sequence or property expression.
class CaseAssertionExpr
Represents a case operator in a property expression.
class ClockingAssertionExpr
Represents an assertion expression with attached clocking control.
class ConditionalAssertionExpr
Represents a conditional operator in a property expression.
class DisableIffAssertionExpr
Represents a disable iff condition in a property spec.
class FirstMatchAssertionExpr
Represents a first_match operator in a sequence expression.
class InvalidAssertionExpr
Represents an invalid expression.
class SequenceConcatExpr
Represents an assertion expression defined as a delayed concatenation of other expressions.
class SequenceWithMatchExpr
Represents a sequence expression along with a list of actions to perform upon matching and/or instructions for repetition.
class SimpleAssertionExpr
Represents an assertion expression defined as a simple regular expression.
class StrongWeakAssertionExpr
Represents a strong or weak operator in a property expression.
class UnaryAssertionExpr
Represents a unary operator in a property expression.

Public types

struct NondegeneracyCheckResult
A result structure for checking nondegeneracy.
enum class NondegeneracyRequirement { Default, OverlapOp, NonOverlapOp }
Specifies binding behavior of property expressions as it pertains to nondegeneracy checking.

Public functions

void requireSequence(const ASTContext& context) const
Reports an error if the assertion expression is not valid in a sequence.
void requireSequence(const ASTContext& context, DiagCode code) const
Reports an error if the assertion expression is not valid in a sequence.
auto bad() const -> bool
Indicates whether the expression is invalid.
auto checkNondegeneracy() const -> NondegeneracyCheckResult
Checks whether this assertion expression is nondegenerate or whether it has properties of degeneracy (admitting empty matches or no matches at all).
auto computeSequenceLength() const -> std::optional<SequenceRange>
Computes possible clock ticks (delay) length of sequence under assertion expression.
template<typename T>
auto as() -> T&
Casts this expression to the given concrete derived type.
template<typename T>
auto as() const -> const T&
Casts this expression to the given concrete derived type.
template<typename T>
auto as_if() -> T*
Tries to cast this expression to the given concrete derived type.
template<typename T>
auto as_if() const -> const T*
Tries to cast this expression to the given concrete derived type.
template<typename TVisitor, typename... Args>
auto visit(TVisitor& visitor, Args && ... args) const -> decltype(auto)
Visits this expression's concrete derived type via the provided visitor object.

Public variables

AssertionExprKind kind
The kind of expression; indicates the type of derived class.
const syntax::SyntaxNode* syntax
The syntax used to create the expression, if any.

Enum documentation

enum class slang::ast::AssertionExpr::NondegeneracyRequirement

Specifies binding behavior of property expressions as it pertains to nondegeneracy checking.

Enumerators
Default

Any sequence that is used as a property shall be nondegenerate.

OverlapOp

Any sequence that is used as the antecedent of an overlapping implication or followed-by operator shall be nondegenerate.

NonOverlapOp

Any sequence that is used as the antecedent of a nonoverlapping implication or followed-by operator shall admit at least one match.

Such a sequence can admit only empty matches.

Function documentation

template<typename T>
T& slang::ast::AssertionExpr::as()

Casts this expression to the given concrete derived type.

Asserts that the type is appropriate given this expression's kind.

template<typename T>
const T& slang::ast::AssertionExpr::as() const

Casts this expression to the given concrete derived type.

Asserts that the type is appropriate given this expression's kind.

template<typename T>
T* slang::ast::AssertionExpr::as_if()

Tries to cast this expression to the given concrete derived type.

If the type is not appropriate given this expression's kind, returns nullptr.

template<typename T>
const T* slang::ast::AssertionExpr::as_if() const

Tries to cast this expression to the given concrete derived type.

If the type is not appropriate given this expression's kind, returns nullptr.

Variable documentation

const syntax::SyntaxNode* slang::ast::AssertionExpr::syntax

The syntax used to create the expression, if any.

An expression tree can be created manually in which case it may not have a syntax representation.