slang-netlist  0.10.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 getConstantDrivers (NetlistNode &node) const -> std::vector< NetlistNode * >
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).
void addBlackBoxPath (std::string path)
 Record the hierarchical path of a black-boxed instance.
auto getBlackBoxPaths () const -> std::span< std::string const >
 Return the hierarchical paths of the black-boxed instances.
auto getBlackBoxCoverage (NetlistNode const &node) const -> BlackBoxCoverage
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

◆ addBlackBoxPath()

void slang::netlist::NetlistGraph::addBlackBoxPath ( std::string path)
inline

Record the hierarchical path of a black-boxed instance.

◆ 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 glob pattern.

Supported wildcards: * zero or more characters within a single path segment (does not cross .). **, ... zero or more characters including . (recursive). ? exactly one character within a single path segment.

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

◆ getBlackBoxCoverage()

auto slang::netlist::NetlistGraph::getBlackBoxCoverage ( NetlistNode const & node) const -> BlackBoxCoverage
nodiscard

Classify a node against the recorded black-box instance paths.

A Port node directly below a black-boxed instance is on the boundary; any other node at or below a black-boxed instance is contained. Nodes with no hierarchical path, or outside every box, are outside. Containment takes precedence over the boundary when boxes nest.

◆ getBlackBoxPaths()

auto slang::netlist::NetlistGraph::getBlackBoxPaths ( ) const -> std::span< std::string const >
inlinenodiscard

Return the hierarchical paths of the black-boxed instances.

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

◆ getConstantDrivers()

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

Return the Constant nodes feeding node if its combinational fan-in bottoms out only at Constants (i.e. the sink is tied off to literal values). Returns an empty vector if any non-constant source reaches node — namely a State node (depends on a register) or an undriven top-level input Port (depends on an external signal) — or if node has no Constant in its fan-in at all.

Variables, Assignments, Conditionals, Cases, Merges, and driven Ports in the fan-in are treated as pass-throughs.

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