unified horn for data and instructions
[fleet.git] / src / edu / berkeley / fleet / fpga / Fpga.java
index eabc55a..5c9494a 100644 (file)
@@ -115,7 +115,7 @@ public class Fpga extends Fleet {
             new FabricTree((FpgaBenkoBox[])ihornports.toArray(new FpgaBenkoBox[0]),
                            "funnel",
                            "ihorn");
-        
+
         if (quiet) return;
         System.out.println("`include \"macros.v\"");
         System.out.println("module fabric(clk, data_Memory0_command_r, data_Memory0_command_a, data_Memory0_command,");
@@ -143,6 +143,8 @@ public class Fpga extends Fleet {
                     System.out.println("  wire [(`PACKET_WIDTH-1):0] data_"
                                        +getUniqueName(ship)+"_"+port.getName()+";");
 
+        System.out.println("wire [(`PACKET_WIDTH-1):0] ihornleft;");
+
         System.out.println("");
         instructions.dumpChannels(false);
         System.out.println("");
@@ -196,18 +198,23 @@ public class Fpga extends Fleet {
             }
 
         }
+
+        System.out.println("funnel ihornfun(clk,"+
+                           "             ihornleft_r, ihornleft_a, ihornleft,"+
+                           "             ihorn_r, ihorn_a, ihorn,"+
+                           "             source_r, source_a, source);");
+        System.out.println("horn tophorn(clk,"+
+                           "             ihornleft_r, ihornleft_a, ihornleft,"+
+                           "             instruction_r, instruction_a, instruction,"+
+                           "             dest_r, dest_a, dest);");
         /*
-        System.out.println("funnel topfun(clk,"+
-                           "              dest_r, dest_a, dest,"+
-                           "              source_r, source_a, source,"+
-                           "              data_Memory0_dhorn_r, data_Memory0_dhorn_a, data_Memory0_dhorn);");
-        */
         System.out.println("assign instruction_r = ihorn_r;");
         System.out.println("assign ihorn_a = instruction_a;");
         System.out.println("assign instruction = ihorn;");
         System.out.println("assign dest_r = source_r;");
         System.out.println("assign source_a = dest_a;");
         System.out.println("assign dest = source;");
+        */
         System.out.println("endmodule");
     }
 
@@ -226,11 +233,11 @@ public class Fpga extends Fleet {
             if (end-start == 1) {
                 FpgaBenkoBox p = ports[start];
                 if (prefix.equals("instruction")) {
-                    p.instr_addr = addr;
-                    p.instr_bits = bits;
+                    p.instr_addr = (addr<<1);
+                    p.instr_bits = bits+1;
                 } else if (prefix.equals("dest")) {
-                    p.addr = addr;
-                    p.bits = bits;
+                    p.addr = (addr << 1) | 1;
+                    p.bits = bits+1;
                     if (bits >= 11)
                         throw new RuntimeException("too many benkoboxen!");
                     int count = 0;