aboutsummaryrefslogtreecommitdiffstats
path: root/common/design_utils.h
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-18 17:08:35 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-18 17:08:35 +0200
commit79d1075345010c025c014786d184ad648777f61c (patch)
treea52a3f81fe670e41accca9c5271ec7c3c166483d /common/design_utils.h
parent58dfdfa9c8481745e5b92e33d024b0ddc5d9d9dc (diff)
downloadnextpnr-79d1075345010c025c014786d184ad648777f61c.tar.gz
nextpnr-79d1075345010c025c014786d184ad648777f61c.tar.bz2
nextpnr-79d1075345010c025c014786d184ad648777f61c.zip
Getting rid of old IdString API users, Add ctx to many internal APIs
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'common/design_utils.h')
-rw-r--r--common/design_utils.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/design_utils.h b/common/design_utils.h
index 2177c0e5..d7f0b733 100644
--- a/common/design_utils.h
+++ b/common/design_utils.h
@@ -41,8 +41,9 @@ void replace_port(CellInfo *old_cell, IdString old_name, CellInfo *rep_cell,
// true, then this cell must be the only load. If ignore_cell is set, that cell
// is not considered
template <typename F1>
-CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port,
- bool exclusive = false, CellInfo *exclude = nullptr)
+CellInfo *net_only_drives(const Context *ctx, NetInfo *net, F1 cell_pred,
+ IdString port, bool exclusive = false,
+ CellInfo *exclude = nullptr)
{
if (net == nullptr)
return nullptr;
@@ -63,7 +64,8 @@ CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port,
}
}
for (const auto &load : net->users) {
- if (load.cell != exclude && cell_pred(load.cell) && load.port == port) {
+ if (load.cell != exclude && cell_pred(ctx, load.cell) &&
+ load.port == port) {
return load.cell;
}
}
@@ -73,11 +75,12 @@ CellInfo *net_only_drives(NetInfo *net, F1 cell_pred, IdString port,
// If a net is driven by a given port of a cell matching a predicate, return
// that cell, otherwise nullptr
template <typename F1>
-CellInfo *net_driven_by(const NetInfo *net, F1 cell_pred, IdString port)
+CellInfo *net_driven_by(const Context *ctx, const NetInfo *net, F1 cell_pred,
+ IdString port)
{
if (net == nullptr)
return nullptr;
- if (cell_pred(net->driver.cell) && net->driver.port == port) {
+ if (cell_pred(ctx, net->driver.cell) && net->driver.port == port) {
return net->driver.cell;
} else {
return nullptr;