Skip to content

Commit

Permalink
improve crit_index set change
Browse files Browse the repository at this point in the history
  • Loading branch information
w0lek committed Dec 5, 2023
1 parent 630a1df commit 8c1e4dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion vpr/src/base/vpr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ RouteStatus vpr_route_flow(const Netlist<>& net_list,
net_delay = make_net_pins_matrix<float>(net_list);

//Initialize the delay calculator
std::shared_ptr<SetupHoldTimingInfo> timing_info;
std::shared_ptr<SetupHoldTimingInfo> timing_info = nullptr;

std::shared_ptr<RoutingDelayCalculator> routing_delay_calc = nullptr;
if (vpr_setup.Timing.timing_analysis_enabled) {
auto& atom_ctx = g_vpr_ctx.atom();
Expand Down Expand Up @@ -1471,6 +1472,7 @@ void vpr_analysis(const Netlist<>& net_list,
//Do final timing analysis
auto analysis_delay_calc = std::make_shared<AnalysisDelayCalculator>(atom_ctx.nlist, atom_ctx.lookup, net_delay, vpr_setup.RouterOpts.flat_routing);
auto timing_info = make_setup_hold_timing_info(analysis_delay_calc, vpr_setup.AnalysisOpts.timing_update_type);

timing_info->update();

if (isEchoFileEnabled(E_ECHO_ANALYSIS_TIMING_GRAPH)) {
Expand Down
2 changes: 1 addition & 1 deletion vpr/src/base/vpr_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ class ServerContext : public Context {
std::vector<tatum::TimingPath> crit_paths_;
int critical_path_num_ = 1;
std::string path_type_ = "setup";
int crit_path_index_ = -1;
int crit_path_index_ = 0;
std::shared_ptr<SetupHoldTimingInfo> hold_timing_info_;
};

Expand Down
3 changes: 3 additions & 0 deletions vpr/src/draw/draw_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,11 @@ void draw_crit_path(ezgl::renderer* g) {
// check path index
if (server_ctx.crit_path_index() >= static_cast<int>(paths.size())) {
server_ctx.set_crit_path_index(-1);
}
if (server_ctx.crit_path_index() == -1) {
return;
}

tatum::TimingPath path = paths[server_ctx.crit_path_index()];

//Walk through the timing path drawing each edge
Expand Down
10 changes: 6 additions & 4 deletions vpr/src/server/pathhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ void calcCritPath(int numMax, const std::string& type)
auto& timing_ctx = g_vpr_ctx.timing();

if (type == "setup") {
server_ctx.set_crit_paths(path_collector.collect_worst_setup_timing_paths(
auto paths = path_collector.collect_worst_setup_timing_paths(
*timing_ctx.graph,
*(draw_state->setup_timing_info->setup_analyzer()), numMax));
*(draw_state->setup_timing_info->setup_analyzer()), numMax);
server_ctx.set_crit_paths(paths);
} else if (type == "hold") {
if (server_ctx.hold_timing_info()) {
server_ctx.set_crit_paths(path_collector.collect_worst_hold_timing_paths(
auto paths = path_collector.collect_worst_hold_timing_paths(
*timing_ctx.graph,
*(server_ctx.hold_timing_info()->hold_analyzer()), numMax));
*(server_ctx.hold_timing_info()->hold_analyzer()), numMax);
server_ctx.set_crit_paths(paths);
} else {
std::cerr << "g_vpr_ctx.hold_timing_info is nullptr" << std::endl;
}
Expand Down

0 comments on commit 8c1e4dc

Please sign in to comment.