Skip to content

Commit 5d48549

Browse files
mtdudekacomodi
authored andcommitted
Initial FPGA Interchange rr_graph builder
Signed-off-by: Maciej Dudek <[email protected]>
1 parent cd8fb2b commit 5d48549

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
422422

423423
RouterOpts->max_logged_overused_rr_nodes = Options.max_logged_overused_rr_nodes;
424424
RouterOpts->generate_rr_node_overuse_report = Options.generate_rr_node_overuse_report;
425+
RouterOpts->FPGAInterchange = Options.FPGAInterchangeDevice;
425426
}
426427

427428
static void SetupAnnealSched(const t_options& Options,

vpr/src/route/rr_graph.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "build_switchblocks.h"
3232
#include "rr_graph_writer.h"
3333
#include "rr_graph_reader.h"
34+
#include "rr_graph_fpga_interchange.h"
3435
#include "router_lookahead_map.h"
3536
#include "rr_graph_clock.h"
3637
#include "edge_groups.h"
@@ -315,7 +316,8 @@ void create_rr_graph(const t_graph_type graph_type,
315316
int* Warnings) {
316317
const auto& device_ctx = g_vpr_ctx.device();
317318
auto& mutable_device_ctx = g_vpr_ctx.mutable_device();
318-
if (!det_routing_arch->read_rr_graph_filename.empty()) {
319+
320+
if (!det_routing_arch->read_rr_graph_filename.empty() || router_opts.FPGAInterchange) {
319321
if (device_ctx.read_rr_graph_filename != det_routing_arch->read_rr_graph_filename) {
320322
free_rr_graph();
321323

@@ -332,6 +334,25 @@ void create_rr_graph(const t_graph_type graph_type,
332334
router_opts.reorder_rr_graph_nodes_threshold,
333335
router_opts.reorder_rr_graph_nodes_seed);
334336
}
337+
} else if (!device_ctx.read_rr_graph_filename.size() && router_opts.FPGAInterchange) {
338+
free_rr_graph();
339+
340+
VTR_LOG("Custom RR_graph generator\n");
341+
build_rr_graph_fpga_interchange(graph_type,
342+
grid,
343+
segment_inf,
344+
router_opts.base_cost_type,
345+
&det_routing_arch->wire_to_rr_ipin_switch,
346+
det_routing_arch->read_rr_graph_filename.c_str(),
347+
router_opts.read_rr_edge_metadata,
348+
router_opts.do_check_rr_graph);
349+
350+
exit(0);
351+
if (router_opts.reorder_rr_graph_nodes_algorithm != DONT_REORDER) {
352+
mutable_device_ctx.rr_graph_builder.reorder_nodes(router_opts.reorder_rr_graph_nodes_algorithm,
353+
router_opts.reorder_rr_graph_nodes_threshold,
354+
router_opts.reorder_rr_graph_nodes_seed);
355+
}
335356
}
336357
} else {
337358
if (channel_widths_unchanged(device_ctx.chan_width, nodes_per_chan) && !device_ctx.rr_graph.empty()) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "rr_graph_fpga_interchange.h"
2+
3+
#include "arch_util.h"
4+
#include "vtr_time.h"
5+
#include "globals.h"
6+
7+
void build_rr_graph_fpga_interchange(const t_graph_type graph_type,
8+
const DeviceGrid& grid,
9+
const std::vector<t_segment_inf>& segment_inf,
10+
const enum e_base_cost_type base_cost_type,
11+
int* wire_to_rr_ipin_switch,
12+
const char* read_rr_graph_name,
13+
bool read_edge_metadata,
14+
bool do_check_rr_graph) {
15+
vtr::ScopedStartFinishTimer timer("Building RR Graph from device database");
16+
17+
auto& device_ctx = g_vpr_ctx.mutable_device();
18+
device_ctx.rr_segments = segment_inf;
19+
20+
VTR_LOG("%s\n", get_arch_file_name());
21+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Defines the function used to load an rr graph written in xml format into vpr*/
2+
3+
#ifndef RR_GRAPH_FPGA_INTERCHANGE_H
4+
#define RR_GRAPH_FPGA_INTERCHANGE_H
5+
6+
#include "rr_graph.h"
7+
#include "device_grid.h"
8+
9+
void build_rr_graph_fpga_interchange(const t_graph_type graph_type,
10+
const DeviceGrid& grid,
11+
const std::vector<t_segment_inf>& segment_inf,
12+
const enum e_base_cost_type base_cost_type,
13+
int* wire_to_rr_ipin_switch,
14+
const char* read_rr_graph_name,
15+
bool read_edge_metadata,
16+
bool do_check_rr_graph);
17+
18+
#endif /* RR_GRAPH_FPGA_INTERCHANGE_H */

0 commit comments

Comments
 (0)