aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/site_router.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-03-03 07:06:07 +0000
committerGitHub <noreply@github.com>2021-03-03 07:06:07 +0000
commit6e38e236f88db749788fb74a6fa8ac0c80b6035b (patch)
treedfab73bc8afa157ebf323a8f6c9b54d0998392f0 /fpga_interchange/site_router.cc
parent27fbee523301be074abd06a3568dc9591d98e0fa (diff)
parent71b92cb8139c63a7936fa05f2a47739b0c115b01 (diff)
downloadnextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.tar.gz
nextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.tar.bz2
nextpnr-6e38e236f88db749788fb74a6fa8ac0c80b6035b.zip
Merge pull request #604 from litghost/add_counter_test
Add counter test for FPGA interchange
Diffstat (limited to 'fpga_interchange/site_router.cc')
-rw-r--r--fpga_interchange/site_router.cc37
1 files changed, 31 insertions, 6 deletions
diff --git a/fpga_interchange/site_router.cc b/fpga_interchange/site_router.cc
index 7232b635..9d4fc57c 100644
--- a/fpga_interchange/site_router.cc
+++ b/fpga_interchange/site_router.cc
@@ -697,7 +697,7 @@ bool route_site(const Context *ctx, SiteInformation *site_info)
// The simplistic solution (only select when 1 solution is available)
// will likely solve initial problems. Once that is show to be wrong,
// come back with something more general.
- NPNR_ASSERT(false);
+ return false;
} while (!wire_to_expansion.empty());
@@ -747,17 +747,42 @@ bool SiteRouter::checkSiteRouting(const Context *ctx, const TileStatus &tile_sta
return site_ok;
}
}
- //
+
// FIXME: Populate "consumed_wires" with all VCC/GND tied in the site.
// This will allow route_site to leverage site local constant sources.
//
// FIXME: Handle case where a constant is requested, but use of an
// inverter is possible. This is the place to handle "bestConstant"
// (e.g. route VCC's over GND's, etc).
- //
- // FIXME: Enable some LUT rotation!
- // Default cell/bel pin map always uses high pins, which will generate
- // conflicts where there are none!!!
+ auto tile_type_idx = ctx->chip_info->tiles[tile].type;
+ const std::vector<LutElement> &lut_elements = ctx->lut_elements.at(tile_type_idx);
+ std::vector<LutMapper> lut_mappers;
+ lut_mappers.reserve(lut_elements.size());
+ for (size_t i = 0; i < lut_elements.size(); ++i) {
+ lut_mappers.push_back(LutMapper(lut_elements[i]));
+ }
+
+ for (CellInfo *cell : cells_in_site) {
+ if (cell->lut_cell.pins.empty()) {
+ continue;
+ }
+
+ BelId bel = cell->bel;
+ const auto &bel_data = bel_info(ctx->chip_info, bel);
+ if (bel_data.lut_element != -1) {
+ lut_mappers[bel_data.lut_element].cells.push_back(cell);
+ }
+ }
+
+ for (LutMapper lut_mapper : lut_mappers) {
+ if (lut_mapper.cells.empty()) {
+ continue;
+ }
+
+ if (!lut_mapper.remap_luts(ctx)) {
+ return false;
+ }
+ }
SiteInformation site_info(ctx, cells_in_site);