Skip to content

Commit

Permalink
to find if a node has other node in its output via any combinational …
Browse files Browse the repository at this point in the history
…connection
  • Loading branch information
sakshi15108 committed Oct 21, 2023
1 parent 87577c2 commit 990be13
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lgraph/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,23 @@ bool Node::is_root() const {
return ans;
}

bool Node::is_combinationally_connected(const Node &n2) const {
bool is_comb_conn = false;
for (const auto &e : out_edges()) {
auto n = e.sink.get_node();
if ( n == n2 ) {
//n2 IS connected to the node's out.
is_comb_conn = true;
break;
} else if ( n.is_type_flop() ) {
is_comb_conn = false;
} else {
is_comb_conn = n.is_combinationally_connected(n2);
}
}
return is_comb_conn;
}

Node Node::get_up_node() const {
I(!is_root());
I(!Hierarchy::is_invalid(hidx));
Expand Down
1 change: 1 addition & 0 deletions lgraph/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ class Node {
Hierarchy_index hierarchy_go_up() const;
Node get_up_node() const;
bool is_root() const;
bool is_combinationally_connected(const Node &n2) const;

void set_type_sub(Lg_type_id subid);
void set_type_const(const Lconst &val);
Expand Down

0 comments on commit 990be13

Please sign in to comment.