update everything to naming conventions agreed upon in class last week
authoradam <adam@megacz.com>
Mon, 12 Feb 2007 11:55:07 +0000 (12:55 +0100)
committeradam <adam@megacz.com>
Mon, 12 Feb 2007 11:55:07 +0000 (12:55 +0100)
15 files changed:
contrib/dcache-demo.fleet [deleted file]
contrib/demo.fleet
contrib/demo.ships [deleted file]
contrib/icache-demo.fleet [deleted file]
contrib/misc.fleet [deleted file]
ships/Alu2.ship
ships/Debug.ship
ships/Dscratch.ship
ships/Iscratch.ship
ships/Lut.ship
ships/Shift.ship
src/edu/berkeley/fleet/interpreter/Interpreter.java
tests/dcache/dcache-read.fleet
tests/fifo/fifo-loop.fleet
tests/icache/icache-test.fleet

diff --git a/contrib/dcache-demo.fleet b/contrib/dcache-demo.fleet
deleted file mode 100644 (file)
index cdaf598..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-
-// ships required in order to run this code
-#ship debug        : Debug
-#ship dscratch     : Dscratch
-#ship fifo         : Fifo
-
-// dumb configurations
-debug.data:        [*] take, deliver;
-dscratch.write_addr: [*] take, deliver;
-dscratch.write_data: [*] take, deliver;
-dscratch.read_addr:  [*] take, deliver;
-fifo.in:           [*] take, deliver;
-
-// addresses and values to initialize the dscratch with
-1:  sendto dscratch.write_addr;
-2:  sendto dscratch.write_addr;
-3:  sendto dscratch.write_addr;
-4:  sendto dscratch.write_addr;
-11: sendto dscratch.write_data;
-12: sendto dscratch.write_data;
-13: sendto dscratch.write_data;
-14: sendto dscratch.write_data;
-
-// send write-completion tokens to the fifo output
-dscratch.write_done:
-  [*] take, sendto fifo.out;
-
-// when the write-completion tokens accumulate, unleash
-// the read addresses
-fifo.out:
-  [4] wait;
-  [4] take, sendto dscratch.read_addr;
-
-// read addresses
-4:  sendto fifo.in;
-3:  sendto fifo.in;
-2:  sendto fifo.in;
-1:  sendto fifo.in;
-
-// data read from dscratch goes to the debug ship
-dscratch.read_data:
-  [*] take, sendto debug.data;
index 6c0e50b..8f8c514 100644 (file)
@@ -1,13 +1,14 @@
-#include "contrib/demo.ships"
+#ship debug    : Debug
+#ship iscratch : Iscratch
 
-BOB:          sendto iscratch.cbd;
-iscratch.cbd:   [*] take, deliver;
-debug.data:   [*] take, deliver;
+BOB:             sendto iscratch.inCBD;
+iscratch.inCBD:  [*] take, deliver;
+debug.in:        [*] take, deliver;
 
 BOB: {
-  12:           sendto debug.data;
-  13:           sendto debug.data;
-  14:           sendto debug.data;
-  BOB:          sendto iscratch.cbd;
+  12:           sendto debug.in;
+  13:           sendto debug.in;
+  14:           sendto debug.in;
+  BOB:          sendto iscratch.inCBD;
 }
 
