mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-05 21:53:24 +00:00
iterator hell
This commit is contained in:
parent
33910bcf82
commit
1c2fb078eb
1 changed files with 27 additions and 7 deletions
|
@ -1684,7 +1684,12 @@ public:
|
||||||
return !size();
|
return !size();
|
||||||
}
|
}
|
||||||
// AAA
|
// AAA
|
||||||
class iterator: public std::iterator<std::bidirectional_iterator_tag, std::pair<IdString, Const>> {
|
class iterator {
|
||||||
|
typedef std::bidirectional_iterator_tag iterator_category;
|
||||||
|
typedef std::pair<IdString, Const> value_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef std::pair<IdString, Const>* pointer;
|
||||||
|
typedef std::pair<IdString, Const>& reference;
|
||||||
Cell* parent;
|
Cell* parent;
|
||||||
int position;
|
int position;
|
||||||
public:
|
public:
|
||||||
|
@ -1747,7 +1752,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// AAA CONST ITERATOR
|
// AAA CONST ITERATOR
|
||||||
class const_iterator: public std::iterator<std::input_iterator_tag, std::pair<IdString, Const>> {
|
class const_iterator {
|
||||||
|
typedef std::input_iterator_tag iterator_category;
|
||||||
|
typedef std::pair<IdString, Const> value_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef std::pair<IdString, Const>* pointer;
|
||||||
|
typedef std::pair<IdString, Const>& reference;
|
||||||
Cell* parent;
|
Cell* parent;
|
||||||
int position;
|
int position;
|
||||||
public:
|
public:
|
||||||
|
@ -1825,7 +1835,12 @@ public:
|
||||||
return !size();
|
return !size();
|
||||||
}
|
}
|
||||||
// AAA
|
// AAA
|
||||||
class iterator: public std::iterator<std::bidirectional_iterator_tag, std::pair<IdString, SigSpec>> {
|
class iterator {
|
||||||
|
typedef std::bidirectional_iterator_tag iterator_category;
|
||||||
|
typedef std::pair<IdString, SigSpec> value_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef std::pair<IdString, SigSpec>* pointer;
|
||||||
|
typedef std::pair<IdString, SigSpec>& reference;
|
||||||
Cell* parent;
|
Cell* parent;
|
||||||
int position;
|
int position;
|
||||||
public:
|
public:
|
||||||
|
@ -1890,7 +1905,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// AAA CONST ITERATOR
|
// AAA CONST ITERATOR
|
||||||
class const_iterator: public std::iterator<std::input_iterator_tag, std::pair<IdString, SigSpec>> {
|
class const_iterator {
|
||||||
|
typedef std::input_iterator_tag iterator_category;
|
||||||
|
typedef std::pair<IdString, SigSpec> value_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef std::pair<IdString, SigSpec>* pointer;
|
||||||
|
typedef std::pair<IdString, SigSpec>& reference;
|
||||||
Cell* parent;
|
Cell* parent;
|
||||||
int position;
|
int position;
|
||||||
public:
|
public:
|
||||||
|
@ -1917,7 +1937,7 @@ public:
|
||||||
} else if (parent->type == ID($not)) {
|
} else if (parent->type == ID($not)) {
|
||||||
return parent->not_.connections()[position];
|
return parent->not_.connections()[position];
|
||||||
} else {
|
} else {
|
||||||
log_assert(false && "malformed cell or code broke");
|
throw std::out_of_range("FakeConns.const_iterator::operator*() const");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1951,7 +1971,7 @@ public:
|
||||||
bool has_memid() { return is_legacy() && legacy->has_memid(); }
|
bool has_memid() { return is_legacy() && legacy->has_memid(); }
|
||||||
bool is_mem_cell() { return is_legacy() && legacy->is_mem_cell(); }
|
bool is_mem_cell() { return is_legacy() && legacy->is_mem_cell(); }
|
||||||
// TODO stub
|
// TODO stub
|
||||||
void set_src_attribute(const std::string &src) { };
|
void set_src_attribute(const std::string &src) { (void)src; };
|
||||||
|
|
||||||
void setPort(const RTLIL::IdString &portname, RTLIL::SigSpec signal);
|
void setPort(const RTLIL::IdString &portname, RTLIL::SigSpec signal);
|
||||||
const RTLIL::SigSpec &getPort(const RTLIL::IdString &portname);
|
const RTLIL::SigSpec &getPort(const RTLIL::IdString &portname);
|
||||||
|
@ -1967,7 +1987,7 @@ public:
|
||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void rewrite_sigspecs(T &functor) {
|
void rewrite_sigspecs(T &functor) {
|
||||||
for (auto &it : connections_)
|
for (std::pair<IdString, SigSpec> &it : connections_)
|
||||||
functor(it.second);
|
functor(it.second);
|
||||||
}
|
}
|
||||||
void sort() {
|
void sort() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue