@@ -168,7 +168,7 @@ static t_pin_to_pin_annotation get_pack_pattern(std::string pp_name, std::string
168
168
return pp;
169
169
}
170
170
171
- void add_segment_with_default_values (t_segment_inf& seg, std::string name) {
171
+ static void add_segment_with_default_values (t_segment_inf& seg, std::string name) {
172
172
// Use default values as we will populate rr_graph with correct values
173
173
// This segments are just declaration of future use
174
174
seg.name = name;
@@ -381,6 +381,25 @@ struct ArchReader {
381
381
return pad_bels_.count (name) != 0 ;
382
382
}
383
383
384
+ void add_ltype (std::function<int (int )> map,
385
+ const char* name,
386
+ t_sub_tile& sub_tile,
387
+ t_physical_tile_type& type) {
388
+
389
+ vtr::bimap<t_logical_pin, t_physical_pin> directs_map;
390
+ auto ltype = get_type_by_name<t_logical_block_type>(name, ltypes_);
391
+
392
+ for (int npin = 0 ; npin < ltype->pb_type ->num_ports ; npin++) {
393
+ t_physical_pin physical_pin (map (npin));
394
+ t_logical_pin logical_pin (npin);
395
+
396
+ directs_map.insert (logical_pin, physical_pin);
397
+ }
398
+
399
+ type.tile_block_pin_directs_map [ltype->index ][sub_tile.index ] = directs_map;
400
+ sub_tile.equivalent_sites .push_back (ltype);
401
+ }
402
+
384
403
/* * @brief Utility function to fill in all the necessary information for the sub_tile
385
404
*
386
405
* Given a physical tile type and a corresponding sub tile with additional information on the IO pin count
@@ -421,47 +440,36 @@ struct ArchReader {
421
440
}
422
441
}
423
442
424
- vtr::bimap<t_logical_pin, t_physical_pin> directs_map;
425
-
426
- for (int npin = 0 ; npin < num_pins; npin++) {
427
- t_physical_pin physical_pin (npin);
428
- t_logical_pin logical_pin (npin);
429
-
430
- directs_map.insert (logical_pin, physical_pin);
431
- }
432
-
433
- auto ltype = get_type_by_name<t_logical_block_type>(sub_tile.name , ltypes_);
434
-
435
- type.tile_block_pin_directs_map [ltype->index ][sub_tile.index ] = directs_map;
436
- sub_tile.equivalent_sites .push_back (ltype);
437
-
438
443
if (site_in_tile) {
439
444
auto site_types = ar_.getSiteTypeList ();
440
445
auto site_type = site_types[site_in_tile->getPrimaryType ()];
441
446
auto alt_sites_pins = site_in_tile->getAltPinsToPrimaryPins ();
442
447
443
- for (int i = 0 ; i < site_type.getAltSiteTypes ().size (); ++i) {
448
+ if (take_sites_.count (site_type.getName ()) != 0 ) {
449
+ std::function<int (int )> map = [](int x){ return x; };
450
+ add_ltype (map, sub_tile.name , sub_tile, type);
451
+ }
452
+
453
+ for (int i = 0 ; i < (int )site_type.getAltSiteTypes ().size (); ++i) {
444
454
auto alt_site = site_types[site_type.getAltSiteTypes ()[i]];
455
+
445
456
if (take_sites_.count (alt_site.getName ()) == 0 )
446
457
continue ;
447
458
448
- auto ltype = get_type_by_name<t_logical_block_type>(str (alt_site.getName ()).c_str (), ltypes_);
449
- sub_tile.equivalent_sites .push_back (ltype);
450
-
451
- vtr::bimap<t_logical_pin, t_physical_pin> directs_map;
452
459
auto pin_map = alt_sites_pins[i];
453
460
454
- for (int npin = 0 ; npin < ltype->pb_type ->num_ports ; npin++) {
455
- auto pin = site_type.getPins ()[pin_map.getPins ()[npin]];
456
- auto idx = (*port_name_to_sub_tile_idx)[str (pin.getName ())];
457
- t_physical_pin physical_pin (idx);
458
- t_logical_pin logical_pin (npin);
461
+ std::function<int (int )> map = [pin_map, site_type, port_name_to_sub_tile_idx, this ](int x){
462
+ auto pin = site_type.getPins ()[pin_map.getPins ()[x]];
463
+ return (*port_name_to_sub_tile_idx)[str (pin.getName ())];
464
+ };
459
465
460
- directs_map.insert (logical_pin, physical_pin);
461
- }
462
- type.tile_block_pin_directs_map [ltype->index ][sub_tile.index ] = directs_map;
466
+ add_ltype (map, str (alt_site.getName ()).c_str (), sub_tile, type);
463
467
}
468
+ } else {
469
+ std::function<int (int )> map = [](int x){ return x; };
470
+ add_ltype (map, sub_tile.name , sub_tile, type);
464
471
}
472
+
465
473
// Assign FC specs
466
474
int iblk_pin = 0 ;
467
475
for (const auto & port : sub_tile.ports ) {
@@ -735,7 +743,22 @@ struct ArchReader {
735
743
if (found)
736
744
take_sites_.insert (site_type.getName ());
737
745
738
- // TODO: Enable also alternative site types handling
746
+ for (auto alt_site_idx : site_type.getAltSiteTypes ()) {
747
+ auto alt_site = site_types[alt_site_idx];
748
+ found = false ;
749
+ for (auto bel : alt_site.getBels ()) {
750
+ auto bel_name = bel.getName ();
751
+ bool res = bel_cell_mappings_.find (bel_name) != bel_cell_mappings_.end ();
752
+
753
+ found |= res;
754
+
755
+ if (res || is_pad (str (bel_name)))
756
+ take_bels_.insert (bel_name);
757
+ }
758
+
759
+ if (found)
760
+ take_sites_.insert (alt_site.getName ());
761
+ }
739
762
}
740
763
}
741
764
}
@@ -1865,8 +1888,14 @@ struct ArchReader {
1865
1888
1866
1889
bool has_valid_sites = false ;
1867
1890
1868
- for (auto site_type : tile.getSiteTypes ())
1869
- has_valid_sites |= take_sites_.count (siteTypeList[site_type.getPrimaryType ()].getName ()) != 0 ;
1891
+ for (auto site_type : tile.getSiteTypes ()) {
1892
+ auto site_ = siteTypeList[site_type.getPrimaryType ()];
1893
+ has_valid_sites |= take_sites_.count (site_.getName ()) != 0 ;
1894
+ for (auto alt_site_idx : site_.getAltSiteTypes ()){
1895
+ auto alt_site_ = siteTypeList[alt_site_idx];
1896
+ has_valid_sites |= take_sites_.count (alt_site_.getName ()) != 0 ;
1897
+ }
1898
+ }
1870
1899
1871
1900
if (!has_valid_sites)
1872
1901
continue ;
@@ -1899,14 +1928,20 @@ struct ArchReader {
1899
1928
}
1900
1929
1901
1930
void process_sub_tiles (t_physical_tile_type& type, Device::TileType::Reader& tile) {
1902
- // TODO: only one subtile at the moment
1903
1931
auto siteTypeList = ar_.getSiteTypeList ();
1904
1932
for (auto site_in_tile : tile.getSiteTypes ()) {
1905
1933
t_sub_tile sub_tile;
1906
1934
1935
+ bool site_taken = false ;
1936
+
1907
1937
auto site = siteTypeList[site_in_tile.getPrimaryType ()];
1938
+ site_taken |= take_sites_.count (site.getName ()) != 0 ;
1939
+ for (auto alt_site_idx : site.getAltSiteTypes ()){
1940
+ auto alt_site = siteTypeList[alt_site_idx];
1941
+ site_taken |= take_sites_.count (alt_site.getName ()) != 0 ;
1942
+ }
1908
1943
1909
- if (take_sites_. count (site. getName ()) == 0 )
1944
+ if (!site_taken )
1910
1945
continue ;
1911
1946
1912
1947
sub_tile.index = type.capacity ;
0 commit comments