Skip to content

Commit

Permalink
mem_req_write_arb: remove dependency between req_ready and req_data_v…
Browse files Browse the repository at this point in the history
…alid

This commit adds a feedthrough buffer to store the request metadata if the NoC
is not ready to consume it.
  • Loading branch information
cfuguet committed Oct 29, 2024
1 parent 9df7e23 commit aa4a938
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions rtl/src/utils/hpdcache_mem_req_write_arbiter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ module hpdcache_mem_req_write_arbiter
logic mem_write_arb_req_rok, mem_write_arb_req_wok;
logic mem_write_arb_req_ready;

logic mem_req_write_w;
logic mem_req_write_wok;
hpdcache_mem_req_t mem_req_write;

genvar gen_i;
// }}}

Expand All @@ -90,19 +94,19 @@ module hpdcache_mem_req_write_arbiter
assign req_data_last = |(mem_write_arb_req_gnt_q & mem_write_arb_req_data_last);

// Accept a new request when the grant FIFO is not full and the NoC can accept the request
assign mem_write_arb_req_ready = mem_write_arb_req_wok & mem_req_write_ready_i;
assign mem_write_arb_req_ready = mem_write_arb_req_wok & mem_req_write_wok;

// Write a grant decision into the FIFO
assign mem_write_arb_req_w = mem_req_write_ready_i & req_valid;
assign mem_write_arb_req_w = req_valid & mem_req_write_wok;

// Read grant FIFO when the NoC is able to receive the data and it is the last flit of data
assign mem_write_arb_req_r = mem_req_write_data_ready_i &
mem_write_arb_req_rok &
req_data_valid &
req_data_last;

// Forward the request to the NoC if there is any and the grant FIFO is not full
assign mem_req_write_valid_o = req_valid & mem_write_arb_req_wok;
// Accept a new request when the grant FIFO is not full and the NoC can accept the request
assign mem_req_write_w = req_valid & mem_write_arb_req_wok;

// Forward the data to the NoC if there is any and there is a grant decision in the FIFO
assign mem_req_write_data_valid_o = req_data_valid & mem_write_arb_req_rok;
Expand All @@ -121,6 +125,24 @@ module hpdcache_mem_req_write_arbiter
);
// }}}

// Request FIFO
// {{{
hpdcache_fifo_reg #(
.FIFO_DEPTH (1),
.FEEDTHROUGH (1'b1),
.fifo_data_t (hpdcache_mem_req_t)
) req_fifo_i(
.clk_i,
.rst_ni,
.w_i (mem_req_write_w),
.wok_o (mem_req_write_wok),
.wdata_i (mem_req_write),
.r_i (mem_req_write_ready_i),
.rok_o (mem_req_write_valid_o),
.rdata_o (mem_req_write_o)
);
// }}}

// Grant signal FIFO
// {{{
hpdcache_fifo_reg #(
Expand Down Expand Up @@ -148,7 +170,7 @@ module hpdcache_mem_req_write_arbiter
) req_mux_i(
.data_i (mem_req_write_i),
.sel_i (mem_write_arb_req_gnt),
.data_o (mem_req_write_o)
.data_o (mem_req_write)
);
// }}}

Expand Down

0 comments on commit aa4a938

Please sign in to comment.