diff --git a/contrib/demo.ships b/contrib/demo.ships
deleted file mode 100644 (file)
index c480842..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ship alu2_bad         : Alu2
-#ship alu2         : Alu2
-#ship debug        : Debug
-#ship execute      : Execute
-#ship fifo         : Fifo
-//#ship mem          : Mem
-#ship icache         : Icache
-
-
-// alu1
-// alu2
-// sort2
-// mux
-// lut
-// dup
-// fifo
-// shifter
-// counter
-
-
-// want: memory, fetch, halt
-
-//#ship alu1         : Alu1
-
-
-//#ship alu1        : Alu1
-//#ship dup1        : Dup
-//#ship dup2        : Dup
-//#ship dup3        : Dup
-//#ship dup3        : Dup3
-//#ship demux1      : DeMux
-//#ship demux2      : DeMux
-//#ship sort        : Sort2
-
diff --git a/contrib/icache-demo.fleet b/contrib/icache-demo.fleet
deleted file mode 100644 (file)
index c3f26a3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-// ships required in order to run this code
-#ship debug        : Debug
-#ship iscratch       : Iscratch
-
-// instructions not in any codebag are part of the "root codebag"
-// which is dispatched when the code is loaded
-
-debug.data:   deliver;
-BOB:          sendto iscratch.cbd;
-iscratch.cbd:   [*] take, deliver;
-debug.data:   [*] take, deliver;
-
-
-// This codebag illustrates how to do a loop.  Notice that this
-// is actually an uncontrolled data emitter -- it could clog the
-//  switch fabric!
-
-BOB: {
-  12:           sendto debug.data;
-  13:           sendto debug.data;
-  14:           sendto debug.data;
-  BOB:          sendto iscratch.cbd;
-}
-
diff --git a/contrib/misc.fleet b/contrib/misc.fleet
deleted file mode 100644 (file)
index 8510634..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//22: sendto debug.data
-//22: sendto debug.data
-//alu1.out: ack debug.data
-
-
-//22: sendto alu3.b
-
-// route the "max" output to the demux, and that to either
-// the finished-value output (debug.data) or the subtractor
-//sort.max: [*] take, sendto demux1.in
-//                           demux1.false: [*] take, sendto debug.data
-//                           demux1.true:  [*] take, sendto alu.a
-//
-//// route the "min" value to the demux selector to decide if  we are
-//// done; also send copies to the ALU and the secondary sort input
-//sort.min: [*] take, sendto dup3.in
-//                           dup3.a:  [*] take, sendto demux1.select
-//                           dup3.b:  [*] take, sendto alu.b
-//                           dup3.c:  [*] take, sendto sort.b
-//
-//// "plug up" the ALU opcode input with a "1" (subtraction)
-//1: sendto alu.op
-//          alu.op: take [*] accept
-//
-//// route all data emerging from the ALU back to the primary sort input
-//alu.out: [*] take, sendto sort.a
-//
-//// all other inputs are in default mode
-//sort.a:        [*] take, accept
-//sort.b:        [*] take, accept
-//alu.a:         [*] take, accept
-//alu.b:         [*] take, accept
-//dup3.in:       [*] take, accept
-//demux1.select: [*] take, accept
-//demux1.in:     [*] take, accept
-//
-//// gcd(377,221)=13  (we hope!)
-////377: sendto sort.a
-////221: sendto sort.b
-//
index 607a16e..1c567c9 100644 (file)
@@ -1,9 +1,9 @@
 ship: Alu2
 
 == Ports ===========================================================
-data  in:   a
-data  in:   b
-data  in:   op
+data  in:   in1
+data  in:   in2
+data  in:   inOp
 
 data  out:  out
 
