slang-netlist  0.9.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
41 auto setVariable(SymbolReference const *sym, DriverBitRange newBounds)
42 -> bool {
43 if (symbol != nullptr && symbol == sym) {
44 if (bounds.isContiguousWith(newBounds)) {
45 bounds = bounds.unionWith(newBounds);
46 return true;
47 }
48 return false;
49 }
50 symbol = sym;
51 bounds = newBounds;
52 return true;
53 }
54
56 auto hasSymbol() const -> bool { return symbol != nullptr; }
57
58 void disable() { disabled = true; }
59};
60
61} // 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 setVariable(SymbolReference const *sym, DriverBitRange newBounds) -> bool
Definition NetlistEdge.hpp:41
auto hasSymbol() const -> bool
True if this edge carries a symbol annotation.
Definition NetlistEdge.hpp:56
NetlistEdge(NetlistNode &sourceNode, NetlistNode &targetNode)
Definition NetlistEdge.hpp:25
void disable()
Definition NetlistEdge.hpp:58
ast::EdgeKind edgeKind
Definition NetlistEdge.hpp:20
Definition NetlistNode.hpp:33
Definition Utilities.hpp:16
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