From 0865f0198be862fa13767435e98476894dd099b4 Mon Sep 17 00:00:00 2001 From: KA7E Date: Wed, 31 Jul 2024 11:47:35 -0400 Subject: [PATCH] added bounds check for forced primitive site --- vpr/src/pack/cluster_placement.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vpr/src/pack/cluster_placement.cpp b/vpr/src/pack/cluster_placement.cpp index 7d4fa780dde..0c82da042cc 100644 --- a/vpr/src/pack/cluster_placement.cpp +++ b/vpr/src/pack/cluster_placement.cpp @@ -140,9 +140,15 @@ bool get_next_primitive_list(t_cluster_placement_stats* cluster_placement_stats, continue; } - /* check for force site match, if applicable */ if (force_site > -1) { + /* check that the forced site index is within the available range */ + int max_site = it->second->pb_graph_node->total_primitive_count - 1; + if (force_site > max_site) { + VTR_LOG("The specified primitive site (%d) is out of range (max %d)\n", + force_site, max_site); + break; + } if (force_site == it->second->pb_graph_node->flat_site_index) { cost = try_place_molecule(molecule, it->second->pb_graph_node, primitives_list); if (cost < HUGE_POSITIVE_FLOAT) {