Merge branch 'master' into graphics
This commit is contained in:
168
hw/rtl/cache/VX_bank.v
vendored
168
hw/rtl/cache/VX_bank.v
vendored
@@ -22,8 +22,8 @@ module VX_bank #(
|
||||
parameter CREQ_SIZE = 1,
|
||||
// Miss Reserv Queue Knob
|
||||
parameter MSHR_SIZE = 1,
|
||||
// DRAM Request Queue Size
|
||||
parameter DREQ_SIZE = 1,
|
||||
// Memory Request Queue Size
|
||||
parameter MREQ_SIZE = 1,
|
||||
|
||||
// Enable cache writeable
|
||||
parameter WRITE_ENABLE = 1,
|
||||
@@ -35,10 +35,7 @@ module VX_bank #(
|
||||
parameter CORE_TAG_ID_BITS = 0,
|
||||
|
||||
// bank offset from beginning of index range
|
||||
parameter BANK_ADDR_OFFSET = 0,
|
||||
|
||||
// in-order DRAN
|
||||
parameter IN_ORDER_DRAM = 0
|
||||
parameter BANK_ADDR_OFFSET = 0
|
||||
) (
|
||||
`SCOPE_IO_VX_bank
|
||||
|
||||
@@ -71,19 +68,19 @@ module VX_bank #(
|
||||
output wire [CORE_TAG_WIDTH-1:0] core_rsp_tag,
|
||||
input wire core_rsp_ready,
|
||||
|
||||
// DRAM request
|
||||
output wire dram_req_valid,
|
||||
output wire dram_req_rw,
|
||||
output wire [CACHE_LINE_SIZE-1:0] dram_req_byteen,
|
||||
output wire [`LINE_ADDR_WIDTH-1:0] dram_req_addr,
|
||||
output wire [`CACHE_LINE_WIDTH-1:0] dram_req_data,
|
||||
input wire dram_req_ready,
|
||||
// Memory request
|
||||
output wire mem_req_valid,
|
||||
output wire mem_req_rw,
|
||||
output wire [CACHE_LINE_SIZE-1:0] mem_req_byteen,
|
||||
output wire [`LINE_ADDR_WIDTH-1:0] mem_req_addr,
|
||||
output wire [`CACHE_LINE_WIDTH-1:0] mem_req_data,
|
||||
input wire mem_req_ready,
|
||||
|
||||
// DRAM response
|
||||
input wire dram_rsp_valid,
|
||||
input wire [`LINE_ADDR_WIDTH-1:0] dram_rsp_addr,
|
||||
input wire [`CACHE_LINE_WIDTH-1:0] dram_rsp_data,
|
||||
output wire dram_rsp_ready,
|
||||
// Memory response
|
||||
input wire mem_rsp_valid,
|
||||
input wire [`LINE_ADDR_WIDTH-1:0] mem_rsp_addr,
|
||||
input wire [`CACHE_LINE_WIDTH-1:0] mem_rsp_data,
|
||||
output wire mem_rsp_ready,
|
||||
|
||||
// flush
|
||||
input wire flush_enable,
|
||||
@@ -93,10 +90,10 @@ module VX_bank #(
|
||||
`UNUSED_PARAM (CORE_TAG_ID_BITS)
|
||||
|
||||
`ifdef DBG_CACHE_REQ_INFO
|
||||
/* verilator lint_off UNUSED */
|
||||
`IGNORE_WARNINGS_BEGIN
|
||||
wire [31:0] debug_pc_sel, debug_pc_st0, debug_pc_st1;
|
||||
wire [`NW_BITS-1:0] debug_wid_sel, debug_wid_st0, debug_wid_st1;
|
||||
/* verilator lint_on UNUSED */
|
||||
`IGNORE_WARNINGS_END
|
||||
`endif
|
||||
|
||||
wire creq_pop;
|
||||
@@ -167,8 +164,8 @@ module VX_bank #(
|
||||
wire is_flush_st0;
|
||||
|
||||
wire crsq_in_valid, crsq_in_ready, crsq_in_stall;
|
||||
wire dreq_alm_full;
|
||||
wire drsq_pop;
|
||||
wire mreq_alm_full;
|
||||
wire mrsq_pop;
|
||||
|
||||
wire crsq_in_fire = crsq_in_valid && crsq_in_ready;
|
||||
|
||||
@@ -186,24 +183,24 @@ module VX_bank #(
|
||||
|
||||
// determine which queue to pop next in priority order
|
||||
wire mshr_pop_unqual = mshr_valid
|
||||
&& !dreq_alm_full; // ensure DRAM request queue not full (deadlock prevention)
|
||||
wire drsq_pop_unqual = !mshr_pop_unqual && dram_rsp_valid;
|
||||
wire creq_pop_unqual = !mshr_pop_unqual && !drsq_pop_unqual && !creq_empty && !flush_enable;
|
||||
&& !mreq_alm_full; // ensure memory request queue not full (deadlock prevention)
|
||||
wire mrsq_pop_unqual = !mshr_pop_unqual && mem_rsp_valid;
|
||||
wire creq_pop_unqual = !mshr_pop_unqual && !mrsq_pop_unqual && !creq_empty && !flush_enable;
|
||||
|
||||
wire is_miss_st1 = valid_st1 && (miss_st1 || force_miss_st1);
|
||||
assign mshr_pop = mshr_pop_unqual
|
||||
&& !(!IN_ORDER_DRAM && is_miss_st1 && is_mshr_st1) // do not schedule another mshr request if the previous one missed
|
||||
&& !(is_miss_st1 && is_mshr_st1) // do not schedule another mshr request if the previous one missed
|
||||
&& !crsq_in_stall; // ensure core response ready
|
||||
|
||||
assign drsq_pop = drsq_pop_unqual
|
||||
assign mrsq_pop = mrsq_pop_unqual
|
||||
&& !crsq_in_stall; // ensure core response ready
|
||||
|
||||
assign creq_pop = creq_pop_unqual
|
||||
&& !dreq_alm_full // ensure dram request ready
|
||||
&& !mreq_alm_full // ensure memory request ready
|
||||
&& !mshr_alm_full // ensure mshr enqueue ready
|
||||
&& !crsq_in_stall; // ensure core response ready
|
||||
|
||||
assign dram_rsp_ready = drsq_pop;
|
||||
assign mem_rsp_ready = mrsq_pop;
|
||||
|
||||
// we have a miss in mshr or entering it for the current address
|
||||
wire mshr_pending_sel = mshr_pending
|
||||
@@ -237,15 +234,7 @@ module VX_bank #(
|
||||
end else begin
|
||||
assign creq_line_data = creq_data;
|
||||
end
|
||||
|
||||
wire [`LINE_ADDR_WIDTH-1:0] dram_rsp_addr_qual;
|
||||
if (IN_ORDER_DRAM) begin
|
||||
`UNUSED_VAR (dram_rsp_addr)
|
||||
assign dram_rsp_addr_qual = mshr_addr;
|
||||
end else begin
|
||||
assign dram_rsp_addr_qual = dram_rsp_addr;
|
||||
end
|
||||
|
||||
|
||||
VX_pipe_register #(
|
||||
.DATAW (1 + 1 + 1 + 1 + `LINE_ADDR_WIDTH + `CACHE_LINE_WIDTH + (`UP(`WORD_SELECT_BITS) + WORD_SIZE + `REQS_BITS + 1) * NUM_PORTS + CORE_TAG_WIDTH + 1 + 1),
|
||||
.RESETW (1)
|
||||
@@ -254,13 +243,13 @@ module VX_bank #(
|
||||
.reset (reset),
|
||||
.enable (!crsq_in_stall),
|
||||
.data_in ({
|
||||
flush_enable || mshr_pop || drsq_pop || creq_pop,
|
||||
flush_enable || mshr_pop || mrsq_pop || creq_pop,
|
||||
flush_enable,
|
||||
mshr_pop_unqual,
|
||||
drsq_pop_unqual || flush_enable,
|
||||
mrsq_pop_unqual || flush_enable,
|
||||
mshr_pop_unqual ? 1'b0 : creq_rw,
|
||||
mshr_pop_unqual ? mshr_addr : (dram_rsp_valid ? dram_rsp_addr_qual : (flush_enable ? `LINE_ADDR_WIDTH'(flush_addr) : creq_addr)),
|
||||
dram_rsp_valid ? dram_rsp_data : creq_line_data,
|
||||
mshr_pop_unqual ? mshr_addr : (mem_rsp_valid ? mem_rsp_addr : (flush_enable ? `LINE_ADDR_WIDTH'(flush_addr) : creq_addr)),
|
||||
mem_rsp_valid ? mem_rsp_data : creq_line_data,
|
||||
mshr_pop_unqual ? mshr_wsel : creq_wsel,
|
||||
mshr_pop_unqual ? mshr_byteen : creq_byteen,
|
||||
mshr_pop_unqual ? mshr_tid : creq_tid,
|
||||
@@ -307,7 +296,7 @@ module VX_bank #(
|
||||
);
|
||||
|
||||
// redundant fills
|
||||
wire is_redundant_fill_st0 = !IN_ORDER_DRAM && is_fill_st0 && tag_match_st0;
|
||||
wire is_redundant_fill_st0 = is_fill_st0 && tag_match_st0;
|
||||
|
||||
// we had a miss with prior request for the current address
|
||||
assign prev_miss_dep_st0 = is_miss_st1 && (addr_st0 == addr_st1);
|
||||
@@ -322,9 +311,9 @@ module VX_bank #(
|
||||
assign writeen_unqual_st0 = (WRITE_ENABLE && !is_fill_st0 && tag_match_st0 && mem_rw_st0)
|
||||
|| (is_fill_st0 && !is_redundant_fill_st0);
|
||||
|
||||
assign incoming_fill_st0 = dram_rsp_valid && (addr_st0 == dram_rsp_addr_qual);
|
||||
assign incoming_fill_st0 = mem_rsp_valid && (addr_st0 == mem_rsp_addr);
|
||||
|
||||
assign fill_req_unqual_st0 = !mem_rw_st0 && (!force_miss_st0 || (!IN_ORDER_DRAM && is_mshr_st0 && !prev_miss_dep_st0));
|
||||
assign fill_req_unqual_st0 = !mem_rw_st0 && (!force_miss_st0 || (is_mshr_st0 && !prev_miss_dep_st0));
|
||||
|
||||
VX_pipe_register #(
|
||||
.DATAW (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + `LINE_ADDR_WIDTH + `CACHE_LINE_WIDTH + (`UP(`WORD_SELECT_BITS) + WORD_SIZE + `REQS_BITS + 1) * NUM_PORTS + CORE_TAG_WIDTH),
|
||||
@@ -351,12 +340,12 @@ module VX_bank #(
|
||||
|
||||
wire mshr_push_st1 = !is_fill_st1 && !mem_rw_st1 && (miss_st1 || force_miss_st1);
|
||||
|
||||
wire incoming_fill_qual_st1 = (dram_rsp_valid && (addr_st1 == dram_rsp_addr_qual))
|
||||
wire incoming_fill_qual_st1 = (mem_rsp_valid && (addr_st1 == mem_rsp_addr))
|
||||
|| incoming_fill_st1;
|
||||
|
||||
wire do_writeback_st1 = !is_fill_st1 && mem_rw_st1;
|
||||
|
||||
wire dreq_push_st1 = (miss_st1 && fill_req_unqual_st1 && !incoming_fill_qual_st1)
|
||||
wire mreq_push_st1 = (miss_st1 && fill_req_unqual_st1 && !incoming_fill_qual_st1)
|
||||
|| do_writeback_st1;
|
||||
|
||||
wire [`WORDS_PER_LINE-1:0][WORD_SIZE-1:0] line_byteen_st1;
|
||||
@@ -408,15 +397,14 @@ module VX_bank #(
|
||||
|
||||
assign mshr_push = valid_st1 && mshr_push_st1;
|
||||
wire mshr_dequeue = valid_st1 && is_mshr_st1 && !mshr_push_st1 && crsq_in_ready;
|
||||
wire mshr_restore = !IN_ORDER_DRAM && is_mshr_st1;
|
||||
`RUNTIME_ASSERT(!IN_ORDER_DRAM || !(mshr_push && mshr_restore), ("Oops!"))
|
||||
wire mshr_restore = is_mshr_st1;
|
||||
|
||||
// push a missed request as 'ready' if it was a forced miss that actually had a hit
|
||||
// or the fill request for this block is comming
|
||||
wire mshr_init_ready_state = !miss_st1 || incoming_fill_qual_st1;
|
||||
|
||||
// use dram rsp or core req address to lookup the mshr
|
||||
wire [`LINE_ADDR_WIDTH-1:0] lookup_addr = dram_rsp_valid ? dram_rsp_addr_qual : creq_addr;
|
||||
// use memory rsp or core req address to lookup the mshr
|
||||
wire [`LINE_ADDR_WIDTH-1:0] lookup_addr = mem_rsp_valid ? mem_rsp_addr : creq_addr;
|
||||
|
||||
VX_miss_resrv #(
|
||||
.BANK_ID (BANK_ID),
|
||||
@@ -450,7 +438,7 @@ module VX_bank #(
|
||||
`UNUSED_PIN (enqueue_full),
|
||||
|
||||
// lookup
|
||||
.lookup_ready (drsq_pop),
|
||||
.lookup_ready (mrsq_pop),
|
||||
.lookup_addr (lookup_addr),
|
||||
.lookup_match (mshr_pending),
|
||||
|
||||
@@ -500,41 +488,41 @@ module VX_bank #(
|
||||
.ready_out (core_rsp_ready)
|
||||
);
|
||||
|
||||
// Enqueue DRAM request
|
||||
// Enqueue memory request
|
||||
|
||||
wire [CACHE_LINE_SIZE-1:0] dreq_byteen;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] dreq_addr;
|
||||
wire [`CACHE_LINE_WIDTH-1:0] dreq_data;
|
||||
wire dreq_push, dreq_pop, dreq_empty, dreq_rw;
|
||||
wire [CACHE_LINE_SIZE-1:0] mreq_byteen;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] mreq_addr;
|
||||
wire [`CACHE_LINE_WIDTH-1:0] mreq_data;
|
||||
wire mreq_push, mreq_pop, mreq_empty, mreq_rw;
|
||||
|
||||
assign dreq_push = valid_st1 && dreq_push_st1;
|
||||
assign mreq_push = valid_st1 && mreq_push_st1;
|
||||
|
||||
assign dreq_pop = dram_req_valid && dram_req_ready;
|
||||
assign mreq_pop = mem_req_valid && mem_req_ready;
|
||||
|
||||
assign dreq_rw = WRITE_ENABLE && do_writeback_st1;
|
||||
assign dreq_byteen = dreq_rw ? line_byteen_st1 : {CACHE_LINE_SIZE{1'b1}};
|
||||
assign dreq_addr = addr_st1;
|
||||
assign dreq_data = wdata_st1;
|
||||
assign mreq_rw = WRITE_ENABLE && do_writeback_st1;
|
||||
assign mreq_byteen = mreq_rw ? line_byteen_st1 : {CACHE_LINE_SIZE{1'b1}};
|
||||
assign mreq_addr = addr_st1;
|
||||
assign mreq_data = wdata_st1;
|
||||
|
||||
VX_fifo_queue #(
|
||||
.DATAW (1 + CACHE_LINE_SIZE + `LINE_ADDR_WIDTH + `CACHE_LINE_WIDTH),
|
||||
.SIZE (DREQ_SIZE),
|
||||
.ALM_FULL (DREQ_SIZE-2)
|
||||
) dram_req_queue (
|
||||
.SIZE (MREQ_SIZE),
|
||||
.ALM_FULL (MREQ_SIZE-2)
|
||||
) mem_req_queue (
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
.push (dreq_push),
|
||||
.pop (dreq_pop),
|
||||
.data_in ({dreq_rw, dreq_byteen, dreq_addr, dreq_data}),
|
||||
.data_out ({dram_req_rw, dram_req_byteen, dram_req_addr, dram_req_data}),
|
||||
.empty (dreq_empty),
|
||||
.alm_full (dreq_alm_full),
|
||||
.push (mreq_push),
|
||||
.pop (mreq_pop),
|
||||
.data_in ({mreq_rw, mreq_byteen, mreq_addr, mreq_data}),
|
||||
.data_out ({mem_req_rw, mem_req_byteen, mem_req_addr, mem_req_data}),
|
||||
.empty (mreq_empty),
|
||||
.alm_full (mreq_alm_full),
|
||||
`UNUSED_PIN (full),
|
||||
`UNUSED_PIN (alm_empty),
|
||||
`UNUSED_PIN (size)
|
||||
);
|
||||
|
||||
assign dram_req_valid = !dreq_empty;
|
||||
assign mem_req_valid = !mreq_empty;
|
||||
|
||||
`SCOPE_ASSIGN (valid_st0, valid_st0);
|
||||
`SCOPE_ASSIGN (valid_st1, valid_st1);
|
||||
@@ -544,7 +532,7 @@ module VX_bank #(
|
||||
`SCOPE_ASSIGN (force_miss_st0, force_miss_st0);
|
||||
`SCOPE_ASSIGN (mshr_push, mshr_push);
|
||||
`SCOPE_ASSIGN (crsq_in_stall, crsq_in_stall);
|
||||
`SCOPE_ASSIGN (dreq_alm_full, dreq_alm_full);
|
||||
`SCOPE_ASSIGN (mreq_alm_full, mreq_alm_full);
|
||||
`SCOPE_ASSIGN (mshr_alm_full, mshr_alm_full);
|
||||
`SCOPE_ASSIGN (addr_st0, `LINE_TO_BYTE_ADDR(addr_st0, BANK_ID));
|
||||
`SCOPE_ASSIGN (addr_st1, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID));
|
||||
@@ -552,45 +540,45 @@ module VX_bank #(
|
||||
`ifdef PERF_ENABLE
|
||||
assign perf_read_misses = valid_st1 && !is_fill_st1 && !is_mshr_st1 && miss_st1 && !mem_rw_st1;
|
||||
assign perf_write_misses = valid_st1 && !is_fill_st1 && !is_mshr_st1 && miss_st1 && mem_rw_st1;
|
||||
assign perf_pipe_stalls = crsq_in_stall || dreq_alm_full || mshr_alm_full;
|
||||
assign perf_pipe_stalls = crsq_in_stall || mreq_alm_full || mshr_alm_full;
|
||||
assign perf_mshr_stalls = mshr_alm_full;
|
||||
`endif
|
||||
|
||||
`ifdef DBG_PRINT_CACHE_BANK
|
||||
always @(posedge clk) begin
|
||||
/*if (valid_st1 && pmask_st1 == {NUM_PORTS{1'b1}}) begin
|
||||
$display("%t: cache%0d:%0d full bank multi-porting - addr=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID));
|
||||
end*/
|
||||
/*if (crsq_in_fire && (NUM_PORTS > 1) && $countones(crsq_pmask) > 1) begin
|
||||
$display("%t: *** cache%0d:%0d multi-port-out: pmask=%b, addr=%0h, tag=%0h", $time, CACHE_ID, BANK_ID, crsq_pmask, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID), crsq_tag);
|
||||
end */
|
||||
if (valid_st1 && !is_fill_st1 && miss_st1 && incoming_fill_qual_st1) begin
|
||||
$display("%t: cache%0d:%0d miss with incoming fill - addr=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID));
|
||||
$display("%t: *** cache%0d:%0d miss with incoming fill - addr=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID));
|
||||
assert(!is_mshr_st1);
|
||||
end
|
||||
if (crsq_in_stall || dreq_alm_full || mshr_alm_full) begin
|
||||
$display("%t: cache%0d:%0d pipeline-stall: cwbq=%b, dwbq=%b, mshr=%b", $time, CACHE_ID, BANK_ID, crsq_in_stall, dreq_alm_full, mshr_alm_full);
|
||||
if (crsq_in_stall || mreq_alm_full || mshr_alm_full) begin
|
||||
$display("%t: *** cache%0d:%0d pipeline-stall: cwbq=%b, dwbq=%b, mshr=%b", $time, CACHE_ID, BANK_ID, crsq_in_stall, mreq_alm_full, mshr_alm_full);
|
||||
end
|
||||
if (flush_enable) begin
|
||||
$display("%t: cache%0d:%0d flush: addr=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(flush_addr, BANK_ID));
|
||||
end
|
||||
if (drsq_pop) begin
|
||||
$display("%t: cache%0d:%0d fill-rsp: addr=%0h, data=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(dram_rsp_addr_qual, BANK_ID), dram_rsp_data);
|
||||
if (mrsq_pop) begin
|
||||
$display("%t: cache%0d:%0d fill-rsp: addr=%0h, data=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(mem_rsp_addr, BANK_ID), mem_rsp_data);
|
||||
end
|
||||
if (mshr_pop) begin
|
||||
$display("%t: cache%0d:%0d mshr-rd-req: addr=%0h, tag=%0h, pmask=%0b, tid=%0d, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(mshr_addr, BANK_ID), mshr_tag, mshr_pmask, mshr_tid, mshr_byteen, debug_wid_sel, debug_pc_sel);
|
||||
$display("%t: cache%0d:%0d mshr-rd-req: addr=%0h, tag=%0h, pmask=%b, tid=%0d, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(mshr_addr, BANK_ID), mshr_tag, mshr_pmask, mshr_tid, mshr_byteen, debug_wid_sel, debug_pc_sel);
|
||||
end
|
||||
if (creq_pop) begin
|
||||
if (creq_rw)
|
||||
$display("%t: cache%0d:%0d core-wr-req: addr=%0h, tag=%0h, pmask=%0b, tid=%0d, byteen=%b, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(creq_addr, BANK_ID), creq_tag, creq_pmask, creq_tid, creq_byteen, creq_data, debug_wid_sel, debug_pc_sel);
|
||||
$display("%t: cache%0d:%0d core-wr-req: addr=%0h, tag=%0h, pmask=%b, tid=%0d, byteen=%b, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(creq_addr, BANK_ID), creq_tag, creq_pmask, creq_tid, creq_byteen, creq_data, debug_wid_sel, debug_pc_sel);
|
||||
else
|
||||
$display("%t: cache%0d:%0d core-rd-req: addr=%0h, tag=%0h, pmask=%0b, tid=%0d, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(creq_addr, BANK_ID), creq_tag, creq_pmask, creq_tid, creq_byteen, debug_wid_sel, debug_pc_sel);
|
||||
$display("%t: cache%0d:%0d core-rd-req: addr=%0h, tag=%0h, pmask=%b, tid=%0d, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(creq_addr, BANK_ID), creq_tag, creq_pmask, creq_tid, creq_byteen, debug_wid_sel, debug_pc_sel);
|
||||
end
|
||||
if (crsq_in_fire) begin
|
||||
$display("%t: cache%0d:%0d core-rsp: addr=%0h, tag=%0h, pmask=%0b, tid=%0d, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID), crsq_tag, crsq_pmask, crsq_tid, crsq_data, debug_wid_st1, debug_pc_st1);
|
||||
$display("%t: cache%0d:%0d core-rsp: addr=%0h, tag=%0h, pmask=%b, tid=%0d, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(addr_st1, BANK_ID), crsq_tag, crsq_pmask, crsq_tid, crsq_data, debug_wid_st1, debug_pc_st1);
|
||||
end
|
||||
if (dreq_push) begin
|
||||
if (mreq_push) begin
|
||||
if (do_writeback_st1)
|
||||
$display("%t: cache%0d:%0d writeback: addr=%0h, data=%0h, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(dreq_addr, BANK_ID), dreq_data, dreq_byteen, debug_wid_st1, debug_pc_st1);
|
||||
$display("%t: cache%0d:%0d writeback: addr=%0h, data=%0h, byteen=%b, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(mreq_addr, BANK_ID), mreq_data, mreq_byteen, debug_wid_st1, debug_pc_st1);
|
||||
else
|
||||
$display("%t: cache%0d:%0d fill-req: addr=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(dreq_addr, BANK_ID), debug_wid_st1, debug_pc_st1);
|
||||
$display("%t: cache%0d:%0d fill-req: addr=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, BANK_ID, `LINE_TO_BYTE_ADDR(mreq_addr, BANK_ID), debug_wid_st1, debug_pc_st1);
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
231
hw/rtl/cache/VX_cache.v
vendored
231
hw/rtl/cache/VX_cache.v
vendored
@@ -21,10 +21,10 @@ module VX_cache #(
|
||||
parameter CREQ_SIZE = 4,
|
||||
// Miss Reserv Queue Knob
|
||||
parameter MSHR_SIZE = 8,
|
||||
// DRAM Response Queue Size
|
||||
parameter DRSQ_SIZE = 4,
|
||||
// DRAM Request Queue Size
|
||||
parameter DREQ_SIZE = 4,
|
||||
// Memory Response Queue Size
|
||||
parameter MRSQ_SIZE = 4,
|
||||
// Memory Request Queue Size
|
||||
parameter MREQ_SIZE = 4,
|
||||
|
||||
// Enable cache writeable
|
||||
parameter WRITE_ENABLE = 1,
|
||||
@@ -35,22 +35,17 @@ module VX_cache #(
|
||||
// size of tag id in core request tag
|
||||
parameter CORE_TAG_ID_BITS = CORE_TAG_WIDTH,
|
||||
|
||||
// dram request tag size
|
||||
parameter DRAM_TAG_WIDTH = (32 - $clog2(CACHE_LINE_SIZE)),
|
||||
// Memory request tag size
|
||||
parameter MEM_TAG_WIDTH = (32 - $clog2(CACHE_LINE_SIZE)),
|
||||
|
||||
// bank offset from beginning of index range
|
||||
parameter BANK_ADDR_OFFSET = 0,
|
||||
|
||||
// in-order DRAN
|
||||
parameter IN_ORDER_DRAM = 0
|
||||
parameter BANK_ADDR_OFFSET = 0
|
||||
) (
|
||||
`SCOPE_IO_VX_cache
|
||||
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
|
||||
input wire flush,
|
||||
|
||||
// Core request
|
||||
input wire [NUM_REQS-1:0] core_req_valid,
|
||||
input wire [NUM_REQS-1:0] core_req_rw,
|
||||
@@ -66,29 +61,32 @@ module VX_cache #(
|
||||
output wire [`CORE_REQ_TAG_COUNT-1:0][CORE_TAG_WIDTH-1:0] core_rsp_tag,
|
||||
input wire [`CORE_REQ_TAG_COUNT-1:0] core_rsp_ready,
|
||||
|
||||
// Memory request
|
||||
output wire mem_req_valid,
|
||||
output wire mem_req_rw,
|
||||
output wire [CACHE_LINE_SIZE-1:0] mem_req_byteen,
|
||||
output wire [`MEM_ADDR_WIDTH-1:0] mem_req_addr,
|
||||
output wire [`CACHE_LINE_WIDTH-1:0] mem_req_data,
|
||||
output wire [MEM_TAG_WIDTH-1:0] mem_req_tag,
|
||||
input wire mem_req_ready,
|
||||
|
||||
// Memory response
|
||||
input wire mem_rsp_valid,
|
||||
input wire [`CACHE_LINE_WIDTH-1:0] mem_rsp_data,
|
||||
input wire [MEM_TAG_WIDTH-1:0] mem_rsp_tag,
|
||||
output wire mem_rsp_ready,
|
||||
|
||||
// PERF
|
||||
`ifdef PERF_ENABLE
|
||||
VX_perf_cache_if perf_cache_if,
|
||||
`endif
|
||||
|
||||
// DRAM request
|
||||
output wire dram_req_valid,
|
||||
output wire dram_req_rw,
|
||||
output wire [CACHE_LINE_SIZE-1:0] dram_req_byteen,
|
||||
output wire [`DRAM_ADDR_WIDTH-1:0] dram_req_addr,
|
||||
output wire [`CACHE_LINE_WIDTH-1:0] dram_req_data,
|
||||
output wire [DRAM_TAG_WIDTH-1:0] dram_req_tag,
|
||||
input wire dram_req_ready,
|
||||
|
||||
// DRAM response
|
||||
input wire dram_rsp_valid,
|
||||
input wire [`CACHE_LINE_WIDTH-1:0] dram_rsp_data,
|
||||
input wire [DRAM_TAG_WIDTH-1:0] dram_rsp_tag,
|
||||
output wire dram_rsp_ready
|
||||
// device flush
|
||||
input wire flush
|
||||
);
|
||||
|
||||
`STATIC_ASSERT(NUM_BANKS <= NUM_REQS, ("invalid value"))
|
||||
|
||||
|
||||
wire [NUM_BANKS-1:0][NUM_PORTS-1:0] per_bank_core_req_valid;
|
||||
wire [NUM_BANKS-1:0][NUM_PORTS-1:0][`UP(`WORD_SELECT_BITS)-1:0] per_bank_core_req_wsel;
|
||||
wire [NUM_BANKS-1:0][NUM_PORTS-1:0][WORD_SIZE-1:0] per_bank_core_req_byteen;
|
||||
@@ -106,17 +104,17 @@ module VX_cache #(
|
||||
wire [NUM_BANKS-1:0][CORE_TAG_WIDTH-1:0] per_bank_core_rsp_tag;
|
||||
wire [NUM_BANKS-1:0] per_bank_core_rsp_ready;
|
||||
|
||||
wire [NUM_BANKS-1:0] per_bank_dram_req_valid;
|
||||
wire [NUM_BANKS-1:0] per_bank_dram_req_rw;
|
||||
wire [NUM_BANKS-1:0][CACHE_LINE_SIZE-1:0] per_bank_dram_req_byteen;
|
||||
wire [NUM_BANKS-1:0][`DRAM_ADDR_WIDTH-1:0] per_bank_dram_req_addr;
|
||||
wire [NUM_BANKS-1:0][`CACHE_LINE_WIDTH-1:0] per_bank_dram_req_data;
|
||||
wire [NUM_BANKS-1:0] per_bank_dram_req_ready;
|
||||
wire [NUM_BANKS-1:0] per_bank_mem_req_valid;
|
||||
wire [NUM_BANKS-1:0] per_bank_mem_req_rw;
|
||||
wire [NUM_BANKS-1:0][CACHE_LINE_SIZE-1:0] per_bank_mem_req_byteen;
|
||||
wire [NUM_BANKS-1:0][`MEM_ADDR_WIDTH-1:0] per_bank_mem_req_addr;
|
||||
wire [NUM_BANKS-1:0][`CACHE_LINE_WIDTH-1:0] per_bank_mem_req_data;
|
||||
wire [NUM_BANKS-1:0] per_bank_mem_req_ready;
|
||||
|
||||
wire [NUM_BANKS-1:0] per_bank_dram_rsp_ready;
|
||||
wire [NUM_BANKS-1:0] per_bank_mem_rsp_ready;
|
||||
|
||||
wire [`CACHE_LINE_WIDTH-1:0] dram_rsp_data_qual;
|
||||
wire [DRAM_TAG_WIDTH-1:0] dram_rsp_tag_qual;
|
||||
wire [`CACHE_LINE_WIDTH-1:0] mem_rsp_data_qual;
|
||||
wire [MEM_TAG_WIDTH-1:0] mem_rsp_tag_qual;
|
||||
wire [`LINE_SELECT_BITS-1:0] flush_addr;
|
||||
wire flush_enable;
|
||||
|
||||
@@ -129,35 +127,35 @@ module VX_cache #(
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wire drsq_full, drsq_empty;
|
||||
wire drsq_push, drsq_pop;
|
||||
wire mrsq_full, mrsq_empty;
|
||||
wire mrsq_push, mrsq_pop;
|
||||
|
||||
assign drsq_push = dram_rsp_valid && dram_rsp_ready;
|
||||
assign dram_rsp_ready = !drsq_full;
|
||||
assign mrsq_push = mem_rsp_valid && mem_rsp_ready;
|
||||
assign mem_rsp_ready = !mrsq_full;
|
||||
|
||||
VX_fifo_queue #(
|
||||
.DATAW (DRAM_TAG_WIDTH + `CACHE_LINE_WIDTH),
|
||||
.SIZE (DRSQ_SIZE),
|
||||
.DATAW (MEM_TAG_WIDTH + `CACHE_LINE_WIDTH),
|
||||
.SIZE (MRSQ_SIZE),
|
||||
.BUFFERED (1)
|
||||
) dram_rsp_queue (
|
||||
) mem_rsp_queue (
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
.push (drsq_push),
|
||||
.pop (drsq_pop),
|
||||
.data_in ({dram_rsp_tag, dram_rsp_data}),
|
||||
.data_out ({dram_rsp_tag_qual, dram_rsp_data_qual}),
|
||||
.empty (drsq_empty),
|
||||
.full (drsq_full),
|
||||
.push (mrsq_push),
|
||||
.pop (mrsq_pop),
|
||||
.data_in ({mem_rsp_tag, mem_rsp_data}),
|
||||
.data_out ({mem_rsp_tag_qual, mem_rsp_data_qual}),
|
||||
.empty (mrsq_empty),
|
||||
.full (mrsq_full),
|
||||
`UNUSED_PIN (alm_full),
|
||||
`UNUSED_PIN (alm_empty),
|
||||
`UNUSED_PIN (size)
|
||||
);
|
||||
|
||||
if (NUM_BANKS == 1) begin
|
||||
`UNUSED_VAR (dram_rsp_tag_qual)
|
||||
assign drsq_pop = !drsq_empty && per_bank_dram_rsp_ready;
|
||||
`UNUSED_VAR (mem_rsp_tag_qual)
|
||||
assign mrsq_pop = !mrsq_empty && per_bank_mem_rsp_ready;
|
||||
end else begin
|
||||
assign drsq_pop = !drsq_empty && per_bank_dram_rsp_ready[`DRAM_ADDR_BANK(dram_rsp_tag_qual)];
|
||||
assign mrsq_pop = !mrsq_empty && per_bank_mem_rsp_ready[`MEM_ADDR_BANK(mem_rsp_tag_qual)];
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -176,6 +174,7 @@ module VX_cache #(
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
VX_cache_core_req_bank_sel #(
|
||||
.CACHE_ID (CACHE_ID),
|
||||
.CACHE_LINE_SIZE (CACHE_LINE_SIZE),
|
||||
.NUM_BANKS (NUM_BANKS),
|
||||
.NUM_PORTS (NUM_PORTS),
|
||||
@@ -227,17 +226,17 @@ module VX_cache #(
|
||||
wire [CORE_TAG_WIDTH-1:0] curr_bank_core_rsp_tag;
|
||||
wire curr_bank_core_rsp_ready;
|
||||
|
||||
wire curr_bank_dram_req_valid;
|
||||
wire curr_bank_dram_req_rw;
|
||||
wire [CACHE_LINE_SIZE-1:0] curr_bank_dram_req_byteen;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] curr_bank_dram_req_addr;
|
||||
wire[`CACHE_LINE_WIDTH-1:0] curr_bank_dram_req_data;
|
||||
wire curr_bank_dram_req_ready;
|
||||
wire curr_bank_mem_req_valid;
|
||||
wire curr_bank_mem_req_rw;
|
||||
wire [CACHE_LINE_SIZE-1:0] curr_bank_mem_req_byteen;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] curr_bank_mem_req_addr;
|
||||
wire[`CACHE_LINE_WIDTH-1:0] curr_bank_mem_req_data;
|
||||
wire curr_bank_mem_req_ready;
|
||||
|
||||
wire curr_bank_dram_rsp_valid;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] curr_bank_dram_rsp_addr;
|
||||
wire [`CACHE_LINE_WIDTH-1:0] curr_bank_dram_rsp_data;
|
||||
wire curr_bank_dram_rsp_ready;
|
||||
wire curr_bank_mem_rsp_valid;
|
||||
wire [`LINE_ADDR_WIDTH-1:0] curr_bank_mem_rsp_addr;
|
||||
wire [`CACHE_LINE_WIDTH-1:0] curr_bank_mem_rsp_data;
|
||||
wire curr_bank_mem_rsp_ready;
|
||||
|
||||
// Core Req
|
||||
assign curr_bank_core_req_valid = per_bank_core_req_valid[i];
|
||||
@@ -258,28 +257,28 @@ module VX_cache #(
|
||||
assign per_bank_core_rsp_tag [i] = curr_bank_core_rsp_tag;
|
||||
assign per_bank_core_rsp_data [i] = curr_bank_core_rsp_data;
|
||||
|
||||
// DRAM request
|
||||
assign per_bank_dram_req_valid[i] = curr_bank_dram_req_valid;
|
||||
assign per_bank_dram_req_rw[i] = curr_bank_dram_req_rw;
|
||||
assign per_bank_dram_req_byteen[i] = curr_bank_dram_req_byteen;
|
||||
// Memory request
|
||||
assign per_bank_mem_req_valid[i] = curr_bank_mem_req_valid;
|
||||
assign per_bank_mem_req_rw[i] = curr_bank_mem_req_rw;
|
||||
assign per_bank_mem_req_byteen[i] = curr_bank_mem_req_byteen;
|
||||
if (NUM_BANKS == 1) begin
|
||||
assign per_bank_dram_req_addr[i] = curr_bank_dram_req_addr;
|
||||
assign per_bank_mem_req_addr[i] = curr_bank_mem_req_addr;
|
||||
end else begin
|
||||
assign per_bank_dram_req_addr[i] = `LINE_TO_DRAM_ADDR(curr_bank_dram_req_addr, i);
|
||||
assign per_bank_mem_req_addr[i] = `LINE_TO_MEM_ADDR(curr_bank_mem_req_addr, i);
|
||||
end
|
||||
assign per_bank_dram_req_data[i] = curr_bank_dram_req_data;
|
||||
assign curr_bank_dram_req_ready = per_bank_dram_req_ready[i];
|
||||
assign per_bank_mem_req_data[i] = curr_bank_mem_req_data;
|
||||
assign curr_bank_mem_req_ready = per_bank_mem_req_ready[i];
|
||||
|
||||
// DRAM response
|
||||
// Memory response
|
||||
if (NUM_BANKS == 1) begin
|
||||
assign curr_bank_dram_rsp_valid = !drsq_empty;
|
||||
assign curr_bank_dram_rsp_addr = dram_rsp_tag_qual;
|
||||
assign curr_bank_mem_rsp_valid = !mrsq_empty;
|
||||
assign curr_bank_mem_rsp_addr = mem_rsp_tag_qual;
|
||||
end else begin
|
||||
assign curr_bank_dram_rsp_valid = !drsq_empty && (`DRAM_ADDR_BANK(dram_rsp_tag_qual) == i);
|
||||
assign curr_bank_dram_rsp_addr = `DRAM_TO_LINE_ADDR(dram_rsp_tag_qual);
|
||||
assign curr_bank_mem_rsp_valid = !mrsq_empty && (`MEM_ADDR_BANK(mem_rsp_tag_qual) == i);
|
||||
assign curr_bank_mem_rsp_addr = `MEM_TO_LINE_ADDR(mem_rsp_tag_qual);
|
||||
end
|
||||
assign curr_bank_dram_rsp_data = dram_rsp_data_qual;
|
||||
assign per_bank_dram_rsp_ready[i] = curr_bank_dram_rsp_ready;
|
||||
assign curr_bank_mem_rsp_data = mem_rsp_data_qual;
|
||||
assign per_bank_mem_rsp_ready[i] = curr_bank_mem_rsp_ready;
|
||||
|
||||
VX_bank #(
|
||||
.BANK_ID (i),
|
||||
@@ -292,12 +291,11 @@ module VX_cache #(
|
||||
.NUM_REQS (NUM_REQS),
|
||||
.CREQ_SIZE (CREQ_SIZE),
|
||||
.MSHR_SIZE (MSHR_SIZE),
|
||||
.DREQ_SIZE (DREQ_SIZE),
|
||||
.MREQ_SIZE (MREQ_SIZE),
|
||||
.WRITE_ENABLE (WRITE_ENABLE),
|
||||
.CORE_TAG_WIDTH (CORE_TAG_WIDTH),
|
||||
.CORE_TAG_ID_BITS (CORE_TAG_ID_BITS),
|
||||
.BANK_ADDR_OFFSET (BANK_ADDR_OFFSET),
|
||||
.IN_ORDER_DRAM (IN_ORDER_DRAM)
|
||||
.BANK_ADDR_OFFSET (BANK_ADDR_OFFSET)
|
||||
) bank (
|
||||
`SCOPE_BIND_VX_cache_bank(i)
|
||||
|
||||
@@ -330,19 +328,19 @@ module VX_cache #(
|
||||
.core_rsp_tag (curr_bank_core_rsp_tag),
|
||||
.core_rsp_ready (curr_bank_core_rsp_ready),
|
||||
|
||||
// DRAM request
|
||||
.dram_req_valid (curr_bank_dram_req_valid),
|
||||
.dram_req_rw (curr_bank_dram_req_rw),
|
||||
.dram_req_byteen (curr_bank_dram_req_byteen),
|
||||
.dram_req_addr (curr_bank_dram_req_addr),
|
||||
.dram_req_data (curr_bank_dram_req_data),
|
||||
.dram_req_ready (curr_bank_dram_req_ready),
|
||||
// Memory request
|
||||
.mem_req_valid (curr_bank_mem_req_valid),
|
||||
.mem_req_rw (curr_bank_mem_req_rw),
|
||||
.mem_req_byteen (curr_bank_mem_req_byteen),
|
||||
.mem_req_addr (curr_bank_mem_req_addr),
|
||||
.mem_req_data (curr_bank_mem_req_data),
|
||||
.mem_req_ready (curr_bank_mem_req_ready),
|
||||
|
||||
// DRAM response
|
||||
.dram_rsp_valid (curr_bank_dram_rsp_valid),
|
||||
.dram_rsp_addr (curr_bank_dram_rsp_addr),
|
||||
.dram_rsp_data (curr_bank_dram_rsp_data),
|
||||
.dram_rsp_ready (curr_bank_dram_rsp_ready),
|
||||
// Memory response
|
||||
.mem_rsp_valid (curr_bank_mem_rsp_valid),
|
||||
.mem_rsp_addr (curr_bank_mem_rsp_addr),
|
||||
.mem_rsp_data (curr_bank_mem_rsp_data),
|
||||
.mem_rsp_ready (curr_bank_mem_rsp_ready),
|
||||
|
||||
// flush
|
||||
.flush_enable (flush_enable),
|
||||
@@ -351,6 +349,7 @@ module VX_cache #(
|
||||
end
|
||||
|
||||
VX_cache_core_rsp_merge #(
|
||||
.CACHE_ID (CACHE_ID),
|
||||
.NUM_BANKS (NUM_BANKS),
|
||||
.NUM_PORTS (NUM_PORTS),
|
||||
.WORD_SIZE (WORD_SIZE),
|
||||
@@ -372,27 +371,27 @@ module VX_cache #(
|
||||
.core_rsp_ready (core_rsp_ready)
|
||||
);
|
||||
|
||||
wire [NUM_BANKS-1:0][(`DRAM_ADDR_WIDTH + 1 + CACHE_LINE_SIZE + `CACHE_LINE_WIDTH)-1:0] data_in;
|
||||
wire [NUM_BANKS-1:0][(`MEM_ADDR_WIDTH + 1 + CACHE_LINE_SIZE + `CACHE_LINE_WIDTH)-1:0] data_in;
|
||||
for (genvar i = 0; i < NUM_BANKS; i++) begin
|
||||
assign data_in[i] = {per_bank_dram_req_addr[i], per_bank_dram_req_rw[i], per_bank_dram_req_byteen[i], per_bank_dram_req_data[i]};
|
||||
assign data_in[i] = {per_bank_mem_req_addr[i], per_bank_mem_req_rw[i], per_bank_mem_req_byteen[i], per_bank_mem_req_data[i]};
|
||||
end
|
||||
|
||||
VX_stream_arbiter #(
|
||||
.NUM_REQS (NUM_BANKS),
|
||||
.DATAW (`DRAM_ADDR_WIDTH + 1 + CACHE_LINE_SIZE + `CACHE_LINE_WIDTH),
|
||||
.DATAW (`MEM_ADDR_WIDTH + 1 + CACHE_LINE_SIZE + `CACHE_LINE_WIDTH),
|
||||
.BUFFERED (1)
|
||||
) dram_req_arb (
|
||||
) mem_req_arb (
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
.valid_in (per_bank_dram_req_valid),
|
||||
.valid_in (per_bank_mem_req_valid),
|
||||
.data_in (data_in),
|
||||
.ready_in (per_bank_dram_req_ready),
|
||||
.valid_out (dram_req_valid),
|
||||
.data_out ({dram_req_addr, dram_req_rw, dram_req_byteen, dram_req_data}),
|
||||
.ready_out (dram_req_ready)
|
||||
.ready_in (per_bank_mem_req_ready),
|
||||
.valid_out (mem_req_valid),
|
||||
.data_out ({mem_req_addr, mem_req_rw, mem_req_byteen, mem_req_data}),
|
||||
.ready_out (mem_req_ready)
|
||||
);
|
||||
|
||||
assign dram_req_tag = dram_req_addr;
|
||||
assign mem_req_tag = mem_req_addr;
|
||||
|
||||
`ifdef PERF_ENABLE
|
||||
// per cycle: core_reads, core_writes
|
||||
@@ -420,13 +419,13 @@ module VX_cache #(
|
||||
assign perf_mshr_stall_per_cycle = $countones(perf_mshr_stall_per_bank);
|
||||
assign perf_pipe_stall_per_cycle = $countones(perf_pipe_stall_per_bank);
|
||||
|
||||
reg [43:0] perf_core_reads;
|
||||
reg [43:0] perf_core_writes;
|
||||
reg [43:0] perf_read_misses;
|
||||
reg [43:0] perf_write_misses;
|
||||
reg [43:0] perf_mshr_stalls;
|
||||
reg [43:0] perf_pipe_stalls;
|
||||
reg [43:0] perf_crsp_stalls;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_core_reads;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_core_writes;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_read_misses;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_write_misses;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_mshr_stalls;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_pipe_stalls;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_crsp_stalls;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
@@ -438,13 +437,13 @@ module VX_cache #(
|
||||
perf_pipe_stalls <= 0;
|
||||
perf_crsp_stalls <= 0;
|
||||
end else begin
|
||||
perf_core_reads <= perf_core_reads + 44'(perf_core_reads_per_cycle);
|
||||
perf_core_writes <= perf_core_writes + 44'(perf_core_writes_per_cycle);
|
||||
perf_read_misses <= perf_read_misses + 44'(perf_read_miss_per_cycle);
|
||||
perf_write_misses <= perf_write_misses+ 44'(perf_write_miss_per_cycle);
|
||||
perf_mshr_stalls <= perf_mshr_stalls + 44'(perf_mshr_stall_per_cycle);
|
||||
perf_pipe_stalls <= perf_pipe_stalls + 44'(perf_pipe_stall_per_cycle);
|
||||
perf_crsp_stalls <= perf_crsp_stalls + 44'(perf_crsp_stall_per_cycle);
|
||||
perf_core_reads <= perf_core_reads + `PERF_CTR_BITS'(perf_core_reads_per_cycle);
|
||||
perf_core_writes <= perf_core_writes + `PERF_CTR_BITS'(perf_core_writes_per_cycle);
|
||||
perf_read_misses <= perf_read_misses + `PERF_CTR_BITS'(perf_read_miss_per_cycle);
|
||||
perf_write_misses <= perf_write_misses+ `PERF_CTR_BITS'(perf_write_miss_per_cycle);
|
||||
perf_mshr_stalls <= perf_mshr_stalls + `PERF_CTR_BITS'(perf_mshr_stall_per_cycle);
|
||||
perf_pipe_stalls <= perf_pipe_stalls + `PERF_CTR_BITS'(perf_pipe_stall_per_cycle);
|
||||
perf_crsp_stalls <= perf_crsp_stalls + `PERF_CTR_BITS'(perf_crsp_stall_per_cycle);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
11
hw/rtl/cache/VX_cache_core_req_bank_sel.v
vendored
11
hw/rtl/cache/VX_cache_core_req_bank_sel.v
vendored
@@ -1,6 +1,8 @@
|
||||
`include "VX_cache_define.vh"
|
||||
|
||||
module VX_cache_core_req_bank_sel #(
|
||||
parameter CACHE_ID = 0,
|
||||
|
||||
// Size of line inside a bank in bytes
|
||||
parameter CACHE_LINE_SIZE = 64,
|
||||
// Size of a word in bytes
|
||||
@@ -22,7 +24,7 @@ module VX_cache_core_req_bank_sel #(
|
||||
input wire reset,
|
||||
|
||||
`ifdef PERF_ENABLE
|
||||
output wire [43:0] bank_stalls,
|
||||
output wire [`PERF_CTR_BITS-1:0] bank_stalls,
|
||||
`endif
|
||||
|
||||
input wire [NUM_REQS-1:0] core_req_valid,
|
||||
@@ -43,6 +45,7 @@ module VX_cache_core_req_bank_sel #(
|
||||
output wire [NUM_BANKS-1:0][CORE_TAG_WIDTH-1:0] per_bank_core_req_tag,
|
||||
input wire [`BANK_READY_COUNT-1:0] per_bank_core_req_ready
|
||||
);
|
||||
`UNUSED_PARAM (CACHE_ID)
|
||||
`STATIC_ASSERT (NUM_REQS >= NUM_BANKS, ("invalid number of banks"));
|
||||
|
||||
`UNUSED_VAR (clk)
|
||||
@@ -148,7 +151,7 @@ module VX_cache_core_req_bank_sel #(
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end else begin
|
||||
|
||||
always @(*) begin
|
||||
@@ -303,13 +306,13 @@ module VX_cache_core_req_bank_sel #(
|
||||
end
|
||||
end
|
||||
|
||||
reg [43:0] bank_stalls_r;
|
||||
reg [`PERF_CTR_BITS-1:0] bank_stalls_r;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
bank_stalls_r <= 0;
|
||||
end else begin
|
||||
bank_stalls_r <= bank_stalls_r + 44'($countones(core_req_sel_r & ~core_req_ready));
|
||||
bank_stalls_r <= bank_stalls_r + `PERF_CTR_BITS'($countones(core_req_sel_r & ~core_req_ready));
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
8
hw/rtl/cache/VX_cache_core_rsp_merge.v
vendored
8
hw/rtl/cache/VX_cache_core_rsp_merge.v
vendored
@@ -1,6 +1,8 @@
|
||||
`include "VX_cache_define.vh"
|
||||
|
||||
module VX_cache_core_rsp_merge #(
|
||||
parameter CACHE_ID = 0,
|
||||
|
||||
// Number of Word requests per cycle
|
||||
parameter NUM_REQS = 1,
|
||||
// Number of banks
|
||||
@@ -31,6 +33,8 @@ module VX_cache_core_rsp_merge #(
|
||||
output wire [NUM_REQS-1:0][`WORD_WIDTH-1:0] core_rsp_data,
|
||||
input wire [`CORE_REQ_TAG_COUNT-1:0] core_rsp_ready
|
||||
);
|
||||
`UNUSED_PARAM (CACHE_ID)
|
||||
|
||||
if (NUM_BANKS > 1) begin
|
||||
|
||||
reg [NUM_REQS-1:0] core_rsp_valid_unqual;
|
||||
@@ -39,6 +43,10 @@ module VX_cache_core_rsp_merge #(
|
||||
|
||||
if (CORE_TAG_ID_BITS != 0) begin
|
||||
|
||||
// The core response bus handles a single tag at the time
|
||||
// We first need to select the current tag to process,
|
||||
// then send all bank responses for that tag as a batch
|
||||
|
||||
reg [CORE_TAG_WIDTH-1:0] core_rsp_tag_unqual;
|
||||
wire core_rsp_ready_unqual;
|
||||
|
||||
|
||||
10
hw/rtl/cache/VX_cache_define.vh
vendored
10
hw/rtl/cache/VX_cache_define.vh
vendored
@@ -21,8 +21,8 @@
|
||||
`define WORDS_PER_LINE (CACHE_LINE_SIZE / WORD_SIZE)
|
||||
|
||||
`define WORD_ADDR_WIDTH (32-`CLOG2(WORD_SIZE))
|
||||
`define DRAM_ADDR_WIDTH (32-`CLOG2(CACHE_LINE_SIZE))
|
||||
`define LINE_ADDR_WIDTH (`DRAM_ADDR_WIDTH-`BANK_SELECT_BITS)
|
||||
`define MEM_ADDR_WIDTH (32-`CLOG2(CACHE_LINE_SIZE))
|
||||
`define LINE_ADDR_WIDTH (`MEM_ADDR_WIDTH-`BANK_SELECT_BITS)
|
||||
|
||||
// Word select
|
||||
`define WORD_SELECT_BITS `CLOG2(`WORDS_PER_LINE)
|
||||
@@ -59,11 +59,11 @@
|
||||
|
||||
`define BANK_READY_COUNT ((SHARED_BANK_READY != 0) ? 1 : NUM_BANKS)
|
||||
|
||||
`define DRAM_ADDR_BANK(x) x[`BANK_SELECT_BITS+BANK_ADDR_OFFSET-1 : BANK_ADDR_OFFSET]
|
||||
`define MEM_ADDR_BANK(x) x[`BANK_SELECT_BITS+BANK_ADDR_OFFSET-1 : BANK_ADDR_OFFSET]
|
||||
|
||||
`define DRAM_TO_LINE_ADDR(x) x[`DRAM_ADDR_WIDTH-1 : `BANK_SELECT_BITS]
|
||||
`define MEM_TO_LINE_ADDR(x) x[`MEM_ADDR_WIDTH-1 : `BANK_SELECT_BITS]
|
||||
|
||||
`define LINE_TO_DRAM_ADDR(x, i) {x, `BANK_SELECT_BITS'(i)}
|
||||
`define LINE_TO_MEM_ADDR(x, i) {x, `BANK_SELECT_BITS'(i)}
|
||||
|
||||
`define LINE_TO_BYTE_ADDR(x, i) {x, (32-$bits(x))'(i << (32-$bits(x)-`BANK_SELECT_BITS))}
|
||||
|
||||
|
||||
202
hw/rtl/cache/VX_shared_mem.v
vendored
202
hw/rtl/cache/VX_shared_mem.v
vendored
@@ -4,25 +4,25 @@ module VX_shared_mem #(
|
||||
parameter CACHE_ID = 0,
|
||||
|
||||
// Size of cache in bytes
|
||||
parameter CACHE_SIZE = 16384,
|
||||
parameter CACHE_SIZE = (1024*16),
|
||||
// Number of banks
|
||||
parameter NUM_BANKS = 4,
|
||||
parameter NUM_BANKS = 2,
|
||||
// Size of a word in bytes
|
||||
parameter WORD_SIZE = 4,
|
||||
// Number of Word requests per cycle
|
||||
parameter NUM_REQS = NUM_BANKS,
|
||||
parameter NUM_REQS = 4,
|
||||
|
||||
// Core Request Queue Size
|
||||
parameter CREQ_SIZE = 4,
|
||||
|
||||
// core request tag size
|
||||
parameter CORE_TAG_WIDTH = 1,
|
||||
parameter CREQ_SIZE = 8,
|
||||
|
||||
// size of tag id in core request tag
|
||||
parameter CORE_TAG_ID_BITS = 0,
|
||||
parameter CORE_TAG_ID_BITS = 8,
|
||||
|
||||
// core request tag size
|
||||
parameter CORE_TAG_WIDTH = (2 + CORE_TAG_ID_BITS),
|
||||
|
||||
// bank offset from beginning of index range
|
||||
parameter BANK_ADDR_OFFSET = 0
|
||||
parameter BANK_ADDR_OFFSET = `CLOG2(256)
|
||||
) (
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
@@ -54,13 +54,6 @@ module VX_shared_mem #(
|
||||
|
||||
localparam CACHE_LINE_SIZE = WORD_SIZE;
|
||||
|
||||
`ifdef DBG_CACHE_REQ_INFO
|
||||
/* verilator lint_off UNUSED */
|
||||
wire [31:0] debug_pc_st0;
|
||||
wire [`NW_BITS-1:0] debug_wid_st0;
|
||||
/* verilator lint_on UNUSED */
|
||||
`endif
|
||||
|
||||
wire [NUM_BANKS-1:0] per_bank_core_req_valid_unqual;
|
||||
wire [NUM_BANKS-1:0] per_bank_core_req_rw_unqual;
|
||||
wire [NUM_BANKS-1:0][`LINE_ADDR_WIDTH-1:0] per_bank_core_req_addr_unqual;
|
||||
@@ -71,6 +64,7 @@ module VX_shared_mem #(
|
||||
wire per_bank_core_req_ready_unqual;
|
||||
|
||||
VX_cache_core_req_bank_sel #(
|
||||
.CACHE_ID (CACHE_ID),
|
||||
.CACHE_LINE_SIZE (WORD_SIZE),
|
||||
.NUM_BANKS (NUM_BANKS),
|
||||
.NUM_PORTS (1),
|
||||
@@ -108,20 +102,26 @@ module VX_shared_mem #(
|
||||
wire [NUM_BANKS-1:0][`LINE_SELECT_BITS-1:0] per_bank_core_req_addr;
|
||||
wire [NUM_BANKS-1:0][WORD_SIZE-1:0] per_bank_core_req_byteen;
|
||||
wire [NUM_BANKS-1:0][`WORD_WIDTH-1:0] per_bank_core_req_data;
|
||||
wire [NUM_REQS-1:0][CORE_TAG_WIDTH-1:0] per_bank_core_req_tag;
|
||||
wire [NUM_BANKS-1:0][CORE_TAG_WIDTH-1:0] per_bank_core_req_tag;
|
||||
wire [NUM_BANKS-1:0][`REQS_BITS-1:0] per_bank_core_req_tid;
|
||||
|
||||
wire creq_push, creq_pop, creq_empty, creq_full;
|
||||
wire crsq_in_ready;
|
||||
wire crsq_in_fire_last;
|
||||
|
||||
wire [NUM_BANKS-1:0] per_bank_rsp_valid = per_bank_core_req_valid & ~per_bank_core_req_rw;
|
||||
|
||||
wire core_req_has_read = (| per_bank_rsp_valid);
|
||||
|
||||
assign creq_push = (| core_req_valid) && !creq_full;
|
||||
assign creq_pop = ~creq_empty && crsq_in_ready;
|
||||
assign creq_push = (| core_req_valid) && ~creq_full;
|
||||
|
||||
assign creq_pop = (~creq_empty && ~core_req_has_read)
|
||||
|| crsq_in_fire_last;
|
||||
|
||||
assign per_bank_core_req_ready_unqual = ~creq_full;
|
||||
|
||||
wire [NUM_REQS-1:0][`LINE_SELECT_BITS-1:0] per_bank_core_req_addr_qual;
|
||||
wire [NUM_BANKS-1:0][`LINE_SELECT_BITS-1:0] per_bank_core_req_addr_qual;
|
||||
`UNUSED_VAR (per_bank_core_req_addr_unqual)
|
||||
for (genvar i = 0; i < NUM_REQS; i++) begin
|
||||
for (genvar i = 0; i < NUM_BANKS; i++) begin
|
||||
assign per_bank_core_req_addr_qual[i] = per_bank_core_req_addr_unqual[i][`LINE_SELECT_BITS-1:0];
|
||||
end
|
||||
|
||||
@@ -155,9 +155,14 @@ module VX_shared_mem #(
|
||||
`UNUSED_PIN (size)
|
||||
);
|
||||
|
||||
wire [NUM_BANKS-1:0][`WORD_WIDTH-1:0] per_bank_core_rsp_data;
|
||||
wire [NUM_BANKS-1:0][`WORD_WIDTH-1:0] per_bank_core_rsp_data;
|
||||
|
||||
for (genvar i = 0; i < NUM_BANKS; i++) begin
|
||||
|
||||
wire wren = per_bank_core_req_rw[i]
|
||||
&& per_bank_core_req_valid[i]
|
||||
&& creq_pop;
|
||||
|
||||
VX_sp_ram #(
|
||||
.DATAW (`WORD_WIDTH),
|
||||
.SIZE (`LINES_PER_BANK),
|
||||
@@ -166,13 +171,41 @@ module VX_shared_mem #(
|
||||
) data (
|
||||
.clk (clk),
|
||||
.addr (per_bank_core_req_addr[i]),
|
||||
.wren (per_bank_core_req_valid[i] && per_bank_core_req_rw[i]),
|
||||
.wren (wren),
|
||||
.byteen (per_bank_core_req_byteen[i]),
|
||||
.rden (1'b1),
|
||||
.din (per_bank_core_req_data[i]),
|
||||
.dout (per_bank_core_rsp_data[i])
|
||||
);
|
||||
end
|
||||
|
||||
// The core response bus handles a single tag at the time
|
||||
// We first need to select the current tag to process,
|
||||
// then send all bank responses for that tag as a batch
|
||||
|
||||
wire crsq_in_valid, crsq_in_ready;
|
||||
|
||||
reg [NUM_BANKS-1:0] bank_rsp_sel, bank_rsp_sel_r;
|
||||
|
||||
wire [NUM_BANKS-1:0] bank_rsp_sel_n = bank_rsp_sel | bank_rsp_sel_r;
|
||||
|
||||
wire crsq_in_fire = crsq_in_valid && crsq_in_ready;
|
||||
|
||||
assign crsq_in_fire_last = crsq_in_fire && (bank_rsp_sel_n == per_bank_rsp_valid);
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
bank_rsp_sel <= 0;
|
||||
end else begin
|
||||
if (crsq_in_fire) begin
|
||||
if (bank_rsp_sel_n == per_bank_rsp_valid) begin
|
||||
bank_rsp_sel <= 0;
|
||||
end else begin
|
||||
bank_rsp_sel <= bank_rsp_sel_n;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
reg [NUM_REQS-1:0] core_rsp_valids_in;
|
||||
reg [NUM_REQS-1:0][`WORD_WIDTH-1:0] core_rsp_data_in;
|
||||
@@ -180,31 +213,30 @@ module VX_shared_mem #(
|
||||
|
||||
always @(*) begin
|
||||
core_rsp_valids_in = 0;
|
||||
core_rsp_data_in = 'x;
|
||||
core_rsp_data_in = 'x;
|
||||
core_rsp_tag_in = 'x;
|
||||
for (integer i = 0; i < NUM_BANKS; i++) begin
|
||||
if (per_bank_core_req_valid[i]) begin
|
||||
core_rsp_valids_in[per_bank_core_req_tid[i]] = 1;
|
||||
core_rsp_data_in[per_bank_core_req_tid[i]] = per_bank_core_rsp_data[i];
|
||||
bank_rsp_sel_r = 0;
|
||||
|
||||
for (integer i = NUM_BANKS-1; i >= 0; --i) begin
|
||||
if (per_bank_rsp_valid[i] && ~bank_rsp_sel[i]) begin
|
||||
core_rsp_tag_in = per_bank_core_req_tag[i];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
`ifdef DBG_CACHE_REQ_INFO
|
||||
if (CORE_TAG_WIDTH != CORE_TAG_ID_BITS && CORE_TAG_ID_BITS != 0) begin
|
||||
assign {debug_pc_st0, debug_wid_st0} = core_rsp_tag_in[`CACHE_REQ_INFO_RNG];
|
||||
end else begin
|
||||
assign {debug_pc_st0, debug_wid_st0} = 0;
|
||||
|
||||
for (integer i = 0; i < NUM_BANKS; i++) begin
|
||||
if (per_bank_core_req_valid[i]
|
||||
&& (core_rsp_tag_in[CORE_TAG_ID_BITS-1:0] == per_bank_core_req_tag[i][CORE_TAG_ID_BITS-1:0])) begin
|
||||
core_rsp_valids_in[per_bank_core_req_tid[i]] = 1;
|
||||
core_rsp_data_in[per_bank_core_req_tid[i]] = per_bank_core_rsp_data[i];
|
||||
bank_rsp_sel_r[i] = 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
|
||||
wire [NUM_REQS-1:0] core_rsp_valids_out;
|
||||
wire core_rsp_valid_out;
|
||||
|
||||
wire core_rsp_rw = | (per_bank_core_req_valid & per_bank_core_req_rw);
|
||||
|
||||
wire crsq_in_valid = ~creq_empty && ~core_rsp_rw;
|
||||
assign crsq_in_valid = ~creq_empty && core_req_has_read;
|
||||
|
||||
VX_skid_buffer #(
|
||||
.DATAW (NUM_BANKS * (1 + `WORD_WIDTH) + CORE_TAG_WIDTH)
|
||||
@@ -221,16 +253,82 @@ module VX_shared_mem #(
|
||||
|
||||
assign core_rsp_valid = core_rsp_valids_out & {NUM_REQS{core_rsp_valid_out}};
|
||||
|
||||
`ifdef DBG_CACHE_REQ_INFO
|
||||
`IGNORE_WARNINGS_BEGIN
|
||||
wire [NUM_BANKS-1:0][31:0] debug_pc_st0, debug_pc_st1;
|
||||
wire [NUM_BANKS-1:0][`NW_BITS-1:0] debug_wid_st0, debug_wid_st1;
|
||||
`IGNORE_WARNINGS_END
|
||||
|
||||
for (genvar i = 0; i < NUM_BANKS; ++i) begin
|
||||
if (CORE_TAG_WIDTH != CORE_TAG_ID_BITS && CORE_TAG_ID_BITS != 0) begin
|
||||
assign {debug_pc_st0[i], debug_wid_st0[i]} = per_bank_core_req_tag_unqual[i][CORE_TAG_WIDTH-1:CORE_TAG_ID_BITS];
|
||||
assign {debug_pc_st1[i], debug_wid_st1[i]} = per_bank_core_req_tag[i][CORE_TAG_WIDTH-1:CORE_TAG_ID_BITS];
|
||||
end else begin
|
||||
assign {debug_pc_st0[i], debug_wid_st0[i]} = 0;
|
||||
assign {debug_pc_st1[i], debug_wid_st1[i]} = 0;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
`ifdef DBG_PRINT_CACHE_BANK
|
||||
|
||||
reg is_multi_tag_req;
|
||||
`IGNORE_WARNINGS_BEGIN
|
||||
reg [CORE_TAG_WIDTH-1:0] core_req_tag_sel;
|
||||
`IGNORE_WARNINGS_END
|
||||
|
||||
always @(*) begin
|
||||
core_req_tag_sel ='x;
|
||||
for (integer i = NUM_BANKS-1; i >= 0; --i) begin
|
||||
if (per_bank_core_req_valid[i]) begin
|
||||
core_req_tag_sel = per_bank_core_req_tag[i];
|
||||
end
|
||||
end
|
||||
is_multi_tag_req = 0;
|
||||
for (integer i = 0; i < NUM_BANKS; ++i) begin
|
||||
if (per_bank_core_req_valid[i]
|
||||
&& (core_req_tag_sel[CORE_TAG_ID_BITS-1:0] != per_bank_core_req_tag[i][CORE_TAG_ID_BITS-1:0])) begin
|
||||
is_multi_tag_req = !creq_empty;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (!crsq_in_ready) begin
|
||||
$display("%t: cache%0d pipeline-stall", $time, CACHE_ID);
|
||||
$display("%t: *** cache%0d pipeline-stall", $time, CACHE_ID);
|
||||
end
|
||||
if (is_multi_tag_req) begin
|
||||
$display("%t: *** cache%0d multi-tag request!", $time, CACHE_ID);
|
||||
end
|
||||
if (creq_push) begin
|
||||
for (integer i = 0; i < NUM_BANKS; ++i) begin
|
||||
if (per_bank_core_req_valid_unqual[i]) begin
|
||||
if (per_bank_core_req_rw_unqual[i]) begin
|
||||
$display("%t: cache%0d:%0d core-wr-req: addr=%0h, tag=%0h, byteen=%b, data=%0h, wid=%0d, PC=%0h",
|
||||
$time, CACHE_ID, i, per_bank_core_req_addr_unqual[i], per_bank_core_req_tag_unqual[i], per_bank_core_req_byteen_unqual[i], per_bank_core_req_data_unqual[i],
|
||||
debug_wid_st0[i], debug_pc_st0[i]);
|
||||
end else begin
|
||||
$display("%t: cache%0d:%0d core-rd-req: addr=%0h, tag=%0h, byteen=%b, wid=%0d, PC=%0h",
|
||||
$time, CACHE_ID, i, per_bank_core_req_addr_unqual[i], per_bank_core_req_tag_unqual[i], per_bank_core_req_byteen_unqual[i],
|
||||
debug_wid_st0[i], debug_pc_st0[i]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if (creq_pop) begin
|
||||
if (core_rsp_rw)
|
||||
$display("%t: cache%0d core-wr-req: tmask=%0b, addr=%0h, tag=%0h, byteen=%b, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, per_bank_core_req_valid, per_bank_core_req_addr, per_bank_core_req_tag, per_bank_core_req_byteen, per_bank_core_req_data, debug_wid_st0, debug_pc_st0);
|
||||
else
|
||||
$display("%t: cache%0d core-rd-req: tmask=%0b, addr=%0h, tag=%0h, byteen=%b, data=%0h, wid=%0d, PC=%0h", $time, CACHE_ID, per_bank_core_req_valid, per_bank_core_req_addr, per_bank_core_req_tag, per_bank_core_req_byteen, per_bank_core_rsp_data, debug_wid_st0, debug_pc_st0);
|
||||
for (integer i = 0; i < NUM_BANKS; ++i) begin
|
||||
if (per_bank_core_req_valid[i]) begin
|
||||
if (per_bank_core_req_rw[i]) begin
|
||||
$display("%t: cache%0d:%0d core-wr-rsp: addr=%0h, tag=%0h, byteen=%b, data=%0h, wid=%0d, PC=%0h",
|
||||
$time, CACHE_ID, i, per_bank_core_req_addr[i], per_bank_core_req_tag[i], per_bank_core_req_byteen[i], per_bank_core_req_data[i],
|
||||
debug_wid_st1[i], debug_pc_st1[i]);
|
||||
end else begin
|
||||
$display("%t: cache%0d:%0d core-rd-rsp: addr=%0h, tag=%0h, byteen=%b, wid=%0d, PC=%0h",
|
||||
$time, CACHE_ID, i, per_bank_core_req_addr[i], per_bank_core_req_tag[i], per_bank_core_req_byteen[i],
|
||||
debug_wid_st1[i], debug_pc_st1[i]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
`endif
|
||||
@@ -249,9 +347,9 @@ module VX_shared_mem #(
|
||||
assign perf_crsp_stall_per_cycle = $countones(core_rsp_valid & ~core_rsp_ready);
|
||||
end
|
||||
|
||||
reg [43:0] perf_core_reads;
|
||||
reg [43:0] perf_core_writes;
|
||||
reg [43:0] perf_crsp_stalls;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_core_reads;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_core_writes;
|
||||
reg [`PERF_CTR_BITS-1:0] perf_crsp_stalls;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
@@ -259,9 +357,9 @@ module VX_shared_mem #(
|
||||
perf_core_writes <= 0;
|
||||
perf_crsp_stalls <= 0;
|
||||
end else begin
|
||||
perf_core_reads <= perf_core_reads + 44'(perf_core_reads_per_cycle);
|
||||
perf_core_writes <= perf_core_writes + 44'(perf_core_writes_per_cycle);
|
||||
perf_crsp_stalls <= perf_crsp_stalls + 44'(perf_crsp_stall_per_cycle);
|
||||
perf_core_reads <= perf_core_reads + `PERF_CTR_BITS'(perf_core_reads_per_cycle);
|
||||
perf_core_writes <= perf_core_writes + `PERF_CTR_BITS'(perf_core_writes_per_cycle);
|
||||
perf_crsp_stalls <= perf_crsp_stalls + `PERF_CTR_BITS'(perf_crsp_stall_per_cycle);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user