@@ -36,7 +36,8 @@ static void mark_direct_of_ports(int idirect,
36
36
std::string_view src_string,
37
37
int line,
38
38
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);
40
41
41
42
/* Mark the pin entry in idirect_from_blk_pin with idirect and the pin entry in *
42
43
* 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,
51
52
std::vector<std::vector<int >>& direct_type_from_blk_pin,
52
53
int direct_type,
53
54
int line,
54
- std::string_view src_string);
55
+ std::string_view src_string,
56
+ const PortPinToBlockPinConverter& port_pin_to_block_pin);
55
57
56
58
const std::vector<t_pl_macro>& PlaceMacros::macros () const {
57
59
return pl_macros_;
@@ -390,6 +392,8 @@ void PlaceMacros::alloc_and_load_idirect_from_blk_pin_(const std::vector<t_direc
390
392
direct_type_from_blk_pin_[type.index ].resize (type.num_pins , OPEN);
391
393
}
392
394
395
+ const PortPinToBlockPinConverter port_pin_to_block_pin;
396
+
393
397
/* Load the values */
394
398
// Go through directs and find pins with possible direct connections
395
399
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
410
414
mark_direct_of_ports (idirect, SOURCE, from_pb_type_name, from_port_name,
411
415
from_end_pin_index, from_start_pin_index, directs[idirect].from_pin ,
412
416
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);
414
419
415
420
// Then, find blocks with the same name as to_pb_type_name and from_port_name
416
421
mark_direct_of_ports (idirect, SINK, to_pb_type_name, to_port_name,
417
422
to_end_pin_index, to_start_pin_index, directs[idirect].to_pin ,
418
423
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);
420
426
421
427
} // Finish going through all the directs
422
428
}
@@ -430,7 +436,8 @@ static void mark_direct_of_ports(int idirect,
430
436
std::string_view src_string,
431
437
int line,
432
438
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) {
434
441
/* Go through all the ports in all the blocks to find the port that has the same *
435
442
* name as port_name and belongs to the block type that has the name pb_type_name. *
436
443
* 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,
467
474
if (start_pin_index >= 0 || end_pin_index >= 0 ) {
468
475
mark_direct_of_pins (start_pin_index, end_pin_index, itype,
469
476
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);
471
479
} else {
472
480
mark_direct_of_pins (0 , num_port_pins - 1 , itype,
473
481
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);
475
484
}
476
485
} // Do nothing if port_name does not match
477
486
} // Finish going through all the ports
@@ -490,14 +499,13 @@ static void mark_direct_of_pins(int start_pin_index,
490
499
std::vector<std::vector<int >>& direct_type_from_blk_pin,
491
500
int direct_type,
492
501
int line,
493
- std::string_view src_string) {
502
+ std::string_view src_string,
503
+ const PortPinToBlockPinConverter& port_pin_to_block_pin) {
494
504
/* Mark the pin entry in idirect_from_blk_pin with idirect and the pin entry in *
495
505
* direct_type_from_blk_pin with direct_type from start_pin_index to *
496
506
* end_pin_index. */
497
507
auto & device_ctx = g_vpr_ctx.device ();
498
508
499
- PortPinToBlockPinConverter port_pin_to_block_pin;
500
-
501
509
// Mark pins with indices from start_pin_index to end_pin_index, inclusive
502
510
for (int iport_pin = start_pin_index; iport_pin <= end_pin_index; iport_pin++) {
503
511
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) {
663
671
}
664
672
}
665
673
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