@@ -18,13 +18,13 @@ niftycool.
 
 == Fleeterpreter ====================================================
 public void service() {
-  if (box_a.dataReadyForShip() &&
-      box_b.dataReadyForShip() &&
-      box_op.dataReadyForShip() &&
+  if (box_in1.dataReadyForShip() &&
+      box_in2.dataReadyForShip() &&
+      box_inOp.dataReadyForShip() &&
       box_out.readyForItemFromShip()) {
-      int a      = box_a.removeDataForShip();
-      int b      = box_b.removeDataForShip();
-      int op     = box_op.removeDataForShip();
+      int a      = box_in1.removeDataForShip();
+      int b      = box_in2.removeDataForShip();
+      int op     = box_inOp.removeDataForShip();
       switch(op) {
           case 0: box_out.addDataFromShip(a+b); // ADD
               break;
index aaeff49..842059c 100644 (file)
@@ -1,7 +1,7 @@
 ship: Debug
 
 == Ports ===========================================================
-data  in:   data
+data  in:   in
 
 == Constants ========================================================
 
@@ -9,8 +9,8 @@ data  in:   data
 
 == Fleeterpreter ====================================================
 public void service() {
-  if (box_data.dataReadyForShip())
-    ((Interpreter)getFleet()).debug(box_data.removeDataForShip());
+  if (box_in.dataReadyForShip())
+    ((Interpreter)getFleet()).debug(box_in.removeDataForShip());
 }
 
 == ArchSim ==============================================================
index 08c4413..d82de3d 100644 (file)
@@ -1,12 +1,12 @@
 ship: Dscratch
 
 == Ports ===========================================================
-data  in:    read_addr
-data out:    read_data
+data  in:    inReadAddr
+data out:    outReadData
 
-data  in:    write_addr
-data  in:    write_data
-token out:   write_done
+data  in:    inWriteAddr
+data  in:    inWriteData
+token out:   outWriteDone
 
 == Fleeterpreter ====================================================
     private long[] mem = new long[0];
@@ -21,17 +21,17 @@ token out:   write_done
     }
 
     public void service() {
-        if (box_read_addr.dataReadyForShip() &&
-            box_read_data.readyForItemFromShip()) {
-            box_read_data.addDataFromShip((int)readMem(box_read_addr.removeDataForShip()));
+        if (box_inReadAddr.dataReadyForShip() &&
+            box_outReadData.readyForItemFromShip()) {
+            box_outReadData.addDataFromShip((int)readMem(box_inReadAddr.removeDataForShip()));
         }
 
-        if (box_write_addr.dataReadyForShip() &&
-            box_write_data.dataReadyForShip() &&
-            box_write_done.readyForItemFromShip()) {
-            writeMem(box_write_addr.removeDataForShip(),
-                     box_write_data.removeDataForShip());
-            box_write_done.addTokenFromShip();
+        if (box_inWriteAddr.dataReadyForShip() &&
+            box_inWriteData.dataReadyForShip() &&
+            box_outWriteDone.readyForItemFromShip()) {
+            writeMem(box_inWriteAddr.removeDataForShip(),
+                     box_inWriteData.removeDataForShip());
+            box_outWriteDone.addTokenFromShip();
         }
     }
 
index bc502cb..99549ea 100644 (file)
@@ -1,11 +1,11 @@
 ship: Iscratch
 
 == Ports ===========================================================
-data  in:    write_addr
-data  in:    write_data
-token out:   write_done
+data  in:    inWriteAddr
+data  in:    inWriteData
+token out:   outWriteDone
 
-data  in:    cbd
+data  in:    inCBD
 
 == Fleeterpreter ====================================================
 
@@ -28,26 +28,26 @@ data  in:    cbd
     }
 
     public void service() {
-        if (box_cbd.dataReadyForShip()) {
-            int val = box_cbd.removeDataForShip();
+        if (box_inCBD.dataReadyForShip()) {
+            int val = box_inCBD.removeDataForShip();
             int addr = val >> 6;
             int size = val & 0x3f;
             dispatch(addr, size);
         }
 
-        if (box_write_addr.dataReadyForShip() &&
-            box_write_data.dataReadyForShip() &&
-            box_write_done.readyForItemFromShip()) {
+        if (box_inWriteAddr.dataReadyForShip() &&
+            box_inWriteData.dataReadyForShip() &&
+            box_outWriteDone.readyForItemFromShip()) {
             Interpreter f = (Interpreter)getFleet();
-            f.writeMem(box_write_addr.removeDataForShip(),
-                       box_write_data.removeDataForShip());
-            box_write_done.addTokenFromShip();
+            f.writeMem(box_inWriteAddr.removeDataForShip(),
+                       box_inWriteData.removeDataForShip());
+            box_outWriteDone.addTokenFromShip();
         }
     }
 
     public void boot(byte[] instructions) {
         Interpreter fleet = (Interpreter)getFleet();
-        // load the iscratch and take note of the 0-address CBD
+        // load the iscratch and take note of the 0-address INCBD
         long launch = 0;
         for(int i=0; i<instructions.length; i+=6) {
             long word = 0;
@@ -57,7 +57,7 @@ data  in:    cbd
             if (i==0) launch = word;
         }
 
-        // dispatch the 0-address CBD
+        // dispatch the 0-address INCBD
         int base = (int)(launch >> 6);
         base = base & ~(0xffffffff << 18);
         int size = (int)launch;
index 2f18657..91489d7 100644 (file)
@@ -1,9 +1,9 @@
 ship: Lut
 
 == Ports ===========================================================
-data  in:   a
-data  in:   b
-data  in:   lut
+data  in:   in1
+data  in:   in2
+data  in:   inLut
 
 data  out:  out
 
@@ -11,10 +11,10 @@ data  out:  out
 == TeX ==============================================================
 == Fleeterpreter ====================================================
     public void service() {
-        if (box_a.dataReadyForShip() && box_b.dataReadyForShip() && box_lut.dataReadyForShip()) {
-            int a      = box_a.removeDataForShip();
-            int b      = box_b.removeDataForShip();
-            int lut    = box_lut.removeDataForShip();
+        if (box_in1.dataReadyForShip() && box_in2.dataReadyForShip() && box_inLut.dataReadyForShip()) {
+            int a      = box_in1.removeDataForShip();
+            int b      = box_in2.removeDataForShip();
+            int lut    = box_inLut.removeDataForShip();
             int ret = 0;
             if ((lut & 1) != 0) ret |= (~a) & (~b);
             if ((lut & 2) != 0) ret |= (a)  & (~b);
index dfba5e1..6476ab1 100644 (file)
@@ -1,19 +1,19 @@
 ship: Shift
 
 == Ports ===========================================================
-data in:  val
-data in:  shamt
+data in:  in
+data in:  inShift
 data out: out
 
 == Constants ========================================================
 == TeX ==============================================================
 == Fleeterpreter ====================================================
     public void service() {
-        if (box_val.dataReadyForShip() && box_shamt.dataReadyForShip()) {
-            int val = box_val.removeDataForShip();
-            int shamt = box_shamt.removeDataForShip();
-            if (shamt < 0) val = val >> (-1 * shamt);
-            else           val = val << shamt;
+        if (box_in.dataReadyForShip() && box_inShift.dataReadyForShip()) {
+            int val = box_in.removeDataForShip();
+            int inShift = box_inShift.removeDataForShip();
+            if (inShift < 0) val = val >> (-1 * inShift);
+            else           val = val << inShift;
             box_out.addDataFromShip(val);
         }
     }
index 77605ac..7c0c349 100644 (file)
@@ -104,6 +104,7 @@ public class Interpreter extends Fleet {
                     try {
                         go(fp, instructions);
                     } catch (Exception e) {
+                        if (fp.isTerminated()) return;
                         throw new RuntimeException(e);
                     }
                 }
index 7905bcd..d2b5eec 100644 (file)
 #ship fifo         : Fifo
 
 // dumb configurations
-debug.data:        [*] take, deliver;
-dscratch.write_addr: [*] take, deliver;
-dscratch.write_data: [*] take, deliver;
-dscratch.read_addr:  [*] take, deliver;
+debug.in:        [*] take, deliver;
+dscratch.inWriteAddr: [*] take, deliver;
+dscratch.inWriteData: [*] take, deliver;
+dscratch.inReadAddr:  [*] take, deliver;
 fifo.in:           [*] take, deliver;
 
 // addresses and values to initialize the dscratch with
-1:  sendto dscratch.write_addr;
-2:  sendto dscratch.write_addr;
-3:  sendto dscratch.write_addr;
-4:  sendto dscratch.write_addr;
-11: sendto dscratch.write_data;
-12: sendto dscratch.write_data;
-13: sendto dscratch.write_data;
-14: sendto dscratch.write_data;
+1:  sendto dscratch.inWriteAddr;
+2:  sendto dscratch.inWriteAddr;
+3:  sendto dscratch.inWriteAddr;
+4:  sendto dscratch.inWriteAddr;
+11: sendto dscratch.inWriteData;
+12: sendto dscratch.inWriteData;
+13: sendto dscratch.inWriteData;
+14: sendto dscratch.inWriteData;
 
 // send write-completion tokens to the fifo output
-dscratch.write_done:
+dscratch.outWriteDone:
   [*] take, sendto fifo.out;
 
 // when the write-completion tokens accumulate, unleash
 // the read addresses
 fifo.out:
   [4] wait;
-  [4] take, sendto dscratch.read_addr;
+  [4] take, sendto dscratch.inReadAddr;
 
 // read addresses
 4:  sendto fifo.in;
@@ -43,6 +43,6 @@ fifo.out:
 1:  sendto fifo.in;
 
 // data read from dscratch goes to the debug ship
-dscratch.read_data:
-  [*] take, sendto debug.data;
+dscratch.outReadData:
+  [*] take, sendto debug.in;
 
index 2269e02..4edac1c 100644 (file)
@@ -1,71 +1,15 @@
 // expected output
 #expect 9
-#expect 9
-#expect 8
-#expect 9
-#expect 9
-#expect 9
-#expect 9
-#expect 9
-#expect 9
-#expect 9
 
 // ships required in order to run this code
 #ship debug        : Debug
 #ship fifo         : Fifo
 
-debug.data:   [*] take, deliver;
+debug.in:   [*] take, deliver;
 9:            sendto fifo.in;
 fifo.in:
   take;
   [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
-  [100] deliver;
 fifo.out:
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
-  [100r] take, discard;
-  [100r] take, discard;
-  [1r] take, sendto debug.data;
+  [99r] take, sendto fifo.in;
+  [1r] take, sendto debug.in;
index 49b1c7c..ff3d894 100644 (file)
@@ -4,15 +4,15 @@
 #expect 14
 
 // ships required in order to run this code
-#ship debug        : Debug
+#ship debug          : Debug
 #ship iscratch       : Iscratch
 
 // instructions not in any codebag are part of the "root codebag"
 // which is dispatched when the code is loaded
 
-BOB:          sendto iscratch.cbd;
-iscratch.cbd:   [*] take, deliver;
-debug.data:   [*] take, deliver;
+BOB:              sendto iscratch.inCBD;
+iscratch.inCBD:   [*] take, deliver;
+debug.in:         [*] take, deliver;
 
 
 // This codebag illustrates how to do a loop.  Notice that this
@@ -20,8 +20,8 @@ debug.data:   [*] take, deliver;
 //  switch fabric!
 
 BOB: {
-  12:           sendto debug.data;
-  13:           sendto debug.data;
-  14:           sendto debug.data;
+  12:           sendto debug.in;
+  13:           sendto debug.in;
+  14:           sendto debug.in;
 }