Add an Alu2 that uses virtual destinations instead of commands. Add an example.
[fleet.git] / contrib / ps3-1b.fleet
diff --git a/contrib/ps3-1b.fleet b/contrib/ps3-1b.fleet
new file mode 100644 (file)
index 0000000..cf44f85
--- /dev/null
@@ -0,0 +1,52 @@
+// Problem 1 (Amir)
+//
+// Two Fifo ships contain the same number of elements. Send a combined 
+// sequence to the Debug ship such that each pair of elements is in 
+// increasing order.
+//
+// Hint: look at the ship file that defines the Alu2 ship
+//
+// Author: Amir Kamil
+//
+// Unlike the Alu2 version, no flow control/sequencing is necessary.
+
+
+#import edu.berkeley.fleet.ships
+#ship alu          : Alu2b
+#ship debug        : Debug
+#ship fifo1        : Fifo
+#ship fifo2        : Fifo
+
+#expect 1
+#expect 2
+#expect 3
+#expect 9
+#expect 8
+#expect 11
+
+// for debugging; your solution must work with any
+// set of numbers
+
+1:          sendto fifo1.in;
+3:          sendto fifo1.in;
+8:          sendto fifo1.in;
+fifo1.in:   [*] take, deliver;
+2:          sendto fifo2.in;
+9:          sendto fifo2.in;
+11:         sendto fifo2.in;
+fifo2.in:   [*] take, deliver;
+
+// your solution goes here
+
+fifo1.out:  [*] nop;
+            (*) take, sendto alu.in1.min;
+            (*) sendto alu.in1.max;
+            kill;
+fifo2.out:  [*] take, sendto alu.in2;
+alu.in1:    [*] take, deliver;
+alu.in2:    [*] nop;
+            (*) take, deliver;
+            (*) deliver;
+            kill;
+alu.out:    [*] take, sendto debug.in;
+debug.in:   [*] take, deliver;