aboutsummaryrefslogtreecommitdiffstats
path: root/common/placer_heap.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-02-02 15:54:36 +0000
committerDavid Shah <dave@ds0.me>2020-02-12 10:41:27 +0000
commit9125698cb09b7f869599f47cfa9992d9712de41e (patch)
tree50b4156fbd1b45888747f57d9520a611e4a227d5 /common/placer_heap.cc
parent1cb0e3af03affd2419f08e234c3a969dec68812a (diff)
downloadnextpnr-9125698cb09b7f869599f47cfa9992d9712de41e.tar.gz
nextpnr-9125698cb09b7f869599f47cfa9992d9712de41e.tar.bz2
nextpnr-9125698cb09b7f869599f47cfa9992d9712de41e.zip
HeAP: backport out-of-range fix
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'common/placer_heap.cc')
-rw-r--r--common/placer_heap.cc4
1 files 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;