Inject MachXO2 globals info into RoutingGraph. Create stub BRANCH handling, and handle "DCC" globals connecting L/R to U/D.
diff --git a/libtrellis/include/RoutingGraph.hpp b/libtrellis/include/RoutingGraph.hpp index dadb32d..be23e77 100644 --- a/libtrellis/include/RoutingGraph.hpp +++ b/libtrellis/include/RoutingGraph.hpp
@@ -8,6 +8,9 @@ #include <set> #include <boost/functional/hash.hpp> +#include "Chip.hpp" +#include "Database.hpp" + using namespace std; namespace Trellis { @@ -167,6 +170,9 @@ // Algorithm to give global nets a unique position in MachXO2 devices. // ECP5 defers global routing to nextpnr. RoutingId find_machxo2_global_position(int row, int col, const std::string &db_name); + // We need access to globals.json to correctly assign global positions. + // Internal use only- do NOT expose to pytrellis for now. + MachXO2GlobalsInfo global_data_machxo2; }; }
diff --git a/libtrellis/src/RoutingGraph.cpp b/libtrellis/src/RoutingGraph.cpp index 7eea329..5c50fbc 100644 --- a/libtrellis/src/RoutingGraph.cpp +++ b/libtrellis/src/RoutingGraph.cpp
@@ -30,6 +30,9 @@ chip_prefix = "1200_"; else assert(false); + + if(c.info.family == "MachXO2") + global_data_machxo2 = get_global_info_machxo2(DeviceLocator{c.info.family, c.info.name}); } ident_t IdStore::ident(const std::string &str) const @@ -281,6 +284,8 @@ // Globals are given their nominal position, even if they span multiple // tiles, by the following rules: + static const std::regex clk_dcc(R"(^G_CLK[IO]\d[TB]_DCC)", std::regex::optimize); + smatch m; pair<int, int> center = center_map[make_pair(max_row, max_col)]; RoutingId curr_global; @@ -311,6 +316,7 @@ curr_global.id = ident(db_copy); curr_global.loc.x = center.second; curr_global.loc.y = center.first; + return curr_global; // U/D wires get the nominal position of center row, current column. @@ -343,6 +349,16 @@ curr_global.loc.y = center.first; return curr_global; } + } else if(db_name.find("BRANCH") != string::npos) { + curr_global.id = ident(db_name); + curr_global.loc.x = -2; + curr_global.loc.y = -2; + return curr_global; + } else if(regex_match(db_name, m, clk_dcc)) { + curr_global.id = ident(db_name); + curr_global.loc.x = col; + curr_global.loc.y = row; + return curr_global; } else { // TODO: Not fuzzed yet! return RoutingId();