aboutsummaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-02-18 10:52:37 +0000
committergatecat <gatecat@ds0.me>2022-02-18 11:13:18 +0000
commit6a32aca4ac8705b637943c236cedd2f36422fb21 (patch)
tree28483964fb3c92bc104ab6162d1c9196651ced26 /generic
parent61d1db16be2c68cf6ae8b4d2ff3266b5c7086ad2 (diff)
downloadnextpnr-6a32aca4ac8705b637943c236cedd2f36422fb21.tar.gz
nextpnr-6a32aca4ac8705b637943c236cedd2f36422fb21.tar.bz2
nextpnr-6a32aca4ac8705b637943c236cedd2f36422fb21.zip
refactor: New member functions to replace design_utils
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'generic')
-rw-r--r--generic/arch.cc2
-rw-r--r--generic/cells.cc22
-rw-r--r--generic/pack.cc2
-rw-r--r--generic/viaduct/example/example.cc6
-rw-r--r--generic/viaduct_helpers.cc8
5 files changed, 20 insertions, 20 deletions
diff --git a/generic/arch.cc b/generic/arch.cc
index ad054efd..c4814bab 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -721,7 +721,7 @@ void Arch::assignArchInfo()
CellInfo *ci = cell.second.get();
if (ci->type == id("GENERIC_SLICE")) {
ci->is_slice = true;
- ci->slice_clk = get_net_or_empty(ci, id("CLK"));
+ ci->slice_clk = ci->getPort(id("CLK"));
} else {
ci->is_slice = false;
}
diff --git a/generic/cells.cc b/generic/cells.cc
index c14ddf73..76d6474f 100644
--- a/generic/cells.cc
+++ b/generic/cells.cc
@@ -66,19 +66,19 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff)
for (int i = 0; i < lut_k; i++) {
IdString port = ctx->id("I[" + std::to_string(i) + "]");
- replace_port(lut, port, lc, port);
+ lut->movePortTo(port, lc, port);
}
if (no_dff) {
lc->params[ctx->id("FF_USED")] = 0;
- replace_port(lut, ctx->id("Q"), lc, ctx->id("F"));
+ lut->movePortTo(ctx->id("Q"), lc, ctx->id("F"));
}
}
void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut)
{
lc->params[ctx->id("FF_USED")] = 1;
- replace_port(dff, ctx->id("CLK"), lc, ctx->id("CLK"));
+ dff->movePortTo(ctx->id("CLK"), lc, ctx->id("CLK"));
if (pass_thru_lut) {
// Fill LUT with alternating 10
@@ -89,26 +89,26 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l
init.append("10");
lc->params[ctx->id("INIT")] = Property::from_string(init);
- replace_port(dff, ctx->id("D"), lc, ctx->id("I[0]"));
+ dff->movePortTo(ctx->id("D"), lc, ctx->id("I[0]"));
}
- replace_port(dff, ctx->id("Q"), lc, ctx->id("Q"));
+ dff->movePortTo(ctx->id("Q"), lc, ctx->id("Q"));
}
void nxio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *iob, pool<IdString> &todelete_cells)
{
if (nxio->type == ctx->id("$nextpnr_ibuf")) {
iob->params[ctx->id("INPUT_USED")] = 1;
- replace_port(nxio, ctx->id("O"), iob, ctx->id("O"));
+ nxio->movePortTo(ctx->id("O"), iob, ctx->id("O"));
} else if (nxio->type == ctx->id("$nextpnr_obuf")) {
iob->params[ctx->id("OUTPUT_USED")] = 1;
- replace_port(nxio, ctx->id("I"), iob, ctx->id("I"));
+ nxio->movePortTo(ctx->id("I"), iob, ctx->id("I"));
} else if (nxio->type == ctx->id("$nextpnr_iobuf")) {
// N.B. tristate will be dealt with below
iob->params[ctx->id("INPUT_USED")] = 1;
iob->params[ctx->id("OUTPUT_USED")] = 1;
- replace_port(nxio, ctx->id("I"), iob, ctx->id("I"));
- replace_port(nxio, ctx->id("O"), iob, ctx->id("O"));
+ nxio->movePortTo(ctx->id("I"), iob, ctx->id("I"));
+ nxio->movePortTo(ctx->id("O"), iob, ctx->id("O"));
} else {
NPNR_ASSERT(false);
}
@@ -118,8 +118,8 @@ void nxio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *iob, pool<IdString> &to
ctx->id("Y"));
if (tbuf) {
iob->params[ctx->id("ENABLE_USED")] = 1;
- replace_port(tbuf, ctx->id("A"), iob, ctx->id("I"));
- replace_port(tbuf, ctx->id("E"), iob, ctx->id("EN"));
+ tbuf->movePortTo(ctx->id("A"), iob, ctx->id("I"));
+ tbuf->movePortTo(ctx->id("E"), iob, ctx->id("EN"));
if (donet->users.size() > 1) {
for (auto user : donet->users)
diff --git a/generic/pack.cc b/generic/pack.cc
index 8bdbbed0..cb3f5897 100644
--- a/generic/pack.cc
+++ b/generic/pack.cc
@@ -242,7 +242,7 @@ static void pack_io(Context *ctx)
} else if (bool_or_default(ctx->settings, ctx->id("disable_iobs"))) {
// No IO buffer insertion; just remove nextpnr_[io]buf
for (auto &p : ci->ports)
- disconnect_port(ctx, ci, p.first);
+ ci->disconnectPort(p.first);
} else {
// Create a GENERIC_IOB buffer
std::unique_ptr<CellInfo> ice_cell =
diff --git a/generic/viaduct/example/example.cc b/generic/viaduct/example/example.cc
index 3d1c201c..49b36792 100644
--- a/generic/viaduct/example/example.cc
+++ b/generic/viaduct/example/example.cc
@@ -253,10 +253,10 @@ struct ExampleImpl : ViaductAPI
CellInfo *ci = cell.second.get();
auto &fc = fast_cell_info.at(ci->flat_index);
if (ci->type == id_LUT4) {
- fc.lut_f = get_net_or_empty(ci, id_F);
- fc.lut_i3_used = (get_net_or_empty(ci, ctx->id(stringf("I[%d]", K - 1))) != nullptr);
+ fc.lut_f = ci->getPort(id_F);
+ fc.lut_i3_used = (ci->getPort(ctx->id(stringf("I[%d]", K - 1))) != nullptr);
} else if (ci->type == id_DFF) {
- fc.ff_d = get_net_or_empty(ci, id_D);
+ fc.ff_d = ci->getPort(id_D);
}
}
}
diff --git a/generic/viaduct_helpers.cc b/generic/viaduct_helpers.cc
index e9f7fa60..10c3b802 100644
--- a/generic/viaduct_helpers.cc
+++ b/generic/viaduct_helpers.cc
@@ -59,13 +59,13 @@ void ViaductHelpers::remove_nextpnr_iobs(const pool<CellTypePort> &top_ports)
auto &ci = *cell.second;
if (!ci.type.in(ctx->id("$nextpnr_ibuf"), ctx->id("$nextpnr_obuf"), ctx->id("$nextpnr_iobuf")))
continue;
- NetInfo *i = get_net_or_empty(&ci, ctx->id("I"));
+ NetInfo *i = ci.getPort(ctx->id("I"));
if (i && i->driver.cell) {
if (!top_ports.count(CellTypePort(i->driver)))
log_error("Top-level port '%s' driven by illegal port %s.%s\n", ctx->nameOf(&ci),
ctx->nameOf(i->driver.cell), ctx->nameOf(i->driver.port));
}
- NetInfo *o = get_net_or_empty(&ci, ctx->id("O"));
+ NetInfo *o = ci.getPort(ctx->id("O"));
if (o) {
for (auto &usr : o->users) {
if (!top_ports.count(CellTypePort(usr)))
@@ -73,8 +73,8 @@ void ViaductHelpers::remove_nextpnr_iobs(const pool<CellTypePort> &top_ports)
ctx->nameOf(usr.cell), ctx->nameOf(usr.port));
}
}
- disconnect_port(ctx, &ci, ctx->id("I"));
- disconnect_port(ctx, &ci, ctx->id("O"));
+ ci.disconnectPort(ctx->id("I"));
+ ci.disconnectPort(ctx->id("O"));
to_remove.push_back(ci.name);
}
for (IdString cell_name : to_remove)