Przeglądaj źródła

Remove ignore feedback flag and replace with pad table

Baglio Tabifata 5 lat temu
rodzic
commit
fde2d0ce37

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

@@ -17,7 +17,7 @@ public class App {
     private static String serialDevice = null;
     private static PALSpecs pspecs = null;
     private static int outMask = -1;
-    private static boolean ignoreFeedbacks = false;
+    private static boolean padTable = true;
     private static String outFile = null;
 
     public static void main(String[] args) throws Exception {
@@ -31,7 +31,7 @@ public class App {
             }
 
             logger.error("Wrong number of arguments passed.\n"
-                    + "dupal_analyzer <serial_port> <pal_type> <output_file> [Y|N] [hex_output_mask]\n"
+                    + "dupal_analyzer <serial_port> <pal_type> <output_file> [pad_table: Y|N] [hex_output_mask]\n"
                     + "Where <pal_type> can be:\n" + supportedPALs.toString() + "\n");
 
             return;
@@ -55,7 +55,7 @@ public class App {
             }
         });
 
-        dpan.startAnalisys(ignoreFeedbacks);
+        dpan.startAnalisys(padTable);
     }
 
     private static void parseArgs(String[] args) {
@@ -73,7 +73,7 @@ public class App {
         outFile = args[2];
 
         if(args.length >= 4) {
-            ignoreFeedbacks = args[3].equalsIgnoreCase("Y");
+            padTable = args[3].equalsIgnoreCase("Y");
         }
 
         if(args.length >= 5) {

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

@@ -76,11 +76,11 @@ public class DuPALAnalyzer {
         startAnalisys(false);
     }
 
-    public void startAnalisys(boolean ignoreFeedbacks) throws Exception {
+    public void startAnalisys(boolean padTable) throws Exception {
         int board_revision = dpci.getBoardVersion();
         DuPALCmdInterface.DuPAL_LED led;
        
-        logger.info("startAnalisys() -> " + (!ignoreFeedbacks ? "Feedbacks will be inserted in inputs" : "Feedbacks will not be inserted in inputs."));
+        logger.info("startAnalisys() -> Espresso table results will "+(padTable?"":"not")+" be padded.");
         
         switch(dpci.palSpecs.slotNumber()) {
             default:
@@ -115,7 +115,7 @@ public class DuPALAnalyzer {
                 
                 OutState[] osArray = OSExplorer.exploreOutStates(dpci, ioAsOutMask);
                 header = EspressoFormatter.formatEspressoTableHeader(dpci.palSpecs, ioAsOutMask);
-                table = EspressoFormatter.formatEspressoTable(dpci.palSpecs, ioAsOutMask, osArray, ignoreFeedbacks);
+                table = EspressoFormatter.formatEspressoTable(dpci.palSpecs, ioAsOutMask, osArray, padTable);
 
                 logger.info("Got " + osArray.length + " output states!");
             }

+ 4 - 4
src/main/java/info/hkzlab/dupal/analyzer/palanalisys/formatter/EspressoFormatter.java

@@ -51,10 +51,10 @@ public class EspressoFormatter {
     }
   
     public static String[] formatEspressoTable(PALSpecs pSpecs, int ioAsOutMask, OutState[] states) {
-        return formatEspressoTable(pSpecs, ioAsOutMask, states, false);
+        return formatEspressoTable(pSpecs, ioAsOutMask, states, true);
     }
     
-    public static String[] formatEspressoTable(PALSpecs pSpecs, int ioAsOutMask, OutState[] states, boolean ignoreFeedbacks) {
+    public static String[] formatEspressoTable(PALSpecs pSpecs, int ioAsOutMask, OutState[] states, boolean padTable) {
         int ioAsOut_W = BitUtils.scatterBitField(BitUtils.consolidateBitField(ioAsOutMask, pSpecs.getMask_IO_R()), pSpecs.getMask_IO_W());
         HashSet<String> tableRows = new HashSet<>();
 
@@ -84,7 +84,7 @@ public class EspressoFormatter {
                 for(int idx = 0; idx < io_ins_count; idx++) strBuf.append((char)(((io_ins >> idx) & 0x01) + 0x30));
                 for(int idx = 0; idx < io_fio_count; idx++) {
                     boolean fio_pin_hiz = ((io_fio_hiz >> idx) & 0x01) != 0;
-                    strBuf.append((fio_pin_hiz || ignoreFeedbacks) ? '-' : (char)(((io_fio >> idx) & 0x01) + 0x30));
+                    strBuf.append(fio_pin_hiz ? '-' : (char)(((io_fio >> idx) & 0x01) + 0x30));
                 }
                 for(int idx = 0; idx < pSpecs.getPinCount_RO(); idx++) strBuf.append((char)(((ro_ps >> idx) & 0x01) + 0x30));
 
@@ -132,7 +132,7 @@ public class EspressoFormatter {
 
                 for(int idx = 0; idx < io_fio_count; idx++) {
                     boolean fio_pin_hiz = ((io_fio_hiz >> idx) & 0x01) != 0;
-                    strBuf.append((fio_pin_hiz || ignoreFeedbacks) ? '-' : (char)(((io_fio >> idx) & 0x01) + 0x30));
+                    strBuf.append(fio_pin_hiz ? '-' : (char)(((io_fio >> idx) & 0x01) + 0x30));
                 }
 
                 for(int idx = 0; idx < pSpecs.getPinCount_RO(); idx++) strBuf.append((char)(((ro_ps >> idx) & 0x01) + 0x30));

+ 0 - 19
src/test/java/info/hkzlab/dupal/analyzer/FormattersTest.java

@@ -70,24 +70,5 @@ public class FormattersTest {
         Arrays.sort(rows);
 
         assertArrayEquals("EspressoFormatter should build the correct truth table for specified states", expected, rows);
-
-        rows = EspressoFormatter.formatEspressoTable(pSpecs, ioAsOutMask, states, true);
-        expected = new String[] {
-            "0000000000000--- --11111000\n",
-            "0000000000011--- 0110-00001\n",
-            
-            "1110000000000--- 0110-00001\n",
-            "0010000000000--- 0000000000\n",
-            
-            "1001000000000--- 0000000000\n",
-            "0000000000010--- 0110-00001\n",
-            "0010000000000--- 0110-00001\n",
-        };
-
-        // Sort them, as we cannot guarantee the order of the formatted espresso table
-        Arrays.sort(expected);
-        Arrays.sort(rows);
-
-        assertArrayEquals("EspressoFormatter should build the correct truth table for specified states when ignoring feedback IOs", expected, rows);
     }
 }