15
15
#include " vpr_types.h"
16
16
17
17
#include < sstream>
18
- #include < cassert>
19
18
20
19
namespace server {
21
20
@@ -37,12 +36,13 @@ static void collect_crit_path_metadata(std::stringstream& ss, const std::vector<
37
36
}
38
37
39
38
/* *
40
- * @brief helper function to calculate the setup critical path with specified parameters.
39
+ * @brief helper function to generate critical path timing report with specified parameters.
41
40
*/
42
- static CritPathsResult generate_setup_timing_report (const SetupTimingInfo& timing_info,
43
- const AnalysisDelayCalculator& delay_calc,
44
- const t_analysis_opts& analysis_opts,
45
- bool is_flat) {
41
+ static CritPathsResult generate_timing_report (const SetupHoldTimingInfo& timing_info,
42
+ const AnalysisDelayCalculator& delay_calc,
43
+ const t_analysis_opts& analysis_opts,
44
+ const std::string& report_type,
45
+ bool is_flat) {
46
46
auto & timing_ctx = g_vpr_ctx.timing ();
47
47
auto & atom_ctx = g_vpr_ctx.atom ();
48
48
@@ -53,37 +53,24 @@ static CritPathsResult generate_setup_timing_report(const SetupTimingInfo& timin
53
53
54
54
std::vector<tatum::TimingPath> paths;
55
55
std::stringstream ss;
56
- timing_reporter.report_timing_setup (paths, ss, *timing_info.setup_analyzer (), analysis_opts.timing_report_npaths );
57
- collect_crit_path_metadata (ss, paths);
58
- return CritPathsResult{paths, ss.str ()};
59
- }
60
-
61
- /* *
62
- * @brief helper function to calculate the hold critical path with specified parameters.
63
- */
64
- static CritPathsResult generate_hold_timing_report (const HoldTimingInfo& timing_info,
65
- const AnalysisDelayCalculator& delay_calc,
66
- const t_analysis_opts& analysis_opts,
67
- bool is_flat) {
68
- auto & timing_ctx = g_vpr_ctx.timing ();
69
- auto & atom_ctx = g_vpr_ctx.atom ();
70
-
71
- VprTimingGraphResolver resolver (atom_ctx.nlist , atom_ctx.lookup , *timing_ctx.graph , delay_calc, is_flat);
72
- resolver.set_detail_level (analysis_opts.timing_report_detail );
73
-
74
- tatum::TimingReporter timing_reporter (resolver, *timing_ctx.graph , *timing_ctx.constraints );
56
+ if (report_type == comm::KEY_SETUP_PATH_LIST) {
57
+ timing_reporter.report_timing_setup (paths, ss, *timing_info.setup_analyzer (), analysis_opts.timing_report_npaths );
58
+ } else if (report_type == comm::KEY_HOLD_PATH_LIST) {
59
+ timing_reporter.report_timing_hold (paths, ss, *timing_info.hold_analyzer (), analysis_opts.timing_report_npaths );
60
+ }
75
61
76
- std::vector<tatum::TimingPath> paths;
77
- std::stringstream ss;
78
- timing_reporter.report_timing_hold (paths, ss, *timing_info.hold_analyzer (), analysis_opts.timing_report_npaths );
79
- collect_crit_path_metadata (ss, paths);
80
- return CritPathsResult{paths, ss.str ()};
62
+ if (!paths.empty ()) {
63
+ collect_crit_path_metadata (ss, paths);
64
+ return CritPathsResult{paths, ss.str ()};
65
+ } else {
66
+ return CritPathsResult{std::vector<tatum::TimingPath>(), " " };
67
+ }
81
68
}
82
69
83
70
/* *
84
- * @brief Unified helper function to calculate the critical path with specified parameters.
71
+ * @brief Helper function to calculate critical path timing report with specified parameters.
85
72
*/
86
- CritPathsResult calcCriticalPath (const std::string& type , int critPathNum, e_timing_report_detail detailsLevel, bool is_flat_routing)
73
+ CritPathsResult calcCriticalPath (const std::string& report_type , int critPathNum, e_timing_report_detail detailsLevel, bool is_flat_routing)
87
74
{
88
75
// shortcuts
89
76
auto & atom_ctx = g_vpr_ctx.atom ();
@@ -99,19 +86,14 @@ CritPathsResult calcCriticalPath(const std::string& type, int critPathNum, e_tim
99
86
auto analysis_delay_calc = std::make_shared<AnalysisDelayCalculator>(atom_ctx.nlist , atom_ctx.lookup , net_delay, is_flat_routing);
100
87
101
88
e_timing_update_type timing_update_type = e_timing_update_type::AUTO; // FULL, INCREMENTAL, AUTO
102
- auto timing_info = make_setup_hold_timing_info (analysis_delay_calc, timing_update_type);
89
+ std::unique_ptr<SetupHoldTimingInfo> timing_info = make_setup_hold_timing_info (analysis_delay_calc, timing_update_type);
103
90
timing_info->update ();
104
91
105
92
t_analysis_opts analysis_opt;
106
93
analysis_opt.timing_report_detail = detailsLevel;
107
94
analysis_opt.timing_report_npaths = critPathNum;
108
95
109
- if (type == comm::KEY_SETUP_PATH_LIST) {
110
- return generate_setup_timing_report (*timing_info, *analysis_delay_calc, analysis_opt, is_flat_routing);
111
- } else if (type == comm::KEY_HOLD_PATH_LIST) {
112
- return generate_hold_timing_report (*timing_info, *analysis_delay_calc, analysis_opt, is_flat_routing);
113
- }
114
- return CritPathsResult{std::vector<tatum::TimingPath>(), " " };
96
+ return generate_timing_report (*timing_info, *analysis_delay_calc, analysis_opt, report_type, is_flat_routing);
115
97
}
116
98
117
99
} // namespace server
0 commit comments