-// lines beginning with "#" are directives to the interpreter
-// and are not part of the actual FLEET assembly code
-
-// import the ships in the Java package edu.berkeley.fleet
-
#import edu.berkeley.fleet
-
-// the identifier after the token is the
-// Java class name of the ship to use
-
-#ship adder : AdderShip
-#ship adder2 : AdderShip
-#ship memread : MemReadShip
-#ship memwrite : MemWriteShip
-#ship halt : HaltShip
-#ship less : LessThanShip
-#ship ifthen : IfThenElseShip
-#ship i : RegisterShip
-#ship fetch : FetchShip
-#ship gate : GateShip
-#ship gate2 : GateShip
-
-
-// define the initial contents of memory
-#memory { 000, 100, 200, 300, 400, 500 }
-
-// preload the counter register
-4 -> i.write
-i.writedone -> gate.release
-gate.codebag <- top
-
-top: { i.read -> less.in1
- 0 -> less.in2
- less.out -> ifthen.if
- ifthen.then <- { 0 -> halt.in }
- ifthen.else <- continue
- }
-
-continue: {
- i.read -> memread.addr
- i.read -> memwrite.addr
- memread.data -> adder.in1
- 1000 -> adder.in2
- adder.out -> memwrite.data
- memwrite.done -> gate.release
- gate.codebag <- {
- i.read -> adder2.in1
- -1 -> adder2.in2
- adder2.out -> i.write
- i.writedone -> gate2.release
- gate2.codebag <- top
- }
- }
-
-
+// skeleton solution to problem #1 (fill in the XXX blanks)
+
+#memory { 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
+ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+
+#ship memread : MemReadShip
+#ship memwrite : MemWriteShip
+#ship bitbucket : BitBucketShip
+#ship halt : HaltShip
+#ship fetch : FetchShip
+
+top: { 100 -> memread.count
+ 0 -(100)-> memread.token
+ // XXX -> memread.addr
+ // XXX -> memread.stride
+
+ memread.data -(*)-> memwrite.data
+
+ // XXX -> memwrite.count
+ // XXX -> memwrite.addr
+ // XXX -> memwrite.stride
+ memwrite.token -(99)-> bitbucket.in
+ memwrite.token -> halt.in
+}
+
+top -> fetch.in