diff options
author | David Shah <davey1576@gmail.com> | 2018-08-01 15:30:28 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-08-01 15:30:28 +0200 |
commit | 534465d3ad5a2d42766088418eb37f88b029b195 (patch) | |
tree | 7a97a777db33d0e610159359f45f1d9fe8408e76 /ecp5/arch.h | |
parent | bcdcba66a69fbad707866299772a17a4ba0972ee (diff) | |
download | nextpnr-534465d3ad5a2d42766088418eb37f88b029b195.tar.gz nextpnr-534465d3ad5a2d42766088418eb37f88b029b195.tar.bz2 nextpnr-534465d3ad5a2d42766088418eb37f88b029b195.zip |
ecp5: Adding tilegrid helper functions to Arch
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r-- | ecp5/arch.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h index 0685042c..002d69c2 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -759,6 +759,27 @@ struct Arch : BaseCtx return range; } + std::string getTileByTypeAndLocation(int row, int col, std::string type) const + { + auto &tileloc = chip_info->tile_info[row * chip_info->width + col]; + for (int i = 0; i < tileloc.num_tiles; i++) { + if (chip_info->tiletype_names[tileloc.tile_names[i].type_idx].get() == type) + return tileloc.tile_names[i].name.get(); + } + NPNR_ASSERT_FALSE_STR("no tile at (" + std::to_string(col) + ", " + std::to_string(row) + ") with type " + + type); + } + + std::string getPipTilename(PipId pip) const + { + auto &tileloc = chip_info->tile_info[pip.location.y * chip_info->width + pip.location.x]; + for (int i = 0; i < tileloc.num_tiles; i++) { + if (tileloc.tile_names[i].type_idx == locInfo(pip)->pip_data[pip.index].tile_type) + return tileloc.tile_names[i].name.get(); + } + NPNR_ASSERT_FALSE("failed to find Pip tile"); + } + std::string getPipTiletype(PipId pip) const { return chip_info->tiletype_names[locInfo(pip)->pip_data[pip.index].tile_type].get(); |