Skip to content

Commit 6593fc3

Browse files
committed
Updated timing_fail_error flow
1 parent e532019 commit 6593fc3

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

vpr/src/timing/timing_fail_error.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@
1111

1212
/* Represents whether or not VPR should fail if timing constraints aren't met. */
1313
static bool terminate_if_timing_fails = false;
14-
static std::string fail_timing_msg = "";
14+
15+
/* True if negative final slack. */
16+
static bool failed_timing = "";
1517

1618
void set_terminate_if_timing_fails(bool cmd_opt_terminate_if_timing_fails) {
1719
terminate_if_timing_fails = cmd_opt_terminate_if_timing_fails;
1820
}
1921

2022
/* Checks if slack is negative, if routing is finished, and if user wants VPR flow to fail if their
21-
* design doesn't meet timingconstraints. If both conditions are true, the function adds details about
22-
* the negative slack to a string that will be printed when VPR throws an error.
23+
* design doesn't meet timingconstraints. If both conditions are true, failed_timing is set to True.
2324
*/
24-
void check_if_failed_timing_constraints(double& slack, std::string slack_name, std::string prefix) {
25+
void check_if_failed_timing_constraints(double& slack, std::string prefix) {
2526
// The error should only be thrown after routing. Checking that prefix == "Final" ensures that
2627
// only negative slacks found after routing are considered.
2728
if (terminate_if_timing_fails && slack < 0 && prefix == "Final ") {
28-
fail_timing_msg = "\nDesign did not meet timing constraints.\nTiming failed and terminate_if_timing_fails set -- exiting";
29+
failed_timing = true;
2930
}
3031
return;
3132
}
@@ -34,11 +35,9 @@ void check_if_failed_timing_constraints(double& slack, std::string slack_name, s
3435
* constraints. Called by print_timing_stats in main.cpp.
3536
*/
3637
void error_if_timing_failed() {
37-
// Every time a negative slack is found, it adds on to fail_timing_msg where it failed.
38-
// If fail_timing_msg is empty, then no negative slacks were found.
39-
if (fail_timing_msg != "") {
40-
const char* msg = fail_timing_msg.c_str();
41-
VPR_FATAL_ERROR(VPR_ERROR_TIMING, msg);
38+
if (failed_timing) {
39+
std::string msg = "\nDesign did not meet timing constraints.\nTiming failed and terminate_if_timing_fails set -- exiting";
40+
VPR_FATAL_ERROR(VPR_ERROR_TIMING, msg.c_str());
4241
}
4342
return;
4443
}

vpr/src/timing/timing_fail_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* constraints. If both conditions are true, the function adds details about the negative slack to a string
1212
* that will be printed when VPR throws an error.
1313
*/
14-
void check_if_failed_timing_constraints(double& slack, std::string slack_name, std::string prefix);
14+
void check_if_failed_timing_constraints(double& slack, std::string prefix);
1515

1616
void error_if_timing_failed();
1717

vpr/src/timing/timing_util.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ void print_setup_timing_summary(const tatum::TimingConstraints& constraints,
417417

418418
VTR_LOG("\n");
419419

420-
check_if_failed_timing_constraints(setup_worst_neg_slack, "setup Worst", prefix);
421-
check_if_failed_timing_constraints(setup_total_neg_slack, "setup Total", prefix);
420+
check_if_failed_timing_constraints(setup_worst_neg_slack, prefix);
421+
check_if_failed_timing_constraints(setup_total_neg_slack, prefix);
422422
}
423423

424424
/*
@@ -646,8 +646,8 @@ void print_hold_timing_summary(const tatum::TimingConstraints& constraints, cons
646646
}
647647
VTR_LOG("\n");
648648

649-
check_if_failed_timing_constraints(hold_worst_neg_slack, "hold Worst", prefix);
650-
check_if_failed_timing_constraints(hold_total_neg_slack, "hold Total", prefix);
649+
check_if_failed_timing_constraints(hold_worst_neg_slack, prefix);
650+
check_if_failed_timing_constraints(hold_total_neg_slack, prefix);
651651
}
652652

653653
/*

0 commit comments

Comments
 (0)