Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions graph/Graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1248,20 +1248,30 @@ Vertex::setHasDownstreamClkPin(bool has_clk_pin)
has_downstream_clk_pin_ = has_clk_pin;
}

#define IN_QUEUE(mask, index) (mask & (1 << unsigned(index)))
#define SET_IN_QUEUE(mask, index) ((mask) |= (1 << unsigned(index)))
#define CLEAR_IN_QUEUE(mask, index) ((mask) &= ~(1 << unsigned(index)))

bool
Vertex::bfsInQueue(BfsIndex index) const
{
return (bfs_in_queue_ >> unsigned(index)) & 1;
return IN_QUEUE(bfs_in_queue_, index);
}

void
Vertex::setBfsInQueue(BfsIndex index,
bool value)
{
if (value)
bfs_in_queue_ |= 1 << int(index);
else
bfs_in_queue_ &= ~(1 << int(index));
unsigned char expected = bfs_in_queue_;
unsigned char desired;
do {
if ((value && IN_QUEUE(expected, index)) || (!value && !IN_QUEUE(expected, index))) {
return;
}
desired = expected;
SET_IN_QUEUE(value ? desired : expected, index);
CLEAR_IN_QUEUE(value ? expected : desired, index);
} while (!bfs_in_queue_.compare_exchange_weak(expected, desired));
}

////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion include/sta/Graph.hh
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ protected:
bool has_downstream_clk_pin_:1;
bool crpr_path_pruning_disabled_:1;
bool requireds_pruned_:1;
unsigned object_idx_:VertexTable::idx_bits; // 7
unsigned char object_idx_; // >= VertexTable::idx_bits = 7

private:
friend class Graph;
Expand Down