34 template<
typename Key,
typename T,
typename Compare = std::less<Key>>
46 template<
typename Other>
52 current_state.clear();
54 for (
auto &it : other)
55 set(it.first, it.second);
58 bool has(
const Key &k)
63 void set(
const Key &k,
const T &v)
77 const T &
get(
const Key &k)
97 const std::map<Key, T, Compare> &
stdmap()
111 if (it.second !=
nullptr) {
131 template<
typename T,
typename C = std::less<T>>
157 void sort_worker(
const T &
n, std::set<T, C> &marked_cells, std::set<T, C> &active_cells, std::vector<T> &active_stack)
159 if (active_cells.count(n)) {
163 for (
int i =
GetSize(active_stack)-1; i >= 0; i--) {
164 loop.insert(active_stack[i]);
165 if (active_stack[i] == n)
173 if (marked_cells.count(n))
179 active_stack.push_back(n);
180 active_cells.insert(n);
183 sort_worker(left_n, marked_cells, active_cells, active_stack);
186 active_stack.pop_back();
187 active_cells.erase(n);
190 marked_cells.insert(n);
200 std::set<T, C> marked_cells;
201 std::set<T, C> active_cells;
202 std::vector<T> active_stack;
205 sort_worker(it.first, marked_cells, active_cells, active_stack);
std::set< std::set< T, C > > loops
#define YOSYS_NAMESPACE_END
stackmap(const std::map< Key, T, Compare > &other)
void operator=(const Other &other)
void set(const Key &k, const T &v)
void sort_worker(const T &n, std::set< T, C > &marked_cells, std::set< T, C > &active_cells, std::vector< T > &active_stack)
void edge(T left, T right)
int GetSize(RTLIL::Wire *wire)
#define log_assert(_assert_expr_)
std::map< T, std::set< T, C >, C > database
#define YOSYS_NAMESPACE_BEGIN
std::map< Key, T, Compare > current_state
std::vector< std::map< Key, T *, Compare > > backup_state
const std::map< Key, T, Compare > & stdmap()