mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-24 01:25:33 +00:00
reconsidering unset
This commit is contained in:
parent
76102f0bc5
commit
d2107a9ee4
4 changed files with 17 additions and 15 deletions
|
@ -2458,6 +2458,7 @@ RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, RTLIL::IdString type)
|
|||
|
||||
RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, const RTLIL::Cell *other)
|
||||
{
|
||||
log_assert(other);
|
||||
RTLIL::Cell *cell = addCell(name, other->type);
|
||||
cell->connections_ = other->connections_;
|
||||
cell->parameters = other->parameters;
|
||||
|
|
|
@ -2030,14 +2030,11 @@ public:
|
|||
return !operator==(other);
|
||||
}
|
||||
int count(const RTLIL::IdString& portname) const {
|
||||
log("count this %d\n", this);
|
||||
try {
|
||||
parent->getPort(portname);
|
||||
} catch (const std::out_of_range& e) {
|
||||
log("count 0\n");
|
||||
return 0;
|
||||
}
|
||||
log("count 1\n");
|
||||
return 1;
|
||||
}
|
||||
size_t size() const {
|
||||
|
@ -2270,13 +2267,15 @@ public:
|
|||
throw std::out_of_range("FakeParams::size()");
|
||||
}
|
||||
}
|
||||
// TODO check
|
||||
void unsetPort(const RTLIL::IdString& portname) {
|
||||
if (is_legacy())
|
||||
legacy->unsetPort(portname);
|
||||
setPort(portname, SigSpec());
|
||||
try {
|
||||
setPort(portname, SigSpec());
|
||||
} catch (const std::out_of_range& e) {}
|
||||
}
|
||||
void setParam(const RTLIL::IdString ¶mname, RTLIL::Const value);
|
||||
// TODO is this reasonable at all?
|
||||
const RTLIL::Const& getParam(const RTLIL::IdString ¶mname) const;
|
||||
RTLIL::Const& getMutParam(const RTLIL::IdString ¶mname);
|
||||
bool hasParam(const RTLIL::IdString ¶mname) const {
|
||||
|
@ -2288,18 +2287,16 @@ public:
|
|||
throw std::out_of_range("FakeParams::size()");
|
||||
}
|
||||
}
|
||||
// TODO check
|
||||
void unsetParam(const RTLIL::IdString& paramname) {
|
||||
if (is_legacy())
|
||||
legacy->unsetParam(paramname);
|
||||
setPort(paramname, Const());
|
||||
try {
|
||||
setPort(paramname, Const());
|
||||
} catch (const std::out_of_range& e) {}
|
||||
}
|
||||
template<typename T>
|
||||
void rewrite_sigspecs2(T &functor) {
|
||||
// for(auto it = connections_.begin(); it != connections_.end(); ++it) {
|
||||
// auto& thing = *it;
|
||||
// functor(it.second);
|
||||
// }
|
||||
// TODO fix!!!
|
||||
for (auto it : connections_)
|
||||
functor(it.second);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue