Skip to content

Commit b2cf268

Browse files
authored
Merge pull request #2671 from verilog-to-routing/force_site_bounds_check
added bounds check for forced primitive site
2 parents 6405610 + 0865f01 commit b2cf268

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vpr/src/pack/cluster_placement.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ bool get_next_primitive_list(t_cluster_placement_stats* cluster_placement_stats,
140140
continue;
141141
}
142142

143-
144143
/* check for force site match, if applicable */
145144
if (force_site > -1) {
145+
/* check that the forced site index is within the available range */
146+
int max_site = it->second->pb_graph_node->total_primitive_count - 1;
147+
if (force_site > max_site) {
148+
VTR_LOG("The specified primitive site (%d) is out of range (max %d)\n",
149+
force_site, max_site);
150+
break;
151+
}
146152
if (force_site == it->second->pb_graph_node->flat_site_index) {
147153
cost = try_place_molecule(molecule, it->second->pb_graph_node, primitives_list);
148154
if (cost < HUGE_POSITIVE_FLOAT) {

0 commit comments

Comments
 (0)