`reset
state <= 0;
end else begin
- if (!in_r && in_a) in_a <= 0;
- if (out_r && out_a) out_r <= 0;
- if (!out_r && !out_a && state==3) begin
+ `flush
+ `cleanup
+ if (`out_empty && state==3) begin
out_d <= { 1'b0, temp };
- out_r <= 1;
+ `fill_out
state <= state + 1;
- end else if (in_r && !in_a && !out_r && !out_a) begin
+ end else if (`in_full && `out_empty) begin
if (state == 0) begin
out_d <= { 1'b0, in_d };
end else if (state == 1) begin
end else if (state == 2) begin
out_d <= { majority[`DATAWIDTH-1:0], 1'b0 };
temp <= xors;
- out_r <= 1;
+ `fill_out
end
state <= state + 1;
- in_a <= 1;
+ `drain_in
end
end
end
== Test ==============================================================
-
// expected output
#expect 0x3c4bc6
#expect 0x1796d2
// ships required in order to run this code
#ship debug : Debug
#ship csa : CarrySaveAdder
-#ship alu : Alu2
+#ship alu : Alu
#ship fifo : Fifo
fifo.in:
alu.in1: set ilc=4; recv, deliver;
alu.in2: set ilc=4; recv, deliver;
alu.inOp:
- set word=Alu2.inOp[ADD];
+ set word=Alu.inOp[ADD];
set ilc=4; deliver;
alu.out:
collect, send to alu.in1;