Skip to content

Commit

Permalink
Add missing BELs, fix DCCA/DCMA naming, and start assigning nominal p…
Browse files Browse the repository at this point in the history
…ositions to globals connected to missing BELs (checkpoint commit).
  • Loading branch information
cr1901 committed Aug 15, 2020
1 parent 811a2da commit 0401e80
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
4 changes: 2 additions & 2 deletions libtrellis/include/Bels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace MachXO2Bels {

void add_lc(RoutingGraph &graph, int x, int y, int z);
void add_pio(RoutingGraph &graph, int x, int y, int z);
void add_dcc(RoutingGraph &graph, int x, int y, const std::string &name, int z);
void add_dcm(RoutingGraph &graph, int x, int y, int z);
void add_dcc(RoutingGraph &graph, int x, int y, /* const std::string &name, */ int z);
void add_dcm(RoutingGraph &graph, int x, int y, int n, int z);
void add_osch(RoutingGraph &graph, int x, int y, int z);

}
Expand Down
27 changes: 16 additions & 11 deletions libtrellis/src/Bels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,16 @@ namespace MachXO2Bels {
graph.add_bel(bel);
}

void add_dcc(RoutingGraph &graph, int x, int y, const std::string &name, int z) {
string full_name = string("DCC") + name;
void add_dcc(RoutingGraph &graph, int x, int y, /* const std::string &name, */ int z) {
// TODO: All DCCs appear to be in center. Phantom DCCs line the columns
// for global routing with names of the form DCC_RxCy_{0,1}{T,B}. Hence
// commented-out name parameter.
// Diamond acknowledges these BELs, but attempting to use them crashes.
// See if they indeed do exist.
string name = string("DCC") + std::to_string(z);
RoutingBel bel;
bel.name = graph.ident(full_name);
bel.type = graph.ident("DCC");
bel.name = graph.ident(name);
bel.type = graph.ident("DCCA");
bel.loc.x = x;
bel.loc.y = y;
bel.z = z;
Expand All @@ -755,19 +760,19 @@ namespace MachXO2Bels {
graph.add_bel(bel);
}

void add_dcm(RoutingGraph &graph, int x, int y, int z) {
string name = string("DCM") + std::to_string(z);
void add_dcm(RoutingGraph &graph, int x, int y, int n, int z) {
string name = string("DCM") + std::to_string(n);
RoutingBel bel;
bel.name = graph.ident(name);
bel.type = graph.ident("DCM");
bel.type = graph.ident("DCMA");
bel.loc.x = x;
bel.loc.y = y;
bel.z = z;

graph.add_bel_input(bel, graph.ident("CLK0"), x, y, graph.ident(fmt("G_CLK0_" << z << "_DCM")));
graph.add_bel_input(bel, graph.ident("CLK1"), x, y, graph.ident(fmt("G_CLK1_" << z << "_DCM")));
graph.add_bel_input(bel, graph.ident("SEL"), x, y, graph.ident(fmt("G_JSEL" << z << "_DCM")));
graph.add_bel_output(bel, graph.ident("DCMOUT"), x, y, graph.ident(fmt("G_DCMOUT" << z << "_DCM")));
graph.add_bel_input(bel, graph.ident("CLK0"), x, y, graph.ident(fmt("G_CLK0_" << n << "_DCM")));
graph.add_bel_input(bel, graph.ident("CLK1"), x, y, graph.ident(fmt("G_CLK1_" << n << "_DCM")));
graph.add_bel_input(bel, graph.ident("SEL"), x, y, graph.ident(fmt("G_JSEL" << n << "_DCM")));
graph.add_bel_output(bel, graph.ident("DCMOUT"), x, y, graph.ident(fmt("G_DCMOUT" << n << "_DCM")));

graph.add_bel(bel);
}
Expand Down
13 changes: 13 additions & 0 deletions libtrellis/src/Chip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ shared_ptr<RoutingGraph> Chip::get_routing_graph_machxo2()
tile->info.type.find("PIC_B") != string::npos)
for (int z = 0; z < 4; z++)
MachXO2Bels::add_pio(*rg, x, y, z);

// DCC/DCM MachXO2Bels
if (tile->info.type.find("CENTER_EBR_CIB") != string::npos) {
for (int z = 0; z < 8; z++)
MachXO2Bels::add_dcc(*rg, x, y, z);
for (int z = 6; z < 8; z++)
// Start at z = 8, but names start at 6.
MachXO2Bels::add_dcm(*rg, x, y, z, z + 2);
}

if (tile->info.type.find("CIB_CFG0") != string::npos) {
MachXO2Bels::add_osch(*rg, x, y, 0);
}
}

return rg;
Expand Down
8 changes: 7 additions & 1 deletion libtrellis/src/RoutingGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ RoutingId RoutingGraph::find_machxo2_global_position(int row, int col, const std
// 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;
Expand Down Expand Up @@ -354,7 +355,12 @@ RoutingId RoutingGraph::find_machxo2_global_position(int row, int col, const std
curr_global.loc.x = -2;
curr_global.loc.y = -2;
return curr_global;
} else if(regex_match(db_name, m, clk_dcc)) {
} else if(regex_match(db_name, m, clk_dcc) ||
db_name.find("G_JOSC_OSC") != string::npos ||
db_name.find("_DCM") != string::npos) {

// TODO: _DCM should really be a regex.
// Assign nominal position of current requested tile.
curr_global.id = ident(db_name);
curr_global.loc.x = col;
curr_global.loc.y = row;
Expand Down

0 comments on commit 0401e80

Please sign in to comment.