fiddling with Alu3
authoradam <adam@megacz.com>
Sat, 11 Aug 2007 05:01:34 +0000 (06:01 +0100)
committeradam <adam@megacz.com>
Sat, 11 Aug 2007 05:01:34 +0000 (06:01 +0100)
ships/Alu3.ship

index 897a44c..d927fe7 100644 (file)
@@ -66,7 +66,13 @@ public void service() {
 
   always @(posedge clk) begin
     wrote = 0;
-    if (have_out1) begin
+    if (bitstorage_count >= `DATAWIDTH) begin
+      outBits_d  = bitstorage[(`DATAWIDTH-1):0];
+      `onwrite(outBits_r, outBits_a)
+        bitstorage_count <= 0;
+        bitstorage        = bitstorage >> `DATAWIDTH;
+      end
+    end else if (have_out1) begin
       `onwrite(out1_r, out1_a) have_out1 <= 0; end
     end else if (have_out2) begin
       `onwrite(out2_r, out2_a) have_out2 <= 0; end
@@ -78,19 +84,14 @@ public void service() {
       `onread(in2_r, in2_a) have_in2 <= 1; keep_in2 <= in2_d; end
     end else if (!have_in3) begin
       `onread(in3_r, in3_a) have_in3 <= 1; keep_in3 <= in3_d; end
-    end else if (bitstorage_count >= `DATAWIDTH) begin
-      outBits_d  = bitstorage[(`DATAWIDTH-1):0];
-      `onwrite(outBits_r, outBits_a)
-        bitstorage_count <= 0;
-      end
     end else begin
           out1_d           <= { ((keep_in1 & keep_in2) | (keep_in2 & keep_in3) | (keep_in1 & keep_in3)) };
           out2_d                       <= { 1'b0, (keep_in1[(`DATAWIDTH-1):1] ^
                                                    keep_in2[(`DATAWIDTH-1):1] ^
                                                    keep_in3[(`DATAWIDTH-1):1]) };
           out3_d                       <= 0;
-          bitstorage[bitstorage_count]  = (keep_in1[0] ^ keep_in2[0] ^ keep_in3[0]);
-          bitstorage_count             <= bitstorage_count+1;
+        bitstorage[bitstorage_count]  = (keep_in1[0] ^ keep_in2[0] ^ keep_in3[0]);
+        bitstorage_count             <= bitstorage_count+1;
         have_out1 <= 1;
         have_out2 <= 1;
         have_out3 <= 1;
@@ -122,7 +123,7 @@ public void service() {
 0:                  sendto bitfifo.inEnqueue;
 bitfifo.inEnqueue:  [*] take, deliver;
 bitfifo.outDequeue: [*] wait, take, sendto lut3.in2;
-lut3.in2:           notify bitfifo.outDequeue;
+lut3.in2:           [2] notify bitfifo.outDequeue;
                     [74] take, deliver, notify bitfifo.outDequeue;
 
 // mux on second input
@@ -144,12 +145,12 @@ lut3.in3:           take;
                     take;
                     [37] deliver;
 
-lut3.out:           [*] take, sendto alu3.in2;
+lut3.out:           [*] wait, take, sendto alu3.in2;
 
 0:             sendto alu3.in3;
 0:             sendto alu3.in1;
 alu3.in1:      [*] take, deliver;
-alu3.in2:      [*] take, deliver;
+alu3.in2:      [1] notify lut3.out; [*] take, deliver, notify lut3.out;
 alu3.in3:      [*] take, deliver;
 alu3.out1:     [74] take, sendto alu3.in1;
 alu3.out2:     [74] take, sendto alu3.in3;