@@ -535,8 +535,10 @@ void PinPlacer::translate_pcf_cmds() {
535
535
flush_out (false );
536
536
}
537
537
538
- void PinPlacer::get_pcf_directions ( vector<string>& inps, vector<string>& outs,
539
- vector<string>& undefs, vector<string>& internals ) const noexcept {
538
+ void PinPlacer::get_pcf_directions (
539
+ vector<string>& inps, vector<string>& outs,
540
+ vector<string>& undefs,
541
+ vector<string>& internals ) const noexcept {
540
542
inps.clear ();
541
543
outs.clear ();
542
544
undefs.clear ();
@@ -568,6 +570,9 @@ void PinPlacer::get_pcf_directions( vector<string>& inps, vector<string>& outs,
568
570
else
569
571
undefs.push_back (pin);
570
572
//
573
+ if (cmdObj.hasInternalPin ()) {
574
+ internals.push_back (cmdObj.internalPin_ );
575
+ }
571
576
}
572
577
}
573
578
@@ -598,6 +603,8 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
598
603
logVec (outs, " [pcf_outputs] " );
599
604
lprintf (" ___\n " );
600
605
if (not internals.empty ()) {
606
+ logVec (internals, " [pcf_internals] " );
607
+ lprintf (" ___\n " );
601
608
}
602
609
}
603
610
}
@@ -626,24 +633,49 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
626
633
flush_out (true );
627
634
}
628
635
636
+ // lputs9();
637
+ // -- do lines with -internal_pin first
638
+ vector<const PcfReader::Cmd*> P;
639
+ size_t num_cmds = pcf_pin_cmds_.size ();
640
+ P.reserve (num_cmds + 1 );
641
+ const PcfReader::Cmd* cmdA = pcf_pin_cmds_.data ();
642
+ uint cnt_internals = 0 ;
643
+ for (uint i = 0 ; i < num_cmds; i++) {
644
+ P.push_back (cmdA + i);
645
+ if (P.back ()->hasInternalPin ())
646
+ cnt_internals++;
647
+ }
648
+ if (tr >= 4 ) {
649
+ lprintf (" cnt_internals= %u num_cmds= %zu\n " , cnt_internals, num_cmds);
650
+ flush_out (true );
651
+ }
652
+ if (cnt_internals > 0 and cnt_internals < num_cmds) {
653
+ if (tr >= 4 ) {
654
+ lprintf (" separating internals (%u) ..\n " , cnt_internals);
655
+ flush_out (true );
656
+ }
657
+ std::stable_partition (P.begin (), P.end (), PcfReader::is_internal_cmd);
658
+ }
659
+
629
660
string internalPin;
661
+ vector<uint> gbox_rows;
662
+
630
663
string udes_pn2; // translated according to --edits <config.json>
631
664
632
665
string row_str;
633
666
int row_num = -1 ;
634
667
635
668
min_pt_row_ = UINT_MAX; max_pt_row_ = 0 ;
636
669
637
- for (uint cmd_i = 0 ; cmd_i < pcf_pin_cmds_.size (); cmd_i++) {
670
+ assert (P.size () == num_cmds);
671
+ for (uint cmd_i = 0 ; cmd_i < num_cmds; cmd_i++) {
638
672
639
- const PcfReader::Cmd& cmdObj = pcf_pin_cmds_ [cmd_i];
673
+ const PcfReader::Cmd& cmdObj = *P [cmd_i];
640
674
const vector<string>& pcf_cmd = cmdObj.cmd_ ;
641
675
642
676
// only support io and clock for now
643
677
if (pcf_cmd[0 ] != " set_io" && pcf_cmd[0 ] != " set_clk" ) continue ;
644
678
645
- internalPin.clear ();
646
-
647
679
const string& udes_pn1 = pcf_cmd[1 ];
648
680
649
681
bool is_in_pin = (find_udes_input (udes_pn1) >= 0 );
@@ -669,13 +701,6 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
669
701
logVec (pcf_cmd, " cur pcf_cmd: " );
670
702
}
671
703
672
- for (size_t i = 1 ; i < pcf_cmd.size (); i++) {
673
- if (pcf_cmd[i] == " -internal_pin" ) {
674
- internalPin = pcf_cmd[++i];
675
- break ;
676
- }
677
- }
678
-
679
704
row_str.clear ();
680
705
row_num = -1 ;
681
706
for (size_t i = 1 ; i < pcf_cmd.size () - 1 ; i++) {
@@ -719,6 +744,15 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
719
744
return false ;
720
745
}
721
746
747
+ internalPin.clear ();
748
+ if (cmdObj.hasInternalPin ()) {
749
+ internalPin = cmdObj.internalPin_ ;
750
+ // gbox_rows = csv.get_gbox_rows(device_pin_name);
751
+ // if (not gbox_rows.empty()) {
752
+ // // search internalPin among gbox_rows
753
+ // }
754
+ }
755
+
722
756
const char * direction = " INPUT" ;
723
757
724
758
// lookup and write XYZ for 'udes_pin_name'
@@ -764,7 +798,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
764
798
vector<uint> enabledRows = csv.get_enabled_rows_for_mode (mode);
765
799
lprintf (" ---- BEGIN DEBUG_NOTE ---- mode %s (#%u %s) is enabled for %zu rows:\n " ,
766
800
mode.c_str (), col_idx, col_label.c_str (), enabledRows.size ());
767
- lputs9 ();
801
+ // lputs9();
768
802
for (uint r : enabledRows) {
769
803
uint row = r + 2 ;
770
804
const PcCsvReader::BCD& b = csv.getBCD (r);
@@ -821,7 +855,7 @@ bool PinPlacer::write_dot_place(const PcCsvReader& csv) {
821
855
vector<uint> enabledRows = csv.get_enabled_rows_for_mode (mode);
822
856
lprintf (" ---- BEGIN DEBUG_NOTE ---- mode %s (#%u %s) is enabled for %zu rows:\n " ,
823
857
mode.c_str (), col_idx, col_label.c_str (), enabledRows.size ());
824
- lputs9 ();
858
+ // lputs9();
825
859
for (uint r : enabledRows) {
826
860
uint row = r + 2 ;
827
861
const PcCsvReader::BCD& b = csv.getBCD (r);
0 commit comments