Skip to content

Commit e7cddac

Browse files
committed
[vpr][base] check whether instnace exists in netlist
1 parent 5bd8624 commit e7cddac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

vpr/src/base/stats.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,14 @@ void print_resource_usage() {
514514
VTR_LOG("Resource usage...\n");
515515
for (const auto& type : device_ctx.logical_block_types) {
516516
if (is_empty_type(&type)) continue;
517-
517+
size_t num_instances = num_type_instances.count(&type) > 0 ? num_type_instances.at(&type) : 0;
518518
VTR_LOG("\tNetlist\n\t\t%d\tblocks of type: %s\n",
519-
num_type_instances.at(&type), type.name.c_str());
519+
num_instances, type.name.c_str());
520520

521521
VTR_LOG("\tArchitecture\n");
522522
for (const auto equivalent_tile : type.equivalent_tiles) {
523-
auto num_instances = 0;
524523
//get the number of equivalent tile across all layers
525-
num_instances = (int)device_ctx.grid.num_instances(equivalent_tile, -1);
524+
num_instances = device_ctx.grid.num_instances(equivalent_tile, -1);
526525

527526
VTR_LOG("\t\t%d\tblocks of type: %s\n",
528527
num_instances, equivalent_tile->name.c_str());
@@ -555,7 +554,8 @@ void print_device_utilization(const float target_device_utilization) {
555554
float util = 0.;
556555
size_t num_inst = device_ctx.grid.num_instances(&type, -1);
557556
if (num_inst != 0) {
558-
util = float(num_type_instances.at(logical_block)) / num_inst;
557+
size_t num_netlist_instances = num_type_instances.count(logical_block) > 0 ? num_type_instances.at(logical_block) : 0;
558+
util = float(num_netlist_instances) / num_inst;
559559
}
560560
VTR_LOG("\tBlock Utilization: %.2f Logical Block: %s\n", util, logical_block->name.c_str());
561561
}

0 commit comments

Comments
 (0)