slang-netlist  0.12.0
Loading...
Searching...
No Matches
NetlistEdge.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include "slang/ast/SemanticFacts.h"
8
9namespace slang::netlist {
10
11class NetlistNode;
12
18class NetlistEdge : public DirectedEdge<NetlistNode, NetlistEdge> {
19public:
20 ast::EdgeKind edgeKind{ast::EdgeKind::None};
21 SymbolReference const *symbol{nullptr};
23 bool disabled{false};
24
27
28 auto setEdgeKind(ast::EdgeKind kind) { this->edgeKind = kind; }
29
45 auto setVariable(SymbolReference const *sym, DriverBitRange newBounds,
46 ast::EdgeKind kind) -> bool {
47 if (symbol == nullptr) {
48 symbol = sym;
49 bounds = newBounds;
50 edgeKind = kind;
51 return true;
52 }
53 if (symbol != sym || edgeKind != kind ||
54 !bounds.isContiguousWith(newBounds)) {
55 return false;
56 }
57 bounds = bounds.unionWith(newBounds);
58 return true;
59 }
60
62 auto hasSymbol() const -> bool { return symbol != nullptr; }
63
64 void disable() { disabled = true; }
65};
66
67} // namespace slang::netlist
NetlistNode & sourceNode
Definition DirectedGraph.hpp:50
NetlistNode & targetNode
Definition DirectedGraph.hpp:51
DirectedEdge(NetlistNode &sourceNode, NetlistNode &targetNode)
Definition DirectedGraph.hpp:17
SymbolReference const * symbol
Definition NetlistEdge.hpp:21
auto setEdgeKind(ast::EdgeKind kind)
Definition NetlistEdge.hpp:28
DriverBitRange bounds
Definition NetlistEdge.hpp:22
bool disabled
Definition NetlistEdge.hpp:23
auto hasSymbol() const -> bool
True if this edge carries a symbol annotation.
Definition NetlistEdge.hpp:62
NetlistEdge(NetlistNode &sourceNode, NetlistNode &targetNode)
Definition NetlistEdge.hpp:25
void disable()
Definition NetlistEdge.hpp:64
ast::EdgeKind edgeKind
Definition NetlistEdge.hpp:20
auto setVariable(SymbolReference const *sym, DriverBitRange newBounds, ast::EdgeKind kind) -> bool
Definition NetlistEdge.hpp:45
Definition NetlistNode.hpp:33
Definition FormatBuffer.hpp:9
A range over which a symbol is driven.
Definition DriverBitRange.hpp:14
Extracted identity of an AST symbol, decoupled from the slang AST.
Definition SymbolReference.hpp:16