X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ships%2FRotator.ship;h=74cb3f1cb1d0c2c03d19394d18c56685cabf9608;hb=cbafca81451a452015ea365b3546c3bc0ac7bdbd;hp=e3d720837a767214fe733183c2be04e910944d83;hpb=caa93dc7618f95e403b52ea834fa1f136d26e43d;p=fleet.git diff --git a/ships/Rotator.ship b/ships/Rotator.ship index e3d7208..74cb3f1 100644 --- a/ships/Rotator.ship +++ b/ships/Rotator.ship @@ -26,14 +26,15 @@ public void service() { long data = box_in.removeDataForShip(); long mask = ~((-1L) << getInterpreter().getWordWidth()); data = data & mask; - box_out.addDataFromShip(((data << amount) | (data >> (getInterpreter().getWordWidth()-amount))) & mask); + long res = ((data >> amount) | (data << (getInterpreter().getWordWidth()-amount))) & mask; + box_out.addDataFromShip(res, (res & (1L << (getInterpreter().getWordWidth()-1)))!=0); } } == FPGA ============================================================== - reg [(`DATAWIDTH):0] out_d; + reg [(`WORDWIDTH):0] out_d; assign out_d_ = out_d; reg full; @@ -46,11 +47,10 @@ public void service() { assign shamt_eq = (shamt[5:0] == (inAmount_d[5:0])); always @(posedge clk) begin - if (!rst) begin + if (rst) begin `reset full <= 0; end else begin - `flush `cleanup if (`in_full && `inAmount_full && `out_empty) begin if (!full) begin @@ -58,7 +58,7 @@ public void service() { shamt <= 0; full <= 1; end else if (!shamt_eq) begin - out_d <= { out_d[0], out_d[0], out_d[`DATAWIDTH-1:1] }; + out_d <= { out_d[0], out_d[0], out_d[`WORDWIDTH-1:1] }; shamt <= shamt+1; end else begin `drain_in @@ -104,11 +104,12 @@ rotator.inAmount: deliver; rotator.out: set olc=3; - [Rq] collect, send to debug.in; - [Rq] set flags a=c, b=b; - [Rq] [!a] set word=0; - [Rq] [a] set word=1; - [Rq] send to debug.in; + head; + collect, send to debug.in; + set flags a=c, b=b; + [!a] set word=0; + [a] set word=1; + send to debug.in; tail;