@@ -525,3 +525,39 @@ void print_resource_usage(const std::map<t_logical_block_type_ptr, size_t>& num_
525
525
}
526
526
VTR_LOG (" \n " );
527
527
}
528
+
529
+ void print_device_utilization (const std::map<t_logical_block_type_ptr, size_t >& num_type_instances, const float target_device_utilization) {
530
+ auto & device_ctx = g_vpr_ctx.device ();
531
+ float device_utilization = calculate_device_utilization (device_ctx.grid , num_type_instances);
532
+ VTR_LOG (" Device Utilization: %.2f (target %.2f)\n " , device_utilization, target_device_utilization);
533
+ for (const auto & type : device_ctx.physical_tile_types ) {
534
+ if (is_empty_type (&type)) {
535
+ continue ;
536
+ }
537
+
538
+ if (device_ctx.grid .num_instances (&type, -1 ) != 0 ) {
539
+ VTR_LOG (" \t Physical Tile %s:\n " , type.name .c_str ());
540
+
541
+ auto equivalent_sites = get_equivalent_sites_set (&type);
542
+
543
+ for (auto logical_block : equivalent_sites) {
544
+ float util = 0 .;
545
+ size_t num_inst = device_ctx.grid .num_instances (&type, -1 );
546
+ if (num_inst != 0 ) {
547
+ util = float (num_type_instances.at (logical_block)) / num_inst;
548
+ }
549
+ VTR_LOG (" \t Block Utilization: %.2f Logical Block: %s\n " , util, logical_block->name .c_str ());
550
+ }
551
+ }
552
+ }
553
+ VTR_LOG (" \n " );
554
+
555
+ if (!device_ctx.grid .limiting_resources ().empty ()) {
556
+ std::vector<std::string> limiting_block_names;
557
+ for (auto blk_type : device_ctx.grid .limiting_resources ()) {
558
+ limiting_block_names.emplace_back (blk_type->name );
559
+ }
560
+ VTR_LOG (" FPGA size limited by block type(s): %s\n " , vtr::join (limiting_block_names, " " ).c_str ());
561
+ VTR_LOG (" \n " );
562
+ }
563
+ }
0 commit comments