From 9125698cb09b7f869599f47cfa9992d9712de41e Mon Sep 17 00:00:00 2001 From: David Shah Date: Sun, 2 Feb 2020 15:54:36 +0000 Subject: HeAP: backport out-of-range fix Signed-off-by: David Shah --- common/placer_heap.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/placer_heap.cc b/common/placer_heap.cc index e89ce76a..c04e7091 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -594,11 +594,11 @@ class HeAPPlacer if (child->type == root->type) chain_size[root->name]++; if (child->constr_x != child->UNCONSTR) - cell_locs[child->name].x = std::min(max_x, base.x + child->constr_x); + cell_locs[child->name].x = std::max(0, std::min(max_x, base.x + child->constr_x)); else cell_locs[child->name].x = base.x; // better handling of UNCONSTR? if (child->constr_y != child->UNCONSTR) - cell_locs[child->name].y = std::min(max_y, base.y + child->constr_y); + cell_locs[child->name].y = std::max(0, std::min(max_y, base.y + child->constr_y)); else cell_locs[child->name].y = base.y; // better handling of UNCONSTR? chain_root[child->name] = root; -- cgit v1.2.3