RTL code refactoring
This commit is contained in:
@@ -48,7 +48,7 @@ module VX_bank #(
|
||||
input wire reset,
|
||||
|
||||
// Input Core Request
|
||||
input wire delay_req,
|
||||
input wire req_ready,
|
||||
input wire [NUM_REQUESTS-1:0] bank_valids,
|
||||
input wire [NUM_REQUESTS-1:0][31:0] bank_addr,
|
||||
input wire [NUM_REQUESTS-1:0][`WORD_SIZE_RNG] bank_writedata,
|
||||
@@ -168,7 +168,7 @@ module VX_bank #(
|
||||
wire [2:0] reqq_req_mem_write_st0;
|
||||
wire [31:0] reqq_req_pc_st0;
|
||||
|
||||
assign reqq_push = !delay_req && (|bank_valids);
|
||||
assign reqq_push = req_ready && (|bank_valids);
|
||||
|
||||
VX_cache_req_queue #(
|
||||
.CACHE_SIZE_BYTES (CACHE_SIZE_BYTES),
|
||||
|
||||
@@ -52,44 +52,46 @@ module VX_cache #(
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
|
||||
// Req Info
|
||||
// Core request
|
||||
input wire [NUM_REQUESTS-1:0] core_req_valid,
|
||||
input wire [NUM_REQUESTS-1:0][31:0] core_req_addr,
|
||||
input wire [NUM_REQUESTS-1:0][`WORD_SIZE_RNG] core_req_writedata,
|
||||
input wire [NUM_REQUESTS-1:0][2:0] core_req_mem_read,
|
||||
input wire [NUM_REQUESTS-1:0][2:0] core_req_mem_write,
|
||||
input wire [NUM_REQUESTS-1:0][31:0] core_req_addr,
|
||||
input wire [NUM_REQUESTS-1:0][`WORD_SIZE_RNG] core_req_writedata,
|
||||
output wire core_req_ready,
|
||||
|
||||
// Req meta
|
||||
// Core request meta data
|
||||
input wire [4:0] core_req_rd,
|
||||
input wire [NUM_REQUESTS-1:0][1:0] core_req_wb,
|
||||
input wire [`NW_BITS-1:0] core_req_warp_num,
|
||||
input wire [31:0] core_req_pc,
|
||||
output wire delay_req,
|
||||
|
||||
|
||||
// Core Writeback
|
||||
input wire core_no_wb_slot,
|
||||
// Core response
|
||||
output wire [NUM_REQUESTS-1:0] core_wb_valid,
|
||||
output wire [4:0] core_wb_req_rd,
|
||||
output wire [1:0] core_wb_req_wb,
|
||||
output wire [`NW_BITS-1:0] core_wb_warp_num,
|
||||
output wire [NUM_REQUESTS-1:0][`WORD_SIZE_RNG] core_wb_readdata,
|
||||
output wire [NUM_REQUESTS-1:0][31:0] core_wb_pc,
|
||||
output wire [NUM_REQUESTS-1:0][31:0] core_wb_address,
|
||||
output wire [NUM_REQUESTS-1:0][`WORD_SIZE_RNG] core_wb_readdata,
|
||||
input wire core_no_wb_slot,
|
||||
|
||||
// Dram Fill Response
|
||||
// Core response meta data
|
||||
output wire [`NW_BITS-1:0] core_wb_warp_num,
|
||||
output wire [NUM_REQUESTS-1:0][31:0] core_wb_pc,
|
||||
|
||||
// DRAM request
|
||||
output wire dram_req_read,
|
||||
output wire dram_req_write,
|
||||
output wire [31:0] dram_req_addr,
|
||||
output wire [`IBANK_LINE_WORDS-1:0][31:0] dram_req_data,
|
||||
input wire dram_req_ready,
|
||||
|
||||
// DRAM response
|
||||
input wire dram_rsp_valid,
|
||||
input wire [31:0] dram_rsp_addr,
|
||||
input wire [`IBANK_LINE_WORDS-1:0][31:0] dram_rsp_data,
|
||||
output wire dram_rsp_ready,
|
||||
|
||||
// Dram request
|
||||
output wire dram_req_read,
|
||||
output wire dram_req_write,
|
||||
output wire [31:0] dram_req_addr,
|
||||
output wire [`IBANK_LINE_WORDS-1:0][31:0] dram_req_data,
|
||||
input wire dram_req_full,
|
||||
|
||||
|
||||
// Snoop Req
|
||||
input wire snp_req_valid,
|
||||
input wire [31:0] snp_req_addr,
|
||||
@@ -132,7 +134,7 @@ module VX_cache #(
|
||||
wire [NUM_BANKS-1:0][31:0] per_bank_snp_fwd_addr;
|
||||
wire [NUM_BANKS-1:0] per_bank_snp_fwd_pop;
|
||||
|
||||
assign delay_req = (|per_bank_reqq_full);
|
||||
assign core_req_ready = ~(|per_bank_reqq_full);
|
||||
assign snp_req_full = (|per_bank_snrq_full);
|
||||
|
||||
// assign dram_rsp_ready = (NUM_BANKS == 1) ? per_bank_dram_rsp_ready[0] : per_bank_dram_rsp_ready[dram_rsp_addr[`BANK_SELECT_ADDR_RNG]];
|
||||
@@ -171,7 +173,7 @@ module VX_cache #(
|
||||
.dram_req_write (dram_req_write),
|
||||
.dram_req_addr (dram_req_addr),
|
||||
.dram_req_data (dram_req_data),
|
||||
.dram_req_full (dram_req_full)
|
||||
.dram_req_ready (dram_req_ready)
|
||||
);
|
||||
|
||||
VX_cache_core_req_bank_sel #(
|
||||
@@ -372,7 +374,7 @@ module VX_cache #(
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
// Core req
|
||||
.delay_req (delay_req),
|
||||
.req_ready (core_req_ready),
|
||||
.bank_valids (curr_bank_valids),
|
||||
.bank_addr (curr_bank_addr),
|
||||
.bank_writedata (curr_bank_writedata),
|
||||
|
||||
@@ -50,14 +50,14 @@ module VX_cache_dram_req_arb #(
|
||||
|
||||
// Fill Request
|
||||
output wire dfqq_full,
|
||||
input wire[NUM_BANKS-1:0] per_bank_dram_fill_req_valid,
|
||||
input wire[NUM_BANKS-1:0][31:0] per_bank_dram_fill_req_addr,
|
||||
input wire [NUM_BANKS-1:0] per_bank_dram_fill_req_valid,
|
||||
input wire [NUM_BANKS-1:0][31:0] per_bank_dram_fill_req_addr,
|
||||
|
||||
// DFQ Request
|
||||
output wire[NUM_BANKS-1:0] per_bank_dram_wb_queue_pop,
|
||||
input wire[NUM_BANKS-1:0] per_bank_dram_wb_req_valid,
|
||||
input wire[NUM_BANKS-1:0][31:0] per_bank_dram_wb_req_addr,
|
||||
input wire[NUM_BANKS-1:0][`BANK_LINE_WORDS-1:0][`WORD_SIZE-1:0] per_bank_dram_wb_req_data,
|
||||
output wire [NUM_BANKS-1:0] per_bank_dram_wb_queue_pop,
|
||||
input wire [NUM_BANKS-1:0] per_bank_dram_wb_req_valid,
|
||||
input wire [NUM_BANKS-1:0][31:0] per_bank_dram_wb_req_addr,
|
||||
input wire [NUM_BANKS-1:0][`BANK_LINE_WORDS-1:0][`WORD_SIZE-1:0] per_bank_dram_wb_req_data,
|
||||
|
||||
// real Dram request
|
||||
output wire dram_req_read,
|
||||
@@ -65,7 +65,7 @@ module VX_cache_dram_req_arb #(
|
||||
output wire [31:0] dram_req_addr,
|
||||
output wire [`IBANK_LINE_WORDS-1:0][31:0] dram_req_data,
|
||||
|
||||
input wire dram_req_full
|
||||
input wire dram_req_ready
|
||||
);
|
||||
|
||||
wire pref_pop;
|
||||
@@ -75,7 +75,8 @@ module VX_cache_dram_req_arb #(
|
||||
wire dwb_valid;
|
||||
wire dfqq_req;
|
||||
|
||||
assign pref_pop = !dwb_valid && !dfqq_req && !dram_req_full && pref_valid;
|
||||
assign pref_pop = !dwb_valid && !dfqq_req && dram_req_ready && pref_valid;
|
||||
|
||||
VX_prefetcher #(
|
||||
.PRFQ_SIZE (PRFQ_SIZE),
|
||||
.PRFQ_STRIDE (PRFQ_STRIDE),
|
||||
@@ -99,7 +100,7 @@ module VX_cache_dram_req_arb #(
|
||||
wire dfqq_empty;
|
||||
`DEBUG_END
|
||||
|
||||
wire dfqq_pop = !dwb_valid && dfqq_req && !dram_req_full; // If no dwb, and dfqq has valids, then pop
|
||||
wire dfqq_pop = !dwb_valid && dfqq_req && dram_req_ready; // If no dwb, and dfqq has valids, then pop
|
||||
wire dfqq_push = (|per_bank_dram_fill_req_valid);
|
||||
|
||||
VX_cache_dfq_queue cache_dfq_queue(
|
||||
@@ -115,9 +116,9 @@ module VX_cache_dram_req_arb #(
|
||||
.dfqq_full (dfqq_full)
|
||||
);
|
||||
|
||||
wire[`LOG2UP(NUM_BANKS)-1:0] dwb_bank;
|
||||
wire [`LOG2UP(NUM_BANKS)-1:0] dwb_bank;
|
||||
|
||||
wire[NUM_BANKS-1:0] use_wb_valid = per_bank_dram_wb_req_valid;
|
||||
wire [NUM_BANKS-1:0] use_wb_valid = per_bank_dram_wb_req_valid;
|
||||
|
||||
VX_generic_priority_encoder #(
|
||||
.N(NUM_BANKS)
|
||||
@@ -127,7 +128,7 @@ module VX_cache_dram_req_arb #(
|
||||
.found (dwb_valid)
|
||||
);
|
||||
|
||||
assign per_bank_dram_wb_queue_pop = dram_req_full ? 0 : use_wb_valid & ((1 << dwb_bank));
|
||||
assign per_bank_dram_wb_queue_pop = dram_req_ready ? (use_wb_valid & ((1 << dwb_bank))) : 0;
|
||||
|
||||
wire dram_req = dwb_valid || dfqq_req || pref_pop;
|
||||
assign dram_req_read = ((dfqq_req && !dwb_valid) || pref_pop) && dram_req;
|
||||
|
||||
Reference in New Issue
Block a user