adjust ships to use fill/drain/full/empty macros
[fleet.git] / ships / CarrySaveAdder.ship
index d8b1a11..dc67fab 100644 (file)
@@ -43,13 +43,13 @@ public void service() {
       `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
@@ -57,16 +57,15 @@ public void service() {
         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
@@ -76,7 +75,7 @@ public void service() {
 // 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:
@@ -91,7 +90,7 @@ fifo.out:
 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;