Browse Source

Mark fios as ignored and do not remove them

Baglio Tabifata 5 năm trước cách đây
mục cha
commit
99cef8cf0b

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

@@ -14,10 +14,6 @@ public class EspressoFormatter {
     private EspressoFormatter() {};
 
     public static String formatEspressoTableHeader(PALSpecs pSpecs, int ioAsOutMask) {
-        return formatEspressoTableHeader(pSpecs, ioAsOutMask, false);
-    }
-
-    public static String formatEspressoTableHeader(PALSpecs pSpecs, int ioAsOutMask, boolean ignoreFeedbacks) {
         StringBuffer strBuf = new StringBuffer();
         int ioAsOut_W = BitUtils.scatterBitField(BitUtils.consolidateBitField(ioAsOutMask, pSpecs.getMask_IO_R()), pSpecs.getMask_IO_W());
         int io_outCount = BitUtils.countBits(ioAsOutMask);
@@ -25,7 +21,7 @@ public class EspressoFormatter {
         
         int outCount = pSpecs.getPinCount_O() + io_outCount + pSpecs.getPinCount_RO();
         int outCount_oe = pSpecs.getPinCount_O() + io_outCount;
-        int inCount = pSpecs.getPinCount_IN() + io_inCount + (ignoreFeedbacks ? 0 : io_outCount) + pSpecs.getPinCount_RO();
+        int inCount = pSpecs.getPinCount_IN() + io_inCount + io_outCount + pSpecs.getPinCount_RO();
 
         strBuf.append("# " + pSpecs.toString() + "\n");
         strBuf.append(".i " + inCount + "\n"); // Inputs, IO as inputs, IO as outputs (as feedbacks), registered outputs (as feedbacks)
@@ -34,7 +30,7 @@ public class EspressoFormatter {
         strBuf.append(".ilb ");
         for(int idx = 0; idx < 32; idx++) if(((pSpecs.getMask_IN() >> idx) & 0x01) > 0) strBuf.append(pSpecs.getLabels_IN()[idx] + " ");
         for(int idx = 0; idx < 32; idx++) if((((pSpecs.getMask_IO_W() & ~ioAsOut_W) >> idx) & 0x01) > 0) strBuf.append(pSpecs.getLabels_IO()[idx] + " ");
-        if(!ignoreFeedbacks) for(int idx = 0; idx < 32; idx++) if((((pSpecs.getMask_IO_W() & ioAsOut_W) >> idx) & 0x01) > 0) strBuf.append("f" + pSpecs.getLabels_IO()[idx] + " ");
+        for(int idx = 0; idx < 32; idx++) if((((pSpecs.getMask_IO_W() & ioAsOut_W) >> idx) & 0x01) > 0) strBuf.append("f" + pSpecs.getLabels_IO()[idx] + " ");
         for(int idx = 0; idx < 32; idx++) if(((pSpecs.getMask_RO_W() >> idx) & 0x01) > 0) strBuf.append("ps"+pSpecs.getLabels_RO()[idx] + " ");
         strBuf.append("\n");
         
@@ -86,14 +82,10 @@ public class EspressoFormatter {
                 int io_fio_count = BitUtils.countBits(pSpecs.getMask_IO_R() & ioAsOutMask);
                 for(int idx = 0; idx < pSpecs.getPinCount_IN(); idx++) strBuf.append((char)(((ins >> idx) & 0x01) + 0x30));
                 for(int idx = 0; idx < io_ins_count; idx++) strBuf.append((char)(((io_ins >> idx) & 0x01) + 0x30));
-
-                if(!ignoreFeedbacks) {
-                    for(int idx = 0; idx < io_fio_count; idx++) {
-                        boolean fio_pin_hiz = ((io_fio_hiz >> idx) & 0x01) != 0;
-                        strBuf.append(fio_pin_hiz ? '-' : (char)(((io_fio >> 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));
                 }
-
                 for(int idx = 0; idx < pSpecs.getPinCount_RO(); idx++) strBuf.append((char)(((ro_ps >> idx) & 0x01) + 0x30));
 
                 strBuf.append(' ');
@@ -138,11 +130,9 @@ public class EspressoFormatter {
                 for(int idx = 0; idx < pSpecs.getPinCount_IN(); idx++) strBuf.append((char)(((ins >> idx) & 0x01) + 0x30));
                 for(int idx = 0; idx < io_ins_count; idx++) strBuf.append((char)(((io_ins >> idx) & 0x01) + 0x30));
 
-                if(!ignoreFeedbacks) {
-                    for(int idx = 0; idx < io_fio_count; idx++) {
-                        boolean fio_pin_hiz = ((io_fio_hiz >> idx) & 0x01) != 0;
-                        strBuf.append(fio_pin_hiz ? '-' : (char)(((io_fio >> 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));
                 }
 
                 for(int idx = 0; idx < pSpecs.getPinCount_RO(); idx++) strBuf.append((char)(((ro_ps >> idx) & 0x01) + 0x30));

+ 7 - 14
src/test/java/info/hkzlab/dupal/analyzer/FormattersTest.java

@@ -24,13 +24,6 @@ public class FormattersTest {
                 + ".ob o19 o12 io18 io17 o19oe o12oe io18oe io17oe \n" + ".phase 00001111\n\n";
 
         assertEquals("EspressoFormatter should build a correct 16L8 header", expectedHeader, header);
-
-        header = EspressoFormatter.formatEspressoTableHeader(pSpecs, ioAsOutMask, true);
-        expectedHeader = "# PAL16L8\n" + ".i 14\n" + ".o 8\n"
-                + ".ilb i1 i2 i3 i4 i5 i6 i7 i8 i9 i11 io16 io15 io14 io13 \n"
-                + ".ob o19 o12 io18 io17 o19oe o12oe io18oe io17oe \n" + ".phase 00001111\n\n";
-
-        assertEquals("EspressoFormatter should build a correct 16L8 header ignoring feedback IOs", expectedHeader, header);        
     }
 
     @Test
@@ -80,15 +73,15 @@ public class FormattersTest {
 
         rows = EspressoFormatter.formatEspressoTable(pSpecs, ioAsOutMask, states, true);
         expected = new String[] {
-            "0000000000000 --11111000\n",
-            "0000000000011 0110-00001\n",
+            "0000000000000--- --11111000\n",
+            "0000000000011--- 0110-00001\n",
             
-            "1110000000000 0110-00001\n",
-            "0010000000000 0000000000\n",
+            "1110000000000--- 0110-00001\n",
+            "0010000000000--- 0000000000\n",
             
-            "1001000000000 0000000000\n",
-            "0000000000010 0110-00001\n",
-            "0010000000000 0110-00001\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