1111
1212/* Represents whether or not VPR should fail if timing constraints aren't met. */
1313static 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
1618void 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 = " \n Design did not meet timing constraints. \n Timing 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 */
3637void 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 = " \n Design did not meet timing constraints.\n Timing failed and terminate_if_timing_fails set -- exiting" ;
40+ VPR_FATAL_ERROR (VPR_ERROR_TIMING, msg.c_str ());
4241 }
4342 return ;
4443}
0 commit comments