NCC clean newCell
[fleet.git] / contrib / ps3-1b.fleet
1 // Problem 1 (Amir)
2 //
3 // Two Fifo ships contain the same number of elements. Send a combined 
4 // sequence to the Debug ship such that each pair of elements is in 
5 // increasing order.
6 //
7 // Hint: look at the ship file that defines the Alu2 ship
8 //
9 // Author: Amir Kamil
10 //
11 // Unlike the Alu2 version, no flow control/sequencing is necessary.
12
13
14 #import edu.berkeley.fleet.ships
15 #ship alu          : Alu2b
16 #ship debug        : Debug
17 #ship fifo1        : Fifo
18 #ship fifo2        : Fifo
19
20 #expect 1
21 #expect 2
22 #expect 3
23 #expect 9
24 #expect 8
25 #expect 11
26
27 // for debugging; your solution must work with any
28 // set of numbers
29
30 1:          sendto fifo1.in;
31 3:          sendto fifo1.in;
32 8:          sendto fifo1.in;
33 fifo1.in:   [*] take, deliver;
34 2:          sendto fifo2.in;
35 9:          sendto fifo2.in;
36 11:         sendto fifo2.in;
37 fifo2.in:   [*] take, deliver;
38
39 // your solution goes here
40
41 fifo1.out:  [*] nop;
42             (*) take, sendto alu.in1.min;
43             (*) sendto alu.in1.max;
44             kill;
45 fifo2.out:  [*] take, sendto alu.in2;
46 alu.in1:    [*] take, deliver;
47 alu.in2:    [*] nop;
48             (*) take, deliver;
49             (*) deliver;
50             kill;
51 alu.out:    [*] take, sendto debug.in;
52 debug.in:   [*] take, deliver;