|
8 | 8 | #include "globals.h" |
9 | 9 | #include "timing_util.h" |
10 | 10 | #include "timing_info.h" |
| 11 | +#include "timing_fail_error.h" |
11 | 12 |
|
12 | 13 | double sec_to_nanosec(double seconds) { |
13 | 14 | return 1e9 * seconds; |
@@ -415,6 +416,15 @@ void print_setup_timing_summary(const tatum::TimingConstraints& constraints, |
415 | 416 | sec_to_mhz(fanout_weighted_geomean_intra_domain_cpd)); |
416 | 417 |
|
417 | 418 | VTR_LOG("\n"); |
| 419 | + |
| 420 | + /* If the terminate_if_timing fails option is on, this checks if slack is negative and if user wants VPR |
| 421 | + * flow to fail if their design doesn't meet timing constraints. If both conditions are true, the function |
| 422 | + * adds details about the negative slack to a string that will be printed when VPR throws an error. |
| 423 | + */ |
| 424 | + if (timing_ctx.terminate_if_timing_fails && (setup_worst_neg_slack < 0 || setup_total_neg_slack < 0) && prefix == "Final ") { |
| 425 | + std::string msg = "\nDesign did not meet timing constraints.\nTiming failed and terminate_if_timing_fails set -- exiting"; |
| 426 | + VPR_FATAL_ERROR(VPR_ERROR_TIMING, msg.c_str()); |
| 427 | + } |
418 | 428 | } |
419 | 429 |
|
420 | 430 | /* |
@@ -593,8 +603,14 @@ std::vector<HistogramBucket> create_hold_slack_histogram(const tatum::HoldTiming |
593 | 603 | } |
594 | 604 |
|
595 | 605 | void print_hold_timing_summary(const tatum::TimingConstraints& constraints, const tatum::HoldTimingAnalyzer& hold_analyzer, std::string prefix) { |
596 | | - VTR_LOG("%shold Worst Negative Slack (hWNS): %g ns\n", prefix.c_str(), sec_to_nanosec(find_hold_worst_negative_slack(hold_analyzer))); |
597 | | - VTR_LOG("%shold Total Negative Slack (hTNS): %g ns\n", prefix.c_str(), sec_to_nanosec(find_hold_total_negative_slack(hold_analyzer))); |
| 606 | + auto& timing_ctx = g_vpr_ctx.timing(); |
| 607 | + |
| 608 | + auto hold_worst_neg_slack = sec_to_nanosec(find_hold_worst_negative_slack(hold_analyzer)); |
| 609 | + auto hold_total_neg_slack = sec_to_nanosec(find_hold_total_negative_slack(hold_analyzer)); |
| 610 | + |
| 611 | + VTR_LOG("%shold Worst Negative Slack (hWNS): %g ns\n", prefix.c_str(), hold_worst_neg_slack); |
| 612 | + VTR_LOG("%shold Total Negative Slack (hTNS): %g ns\n", prefix.c_str(), hold_total_neg_slack); |
| 613 | + |
598 | 614 | /*For testing*/ |
599 | 615 | //VTR_LOG("Hold Total Negative Slack within clbs: %g ns\n", sec_to_nanosec(find_total_negative_slack_within_clb_blocks(hold_analyzer))); |
600 | 616 | VTR_LOG("\n"); |
@@ -637,6 +653,15 @@ void print_hold_timing_summary(const tatum::TimingConstraints& constraints, cons |
637 | 653 | } |
638 | 654 | } |
639 | 655 | VTR_LOG("\n"); |
| 656 | + |
| 657 | + /* If the terminate_if_timing fails option is on, this checks if slack is negative and if user wants VPR |
| 658 | + * flow to fail if their design doesn't meet timing constraints. If both conditions are true, the function |
| 659 | + * adds details about the negative slack to a string that will be printed when VPR throws an error. |
| 660 | + */ |
| 661 | + if (timing_ctx.terminate_if_timing_fails && (hold_worst_neg_slack < 0 || hold_total_neg_slack < 0) && prefix == "Final ") { |
| 662 | + std::string msg = "\nDesign did not meet timing constraints.\nTiming failed and terminate_if_timing_fails set -- exiting"; |
| 663 | + VPR_FATAL_ERROR(VPR_ERROR_TIMING, msg.c_str()); |
| 664 | + } |
640 | 665 | } |
641 | 666 |
|
642 | 667 | /* |
|
0 commit comments