Skip to content

Commit

Permalink
check the legality of region when parsing it
Browse files Browse the repository at this point in the history
  • Loading branch information
soheilshahrouz committed Jun 30, 2024
1 parent 571cede commit c74ca63
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions vpr/src/base/vpr_constraints_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,24 @@ class VprConstraintsSerializer final : public uxsd::VprConstraintsBase<VprConstr
}

virtual inline void finish_partition_add_region(void*& /*ctx*/) final {
const auto [layer_low, layer_high] = loaded_region.get_layer_range();

if (layer_low < 0 || layer_high < 0 || layer_high < layer_low) {
if (report_error_ == nullptr) {
VPR_ERROR(VPR_ERROR_PLACE, "\nIllegal layer numbers are specified in the constraint file.\n");
} else {
report_error_->operator()("Illegal layer numbers are specified in the constraint file.");
}
}

if (loaded_region.empty()) {
if (report_error_ == nullptr) {
VPR_ERROR(VPR_ERROR_PLACE, "\nThe specified region is empty.\n");
} else {
report_error_->operator()("The specified region is empty.");
}
}

loaded_part_region.add_to_part_region(loaded_region);

Region clear_region;
Expand Down

0 comments on commit c74ca63

Please sign in to comment.