Alu3 bugfixes
[fleet.git] / ships / Alu3.ship
index f88fbb8..9a9d95b 100644 (file)
@@ -50,12 +50,11 @@ public void service() {
   always @(posedge clk) begin
     if (have_out1) begin
       `onwrite(out1_r, out1_a) have_out1 <= 0; end
-    end
-    if (have_out2) begin
+
+    end else if (have_out2) begin
       `onwrite(out2_r, out2_a) have_out2 <= 0; end
-    end
 
-    if (!have_out1 && !have_out2) begin
+    end else if (!have_out1 && !have_out2) begin
       if (!have_a) begin
         `onread(in1_r, in1_a) have_a <= 1; a <= in1_d; end
         end
@@ -67,8 +66,11 @@ public void service() {
         end
   
       if (have_a && have_b && have_c) begin
-        out1_d    <= ((a & b) | (b & c) | (a & c)) << 1;
+        out1_d    <= { { ((a & b) | (b & c) | (a & c)) } , 1'b0 };
         out2_d    <= a ^ b ^ c;
+        have_a    <= 0;
+        have_b    <= 0;
+        have_c    <= 0;
         have_out1 <= 1;
         have_out2 <= 1;
       end