add port percolation, use it for DRAM.ship
[fleet.git] / src / edu / berkeley / fleet / two / ShipDescription.java
index dcf0a97..d1158ea 100644 (file)
@@ -1,5 +1,6 @@
 package edu.berkeley.fleet.two;
 import edu.berkeley.fleet.api.*;
+import edu.berkeley.fleet.fpga.verilog.Verilog.PercolatedPort;
 import java.io.*;
 import java.util.*;
 
@@ -16,6 +17,8 @@ public class ShipDescription implements Iterable<DockDescription> {
     public DockDescription getDockDescription(String name) { return docks.get(name); }
     public Iterator<DockDescription> iterator() { return docks.values().iterator(); }
 
+    public final LinkedList<PercolatedPort> percolatedPorts = new LinkedList<PercolatedPort>();
+
     public ShipDescription(String name, BufferedReader r) throws IOException {
         if (name.endsWith(".ship")) name = name.substring(0, name.length()-".ship".length());
         this.name = name;
@@ -80,6 +83,16 @@ public class ShipDescription implements Iterable<DockDescription> {
                 else if (key.equals("data out"))  { inbox = false; }
                 else if (key.equals("in"))        { inbox = true;  }
                 else if (key.equals("out"))       { inbox = false; }
+                else if (key.startsWith("percolate")) { 
+                    key = s;
+                    key = key.substring("percolate".length()+1).trim();
+                    boolean up = key.startsWith("up");
+                    key = key.substring(key.indexOf(':')+1).trim();
+                    String name = key.substring(0, key.indexOf(' '));
+                    int width = Integer.parseInt(key.substring(key.indexOf(' ')).trim());
+                    percolatedPorts.add(new PercolatedPort(name, width, up));
+                    continue;
+                }
                 else if (key.startsWith("constant")) {
                     String constname = key.substring("constant".length()+1).trim();
                     String val       = s.substring(s.indexOf(':')+1).trim();