move marina/testCode/com to src/com
[fleet.git] / src / com / sun / vlsi / chips / marina / test / Counter.java
diff --git a/src/com/sun/vlsi/chips/marina/test/Counter.java b/src/com/sun/vlsi/chips/marina/test/Counter.java
new file mode 100644 (file)
index 0000000..f39363e
--- /dev/null
@@ -0,0 +1,28 @@
+package com.sun.vlsi.chips.marina.test;
+import com.sun.async.test.ChainControl;
+
+/**
+ *  An item-counter which counts items that pass by in one of the
+ *  circular fifos.
+ */
+public class Counter {
+    private final String dataChain, dataPath;
+    private final ChainControl cc;
+    public Counter(String cntrInst, String dataChain, ChainControl cc) {
+        this.dataChain = dataChain;
+        this.dataPath = dataChain+'.'+cntrInst;
+        this.cc = cc;
+    }
+    /** Read a new value from the Counter */
+    public long getCount() {
+        cc.shift(dataChain, true, false);
+        return 0;
+        // do nothing because I counter schematics don't yet exist
+        //long cnt = cc.getOutBits(dataPath).bitReverse().not().toLong();
+    }
+    /** Set counter value to zero */
+    public void clearCount() {
+                
+    }
+        
+}