slang::ast::SemanticFacts class

A helper class that can extract semantic AST information from tokens and syntax nodes.

Public static functions

static std::optional<VariableLifetime> getVariableLifetime(parsing::Token token)
Interprets a keyword token as a variable lifetime value.
static ArgumentDirection getDirection(parsing::TokenKind kind)
Interprets a token type as an argument direction value.
static ProceduralBlockKind getProceduralBlockKind(syntax::SyntaxKind kind)
Interprets a syntax kind as a procedural block kind.
static DefinitionKind getDefinitionKind(syntax::SyntaxKind kind)
Interprets a syntax kind as a definition kind.
static EdgeKind getEdgeKind(parsing::TokenKind kind)
Interprets an edge token as an EdgeKind value.
static AssertionKind getAssertKind(syntax::SyntaxKind kind)
Interprets a syntax kind as an assertion kind.
static StatementBlockKind getStatementBlockKind(const syntax::BlockStatementSyntax& syntax)
Gets the statement block kind from the given syntax node.
static ElabSystemTaskKind getElabSystemTaskKind(parsing::Token token)
Interprets a system name token as an elaboration system task kind.
static PulseStyleKind getPulseStyleKind(parsing::TokenKind kind)
Interprets a token type as a pulse style kind.
static ChargeStrength getChargeStrength(parsing::TokenKind kind)
Interprets a token type as a charge strength.
static std::string_view getProcedureKindStr(ProceduralBlockKind kind)
Gets the human-friendly string name of a procedural block kind.
static std::string_view getCaseConditionStr(CaseStatementCondition kind)
Gets a human-friendly string name of a case statement condition kind.
static std::pair<std::optional<DriveStrength>, std::optional<DriveStrength>> getDriveStrength(const syntax::NetStrengthSyntax& syntax)
Gets the optional drive strength values associated with the given net strength syntax node.
static ForwardTypeRestriction getTypeRestriction(syntax::ForwardTypeRestrictionSyntax& syntax)
Gets the forward type restriction associated with the given syntax node.
static ForwardTypeRestriction getTypeRestriction(const Type& type)
Gets the forward type restriction that matches the given type.
static std::string_view getTypeRestrictionText(ForwardTypeRestriction typeRestriction)
Gets the human-friendly string name of the given forward type restriction kind.
static void populateTimeScale(TimeScale& timeScale, const Scope& scope, const syntax::TimeUnitsDeclarationSyntax& syntax, std::optional<SourceRange>& unitsRange, std::optional<SourceRange>& precisionRange, bool isFirst)
Populates the given timescale object with the appropriate values specified by the given syntax node.
static void populateTimeScale(std::optional<TimeScale>& timeScale, const Scope& scope, std::optional<TimeScale> directiveTimeScale, std::optional<SourceRange> unitsRange, std::optional<SourceRange> precisionRange)
Populates the given timescale object with the given values.
static bool isAllowedInModport(SymbolKind kind)
static bool isGlobalFutureSampledValueFunc(parsing::KnownSystemName name)

Function documentation

static void slang::ast::SemanticFacts::populateTimeScale(TimeScale& timeScale, const Scope& scope, const syntax::TimeUnitsDeclarationSyntax& syntax, std::optional<SourceRange>& unitsRange, std::optional<SourceRange>& precisionRange, bool isFirst)

Populates the given timescale object with the appropriate values specified by the given syntax node.

Reports errors if needed.

static void slang::ast::SemanticFacts::populateTimeScale(std::optional<TimeScale>& timeScale, const Scope& scope, std::optional<TimeScale> directiveTimeScale, std::optional<SourceRange> unitsRange, std::optional<SourceRange> precisionRange)

Populates the given timescale object with the given values.

Reports errors if the timescale is invalid.

static bool slang::ast::SemanticFacts::isAllowedInModport(SymbolKind kind)

Returns true if the given symbol kind is allowed in modports.

static bool slang::ast::SemanticFacts::isGlobalFutureSampledValueFunc(parsing::KnownSystemName name)

Returns true if the given system name is a global future sampled value function.