@@ -36,7 +36,8 @@ static void mark_direct_of_ports(int idirect,
3636 std::string_view src_string,
3737 int line,
3838 std::vector<std::vector<int >>& idirect_from_blk_pin,
39- std::vector<std::vector<int >>& direct_type_from_blk_pin);
39+ std::vector<std::vector<int >>& direct_type_from_blk_pin,
40+ const PortPinToBlockPinConverter& port_pin_to_block_pin);
4041
4142/* Mark the pin entry in idirect_from_blk_pin with idirect and the pin entry in *
4243 * direct_type_from_blk_pin with direct_type from start_pin_index to *
@@ -51,7 +52,8 @@ static void mark_direct_of_pins(int start_pin_index,
5152 std::vector<std::vector<int >>& direct_type_from_blk_pin,
5253 int direct_type,
5354 int line,
54- std::string_view src_string);
55+ std::string_view src_string,
56+ const PortPinToBlockPinConverter& port_pin_to_block_pin);
5557
5658const std::vector<t_pl_macro>& PlaceMacros::macros () const {
5759 return pl_macros_;
@@ -390,6 +392,8 @@ void PlaceMacros::alloc_and_load_idirect_from_blk_pin_(const std::vector<t_direc
390392 direct_type_from_blk_pin_[type.index ].resize (type.num_pins , OPEN);
391393 }
392394
395+ const PortPinToBlockPinConverter port_pin_to_block_pin;
396+
393397 /* Load the values */
394398 // Go through directs and find pins with possible direct connections
395399 for (size_t idirect = 0 ; idirect < directs.size (); idirect++) {
@@ -410,13 +414,15 @@ void PlaceMacros::alloc_and_load_idirect_from_blk_pin_(const std::vector<t_direc
410414 mark_direct_of_ports (idirect, SOURCE, from_pb_type_name, from_port_name,
411415 from_end_pin_index, from_start_pin_index, directs[idirect].from_pin ,
412416 directs[idirect].line ,
413- idirect_from_blk_pin_, direct_type_from_blk_pin_);
417+ idirect_from_blk_pin_, direct_type_from_blk_pin_,
418+ port_pin_to_block_pin);
414419
415420 // Then, find blocks with the same name as to_pb_type_name and from_port_name
416421 mark_direct_of_ports (idirect, SINK, to_pb_type_name, to_port_name,
417422 to_end_pin_index, to_start_pin_index, directs[idirect].to_pin ,
418423 directs[idirect].line ,
419- idirect_from_blk_pin_, direct_type_from_blk_pin_);
424+ idirect_from_blk_pin_, direct_type_from_blk_pin_,
425+ port_pin_to_block_pin);
420426
421427 } // Finish going through all the directs
422428}
@@ -430,7 +436,8 @@ static void mark_direct_of_ports(int idirect,
430436 std::string_view src_string,
431437 int line,
432438 std::vector<std::vector<int >>& idirect_from_blk_pin,
433- std::vector<std::vector<int >>& direct_type_from_blk_pin) {
439+ std::vector<std::vector<int >>& direct_type_from_blk_pin,
440+ const PortPinToBlockPinConverter& port_pin_to_block_pin) {
434441 /* Go through all the ports in all the blocks to find the port that has the same *
435442 * name as port_name and belongs to the block type that has the name pb_type_name. *
436443 * Then, check that whether start_pin_index and end_pin_index are specified. If *
@@ -467,11 +474,13 @@ static void mark_direct_of_ports(int idirect,
467474 if (start_pin_index >= 0 || end_pin_index >= 0 ) {
468475 mark_direct_of_pins (start_pin_index, end_pin_index, itype,
469476 isub_tile, iport, idirect_from_blk_pin, idirect,
470- direct_type_from_blk_pin, direct_type, line, src_string);
477+ direct_type_from_blk_pin, direct_type, line, src_string,
478+ port_pin_to_block_pin);
471479 } else {
472480 mark_direct_of_pins (0 , num_port_pins - 1 , itype,
473481 isub_tile, iport, idirect_from_blk_pin, idirect,
474- direct_type_from_blk_pin, direct_type, line, src_string);
482+ direct_type_from_blk_pin, direct_type, line, src_string,
483+ port_pin_to_block_pin);
475484 }
476485 } // Do nothing if port_name does not match
477486 } // Finish going through all the ports
@@ -490,14 +499,13 @@ static void mark_direct_of_pins(int start_pin_index,
490499 std::vector<std::vector<int >>& direct_type_from_blk_pin,
491500 int direct_type,
492501 int line,
493- std::string_view src_string) {
502+ std::string_view src_string,
503+ const PortPinToBlockPinConverter& port_pin_to_block_pin) {
494504 /* Mark the pin entry in idirect_from_blk_pin with idirect and the pin entry in *
495505 * direct_type_from_blk_pin with direct_type from start_pin_index to *
496506 * end_pin_index. */
497507 auto & device_ctx = g_vpr_ctx.device ();
498508
499- PortPinToBlockPinConverter port_pin_to_block_pin;
500-
501509 // Mark pins with indices from start_pin_index to end_pin_index, inclusive
502510 for (int iport_pin = start_pin_index; iport_pin <= end_pin_index; iport_pin++) {
503511 int iblk_pin = port_pin_to_block_pin.get_blk_pin_from_port_pin (itype, isub_tile, iport, iport_pin);
@@ -663,35 +671,3 @@ static void validate_macros(const std::vector<t_pl_macro>& macros) {
663671 }
664672}
665673
666- PortPinToBlockPinConverter::PortPinToBlockPinConverter () {
667- auto & device_ctx = g_vpr_ctx.device ();
668- auto & types = device_ctx.physical_tile_types ;
669-
670- // Resize and initialize the values to OPEN (-1).
671- size_t num_types = types.size ();
672- blk_pin_from_port_pin_.resize (num_types);
673-
674- for (size_t itype = 1 ; itype < num_types; itype++) {
675- int blk_pin_count = 0 ;
676- auto & type = types[itype];
677- size_t num_sub_tiles = type.sub_tiles .size ();
678- blk_pin_from_port_pin_[itype].resize (num_sub_tiles);
679- for (size_t isub_tile = 0 ; isub_tile < num_sub_tiles; isub_tile++) {
680- size_t num_ports = type.sub_tiles [isub_tile].ports .size ();
681- blk_pin_from_port_pin_[itype][isub_tile].resize (num_ports);
682- for (size_t iport = 0 ; iport < num_ports; iport++) {
683- int num_pins = type.sub_tiles [isub_tile].ports [iport].num_pins ;
684- for (int ipin = 0 ; ipin < num_pins; ipin++) {
685- blk_pin_from_port_pin_[itype][isub_tile][iport].push_back (blk_pin_count);
686- blk_pin_count++;
687- }
688- }
689- }
690- }
691- }
692-
693- int PortPinToBlockPinConverter::get_blk_pin_from_port_pin (int blk_type_index, int sub_tile, int port, int port_pin) {
694- // Return the port and port_pin for the pin.
695- int blk_pin = blk_pin_from_port_pin_[blk_type_index][sub_tile][port][port_pin];
696- return blk_pin;
697- }
0 commit comments