@@ -48,20 +48,18 @@ void TaskResolver::takeFinished(std::vector<TaskPtr>& result)
48
48
}
49
49
}
50
50
51
- e_timing_report_detail TaskResolver::getDetailsLevelEnum (const std::string& pathDetailsLevelStr) const {
52
- e_timing_report_detail detailesLevel = e_timing_report_detail::INVALID;
51
+ std::optional<e_timing_report_detail> TaskResolver::tryGetDetailsLevelEnum (const std::string& pathDetailsLevelStr) const {
53
52
if (pathDetailsLevelStr == " netlist" ) {
54
- detailesLevel = e_timing_report_detail::NETLIST;
53
+ return e_timing_report_detail::NETLIST;
55
54
} else if (pathDetailsLevelStr == " aggregated" ) {
56
- detailesLevel = e_timing_report_detail::AGGREGATED;
55
+ return e_timing_report_detail::AGGREGATED;
57
56
} else if (pathDetailsLevelStr == " detailed" ) {
58
- detailesLevel = e_timing_report_detail::DETAILED_ROUTING;
57
+ return e_timing_report_detail::DETAILED_ROUTING;
59
58
} else if (pathDetailsLevelStr == " debug" ) {
60
- detailesLevel = e_timing_report_detail::DEBUG;
61
- } else {
62
- VTR_LOG_ERROR (" unhandled option" , pathDetailsLevelStr);
59
+ return e_timing_report_detail::DEBUG;
63
60
}
64
- return detailesLevel;
61
+
62
+ return std::nullopt;
65
63
}
66
64
67
65
bool TaskResolver::update (ezgl::application* app)
@@ -99,22 +97,29 @@ void TaskResolver::processGetPathListTask(ezgl::application*, const TaskPtr& tas
99
97
// read options
100
98
const int nCriticalPathNum = options.getInt (comm::OPTION_PATH_NUM, 1 );
101
99
const std::string pathType = options.getString (comm::OPTION_PATH_TYPE);
102
- const std::string detailsLevel = options.getString (comm::OPTION_DETAILS_LEVEL);
100
+ const std::string details_level_str = options.getString (comm::OPTION_DETAILS_LEVEL);
103
101
const bool isFlat = options.getBool (comm::OPTION_IS_FLAT_ROUTING, false );
104
102
105
103
// calculate critical path depending on options and store result in server context
106
- CritPathsResult crit_paths_result = calcCriticalPath (pathType, nCriticalPathNum, getDetailsLevelEnum (detailsLevel), isFlat);
107
-
108
- // setup context
109
- server_ctx.set_path_type (pathType);
110
- server_ctx.set_critical_path_num (nCriticalPathNum);
111
- server_ctx.set_crit_paths (crit_paths_result.paths );
112
-
113
- if (crit_paths_result.isValid ()) {
114
- std::string msg{crit_paths_result.report };
115
- task->success (msg);
104
+ std::optional<e_timing_report_detail> details_level_opt = tryGetDetailsLevelEnum (details_level_str);
105
+ if (details_level_opt) {
106
+ CritPathsResult crit_paths_result = calcCriticalPath (pathType, nCriticalPathNum, details_level_opt.value (), isFlat);
107
+
108
+ // setup context
109
+ server_ctx.set_path_type (pathType);
110
+ server_ctx.set_critical_path_num (nCriticalPathNum);
111
+ server_ctx.set_crit_paths (crit_paths_result.paths );
112
+
113
+ if (crit_paths_result.isValid ()) {
114
+ std::string msg{crit_paths_result.report };
115
+ task->success (msg);
116
+ } else {
117
+ std::string msg{" Critical paths report is empty" };
118
+ VTR_LOG_ERROR (msg.c_str ());
119
+ task->fail (msg);
120
+ }
116
121
} else {
117
- std::string msg{" Critical paths report is empty " };
122
+ std::string msg{" unsupported report details level " + details_level_str };
118
123
VTR_LOG_ERROR (msg.c_str ());
119
124
task->fail (msg);
120
125
}
0 commit comments