Quellcode durchsuchen

When padding, try to guess which IO is always high or low

Baglio Tabifata vor 5 Jahren
Ursprung
Commit
66d58807da

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

@@ -171,6 +171,19 @@ public class EspressoFormatter {
 
         ArrayList<String> padding = new ArrayList<>();
         if(padTable) {
+            int outAlwaysOff = 0xFF;
+            int outAlwaysOn = 0xFF;
+
+            for(OutState os : states) {
+                outAlwaysOff &= os.pins.hiz;
+                outAlwaysOn &= ~os.pins.hiz;
+            }
+            
+            int oAOff = BitUtils.consolidateBitField(outAlwaysOff, pSpecs.getMask_O_R());
+            int oAOn = BitUtils.consolidateBitField(outAlwaysOn, pSpecs.getMask_O_R());
+            int ioAOff = BitUtils.consolidateBitField(outAlwaysOff, ioAsOutMask);
+            int ioAOn = BitUtils.consolidateBitField(outAlwaysOn, ioAsOutMask);
+
             if(BitUtils.countBits(ioAsOutMask) > 0) {
                 // Feedback IOs
                 padding.add("# Padding FIOs START\n");
@@ -186,7 +199,17 @@ public class EspressoFormatter {
                         for(int cidx = 0; cidx < pSpecs.getPinCount_O(); cidx++) strBuf.append('-');
                         for(int cidx = 0; cidx < io_outs_count; cidx++) strBuf.append('-');
                         for(int cidx = 0; cidx < pSpecs.getPinCount_RO(); cidx++) strBuf.append('-');
-                        for(int cidx = 0; cidx < pSpecs.getPinCount_O()+io_outs_count; cidx++) strBuf.append('-');
+                        
+                        for(int cidx = 0; cidx < pSpecs.getPinCount_O(); cidx++) {
+                            if(((oAOff >> cidx) & 0x01) != 0) strBuf.append('1');
+                            else if(((oAOn >> cidx) & 0x01) != 0) strBuf.append('0');
+                            else strBuf.append('-');
+                        }
+                        for(int cidx = 0; cidx < io_outs_count; cidx++) {
+                            if(((ioAOff >> cidx) & 0x01) != 0) strBuf.append('1');
+                            else if(((ioAOn >> cidx) & 0x01) != 0) strBuf.append('0');
+                            else strBuf.append('-');
+                        }
 
                         strBuf.append('\n');
                         padding.add(strBuf.toString());

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

@@ -52,11 +52,11 @@ public class FormattersTest {
 
         String[] expected = new String[] {
             "# Padding FIOs START\n",
-            "-------------100 ----------\n",
-            "-------------010 ----------\n",
-            "-------------110 ----------\n",
-            "-------------001 ----------\n",
-            "-------------101 ----------\n",
+            "-------------100 -----00-00\n",
+            "-------------010 -----00-00\n",
+            "-------------110 -----00-00\n",
+            "-------------001 -----00-00\n",
+            "-------------101 -----00-00\n",
             "# Padding END\n",
             "1110000000000-11 01-1100100\n",
             "0000000000000-11 0000000000\n",