merge omegaCounter 40nm/90nm branches into chips/omegaCounter/
[fleet.git] / src / com / sun / vlsi / chips / marina / test / Marina.java
index dfc2b59..87a3c95 100644 (file)
@@ -21,8 +21,9 @@ public class Marina {
        
     public static int TOKEN_FIFO_CAPACITY = 3;
     
-    public static boolean kesselsCounter = true;
-    //public static boolean kesselsCounter = false;
+    //public static boolean kesselsCounter = true;
+    public static boolean kesselsCounter = false;
+    public static boolean omegaCounter = false;
 
     public static final String DATA_CHAIN =    kesselsCounter ? "marina.marina_data" : "marina.ivan_data";      
     public static final String CONTROL_CHAIN = kesselsCounter ? "marina.marina_control" : "marina.ivan_control";
@@ -296,7 +297,42 @@ public class Marina {
     /** Get the 6 bit outer loop counter. */
     public int getOLC() {
         shiftReport(true, false);
-        if (kesselsCounter) {
+        if (omegaCounter) {
+            BitVector bits = null;
+            for(int i=0; i<4; i++) {
+                BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
+                //System.out.println("bits are: " + x);
+                bits = bits==null ? x : bits.cat(x);
+            }
+            System.out.print("  kesselsCounter = ");
+            int ret = 0;
+            boolean done = true;
+            boolean bad = false;
+            for(int bit=5; bit>=0; bit--) {
+                boolean zeroOrTwo  = bits.get(4+bit*3);
+                boolean zeroOrDone = bits.get(4+bit*3+1);
+                if      ( zeroOrTwo && !zeroOrDone) {
+                    ret += (2<<bit);
+                    System.out.print("2");
+                    done = false;
+                } else if (!zeroOrTwo && !zeroOrDone) {
+                    ret += (1<<bit);
+                    System.out.print("1");
+                    done = false;
+                } else if ( zeroOrTwo &&  zeroOrDone) {
+                    System.out.print("0");
+                    bad = true;
+                    done = false;
+                } else if (!zeroOrTwo &&  zeroOrDone) {
+                    System.out.print("_");
+                    if (!done) bad = true;
+                }
+                // FIXME: check for unreduced counter and warn about it
+            }
+            if (bad) System.out.print("  WARNING: UNREDUCED COUNTER VALUE!!!!!!");
+            System.out.println();
+            return ret;
+        } else if (kesselsCounter) {
             BitVector bits = null;
             for(int i=0; i<4; i++) {
                 BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);