added working test case for send-without-destination
authoradam <adam@megacz.com>
Sat, 25 Aug 2007 08:47:46 +0000 (09:47 +0100)
committeradam <adam@megacz.com>
Sat, 25 Aug 2007 08:47:46 +0000 (09:47 +0100)
Makefile
ships/BitFifo.ship
ships/Memory.ship
src/edu/berkeley/fleet/fpga/Fpga.java
src/edu/berkeley/fleet/fpga/Generator.java
src/edu/berkeley/fleet/ies44/InstructionEncoder.java
tests/pump/send-without-destination.fleet [new file with mode: 0644]

index 2974747..220845b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -118,7 +118,8 @@ svgs    = $(shell find doc -name \*.svg)
 
 manual: fleet.jar $(svgs:%.svg=%.pdf)
        $(java) -jar fleet.jar doc
-       cd .tmp; TEXINPUTS=$$TEXINPUTS:../doc/ pdflatex *.tex
+       cd .tmp; ln -sf ../doc/*.bib .
+       cd .tmp; TEXINPUTS=$$TEXINPUTS:../src/edu/berkeley/fleet/assembler/:../doc/ pdflatex *.tex
        open .tmp/*.pdf
 
 ## API docs ####################################################################################
index e359290..287692a 100644 (file)
@@ -354,7 +354,6 @@ public void service() {
   initial enqueue_remaining = 0;
   initial bitstorage_count = 0;
 
-  // FIXME: signextend, LSBfirst
   always @(posedge clk) begin
     if (!in_r    && in_a)     in_a    <= 0;
     if (!inOp_r  && inOp_a)   inOp_a  <= 0;
index ae99d10..39110c8 100644 (file)
@@ -157,8 +157,8 @@ module memory (clk,
 
   `input(preload_r,      preload_a,     preload_a_,     [(`DATAWIDTH-1):0],         preload_d)
   `input(cbd_r,          cbd_a,         cbd_a_,         [(`DATAWIDTH-1):0],         cbd_d)
-  `output(ihorn_r,       ihorn_r_,      ihorn_a,        [(`INSTRUCTION_WIDTH-1):0], ihorn_d_)
-  `defreg(ihorn_d_,                                     [(`INSTRUCTION_WIDTH-1):0], ihorn_d)
+  `output(ihorn_r,       ihorn_r_,      ihorn_a,        [(`PACKET_WIDTH-1):0], ihorn_d_)
+  `defreg(ihorn_d_,                                     [(`PACKET_WIDTH-1):0], ihorn_d)
   `output(dhorn_r,       dhorn_r_,      dhorn_a,        [(`PACKET_WIDTH-1):0],      dhorn_d_)
   `defreg(dhorn_d_,                                     [(`PACKET_WIDTH-1):0],      dhorn_d)
 
@@ -253,7 +253,8 @@ module memory (clk,
       case (command[(`INSTRUCTION_WIDTH-1):(`INSTRUCTION_WIDTH-2)])
         0: begin
             ihorn_full  <= 1;
-            ihorn_d     <= command;
+            `packet_data(ihorn_d) <= `instruction_data(command);
+            `packet_dest(ihorn_d) <= `instruction_dest(command);
            end
         1: begin
             dhorn_full  <= 1;
index 919ca3f..5d2fb55 100644 (file)
@@ -183,7 +183,7 @@ public class Fpga extends Fleet {
                 System.out.print(" krunk"+(krunk++)+"(clk, ");
                 System.out.print("instruction_"+getUniqueName(port.getShip())+"_"+port.getName()+"_r, ");
                 System.out.print("instruction_"+getUniqueName(port.getShip())+"_"+port.getName()+"_a, ");
-                System.out.print("instruction_"+getUniqueName(port.getShip())+"_"+port.getName()+", ");
+                System.out.print("`packet_data(instruction_"+getUniqueName(port.getShip())+"_"+port.getName()+"), ");
                 System.out.print("dest_"+getUniqueName(port.getShip())+"_"+port.getName()+"_r, ");
                 System.out.print("dest_"+getUniqueName(port.getShip())+"_"+port.getName()+"_a, ");
                 System.out.print("dest_"+getUniqueName(port.getShip())+"_"+port.getName()+", ");
@@ -303,7 +303,7 @@ public class Fpga extends Fleet {
                 for(int i=0; i<indentamount; i++) indent += "  ";
                 if (decl) {
                     String n = describe(prefix).startsWith("instruction")
-                        ? "[(`INSTRUCTION_WIDTH-1):0]" : "[(`PACKET_WIDTH-1):0]";
+                        ? "[(`PACKET_WIDTH-1):0]" : "[(`PACKET_WIDTH-1):0]";
                     System.out.println("  wire "+n+" "+indent+describe(prefix)+";");
                 } else {
                     System.out.println("     "+indent+
@@ -332,7 +332,7 @@ public class Fpga extends Fleet {
                     for(int i=0; i<indentamount; i++) indent += "  ";
                     if (decl) {
                         String n = FabricTree.this.describe(prefix,o).startsWith("instruction")
-                            ? "[(`INSTRUCTION_WIDTH-1):0]" : "[(`PACKET_WIDTH-1):0]";
+                            ? "[(`PACKET_WIDTH-1):0]" : "[(`PACKET_WIDTH-1):0]";
                         System.out.println("  wire "+n+" "+indent+FabricTree.this.describe(prefix,o)+";");
                     }
                 }
index 87a12e6..ba0bc7e 100644 (file)
@@ -414,6 +414,8 @@ public class Generator {
         pw.println("`define INSTRUCTION_WIDTH        "+WIDTH_WORD);
         pw.println("`define packet_data(p)              p[(`DESTINATION_ADDRESS_BITS+`DATAWIDTH-1):(`DESTINATION_ADDRESS_BITS)]");
         pw.println("`define packet_dest(p)              p[(`DESTINATION_ADDRESS_BITS-1):0]");
+        pw.println("`define instruction_data(p)         p[(`DATAWIDTH-1):0]");
+        pw.println("`define instruction_dest(p)         p["+(OFFSET_PUMP_ADDR+WIDTH_PUMP_ADDR-1)+":"+OFFSET_PUMP_ADDR+"]");
         pw.flush();
         pw.close();
 
@@ -660,10 +662,14 @@ public class Generator {
                                                                    inbox ? new SimpleAction("")
                                                                    : new AssignAction(new SimpleAssignable("`packet_dest("+data_out.getName()+")"),
                                                                                       "`instruction_bit_dest(ondeck)")),
-                                             new ConditionalAction("`instruction_bit_dataout(ondeck) && `instruction_bit_tokenout(ondeck)",
+                                             new ConditionalAction("`instruction_bit_dataout(ondeck) && `instruction_bit_tokenout(ondeck) && !`instruction_bit_datain(ondeck)",
                                                                    inbox ? new SimpleAction("")
                                                                    : new AssignAction(new SimpleAssignable("`packet_dest("+data_out.getName()+")"),
-                                                                                      data_out.getName()+"["+(WIDTH_WORD-1)+":"+(WIDTH_WORD-WIDTH_DEST_ADDR)+"]"))
+                                                                                      data_out.getName()+"["+(OFFSET_PUMP_ADDR+WIDTH_PUMP_ADDR-1)+":"+OFFSET_PUMP_ADDR+"]")),
+                                             new ConditionalAction("`instruction_bit_dataout(ondeck) && `instruction_bit_tokenout(ondeck) && `instruction_bit_datain(ondeck)",
+                                                                   inbox ? new SimpleAction("")
+                                                                   : new AssignAction(new SimpleAssignable("`packet_dest("+data_out.getName()+")"),
+                                                                                      data_latch_input+"["+(OFFSET_PUMP_ADDR+WIDTH_PUMP_ADDR-1)+":"+OFFSET_PUMP_ADDR+"]"))
                               }
                       );
 
index 032e57b..722338b 100644 (file)
@@ -12,8 +12,7 @@ public abstract class InstructionEncoder {
     public static final int WIDTH_DEST_ADDR     = 11;
     public static final int WIDTH_COUNT         = 7;
 
-    public static final int OFFSET_PUMP_ADDR    = 0;
-    public static final int OFFSET_COUNT        = OFFSET_PUMP_ADDR+WIDTH_PUMP_ADDR;
+    public static final int OFFSET_COUNT        = 0;
     public static final int OFFSET_DEST         = OFFSET_COUNT+WIDTH_COUNT;
     public static final int OFFSET_CONTROL      = OFFSET_DEST+WIDTH_DEST_ADDR;
     public static final int OFFSET_RQ           = OFFSET_CONTROL+0;
@@ -22,6 +21,7 @@ public abstract class InstructionEncoder {
     public static final int OFFSET_DL           = OFFSET_CONTROL+3;
     public static final int OFFSET_DI           = OFFSET_CONTROL+4;
     public static final int OFFSET_TI           = OFFSET_CONTROL+5;
+    public static final int OFFSET_PUMP_ADDR    = OFFSET_TI+1;
 
     /** get the bits describing this box's location on the DESTINATION HORN */
     protected abstract long getDestAddr(Destination box);
