aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-08-01 16:53:15 +0200
committerClifford Wolf <clifford@clifford.at>2014-08-01 17:14:32 +0200
commitd13eb7e0999def2da03eb6ddef805145f7fd9c9a (patch)
treed7634c448a42722357b474926056c10797f1546d /kernel/rtlil.cc
parent97a17d39e2f0088e02ed8496d905528722115674 (diff)
downloadyosys-d13eb7e0999def2da03eb6ddef805145f7fd9c9a.tar.gz
yosys-d13eb7e0999def2da03eb6ddef805145f7fd9c9a.tar.bz2
yosys-d13eb7e0999def2da03eb6ddef805145f7fd9c9a.zip
Added ModIndex helper class, some changes to RTLIL::Monitor
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r--kernel/rtlil.cc36
1 files changed, 23 insertions, 13 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 79ddd2e02..137058522 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1092,11 +1092,11 @@ void RTLIL::Module::connect(const RTLIL::SigSpec &lhs, const RTLIL::SigSpec &rhs
void RTLIL::Module::new_connections(const std::vector<RTLIL::SigSig> &new_conn)
{
for (auto mon : monitors)
- mon->notify_new_connections(this, new_conn);
+ mon->notify_connect(this, new_conn);
if (design)
for (auto mon : design->monitors)
- mon->notify_new_connections(this, new_conn);
+ mon->notify_connect(this, new_conn);
connections_ = new_conn;
}
@@ -1516,30 +1516,40 @@ bool RTLIL::Cell::hasPort(RTLIL::IdString portname) const
void RTLIL::Cell::unsetPort(RTLIL::IdString portname)
{
- std::pair<RTLIL::IdString, RTLIL::SigSpec> new_conn(portname, RTLIL::SigSpec());
+ RTLIL::SigSpec signal;
+ auto conn_it = connections_.find(portname);
- for (auto mon : module->monitors)
- mon->notify_cell_connect(this, new_conn);
+ if (conn_it != connections_.end())
+ {
+ for (auto mon : module->monitors)
+ mon->notify_connect(this, conn_it->first, conn_it->second, signal);
- if (module->design)
- for (auto mon : module->design->monitors)
- mon->notify_cell_connect(this, new_conn);
+ if (module->design)
+ for (auto mon : module->design->monitors)
+ mon->notify_connect(this, conn_it->first, conn_it->second, signal);
- connections_.erase(portname);
+ connections_.erase(conn_it);
+ }
}
void RTLIL::Cell::setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
{
- std::pair<RTLIL::IdString, RTLIL::SigSpec> new_conn(portname, signal);
+ auto conn_it = connections_.find(portname);
+
+ if (conn_it == connections_.end()) {
+ connections_[portname] = RTLIL::SigSpec();
+ conn_it = connections_.find(portname);
+ log_assert(conn_it != connections_.end());
+ }
for (auto mon : module->monitors)
- mon->notify_cell_connect(this, new_conn);
+ mon->notify_connect(this, conn_it->first, conn_it->second, signal);
if (module->design)
for (auto mon : module->design->monitors)
- mon->notify_cell_connect(this, new_conn);
+ mon->notify_connect(this, conn_it->first, conn_it->second, signal);
- connections_[portname] = signal;
+ conn_it->second = signal;
}
const RTLIL::SigSpec &RTLIL::Cell::getPort(RTLIL::IdString portname) const