Procházet zdrojové kódy

Decode queue responses from the existing read assembly register

codex před 3 měsíci
rodič
revize
1a75883b0d
1 změnil soubory, kde provedl 6 přidání a 4 odebrání
  1. 6 4
      src/motor/motor_engine.v

+ 6 - 4
src/motor/motor_engine.v

@@ -869,7 +869,7 @@ module motor_queue_storage #(parameter integer SLOTS=96,
     input wire [SLOT_AW-1:0] wr_slot,rd_slot,
     input wire [127:0] wr_data,
     output wire wr_busy,
-    output reg [127:0] rd_data,
+    output wire [127:0] rd_data,
     output reg rd_valid
 );
     localparam integer MEMORY_AW=$clog2(SLOTS*5);
@@ -882,6 +882,10 @@ module motor_queue_storage #(parameter integer SLOTS=96,
     wire [MEMORY_AW-1:0] write_address=write_base+write_word;
     wire [MEMORY_AW-1:0] read_address=read_base+read_word;
     assign wr_busy=write_active || wr_req;
+    // The final read word is latched into read_shift on rd_valid. It remains
+    // intact until the next read transaction, so a second decoded copy is unnecessary.
+    assign rd_data={16'd0,read_shift[84:69],read_shift[68:37],read_shift[36:5],
+        8'd0,5'd0,read_shift[4],1'b0,read_shift[3],5'd0,read_shift[2:0],8'd0};
     ef2_bram_dp #(.DATA_WIDTH(18),.ADDR_WIDTH(MEMORY_AW),.DATA_DEPTH(SLOTS*5)) u_memory (
         .clk(clk),.a_en(write_active),.a_we(write_active),.a_addr(write_address),
         .a_wdata(write_shift[17:0]),.a_rdata(),.b_en(1'b1),.b_we(1'b0),
@@ -890,7 +894,7 @@ module motor_queue_storage #(parameter integer SLOTS=96,
     always @(posedge clk or negedge rst_n)begin
         if(!rst_n)begin
             write_active<=0;read_active<=0;read_phase<=0;write_word<=0;read_word<=0;
-            write_base<=0;read_base<=0;write_shift<=0;read_shift<=0;rd_data<=0;rd_valid<=0;
+            write_base<=0;read_base<=0;write_shift<=0;read_shift<=0;rd_valid<=0;
         end else begin
             rd_valid<=0;
             if(wr_req && !write_active)begin
@@ -909,8 +913,6 @@ module motor_queue_storage #(parameter integer SLOTS=96,
                     read_phase<=0;read_shift<=assembled;
                     if(read_word==4)begin
                         read_active<=0;rd_valid<=1;
-                        rd_data<={16'd0,assembled[84:69],assembled[68:37],assembled[36:5],
-                            8'd0,5'd0,assembled[4],1'b0,assembled[3],5'd0,assembled[2:0],8'd0};
                     end else read_word<=read_word+1'b1;
                 end
             end