diff --git a/tests/pump/send-without-destination.fleet b/tests/pump/send-without-destination.fleet
new file mode 100644 (file)
index 0000000..a0ba82d
--- /dev/null
@@ -0,0 +1,37 @@
+// output ///////////////////////////////////////////////////////////////////
+#expect 5263440
+
+// program //////////////////////////////////////////////////////////////////
+#ship debug        : Debug
+#ship memory       : Memory
+#ship bitfifo      : BitFifo
+#ship fifo         : Fifo
+
+// dumb configurations
+debug.in:           [*] take, deliver;
+memory.inAddrRead:  [*] take, deliver;
+memory.inAddrWrite: [*] take, deliver;
+memory.inDataWrite: [*] take, deliver;
+bitfifo.in:         [*] take, deliver;
+bitfifo.inOp:       [*] take, deliver;
+bitfifo.outOp:      [*] take, deliver;
+
+FRED: {
+  fifo.in: take, deliver, notify fifo.out;
+}
+5263440: sendto fifo.in;
+fifo.out: wait, take, sendto debug.in;
+
+0:    sendto bitfifo.in;  // six bits of leading zero (to wash out the codebag size)
+FRED: sendto bitfifo.in;  // FRED = { address_of_fred[31], size_of_fred[6] }
+
+// strip off bottom 6 bits
+BitFifo.inOp[take=6]:   sendto bitfifo.inOp;
+BitFifo.inOp[take=37]:  sendto bitfifo.inOp;
+BitFifo.outOp[take=37]: sendto bitfifo.outOp;
+bitfifo.out:            take, sendto memory.inAddrRead;
+
+// value read out will be the instruction at FRED
+memory.out:             take, send;
+
+