X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ships%2FFifo.ship;h=bcaec4b55acada5f893b64fbc9c3f85c86a099f8;hb=68d6dbbd166516b8ccb76cef23aec039657d2639;hp=fde05a319edd52ca207b3845a3c0321b6a8d0973;hpb=7bbbd4be446d1426a2cbc34e61dfb42a6f7cfcaa;p=fleet.git diff --git a/ships/Fifo.ship b/ships/Fifo.ship index fde05a3..bcaec4b 100644 --- a/ships/Fifo.ship +++ b/ships/Fifo.ship @@ -2,10 +2,20 @@ ship: Fifo == Ports =========================================================== data in: in + data out: out == Constants ======================================================== + == TeX ============================================================== + +The {\tt Fifo} ship is a simple fifo. Word-sized delivered to the {\tt +in} port are enqueued into the fifo, and values which arrive at the +end of the fifo are provided to the {\tt out} port. + +The internal capacity of the fifo is unspecified, but guaranteed to be +at least 16 words. + == Fleeterpreter ==================================================== private Queue fifo = new LinkedList(); public void service() { @@ -18,32 +28,32 @@ data out: out } == FleetSim ============================================================== -== FPGA ============================================================== -`include "macros.v" - -// fifo *ship*: a 16-deep word-wide fifo -module fifo (clk, - in_r, in_a, in_d, - out_r, out_a, out_d); - - input clk; - input in_r; - input out_a; - output in_a; - output out_r; - input [(`DATAWIDTH-1):0] in_d; - output [(`DATAWIDTH-1):0] out_d; - - wire [(`DATAWIDTH-1):0] d12; - wire [(`DATAWIDTH-1):0] d23; - wire [(`DATAWIDTH-1):0] d34; - - fifo4 s1(clk, in_r, in_a, in_d, r12, a12, d12); - fifo4 s2(clk, r12, a12, d12, r23, a23, d23); - fifo4 s3(clk, r23, a23, d23, r34, a34, d34); - fifo4 s4(clk, r34, a34, d34, out_r, out_a, out_d); - -endmodule + +== Test ================================================================= +// expected output +#expect 9 + +// ships required in order to run this code +#ship debug : Debug +#ship fifo : Fifo + +debug.in: [*] take, deliver; +fifo.in: + literal 9; + deliver; + load repeat counter with 63; + take, deliver; + load repeat counter with 37; + take, deliver; + +fifo.out: + load repeat counter with 63; + take, sendto fifo.in; + load repeat counter with 36; + take, sendto fifo.in; + take, sendto debug.in; + + == Contributors ========================================================= Adam Megacz