slang-netlist  0.9.0
Loading...
Searching...
No Matches
slang::netlist::NetlistGraph Class Reference

Represent the netlist connectivity of an elaborated design. More...

#include <NetlistGraph.hpp>

Inheritance diagram for slang::netlist::NetlistGraph:
slang::netlist::DirectedGraph< NetlistNode, NetlistEdge >

Classes

struct  SensitivitySource
 A clock/reset signal driving a State node, paired with its edge kind. More...

Public Member Functions

void build (ast::Compilation &compilation, analysis::AnalysisManager &analysisManager, BuilderOptions options={})
auto lookup (std::string_view name) const -> NetlistNode *
auto lookup (std::string_view name, DriverBitRange bounds) const -> std::vector< NetlistNode * >
auto getDrivers (std::string_view name, DriverBitRange bounds) const -> std::vector< NetlistNode * >
auto getCombFanOut (NetlistNode &node) const -> std::vector< NetlistNode * >
auto getCombFanIn (NetlistNode &node) const -> std::vector< NetlistNode * >
auto getSensitivity (NetlistNode &node) const -> std::vector< SensitivitySource >
auto findNodes (std::string_view pattern) const -> std::vector< NetlistNode * >
auto findNodesRegex (std::string_view pattern) const -> std::vector< NetlistNode * >
 Find named nodes whose hierarchical path matches the regex pattern.
auto filterNodes (NodeKind kind) const
auto addEdge (NetlistNode &sourceNode, NetlistNode &targetNode) -> NetlistEdge &
 Add an edge between two nodes.
auto getBuildProfile () const -> BuildProfile const &
 Return the profiling data from the last build() call.
void setBuildProfile (BuildProfile const &profile)
 Set the profiling data (called internally by NetlistBuilder).
Public Member Functions inherited from slang::netlist::DirectedGraph< NetlistNode, NetlistEdge >
 DirectedGraph ()=default
auto begin () const -> const_iterator
auto end () const -> const_iterator
auto findNode (const NetlistNode &nodeToFind) const -> node_descriptor
auto getNode (node_descriptor node) const -> NetlistNode &
 Given a node descriptor, return the node by reference.
auto addNode () -> NetlistNode &
auto removeNode (NetlistNode &nodeToRemove) -> bool
auto addEdge (NetlistNode &sourceNode, NetlistNode &targetNode) -> NetlistEdge &
 Add an edge between two existing nodes in the graph.
auto addNewEdge (NetlistNode &sourceNode, NetlistNode &targetNode) -> NetlistEdge &
auto removeEdge (NetlistNode &sourceNode, NetlistNode &targetNode) -> bool
auto outDegree (const NetlistNode &node) const -> size_t
 Return the number of edges outgoing from the specified node.
auto inDegree (const NetlistNode &node) const -> size_t
 Return the number of edges incident to the specified node.
auto numNodes () const -> size_t
 Return the size of the graph.
auto numEdges () const -> size_t
 Return the number of edges in the graph.

Public Attributes

FileTable fileTable
SymbolTable symbolTable

Additional Inherited Members

Public Types inherited from slang::netlist::DirectedGraph< NetlistNode, NetlistEdge >
using NodePtrType
using NodeListType
using iterator
using const_iterator
using node_descriptor
using edge_descriptor
using DirectedGraphType
Static Public Attributes inherited from slang::netlist::DirectedGraph< NetlistNode, NetlistEdge >
static const size_t null_node
Protected Attributes inherited from slang::netlist::DirectedGraph< NetlistNode, NetlistEdge >
std::mutex nodesMutex
NodeListType nodes

Detailed Description

Represent the netlist connectivity of an elaborated design.

Member Function Documentation

◆ addEdge()

auto slang::netlist::NetlistGraph::addEdge ( NetlistNode & sourceNode,
NetlistNode & targetNode ) -> NetlistEdge &
inline

Add an edge between two nodes.

◆ build()

void slang::netlist::NetlistGraph::build ( ast::Compilation & compilation,
analysis::AnalysisManager & analysisManager,
BuilderOptions options = {} )

Build the netlist from an elaborated compilation.

Caller is responsible for having run VisitAll, frozen the compilation, and run the analysis manager prior to this call. options configures the build, including parallel execution, thread pool size, and precision upgrades; see BuilderOptions.

◆ filterNodes()

auto slang::netlist::NetlistGraph::filterNodes ( NodeKind kind) const
inlinenodiscard

Return a view of all nodes of the specified kind.

Parameters
kindThe kind of nodes to filter.
Returns
A view of nodes matching the specified kind.

◆ findNodes()

auto slang::netlist::NetlistGraph::findNodes ( std::string_view pattern) const -> std::vector< NetlistNode * >
nodiscard

Find named nodes whose hierarchical path matches the wildcard pattern. Supports '*' (zero or more characters) and '?' (one character).

◆ findNodesRegex()

auto slang::netlist::NetlistGraph::findNodesRegex ( std::string_view pattern) const -> std::vector< NetlistNode * >
nodiscard

Find named nodes whose hierarchical path matches the regex pattern.

◆ getBuildProfile()

auto slang::netlist::NetlistGraph::getBuildProfile ( ) const -> BuildProfile const &
inlinenodiscard

Return the profiling data from the last build() call.

◆ getCombFanIn()

auto slang::netlist::NetlistGraph::getCombFanIn ( NetlistNode & node) const -> std::vector< NetlistNode * >
nodiscard

Return all nodes that can reach node via combinational edges in the backward (fan-in) direction. The traversal stops at State nodes.

◆ getCombFanOut()

auto slang::netlist::NetlistGraph::getCombFanOut ( NetlistNode & node) const -> std::vector< NetlistNode * >
nodiscard

Return all nodes reachable from node via combinational edges in the forward (fan-out) direction. The traversal stops at State nodes.

◆ getDrivers()

auto slang::netlist::NetlistGraph::getDrivers ( std::string_view name,
DriverBitRange bounds ) const -> std::vector< NetlistNode * >
nodiscard

Return the set of driver nodes for the symbol with the given hierarchical name over the bit range bounds.

A driver is any node that is the source of an edge annotated with a matching symbol reference whose bounds overlap bounds. Each driver is reported at most once.

◆ getSensitivity()

auto slang::netlist::NetlistGraph::getSensitivity ( NetlistNode & node) const -> std::vector< SensitivitySource >
nodiscard

Clocks gating node: own edges for a State, otherwise the union of sensitivity over every State reachable by combinational fan-out. Deduplicated on (source, edgeKind).

◆ lookup() [1/2]

auto slang::netlist::NetlistGraph::lookup ( std::string_view name) const -> NetlistNode *
nodiscard

Lookup a node in the graph by its hierarchical name.

Parameters
nameThe hierarchical name of the node.
Returns
A pointer to the node if found, or nullptr if not found.

◆ lookup() [2/2]

auto slang::netlist::NetlistGraph::lookup ( std::string_view name,
DriverBitRange bounds ) const -> std::vector< NetlistNode * >
nodiscard

Lookup nodes by hierarchical name and bit range.

Returns all Port, Variable, and State nodes whose hierarchical path matches name and whose bounds overlap with bounds.

◆ setBuildProfile()

void slang::netlist::NetlistGraph::setBuildProfile ( BuildProfile const & profile)
inline

Set the profiling data (called internally by NetlistBuilder).

Member Data Documentation

◆ fileTable

FileTable slang::netlist::NetlistGraph::fileTable

◆ symbolTable

SymbolTable slang::netlist::NetlistGraph::symbolTable

The documentation for this class was generated from the following file: