add FpgaDestination.getPathLength() for measuring hop counts
[fleet.git] / src / edu / berkeley / fleet / fpga / HornModule.java
index 44b8be5..1b62922 100644 (file)
@@ -61,6 +61,13 @@ public class HornModule extends Module {
             out1.addInput(this, getOutputPort("out1"));
         }
         public void addOutput(FabricElement out, Module.Port outPort) { throw new RuntimeException(); }
+        public int      getPathLength(FpgaDestination dest) {
+            FpgaPath path0 = out0==null ? null : out0.getPath(dest, null);
+            FpgaPath path1 = out1==null ? null : out1.getPath(dest, null);
+            if (path0==null) return out1.getPathLength(dest)+1;
+            if (path1==null) return out0.getPathLength(dest)+1;
+            return Math.min(out1.getPathLength(dest)+1, out0.getPathLength(dest)+1);
+        }
         public FpgaPath getPath(FpgaDestination dest, BitVector signal) {
             FpgaPath path0 = out0==null ? null : out0.getPath(dest, signal);
             FpgaPath path1 = out1==null ? null : out1.getPath(dest, signal);