Skip to content

Commit 2fb9c69

Browse files
committed
vpr: Spread-out source/sink nodes when drawing height > 1 blocks
1 parent 8e74127 commit 2fb9c69

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

vpr/src/draw/draw.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,18 +2194,31 @@ static void draw_rr_src_sink(int inode, ezgl::color color, ezgl::renderer* g) {
21942194
static void draw_get_rr_src_sink_coords(const t_rr_node& node, float* xcen, float* ycen) {
21952195
t_draw_coords* draw_coords = get_draw_coords_vars();
21962196

2197-
2198-
float xc = draw_coords->tile_x[node.xlow()];
2199-
float yc = draw_coords->tile_y[node.ylow()];
2200-
22012197
auto& device_ctx = g_vpr_ctx.device();
22022198
t_physical_tile_type_ptr tile_type = device_ctx.grid[node.xlow()][node.ylow()].type;
22032199

2200+
//Number of classes (i.e. src/sinks) we need to draw
22042201
float num_class = tile_type->class_inf.size();
22052202

2203+
int height = tile_type->height; //Height in blocks
2204+
2205+
//How many classes to draw per unit block height
2206+
int class_per_height = num_class;
2207+
if (height > 1) {
2208+
class_per_height = num_class / (height - 1);
2209+
}
2210+
2211+
int class_height_offset = node.class_num() / class_per_height; //Offset wrt block height
2212+
int class_height_shift = node.class_num() % class_per_height; //Offset within unit block
2213+
2214+
float xc = draw_coords->tile_x[node.xlow()];
2215+
float yc = draw_coords->tile_y[node.ylow() + class_height_offset];
2216+
22062217
*xcen = xc + 0.5 * draw_coords->get_tile_width();
22072218

2208-
float ypos = ((node.class_num() + 1) / (num_class + 1));
2219+
float class_section_height = class_per_height + 1;
2220+
2221+
float ypos = (class_height_shift + 1) / class_section_height;
22092222
*ycen = yc + ypos * draw_coords->get_tile_height();
22102223
}
22112224

0 commit comments

Comments
 (0)