#include "contrib/demo.ships"
-//22: sendto debug.data
-//22: sendto debug.data
-//alu1.out: ack debug.data
+// values and addresses to write
+1: sendto mem.write_addr;
+2: sendto mem.write_addr;
+3: sendto mem.write_addr;
+9: sendto mem.write_data;
+8: sendto mem.write_data;
+7: sendto mem.write_data;
-299: sendto alu2.a
-120: sendto alu2.b
-0: sendto alu2.op
-alu2.out: take, sendto debug.data
+// memory write ports accept the values
+mem.write_addr: [*] take, deliver;
+mem.write_data: [*] take, deliver;
+// once all three are written, cue the fifo
+mem.write_done:
+ [3] take;
+ ack fifo.out;
-//22: sendto alu3.b
+// meanwhile, the fifo is sitting on a set of read addresses
+fifo.in: [*] take, deliver;
+1: sendto fifo.in;
+2: sendto fifo.in;
+3: sendto fifo.in;
+1: sendto fifo.in;
+1: sendto fifo.in;
+1: sendto fifo.in;
+
+// when it gets the ack, it issues them all to the memory read unit
+fifo.out:
+ wait;
+ [*] take, sendto mem.read_addr;
+
+// values read from memory go to debug (which accepts them)
+mem.read_addr: [*] take, deliver;
+mem.read_data: [*] take, sendto debug.data;
+debug.data: [*] take, deliver;
-// 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
-//