1
1
/*
2
2
*
3
3
* Copyright (c) 2018-2022, Xilinx, Inc.
4
- * Copyright (c) 2022-2023 , Advanced Micro Devices, Inc.
4
+ * Copyright (c) 2022-2024 , Advanced Micro Devices, Inc.
5
5
* All rights reserved.
6
6
*
7
7
* Author: Chris Lavin, Xilinx Research Labs.
36
36
import java .util .Queue ;
37
37
import java .util .Set ;
38
38
39
+ import com .xilinx .rapidwright .design .AltPinMapping ;
39
40
import com .xilinx .rapidwright .design .Cell ;
40
41
import com .xilinx .rapidwright .design .Design ;
41
42
import com .xilinx .rapidwright .design .DesignTools ;
@@ -503,11 +504,14 @@ public static int swapMultipleLutPins(Map<SitePinInst, String> oldPinToNewPins)
503
504
continue ;
504
505
}
505
506
506
- // Either this is a LUT cell or a routethru ...
507
- assert (cell .getType ().startsWith ("LUT" ) ||
508
- cell .isRoutethru () ||
509
- // ... or a distributed RAM cell not on a "H" BEL
510
- cell .getType ().startsWith ("RAM" ) && !bel .getName ().startsWith ("H" ));
507
+ // Only consider LUT cell or a routethru ...
508
+ if (!cell .getType ().startsWith ("LUT" ) && !cell .isRoutethru () &&
509
+ // ... or distributed RAM cells not on a "H" BEL
510
+ (!cell .getType ().startsWith ("RAM" ) || bel .getName ().startsWith ("H" ))) {
511
+ // SRL cells do not support pin swapping
512
+ assert (cell .getType ().startsWith ("SRL" ));
513
+ continue ;
514
+ }
511
515
512
516
String oldPhysicalPinName = "A" + oldSinkSpi .getName ().charAt (1 );
513
517
String oldLogicalPinName = cell .getLogicalPinMapping (oldPhysicalPinName );
@@ -649,7 +653,15 @@ public static void swapSingleLutPins(String key, Collection<PinSwap> pinSwaps) {
649
653
650
654
// Perform the actual swap on cell pin mappings
651
655
for (PinSwap ps : copyOnWritePinSwaps ) {
652
- ps .getCell ().addPinMapping (ps .getNewPhysicalName (), ps .getLogicalName ());
656
+ Cell cell = ps .getCell ();
657
+ cell .addPinMapping (ps .getNewPhysicalName (), ps .getLogicalName ());
658
+ if (cell .isRoutethru () && cell .hasAltPinMappings ()) {
659
+ Map <String , AltPinMapping > altPinMappings = cell .getAltPinMappings ();
660
+ assert (altPinMappings .size () == 1 );
661
+ AltPinMapping apm = altPinMappings .remove (ps .getOldPhysicalName ());
662
+ assert (apm != null );
663
+ cell .addAltPinMapping (ps .getNewPhysicalName (), apm );
664
+ }
653
665
if (ps .getCompanionCell () != null ) {
654
666
ps .getCompanionCell ().addPinMapping (ps .getNewPhysicalName (), ps .getCompanionLogicalName ());
655
667
}
@@ -658,7 +670,7 @@ public static void swapSingleLutPins(String key, Collection<PinSwap> pinSwaps) {
658
670
continue ;
659
671
}
660
672
pinToMove .setPinName (ps .getNewNetPinName ());
661
- pinToMove .setSiteInst (ps . getCell () .getSiteInst ());
673
+ pinToMove .setSiteInst (cell .getSiteInst ());
662
674
}
663
675
664
676
assert (q .isEmpty ());
0 commit comments