Przeglądaj źródła

Start using the "debug" log level a bit more

Fabio Battaglia 4 lat temu
rodzic
commit
19cbd9fda0

+ 2 - 2
src/main/java/info/hkzlab/dupal/analyzer/App.java

@@ -36,7 +36,7 @@ public class App {
     private static String outFile = null;
 
     public static void main(String[] args) throws Exception {
-        System.out.println("DuPAL Analyzer " + version);
+        logger.info("DuPAL Analyzer " + version);
 
         if (args.length < 3) {
             StringBuffer supportedPALs = new StringBuffer();
@@ -59,7 +59,7 @@ public class App {
         DuPALAnalyzer dpan = new DuPALAnalyzer(dpci, outMask, outFile);
 
         if (!dpm.enterRemoteMode()) {
-            System.out.println("Unable to put DuPAL board in REMOTE MODE!");
+            logger.error("Unable to put DuPAL board in REMOTE MODE!");
             System.exit(-1);
         } 
 

+ 7 - 3
src/main/java/info/hkzlab/dupal/analyzer/board/boardio/DuPALAnalyzer.java

@@ -46,8 +46,10 @@ public class DuPALAnalyzer {
             int o_write_mask = BitUtils.scatterBitField(BitUtils.consolidateBitField(ioAsOutMask, (dpci.palSpecs.getMask_IO_R())), dpci.palSpecs.getMask_IO_W());
             int writeAddr = BitUtils.scatterBitField(idx, dpci.palSpecs.getMask_IN()) | BitUtils.scatterBitField((idx >> dpci.palSpecs.getPinCount_IN()), dpci.palSpecs.getMask_IO_W());
             
+            // Skip this run if we end up trying to write on an output pin
             if((writeAddr & o_write_mask) != 0) continue;
 
+            // Try all input combinations in this state
             for(int sub_idx = 0; sub_idx < maxINVal; sub_idx++) {
                 if(ioAsOutMask == dpci.palSpecs.getMask_IO_R()) return ioAsOutMask; // All the IOs we already found to be outputs, no need to continue
 
@@ -61,12 +63,14 @@ public class DuPALAnalyzer {
 
                 ioAsOutMask |= (pinstat ^ BitUtils.scatterBitField((sub_idx >> dpci.palSpecs.getPinCount_IN()), dpci.palSpecs.getMask_IO_R())) & dpci.palSpecs.getMask_IO_R();
                 
-                logger.info(String.format("detectIOTypeMask -> idx: C(%06X) -> S(%06X) | M[%06X]", sub_idx, sub_writeAddr, ioAsOutMask));
+                logger.debug(String.format("detectIOTypeMask -> idx: C(%06X) -> S(%06X) | M[%02X]", sub_idx, sub_writeAddr, ioAsOutMask));
             }
 
+            logger.info(String.format("detectIOTypeMask -> Currently detected mask is %02X", ioAsOutMask));
+
             if(dpci.palSpecs.getPinCount_RO() == 0) break; // No need to try multiple registered states
 
-            logger.info("detectIOTypeMask -> Pulsing clock with address " + String.format("%06X", writeAddr));
+            logger.debug("detectIOTypeMask -> Pulsing clock with address " + String.format("%06X", writeAddr));
             dpci.writeAndPulseClock(writeAddr);
         }
 
@@ -104,7 +108,7 @@ public class DuPALAnalyzer {
             } else { // Either registered, or with feedbacks
                 if(ioAsOutMask < 0) {
                     ioAsOutMask = detectIOTypeMask(dpci);
-                    logger.info("startAnalisys() -> Detected the following IO Type mask: " + String.format("%06X", ioAsOutMask));
+                    logger.info("Detected the following IO as Outputs mask: " + String.format("%02X", ioAsOutMask));
                 }
                 
                 OutState[] osArray = OSExplorer.exploreOutStates(dpci, ioAsOutMask);

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

@@ -29,18 +29,18 @@ public class OSExplorer {
         while(curState != null) {
             // If we ended up in a state where all the links have already been explored...
             if(curState.isStateFull()) {
-                logger.info("exploreOutStates() -> " + curState + " is full.");
+                logger.debug("exploreOutStates() -> " + curState + " is full.");
                 GraphLink[] linkPath = PathFinder.findPathToNearestUnfilledState(curState);
                 if(linkPath != null && linkPath.length > 0) {
                     for(GraphLink l : linkPath) {
-                        logger.info("exploreOutStates() -> Walking link " + l);
+                        logger.debug("exploreOutStates() -> Walking link " + l);
                         // Now let's walk the path, with proper actions depending on the type of link
                         if(l.isFarLink()) dpci.writeAndPulseClock(l.getLinkInputs()); 
                         else dpci.write(l.getLinkInputs()); 
                     }
                     curState = (OutState) (linkPath[linkPath.length-1].getDestinationState());
                     int w_link = (linkPath[linkPath.length-1]).getLinkInputs();
-                    logger.info("exploreOutStates() -> walked path to state " + curState);
+                    logger.debug("exploreOutStates() -> walked path to state " + curState);
 
                     // Do some doublechecking
                     // Extract expected outputs and actual outputs
@@ -72,7 +72,7 @@ public class OSExplorer {
                 OutLink ol = new OutLink(curState, nOutState, w_idx);
                 curState.addOutLink(ol);
             
-                logger.info("exploreOutStates() -> Creating OutLink ["+nextIdx+"/"+(maxLinks-1)+"] - " + ol);
+                logger.debug("exploreOutStates() -> Creating OutLink ["+nextIdx+"/"+(maxLinks-1)+"] - " + ol);
             } else { // We'll get a RegLink
                 nextIdx = curState.getNextRegLinkIdx();
                 nOutState = getOutStateForIdx(dpci, nextIdx, true, ioAsOutMask, maxLinks, statesMap);
@@ -85,7 +85,7 @@ public class OSExplorer {
 
                 RegLink rl = new RegLink(curState, middleState, nOutState, w_idx);
                 curState.addRegLink(rl);
-                logger.info("exploreOutStates() -> Creating RegLink ["+nextIdx+"/"+(maxLinks-1)+"] - " + rl);
+                logger.debug("exploreOutStates() -> Creating RegLink ["+nextIdx+"/"+(maxLinks-1)+"] - " + rl);
             }
 
 

+ 1 - 1
src/main/java/info/hkzlab/dupal/analyzer/palanalisys/explorers/SimpleExplorer.java

@@ -31,7 +31,7 @@ public class SimpleExplorer {
             SimpleState ss = new SimpleState(w_idx, read_a, (read_a ^ read_b));
             ssList.add(ss);
 
-            logger.info("exploreStates() -> Generated " + ss);
+            logger.debug("exploreStates() -> Generated " + ss);
         }
 
         return ssList.toArray(new SimpleState[ssList.size()]);