@@ -290,9 +290,12 @@ struct ArchReader {
290
290
if (cell.name == name)
291
291
return true ;
292
292
293
- for (auto bel : arch_->lut_bels )
294
- if (bel.name == name)
295
- return true ;
293
+ for (const auto & lut_element : arch_->lut_elements ) {
294
+ for (const auto & lut_bel : lut_element.lut_bels ) {
295
+ if (lut_bel.name == name)
296
+ return true ;
297
+ }
298
+ }
296
299
297
300
return false ;
298
301
}
@@ -454,27 +457,26 @@ struct ArchReader {
454
457
455
458
for (auto lut_elem : lut_def.getLutElements ()) {
456
459
for (auto lut : lut_elem.getLuts ()) {
457
- for (auto bel : lut.getBels ()) {
458
- t_lut_bel lut_bel;
459
-
460
- std::string name = bel.getName ().cStr ();
461
- lut_bel.name = name;
462
460
463
- // Check for duplicates
464
- auto is_duplicate = [name](t_lut_bel l) { return l.name == name; };
465
- auto res = std::find_if (arch_->lut_bels .begin (), arch_->lut_bels .end (), is_duplicate);
466
- if (res != arch_->lut_bels .end ())
467
- continue ;
461
+ t_lut_element element;
462
+ element.site_type = lut_elem.getSite ().cStr ();
463
+ element.width = lut.getWidth ();
468
464
465
+ for (auto bel : lut.getBels ()) {
466
+ t_lut_bel lut_bel;
467
+ lut_bel.name = bel.getName ().cStr ();
469
468
std::vector<std::string> ipins;
469
+
470
470
for (auto pin : bel.getInputPins ())
471
471
ipins.push_back (pin.cStr ());
472
472
473
473
lut_bel.input_pins = ipins;
474
474
lut_bel.output_pin = bel.getOutputPin ().cStr ();
475
475
476
- arch_-> lut_bels .push_back (lut_bel);
476
+ element. lut_bels .push_back (lut_bel);
477
477
}
478
+
479
+ arch_->lut_elements .push_back (element);
478
480
}
479
481
}
480
482
}
@@ -737,10 +739,17 @@ struct ArchReader {
737
739
738
740
// Check for duplicates
739
741
std::string lut_name = lut->name ;
742
+ t_lut_bel* lut_bel = nullptr ;
743
+
740
744
auto find_lut = [lut_name](t_lut_bel l) { return l.name == lut_name; };
741
- auto res = std::find_if (arch_->lut_bels .begin (), arch_->lut_bels .end (), find_lut);
742
- VTR_ASSERT (res != arch_->lut_bels .end ());
743
- auto lut_bel = *res;
745
+ for (auto & lut_element : arch_->lut_elements ) {
746
+ auto res = std::find_if (lut_element.lut_bels .begin (), lut_element.lut_bels .end (), find_lut);
747
+ if (res != lut_element.lut_bels .end ()) {
748
+ lut_bel = &*res;
749
+ break ;
750
+ }
751
+ }
752
+ VTR_ASSERT (lut_bel != nullptr );
744
753
745
754
auto mode = &lut->modes [0 ];
746
755
mode->name = vtr::strdup (" lut" );
@@ -760,7 +769,7 @@ struct ArchReader {
760
769
new_leaf->blif_model = vtr::strdup (MODEL_NAMES);
761
770
new_leaf->model = get_model (arch_, std::string (MODEL_NAMES));
762
771
763
- auto in_size = lut_bel. input_pins .size ();
772
+ auto in_size = lut_bel-> input_pins .size ();
764
773
new_leaf->ports [0 ] = get_generic_port (arch_, new_leaf, IN_PORT, " in" , MODEL_NAMES, in_size);
765
774
new_leaf->ports [1 ] = get_generic_port (arch_, new_leaf, OUT_PORT, " out" , MODEL_NAMES);
766
775
@@ -781,13 +790,13 @@ struct ArchReader {
781
790
std::string output_string;
782
791
783
792
if (i < num_pins - 1 ) {
784
- istr << lut_bel. input_pins [i];
793
+ istr << lut_bel-> input_pins [i];
785
794
ostr << " in[" << i << " ]" ;
786
795
input_string = std::string (lut->name ) + std::string (" ." ) + istr.str ();
787
796
output_string = std::string (new_leaf->name ) + std::string (" ." ) + ostr.str ();
788
797
} else {
789
798
istr << " out" ;
790
- ostr << lut_bel. output_pin ;
799
+ ostr << lut_bel-> output_pin ;
791
800
input_string = std::string (new_leaf->name ) + std::string (" ." ) + istr.str ();
792
801
output_string = std::string (lut->name ) + std::string (" ." ) + ostr.str ();
793
802
}
@@ -1533,10 +1542,10 @@ struct ArchReader {
1533
1542
// the RR graph generation is correct.
1534
1543
// This can be removed once the RR graph reader from the interchange
1535
1544
// device is ready and functional.
1536
- int num_seg = 1 ; // wire_names.size();
1545
+ size_t num_seg = 1 ; // wire_names.size();
1537
1546
1538
1547
arch_->Segments .resize (num_seg);
1539
- uint32_t index = 0 ;
1548
+ size_t index = 0 ;
1540
1549
for (auto i : wire_names) {
1541
1550
if (index >= num_seg) break ;
1542
1551
0 commit comments