adjust ships to use fill/drain/full/empty macros
[fleet.git] / ships / Alu.ship
index 2089b8a..6157fc1 100644 (file)
@@ -167,29 +167,25 @@ public void service() {
       `reset
     end else begin
       `flush
-      if (!in1_r_  && in1_a)    in1_a    <= 0;
-      if (!in2_r_  && in2_a)    in2_a    <= 0;
-      if (!inOp_r_ && inOp_a)   inOp_a   <= 0;
-      if (out_r    && out_a) begin
-        out_r  <= 0;
-        inOp_a <= 1;
-
-        if      (inOp_d==0) in1_a <= 1;
-        else if (inOp_d==1) in2_a <= 1;
-        else if (inOp_d==9 &&  both_negative) begin in1_a <= 1; in2_a <= 1; end
-        else if (inOp_d==4 &&  greater) in1_a <= 1;
-        else if (inOp_d==5 &&  greater) in2_a <= 1;
-        else if (inOp_d==9 &&  greater) in1_a <= 1;
-        else if (inOp_d==4 && !greater) in2_a <= 1;
-        else if (inOp_d==5 && !greater) in1_a <= 1;
-        else if (inOp_d==9 && !greater) in2_a <= 1;
+      `cleanup
+      if (`out_draining) begin
+        `drain_inOp
+        if      (inOp_d==0) `drain_in1
+        else if (inOp_d==1) `drain_in2
+        else if (inOp_d==9 &&  both_negative) begin `drain_in1 `drain_in2 end
+        else if (inOp_d==4 &&  greater) `drain_in1
+        else if (inOp_d==5 &&  greater) `drain_in2
+        else if (inOp_d==9 &&  greater) `drain_in1
+        else if (inOp_d==4 && !greater) `drain_in2
+        else if (inOp_d==5 && !greater) `drain_in1
+        else if (inOp_d==9 && !greater) `drain_in2
         else begin
-          in1_a <= 1;
-          in2_a <= 1;
+          `drain_in1
+          `drain_in2
         end
       end
-      if (!out_r && !out_a && in1_r && !in1_a && in2_r && !in2_a && inOp_r && !inOp_a) begin
-        out_r <= 1;
+      if (`out_empty && `in1_full && `in2_full && `inOp_full) begin
+        `fill_out
       end
     end
   end