VPR Draw Structures
T_Draw_State
-
struct t_draw_state
Structure used to store variables related to highlighting/drawing.
Stores a lot of different variables to reflect current draw state. Most callback functions/UI elements mutate some member in this struct, which then alters the draw state. Accessible through global function get_draw_state_vars() in draw_global.cpp. It is recommended to name the variable draw_state for consistent form.
Note
t_draw_state is used in the same way as a Context, but cannot be a Context because Contexts are not copyable, while t_draw_state must be. (t_draw_state is copied to save a restore of the graphics state when running graphics commands.)
Public Functions
-
void refresh_graphic_resources_after_cluster_change()
Refresh graphics resources’ size after update to cluster blocks size.
-
inline void set_graphics_blk_loc_registry_ref(const BlkLocRegistry &blk_loc_registry)
Set the reference to placement location variable.
During the placement stage, this reference should point to a local object in the placement stage because the placement stage does not change the global stage in place_ctx until the end of placement. After the placement is done, the reference should point to the global state stored in place_ctx.
- Parameters:
blk_loc_registry – The PlaceLocVars that the reference will point to.
-
inline const BlkLocRegistry &get_graphics_blk_loc_registry_ref() const
Returns the reference to placement block location variables.
- Returns:
A const reference to placement block location variables.
Public Members
-
e_pic_type pic_on_screen = e_pic_type::NO_PICTURE
What to draw on the screen (ROUTING, PLACEMENT, NO_PICTURE)
-
bool show_nets = false
Whether to draw nets or not.
-
e_draw_nets draw_nets = DRAW_FLYLINES
Whether to draw flylines or routed nets.
-
bool draw_inter_cluster_nets = false
Whether to show inter-cluster nets.
-
bool draw_intra_cluster_nets = false
Whether to show intra-cluster nets.
-
bool highlight_fan_in_fan_out = false
Whether to show block fan-in and fan-out.
-
bool show_crit_path = false
Whether to show crit path.
-
e_draw_congestion show_congestion = DRAW_NO_CONGEST
Controls if congestion is shown, when ROUTING is on screen.
-
e_draw_routing_costs show_routing_costs
Controls if routing congestion costs are shown, when ROUTING is on screen.
-
e_draw_block_pin_util show_blk_pin_util = DRAW_NO_BLOCK_PIN_UTIL
Toggles whether block pin util is shown.
-
e_draw_router_expansion_cost show_router_expansion_cost = DRAW_NO_ROUTER_EXPANSION_COST
Toggles whether router expansion cost is shown.
-
e_draw_placement_macros show_placement_macros = DRAW_NO_PLACEMENT_MACROS
Toggles whether placement macros are shown.
-
e_draw_routing_util show_routing_util = DRAW_NO_ROUTING_UTIL
toggles whether routing util is shown
-
bool show_rr = false
Controls drawing of routing resources on screen.
-
bool enable_rr_decluttering = true
Enables level of detail drawing for routing resources.
When enabled, level of detail algorithms check if the current zoom level is too high to draw routing resources meaningfully. If so, the “rr_decluttered” flag is set and the drawing of all routing resources will be skipped,
TODO: Currently this is always on, and wiring it to a UI button is required in the future.
-
bool rr_decluttered = false
Tells the program that the drawing of routing resources is toggled but still skipped because the zoom level is too high.
-
bool clip_routing_util = false
Whether routing util is shown.
-
bool draw_block_outlines = true
Boolean that toggles block outlines are shown.
-
bool draw_block_text = true
Boolean that toggles block names.
-
bool draw_partitions = false
Boolean that toggles showing partitions.
-
int max_sub_blk_lvl = 0
The maximum number of sub-block levels among all physical block types in the FPGA.
-
int show_blk_internal = 0
If 0, no internal drawing is shown. Otherwise, indicates how many levels of sub-pbs to be drawn.
-
bool no_blk_internal_decluttered_yet = false
True if all block internals were drawn in the previous full redraw.
-
bool no_blk_internal_drawn_yet = false
True if only the CLBs (top-level blocks) were drawn in the previous full redraw.
-
double all_blk_internals_drawn_threshold = 0
Zoom threshold (world units / pixel) below which all block internals could be drawn, for the previous full redraw only.
-
double only_clbs_drawn_threshold = 0
Zoom threshold (world units / pixel) above which only the CLBs (top-level blocks) could be drawn, for the previous full redraw only.
-
double min_blk_internal_area = 0
Area of the smallest block internal recorded in the previous full redraw, defined in world coordinates.
-
double max_blk_internal_area = 0
Area of the largest block internal (non-CLB) recorded in the previous full redraw, defined in world coordinates.
-
bool show_graphics = false
Whether graphics are enabled.
-
e_graphics_pause graphics_pause = e_graphics_pause::EVERY_UPDATE
How often is user input required.
-
bool auto_proceed = false
Should we automatically finish drawing (instead of waiting in the event loop for user interaction?
-
e_route_type draw_route_type = e_route_type::GLOBAL
GLOBAL or DETAILED.
-
vtr::vector<ParentNetId, ezgl::color> net_color
color in which each net should be drawn. [0..cluster_ctx.clb_nlist.nets().size()-1]
-
vtr::vector<RRNodeId, t_draw_rr_node> draw_rr_node
stores the state information of each routing resource.
Used to control drawing each routing resource when ROUTING is on screen. [0..device_ctx.rr_nodes.size()-1]
-
bool save_graphics = false
Whether to generate an output graphics file.
-
std::vector<std::vector<std::string>> parsed_graphics_cmds
Tokenized form of
graphics_commands(used for graphics scripting); one inner vector per;-separated command. Built lazily by run_graphics_commands on the first call (when this vector is still empty);graphics_commandsis set once at init and never mutated, so a single parse is sufficient.
-
size_t graphics_cmd_index = 0
Index of the next command to run in
parsed_graphics_cmds(an index into the outerparsed_graphics_cmdsvector, i.e. which;-separated command is next). Persists across run_graphics_commands() invocations so thatwait_for_stagebarriers can split a script across multiple update_screen() calls.
-
t_proceed_by_step proceed_by_step
A mode that controls if the graphics can proceed by a custom number of steps (e.g. temperature change, routing iteration) and then pause for user interaction.
-
int net_alpha = 255
net transparency factor (0 - Transparent, 255 - Opaque)
-
float pres_fac = 1.
Present congestion cost factor used when drawing. Is a copy of router’s current pres_fac.
-
bool show_noc_button = false
Whether we are showing the NOC button.
-
e_draw_noc draw_noc = DRAW_NO_NOC
Draw state for NOC drawing.
-
bool justEnabled = false
Tracks autocomplete enabling.
-
std::vector<t_draw_layer_display> draw_layer_display
Stores visibility and transparency drawing controls for each layer [0 … grid.num_layers -1].
-
t_draw_layer_display cross_layer_display
Visibility and transparency for elements that cross die layers.
-
void refresh_graphic_resources_after_cluster_change()
T_Draw_Coords
-
struct t_draw_coords
Global Struct that stores drawn coords/sizes of grid blocks/logic blocks.
Structure used to store coordinates and dimensions for grid tiles and logic blocks in the FPGA. Accessible through the global function get_draw_coords_vars().
Public Functions
-
t_draw_coords()
constructor
-
inline void set_tile_width(float new_tile_width)
Sets the tile width.
-
float get_tile_width() const
returns tile width
-
float get_tile_height() const
returns tile width
-
ezgl::rectangle get_pb_bbox(ClusterBlockId clb_index, const t_pb_graph_node &pb_gnode)
returns bounding box for given pb in given clb
-
ezgl::rectangle get_pb_bbox(int grid_layer, int grid_x, int grid_y, int sub_block_index, const t_logical_block_type_ptr type, const t_pb_graph_node &pb_gnode)
returns bounding box of sub block at given location of given type w. given pb
-
ezgl::rectangle get_pb_bbox(int grid_layer, int grid_x, int grid_y, int sub_block_index, const t_logical_block_type_ptr type)
returns pb of sub block of given idx/given type at location
-
ezgl::rectangle get_absolute_pb_bbox(const ClusterBlockId clb_index, const t_pb_graph_node *pb_gnode)
returns a bounding box for the given pb in the given clb with absolute coordinates, that can be directly drawn.
-
ezgl::point2d get_absolute_pin_location(const ClusterBlockId clb_index, const t_pb_graph_pin *pb_graph_pin)
returns a 2D point for the absolute location of the given pb_graph_pin in the entire graphics context.
- Parameters:
clb_index – The index of the cluster block containing the pin.
pb_graph_pin – The pin for which the absolute location is requested.
- Returns:
A point2d representing the absolute coordinates of the pin.
-
ezgl::rectangle get_absolute_clb_bbox(const ClusterBlockId clb_index, const t_logical_block_type_ptr type)
Returns bounding box for CLB of given idx/type.
Public Members
-
std::vector<float> tile_x
Form the axes of the chips coordinate system.
tile_x and tile_y form two axes that make a COORDINATE SYSTEM for grid_tiles, which goes from (tile_x[0],tile_y[0]) at the lower left corner of the FPGA to (tile_x[device_ctx.grid.width()-1]+tile_width, tile_y[device_ctx.grid.height()-1]+tile_width) in the upper right corner.
-
float pin_size
Half-width or Half-height of a pin. Set when init_draw_coords is called.
-
t_draw_coords()