-
Notifications
You must be signed in to change notification settings - Fork 416
Refactored vpr/src/draw #2049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored vpr/src/draw #2049
Conversation
This reverts commit e6f8641.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring; I have some further suggestions though.
packing_pin_util.rpt
Outdated
@@ -0,0 +1,65 @@ | |||
#Packing pin usage report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file accidentally added? It looks like an output file that shouldn't go in the repo.
@@ -34,6 +34,13 @@ | |||
#include "globals.h" | |||
#include "draw_color.h" | |||
#include "draw.h" | |||
#include "draw_basic.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add to the top-level comment at the top of this file: say what kinds of functions should go in this file (or say put new functions in helper files if at all possible).
* could be caused by the user clicking on a routing resource, toggled, or | ||
* fan-in/fan-out of a highlighted node. | ||
*/ | ||
bool draw_if_net_highlighted(ClusterNetId inet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no corresponding comment for this function in the .h file, duplicate or summarize this comment there (we're moving toward commenting what a function does in the .h file, and how it works in the .cpp file if necessary).
//Returns the set of rr nodes which connect driver to sink | ||
static std::vector<int> trace_routed_connection_rr_nodes( | ||
std::vector<int> trace_routed_connection_rr_nodes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate this comment (or move it) in the .h file.
@@ -3787,7 +944,7 @@ bool trace_routed_connection_rr_nodes_recurr(const t_rt_node* rt_node, | |||
} | |||
|
|||
//Find the edge between two rr nodes | |||
static t_edge_size find_edge(int prev_inode, int inode) { | |||
t_edge_size find_edge(int prev_inode, int inode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate this comment in the .h file
# include "place_macro.h" | ||
# include "buttons.h" | ||
|
||
void toggle_nets(GtkWidget* /*widget*/, gint /*response_id*/, gpointer /*data*/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy or move "what function does" comments from .cpp to the .h file where you can.
vpr/src/draw/draw_triangle.cpp
Outdated
@@ -0,0 +1,122 @@ | |||
/* draw_triangle.cpp contains functions that draw triangles.*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you say what they are used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(They are generally used for showing switching in the routing, the direction of signals, and such.)
# include "place_macro.h" | ||
# include "buttons.h" | ||
|
||
void draw_triangle_along_line(ezgl::renderer* g, ezgl::point2d start, ezgl::point2d end, float relative_position = 1., float arrow_size = DEFAULT_ARROW_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move function-level comments from .cpp file to here (the how to call and what do I do part).
vpr/src/draw/draw_types.h
Outdated
@@ -163,6 +163,9 @@ typedef struct { | |||
* save_graphics_file_base: Base of save graphis file name (i.e. before extension) | |||
* pres_fac: present congestion cost factor | |||
*/ | |||
/* Note: t_draw_struct is used in the same way as a Context, but cannot be a Context because Contexts are | |||
* not copyable, while t_draw_struct must be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say why it must be copied; graphics commands feature uses that to do save an restore of the drawing state.
vpr/src/draw/draw_xtoy.cpp
Outdated
@@ -0,0 +1,571 @@ | |||
/*draw_xtoy.cpp contains all functions that draw lines from one point to another.*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this file. I initially read it as being a "toy". It is really drawing the edges between routing resource (rr) nodes, so a better name would be
draw_rr_edges.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good so merging. One nit on adding a space after /* and before */ in one spot at least.
@@ -0,0 +1,133 @@ | |||
/*draw_mux.cpp contains all functions that draw muxes.*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, but good to add these spaces ...
Refactored the vpr/src/draw folder by splitting draw.cpp into smaller files to reduce file length.
Motivation and Context
Draw.cpp was too long (~3000-4000 lines), now much shorter (~1500 lines).
How It Was Tested