Skip to content

Commit 5a10ec2

Browse files
apply PR comments for drawing interposer
1) early exit 2) commenting
1 parent aa8a2e5 commit 5a10ec2

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

vpr/src/draw/draw_interposer.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,33 @@ void draw_interposer_cuts(ezgl::renderer* g) {
1313
const DeviceGrid& grid = device_ctx.grid;
1414
const t_draw_coords* draw_coords = get_draw_coords_vars();
1515

16-
const std::vector<std::vector<int>>& horizontal_cuts = grid.get_horizontal_interposer_cuts();
17-
const std::vector<std::vector<int>>& vertical_cuts = grid.get_vertical_interposer_cuts();
18-
19-
std::vector<std::pair<ezgl::point2d, ezgl::point2d>> lines_to_draw;
16+
if (draw_state->pic_on_screen == e_pic_type::NO_PICTURE) {
17+
return;
18+
}
19+
VTR_ASSERT_SAFE(draw_state->pic_on_screen == e_pic_type::PLACEMENT || draw_state->pic_on_screen == e_pic_type::ROUTING);
2020

21-
const ezgl::rectangle world{{draw_coords->tile_x.front() - draw_coords->get_tile_width(), draw_coords->tile_y.front() - draw_coords->get_tile_height()},
22-
{draw_coords->tile_x.back() + 2 * draw_coords->get_tile_width(), draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}};
21+
// A rectangle containing the FPGA fabric with some padding.
22+
// Used to determine the start and end coordinates of an interposer cut whose x or y position is fixed.
23+
const ezgl::rectangle world{
24+
{draw_coords->tile_x.front() - draw_coords->get_tile_width(),
25+
draw_coords->tile_y.front() - draw_coords->get_tile_height()},
26+
{draw_coords->tile_x.back() + 2 * draw_coords->get_tile_width(),
27+
draw_coords->tile_y.back() + 2 * draw_coords->get_tile_height()}
28+
};
2329

2430
g->set_color(ezgl::BLACK, 255);
2531
g->set_line_dash(ezgl::line_dash::asymmetric_5_3);
2632
g->set_line_width(2);
2733

34+
// Offset factor used to slightly shift the interposer cut lines away from tile boundaries.
35+
// During placement, we draw the line in the middle of a routing channel.
36+
// During routing, we draw the line closer to the tile that does not own the channel.
2837
const float offset_factor = draw_state->pic_on_screen == e_pic_type::PLACEMENT ? -0.5f : -0.5f / device_ctx.chan_width.max;
2938

39+
const std::vector<std::vector<int>>& horizontal_cuts = grid.get_horizontal_interposer_cuts();
40+
const std::vector<std::vector<int>>& vertical_cuts = grid.get_vertical_interposer_cuts();
41+
std::vector<std::pair<ezgl::point2d, ezgl::point2d>> lines_to_draw;
42+
3043
for (size_t layer = 0; layer < grid.get_num_layers(); layer++) {
3144
if (!draw_state->draw_layer_display[layer].visible) {
3245
continue;
@@ -43,12 +56,8 @@ void draw_interposer_cuts(ezgl::renderer* g) {
4356
}
4457
}
4558

46-
if (draw_state->pic_on_screen == e_pic_type::PLACEMENT || draw_state->pic_on_screen == e_pic_type::ROUTING) {
47-
for (const auto& [start, end] : lines_to_draw) {
48-
g->draw_line(start, end);
49-
}
50-
} else {
51-
VTR_ASSERT(draw_state->pic_on_screen == e_pic_type::NO_PICTURE);
59+
for (const auto& [start, end] : lines_to_draw) {
60+
g->draw_line(start, end);
5261
}
5362
}
5463

0 commit comments

Comments
 (0)