--- /dev/null
+ship: Stack
+
+== Ports ===========================================================
+data in: push
+data out: pop
+
+== Constants ========================================================
+
+== TeX ==============================================================
+A stack ship with capacity for at least 32 elements.
+
+Push operations are executed as soon as an inbound datum is {\tt
+deliver}ed on the {\tt push} port. Completion of a push can be
+confirmed by sending a {\tt notify} token from the {\tt push} port.
+
+Pop operations are executed no earlier than the time at which the {\tt
+pop} port attempts to {\tt take} data from the ship.
+
+When the stack becomes full, it will simply not process any new {\tt
+push} operations. When the stack becomes empty, it will simply not
+process any new {\tt pop} operations.
+
+== Fleeterpreter ====================================================
+ private ArrayList<Long> stack = new ArrayList<Long>();
+ public void service() {
+ if (box_push.dataReadyForShip() && stack.size()<32) {
+ stack.add(box_push.removeDataForShip());
+ }
+ if (box_pop.readyForDataFromShip() && stack.size() > 0) {
+ box_pop.addDataFromShip(stack.get(stack.size()-1));
+ stack.remove(stack.size()-1);
+ }
+ }
+
+== FleetSim ==============================================================
+== FPGA ==============================================================
+
+ reg [(`DATAWIDTH-1):0] mem [4:0];
+ reg [5:0] depth;
+
+ always @(posedge clk) begin
+ if (depth < 32) begin
+ `onread(push_r, push_a)
+ pop_d = push_d;
+ mem[depth] <= push_d;
+ depth = depth + 1;
+ end
+ end
+ if (depth > 0) begin
+ `onwrite(pop_r, pop_d)
+ depth = depth - 1;
+ if (depth > 0) begin
+ pop_d = mem[depth];
+ end
+ end
+ end
+ end
+
+
+== Contributors =========================================================
+Adam Megacz <megacz@cs.berkeley.edu>