@@ -499,11 +499,6 @@ void update_screen(ScreenUpdatePriority priority, const char* msg, enum pic_type
499
499
}
500
500
}
501
501
502
- // Block placements may have changed since previous invocation,
503
- // so we need to update the block colors in case blocks have changed
504
- // the tiles where they are implemented
505
- draw_reset_blk_colors ();
506
-
507
502
if (draw_state->show_graphics ) {
508
503
application.update_message (msg);
509
504
application.refresh_drawing ();
@@ -830,7 +825,8 @@ void alloc_draw_structs(const t_arch* arch) {
830
825
draw_internal_alloc_blk ();
831
826
832
827
draw_state->net_color .resize (cluster_ctx.clb_nlist .nets ().size ());
833
- draw_state->block_color .resize (cluster_ctx.clb_nlist .blocks ().size ());
828
+ draw_state->block_color_ .resize (cluster_ctx.clb_nlist .blocks ().size ());
829
+ draw_state->use_default_block_color_ .resize (cluster_ctx.clb_nlist .blocks ().size ());
834
830
835
831
/* Space is allocated for draw_rr_node but not initialized because we do *
836
832
* not yet know information about the routing resources. */
@@ -968,7 +964,7 @@ static void drawplace(ezgl::renderer* g) {
968
964
ezgl::color block_color;
969
965
t_logical_block_type_ptr logical_block_type = nullptr ;
970
966
if (bnum != EMPTY_BLOCK_ID) {
971
- block_color = draw_state->block_color [ bnum] ;
967
+ block_color = draw_state->block_color ( bnum) ;
972
968
logical_block_type = cluster_ctx.clb_nlist .block_type (bnum);
973
969
} else {
974
970
block_color = get_block_type_color (device_ctx.grid [i][j].type );
@@ -2675,7 +2671,7 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type, ClusterBlockId b
2675
2671
iclass = physical_tile->pin_class [physical_pin];
2676
2672
2677
2673
if (physical_tile->class_inf [iclass].type == DRIVER) { /* Fanout */
2678
- if (draw_state->block_color [ blk_id] == SELECTED_COLOR) {
2674
+ if (draw_state->block_color ( blk_id) == SELECTED_COLOR) {
2679
2675
/* If block already highlighted, de-highlight the fanout. (the deselect case)*/
2680
2676
draw_state->net_color [net_id] = ezgl::BLACK;
2681
2677
for (auto pin_id : cluster_ctx.clb_nlist .net_sinks (net_id)) {
@@ -2687,11 +2683,11 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type, ClusterBlockId b
2687
2683
draw_state->net_color [net_id] = DRIVES_IT_COLOR;
2688
2684
for (auto pin_id : cluster_ctx.clb_nlist .net_sinks (net_id)) {
2689
2685
fanblk = cluster_ctx.clb_nlist .pin_block (pin_id);
2690
- draw_state->block_color [ fanblk] = DRIVES_IT_COLOR;
2686
+ draw_state->set_block_color ( fanblk, DRIVES_IT_COLOR) ;
2691
2687
}
2692
2688
}
2693
2689
} else { /* This net is fanin to the block. */
2694
- if (draw_state->block_color [ blk_id] == SELECTED_COLOR) {
2690
+ if (draw_state->block_color ( blk_id) == SELECTED_COLOR) {
2695
2691
/* If block already highlighted, de-highlight the fanin. (the deselect case)*/
2696
2692
draw_state->net_color [net_id] = ezgl::BLACK;
2697
2693
fanblk = cluster_ctx.clb_nlist .net_driver_block (net_id); /* DRIVER to net */
@@ -2700,17 +2696,17 @@ void draw_highlight_blocks_color(t_logical_block_type_ptr type, ClusterBlockId b
2700
2696
/* Highlight the fanin */
2701
2697
draw_state->net_color [net_id] = DRIVEN_BY_IT_COLOR;
2702
2698
fanblk = cluster_ctx.clb_nlist .net_driver_block (net_id); /* DRIVER to net */
2703
- draw_state->block_color [ fanblk] = DRIVEN_BY_IT_COLOR;
2699
+ draw_state->set_block_color ( fanblk, DRIVEN_BY_IT_COLOR) ;
2704
2700
}
2705
2701
}
2706
2702
}
2707
2703
2708
- if (draw_state->block_color [ blk_id] == SELECTED_COLOR) {
2704
+ if (draw_state->block_color ( blk_id) == SELECTED_COLOR) {
2709
2705
/* If block already highlighted, de-highlight the selected block. */
2710
2706
draw_reset_blk_color (blk_id);
2711
2707
} else {
2712
2708
/* Highlight the selected block. */
2713
- draw_state->block_color [ blk_id] = SELECTED_COLOR;
2709
+ draw_state->set_block_color ( blk_id, SELECTED_COLOR) ;
2714
2710
}
2715
2711
}
2716
2712
@@ -2740,26 +2736,7 @@ void deselect_all() {
2740
2736
2741
2737
static void draw_reset_blk_color (ClusterBlockId blk_id) {
2742
2738
t_draw_state* draw_state = get_draw_state_vars ();
2743
-
2744
- auto & place_ctx = g_vpr_ctx.placement ();
2745
-
2746
- t_physical_tile_type_ptr tile_type = nullptr ;
2747
- if (place_ctx.block_locs .empty ()) {
2748
- // No placement, use best guess tile type color
2749
- auto & cluster_ctx = g_vpr_ctx.clustering ();
2750
-
2751
- tile_type = pick_best_physical_type (cluster_ctx.clb_nlist .block_type (blk_id));
2752
- } else {
2753
- // Color the block to match the tile where it is placed
2754
- auto & device_ctx = g_vpr_ctx.device ();
2755
- auto & grid = device_ctx.grid ;
2756
-
2757
- t_pl_loc loc = place_ctx.block_locs [blk_id].loc ;
2758
-
2759
- tile_type = grid[loc.x ][loc.y ].type ;
2760
- }
2761
-
2762
- draw_state->block_color [blk_id] = get_block_type_color (tile_type);
2739
+ draw_state->reset_block_color (blk_id);
2763
2740
}
2764
2741
2765
2742
/* *
@@ -3360,7 +3337,7 @@ static void draw_block_pin_util() {
3360
3337
3361
3338
for (auto blk : blks) {
3362
3339
ezgl::color color = to_ezgl_color (cmap->color (pin_util[blk]));
3363
- draw_state->block_color [ blk] = color;
3340
+ draw_state->set_block_color ( blk, color) ;
3364
3341
}
3365
3342
3366
3343
draw_state->color_map = std::move (cmap);
0 commit comments