add FpgaDestination.getPathLength() for measuring hop counts
[fleet.git] / src / edu / berkeley / fleet / fpga / Fpga.java
index d2b960c..372b9fb 100644 (file)
@@ -64,7 +64,7 @@ public class Fpga extends FleetTwoFleet {
     // Setup //////////////////////////////////////////////////////////////////////////////
 
     Ship createShip(String type) throws IOException {
-        ShipDescription sd = new ShipDescription(type, new BufferedReader(new InputStreamReader(new FileInputStream("ships/"+type+".ship"))));
+        ShipDescription sd = new ShipDescription(this, type, new BufferedReader(new InputStreamReader(new FileInputStream("ships/"+type+".ship"))));
         int count = 0;
         for(Ship ship : ships.values()) if (ship.getType().equals(type)) count++;
         String name = type+count;
@@ -82,31 +82,36 @@ public class Fpga extends FleetTwoFleet {
         //boolean small = false;
 
         if (small) {
-            /*
+            for(int i=0; i<2; i++) createShip("Alu");
             for(int i=0; i<1; i++) createShip("Memory");
             for(int i=0; i<2; i++) createShip("Fifo");
-            for(int i=0; i<2; i++) createShip("Alu");
             createShip("Counter");
             createShip("CarrySaveAdder");
             createShip("Rotator");
             createShip("Lut3");
-            */
+            createShip("Timer");
             createShip("DDR2");
             createShip("Dvi");
+
         } else {
+
             for(int i=0; i<3; i++)  createShip("Memory");
             for(int i=0; i<3; i++)  createShip("Alu");
             for(int i=0; i<2; i++)  createShip("Fifo");
             for(int i=0; i<14; i++) createShip("Counter");
 
+            /*
             // "really big" configuration: 138 docks
             for(int i=0; i<4; i++)  createShip("Alu");
+            */
+
             //createShip("CarrySaveAdder");
             //createShip("Rotator");
             //createShip("Lut3");
 
-            //createShip("DDR2");
-            //createShip("Video");
+            createShip("Timer");
+            createShip("DDR2");
+            createShip("Dvi");
         }
 
         // for FifoShip
@@ -130,6 +135,7 @@ public class Fpga extends FleetTwoFleet {
                 final Module.SourcePort sp = sp0;
                 sources.add(new FabricElement.AbstractFabricElement() {
                         private FabricElement upstream;
+                        public int      getPathLength(FpgaDestination dest) { return upstream.getPathLength(dest); }
                         public FpgaPath getPath(FpgaDestination dest, BitVector signal) { return upstream.getPath(dest, signal); }
                         public void addOutput(FabricElement out, Module.Port outPort) {
                             this.upstream = out;