Răsfoiți Sursa

Avoid exploring outlinks if there are no IO/O pins on PAL

Fabio Battaglia 4 ani în urmă
părinte
comite
63476d0ea0

+ 8 - 2
src/main/java/info/hkzlab/dupal/analyzer/palanalisys/explorers/OSExplorer.java

@@ -77,7 +77,13 @@ public class OSExplorer {
                 nextIdx = curState.getNextRegLinkIdx();
                 nOutState = getOutStateForIdx(dpci, nextIdx, true, ioAsOutMask, maxLinks, statesMap);
                 int w_idx = calcolateWriteINFromIdx(nextIdx, pSpecs, ioAsOutMask);
-                RegLink rl = new RegLink(curState, curState.getOutLinks()[nextIdx].dest, nOutState, w_idx);
+                OutState middleState = null;
+
+                // If we have no outlinks (eg for 16R8), just use the current state as middle
+                if(curState.getOutLinks().length == 0) middleState = curState;
+                else middleState = curState.getOutLinks()[nextIdx].dest;
+
+                RegLink rl = new RegLink(curState, middleState, nOutState, w_idx);
                 curState.addRegLink(rl);
                 logger.info("exploreOutStates() -> Creating RegLink ["+nextIdx+"/"+(maxLinks-1)+"] - " + rl);
             }
@@ -127,7 +133,7 @@ public class OSExplorer {
         }
 
         OutStatePins osp = extractOutPinStates(pSpecs, ioAsOutMask, pinState_A, pinState_B);
-        OutState os = new OutState(osp, maxLinks, (pSpecs.getPinCount_RO() > 0));
+        OutState os = new OutState(osp, ((pSpecs.getPinCount_O() + pSpecs.getPinCount_IO()) > 0 ? maxLinks : 0), (pSpecs.getPinCount_RO() > 0 ? maxLinks : 0));
 
         // Check if we already visited this state, in which case, recover that state, otherwise save the state in the map
         if(statesMap.containsKey(os.hashCode())) os = statesMap.get(os.hashCode());

+ 4 - 4
src/main/java/info/hkzlab/dupal/analyzer/palanalisys/graph/OutState.java

@@ -11,13 +11,13 @@ public class OutState implements GraphState {
     private int lastRegLinkIdx;
 
     public OutState(final OutStatePins pins, final int maxLinks) {
-        this(pins, maxLinks, false);
+        this(pins, maxLinks, 0);
     }
 
-    public OutState(final OutStatePins pins, final int maxLinks, final boolean addRegLinks) {
+    public OutState(final OutStatePins pins, final int maxOLinks, final int maxRLinks) {
         this.pins = pins;
-        outLinks = new OutLink[maxLinks];
-        regLinks = new RegLink[addRegLinks ? maxLinks : 0];
+        outLinks = new OutLink[maxOLinks];
+        regLinks = new RegLink[maxRLinks];
 
         lastOutLinkIdx = 0;
         lastRegLinkIdx = 0;

+ 2 - 2
src/test/java/info/hkzlab/dupal/analyzer/PathFinderTest.java

@@ -49,8 +49,8 @@ public class PathFinderTest {
         OutState os_b = new OutState(new OutStatePins(0x01, 0x00), 3);
         OutState os_c = new OutState(new OutStatePins(0x02, 0x00), 3);
         OutState os_d = new OutState(new OutStatePins(0x03, 0x00), 3);
-        OutState os_e = new OutState(new OutStatePins(0x04, 0x00), 3, true);
-        OutState os_f = new OutState(new OutStatePins(0x05, 0x00), 3, true);
+        OutState os_e = new OutState(new OutStatePins(0x04, 0x00), 3, 3);
+        OutState os_f = new OutState(new OutStatePins(0x05, 0x00), 3, 3);
 
         os_a.addOutLink(new OutLink(os_a, os_a, 0x10));
         os_a.addOutLink(new OutLink(os_a, os_b, 0x20));