diff --git a/xc7/arch.cc b/xc7/arch.cc index b0be78eb..ae138513 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -37,6 +37,8 @@ TorcInfo::TorcInfo(Arch *ctx, const std::string &inDeviceName, const std::string : ddb(new DDB(inDeviceName, inPackageName)), sites(ddb->getSites()), tiles(ddb->getTiles()), segments(ddb->getSegments()) { + static const boost::regex re_loc(".+_X(\\d+)Y(\\d+)"); + boost::cmatch what; bel_to_site_index.reserve(sites.getSiteCount() * 4); bel_to_loc.reserve(sites.getSiteCount() * 4); site_index_to_bel.resize(sites.getSiteCount()); @@ -47,10 +49,12 @@ TorcInfo::TorcInfo(Arch *ctx, const std::string &inDeviceName, const std::string const auto &site = sites.getSite(i); const auto &pd = site.getPrimitiveDefPtr(); const auto &type = pd->getName(); - const auto &tile_info = tiles.getTileInfo(site.getTileIndex()); - const auto x = (tile_info.getCol() + 1) / - 2; // Divide by 2 because XDL coordinate space counts the INT tiles between CLBs - const auto y = tile_info.getRow(); + const auto &tileInfo = tiles.getTileInfo(site.getTileIndex()); + if (!boost::regex_match(tileInfo.getName(), what, re_loc)) + throw; + const auto x = boost::lexical_cast(what.str(1)); + const auto y = boost::lexical_cast(what.str(2)); + if (type == "SLICEL" || type == "SLICEM") { bel_to_site_index.push_back(i); bel_to_site_index.push_back(i); @@ -104,7 +108,6 @@ TorcInfo::TorcInfo(Arch *ctx, const std::string &inDeviceName, const std::string const boost::regex gclk("GCLK_(L_)?B\\d+(_EAST|_WEST)?"); std::unordered_map> delay_lookup; Tilewire currentTilewire; - boost::cmatch what; WireId w; w.index = 0; for (TileIndex tileIndex(0); tileIndex < tiles.getTileCount(); tileIndex++) { diff --git a/xc7/arch.h b/xc7/arch.h index d14ab9df..410bf8b1 100644 --- a/xc7/arch.h +++ b/xc7/arch.h @@ -320,24 +320,6 @@ struct TorcInfo std::vector pip_to_arc; int num_pips; std::vector pip_to_dst_wire; - - private: - void _construct(); - static std::vector construct_bel_to_site_index(Arch *ctx, const Sites &sites); - static std::vector construct_site_index_to_bel(Arch *ctx, const Sites &sites, - const std::vector &bel_to_site_index); - static std::vector construct_site_index_to_type(Arch *ctx, const Sites &sites); - static std::vector construct_bel_to_loc(const Sites &sites, const Tiles &tiles, const int num_bels, - const std::vector &site_index_to_type); - static std::vector - construct_wire_to_tilewire(const Segments &segments, const Tiles &tiles, - std::unordered_map &segment_to_wire, - std::unordered_map &trivial_to_wire); - static std::vector - construct_wire_to_delay(const Tiles &tiles, const std::vector &wire_to_tilewire, const DDB &ddb); - static std::vector construct_pip_to_arc(const std::vector &wire_to_tilewire, const DDB &ddb, - std::vector> &wire_to_pips_uphill, - std::vector> &wire_to_pips_downhill); }; extern std::unique_ptr torc_info;