Skip to content

Commit 62279ec

Browse files
author
Brandon Heiner
committed
Modified detailed routing to support different channel widths
1 parent aeddc02 commit 62279ec

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

doc/src/arch/reference.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,6 @@ Global Routing Information
754754
If global routing is to be performed, channels in different directions and in different parts of the FPGA can be set to different relative widths.
755755
This is specified in the content within the ``<chan_width_distr>`` tag.
756756
757-
.. note:: If detailed routing is to be performed, all the channels in the FPGA must have the same width.
758-
759757
.. arch:tag:: <x distr="{gaussian|uniform|pulse|delta}" peak="float" width=" float" xpeak=" float" dc=" float"/>
760758
761759
:req_param distr: The channel width distribution function

vpr/src/base/CheckSetup.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ void CheckSetup(const t_packer_opts& PackerOpts,
1212
const t_router_opts& RouterOpts,
1313
const t_det_routing_arch& RoutingArch,
1414
const std::vector<t_segment_inf>& Segments,
15-
const t_timing_inf Timing,
16-
const t_chan_width_dist Chans) {
15+
const t_timing_inf Timing) {
1716
int i;
1817
int Tmp;
1918

@@ -61,15 +60,6 @@ void CheckSetup(const t_packer_opts& PackerOpts,
6160
}
6261
}
6362

64-
if (DETAILED == RouterOpts.route_type) {
65-
if ((Chans.chan_x_dist.type != UNIFORM)
66-
|| (Chans.chan_y_dist.type != UNIFORM)
67-
|| (Chans.chan_x_dist.peak != Chans.chan_y_dist.peak)) {
68-
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
69-
"Detailed routing currently only supported on FPGAs with all channels of equal width.\n");
70-
}
71-
}
72-
7363
for (i = 0; i < (int)Segments.size(); ++i) {
7464
Tmp = Segments[i].arch_opin_switch;
7565
auto& device_ctx = g_vpr_ctx.device();

vpr/src/base/CheckSetup.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ void CheckSetup(const t_packer_opts& PackerOpts,
77
const t_router_opts& RouterOpts,
88
const t_det_routing_arch& RoutingArch,
99
const std::vector<t_segment_inf>& Segments,
10-
const t_timing_inf Timing,
11-
const t_chan_width_dist Chans);
10+
const t_timing_inf Timing);
1211

1312
#endif

vpr/src/base/place_and_route.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
#include "timing_info.h"
3838
#include "tatum/echo_writer.hpp"
3939

40+
/******************* Variables local to this module ************************/
41+
42+
/* Used to pass directionality from the binary_search_place_and_route subroutine *
43+
* to the init_chan subroutine. */
44+
static t_graph_type graph_directionality;
45+
4046
/******************* Subroutines local to this module ************************/
4147

4248
static float comp_width(t_chan* chan, float x, float separation);
@@ -87,8 +93,10 @@ int binary_search_place_and_route(const t_placer_opts& placer_opts_ref,
8793

8894
if (router_opts.route_type == GLOBAL) {
8995
graph_type = GRAPH_GLOBAL;
96+
graph_directionality = GRAPH_GLOBAL;
9097
} else {
9198
graph_type = (det_routing_arch->directionality == BI_DIRECTIONAL ? GRAPH_BIDIR : GRAPH_UNIDIR);
99+
graph_directionality = (det_routing_arch->directionality == BI_DIRECTIONAL ? GRAPH_BIDIR : GRAPH_UNIDIR);
92100
}
93101

94102
best_routing = alloc_saved_routing();
@@ -395,6 +403,7 @@ t_chan_width init_chan(int cfactor, t_chan_width_dist chan_width_dist) {
395403
t_chan_width chan_width;
396404
chan_width.x_list.resize(grid.height());
397405
chan_width.y_list.resize(grid.width());
406+
int computed_width;
398407

399408
if (grid.height() > 1) {
400409
int num_channels = grid.height() - 1;
@@ -403,7 +412,12 @@ t_chan_width init_chan(int cfactor, t_chan_width_dist chan_width_dist) {
403412

404413
for (size_t i = 0; i < grid.height(); ++i) {
405414
float y = float(i) / num_channels;
406-
chan_width.x_list[i] = (int)floor(cfactor * comp_width(&chan_x_dist, y, separation) + 0.5);
415+
computed_width = (int)floor(cfactor * comp_width(&chan_x_dist, y, separation) + 0.5);
416+
if ((GRAPH_BIDIR == graph_directionality) || computed_width % 2 == 0) {
417+
chan_width.x_list[i] = computed_width;
418+
} else {
419+
chan_width.x_list[i] = computed_width - 1;
420+
}
407421
chan_width.x_list[i] = std::max(chan_width.x_list[i], 1); //Minimum channel width 1
408422
}
409423
}
@@ -415,8 +429,12 @@ t_chan_width init_chan(int cfactor, t_chan_width_dist chan_width_dist) {
415429

416430
for (size_t i = 0; i < grid.width(); ++i) { //-2 for no perim channels
417431
float x = float(i) / num_channels;
418-
419-
chan_width.y_list[i] = (int)floor(cfactor * comp_width(&chan_y_dist, x, separation) + 0.5);
432+
computed_width = (int)floor(cfactor * comp_width(&chan_y_dist, x, separation) + 0.5);
433+
if ((GRAPH_BIDIR == graph_directionality) || computed_width % 2 == 0) {
434+
chan_width.y_list[i] = computed_width;
435+
} else {
436+
chan_width.y_list[i] = computed_width - 1;
437+
}
420438
chan_width.y_list[i] = std::max(chan_width.y_list[i], 1); //Minimum channel width 1
421439
}
422440
}

vpr/src/base/vpr_api.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ void vpr_init_with_options(const t_options* options, t_vpr_setup* vpr_setup, t_a
301301
CheckSetup(vpr_setup->PackerOpts,
302302
vpr_setup->PlacerOpts,
303303
vpr_setup->RouterOpts,
304-
vpr_setup->RoutingArch, vpr_setup->Segments, vpr_setup->Timing,
305-
arch->Chans);
304+
vpr_setup->RoutingArch, vpr_setup->Segments, vpr_setup->Timing);
306305

307306
/* flush any messages to user still in stdout that hasn't gotten displayed */
308307
fflush(stdout);
@@ -1164,10 +1163,9 @@ void vpr_check_setup(const t_packer_opts& PackerOpts,
11641163
const t_router_opts& RouterOpts,
11651164
const t_det_routing_arch& RoutingArch,
11661165
const std::vector<t_segment_inf>& Segments,
1167-
const t_timing_inf& Timing,
1168-
const t_chan_width_dist& Chans) {
1166+
const t_timing_inf& Timing) {
11691167
CheckSetup(PackerOpts, PlacerOpts, RouterOpts, RoutingArch,
1170-
Segments, Timing, Chans);
1168+
Segments, Timing);
11711169
}
11721170

11731171
///@brief Show current setup

vpr/src/base/vpr_api.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ void vpr_check_setup(const t_packer_opts& PackerOpts,
174174
const t_router_opts& RouterOpts,
175175
const t_det_routing_arch& RoutingArch,
176176
const std::vector<t_segment_inf>& Segments,
177-
const t_timing_inf& Timing,
178-
const t_chan_width_dist& Chans);
177+
const t_timing_inf& Timing);
179178

180179
///@brief Show current setup
181180
void vpr_show_setup(const t_vpr_setup& vpr_setup);

0 commit comments

Comments
 (0)