Skip to content

Commit c74ca63

Browse files
committedJun 30, 2024·
check the legality of region when parsing it
1 parent 571cede commit c74ca63

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎vpr/src/base/vpr_constraints_serializer.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,24 @@ class VprConstraintsSerializer final : public uxsd::VprConstraintsBase<VprConstr
274274
}
275275

276276
virtual inline void finish_partition_add_region(void*& /*ctx*/) final {
277+
const auto [layer_low, layer_high] = loaded_region.get_layer_range();
278+
279+
if (layer_low < 0 || layer_high < 0 || layer_high < layer_low) {
280+
if (report_error_ == nullptr) {
281+
VPR_ERROR(VPR_ERROR_PLACE, "\nIllegal layer numbers are specified in the constraint file.\n");
282+
} else {
283+
report_error_->operator()("Illegal layer numbers are specified in the constraint file.");
284+
}
285+
}
286+
287+
if (loaded_region.empty()) {
288+
if (report_error_ == nullptr) {
289+
VPR_ERROR(VPR_ERROR_PLACE, "\nThe specified region is empty.\n");
290+
} else {
291+
report_error_->operator()("The specified region is empty.");
292+
}
293+
}
294+
277295
loaded_part_region.add_to_part_region(loaded_region);
278296

279297
Region clear_region;

0 commit comments

Comments
 (0)
Please sign in to comment.