opae rtl fixes
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
|
||||
// Size of cache in bytes
|
||||
`ifndef DCACHE_SIZE
|
||||
`define DCACHE_SIZE 2048
|
||||
`define DCACHE_SIZE 4096
|
||||
`endif
|
||||
|
||||
// Size of line inside a bank in bytes
|
||||
|
||||
@@ -136,8 +136,7 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
`ifndef NDEBUG
|
||||
// pc, wb, rd, warp_num
|
||||
`ifndef NDEBUG // pc, wb, rd, warp_num
|
||||
`define DEBUG_CORE_REQ_MDATA_WIDTH (32 + 2 + 5 + `NW_BITS)
|
||||
`else
|
||||
`define DEBUG_CORE_REQ_MDATA_WIDTH 0
|
||||
@@ -227,10 +226,10 @@
|
||||
`define L2CACHE_ID (`L3_ENABLE ? 1 : 0)
|
||||
|
||||
// DRAM request data bits
|
||||
`define L2DRAM_LINE_WIDTH (`L2BANK_LINE_SIZE * 8)
|
||||
`define L2DRAM_LINE_WIDTH (`L2_ENABLE ? (`L2BANK_LINE_SIZE * 8) : `DDRAM_LINE_WIDTH)
|
||||
|
||||
// DRAM request address bits
|
||||
`define L2DRAM_ADDR_WIDTH (32 - `CLOG2(`L2BANK_LINE_SIZE))
|
||||
`define L2DRAM_ADDR_WIDTH (`L2_ENABLE ? (32 - `CLOG2(`L2BANK_LINE_SIZE)) : `DDRAM_ADDR_WIDTH)
|
||||
|
||||
// DRAM byte enable bits
|
||||
`define L2DRAM_BYTEEN_WIDTH (`L2_ENABLE ? `L2BANK_LINE_SIZE : `DDRAM_BYTEEN_WIDTH)
|
||||
@@ -242,7 +241,7 @@
|
||||
`define L2SNP_TAG_WIDTH (`L3_ENABLE ? `LOG2UP(`L3SNRQ_SIZE) : `L3SNP_TAG_WIDTH)
|
||||
|
||||
// Number of Word requests per cycle {1, 2, 4, 8, ...}
|
||||
`define L2NUM_REQUESTS (2*`NUM_CORES)
|
||||
`define L2NUM_REQUESTS (2 * `NUM_CORES)
|
||||
|
||||
////////////////////////// L3cache Configurable Knobs /////////////////////////
|
||||
|
||||
@@ -250,10 +249,10 @@
|
||||
`define L3CACHE_ID 0
|
||||
|
||||
// DRAM request data bits
|
||||
`define L3DRAM_LINE_WIDTH (`L3BANK_LINE_SIZE * 8)
|
||||
`define L3DRAM_LINE_WIDTH (`L3_ENABLE ? (`L3BANK_LINE_SIZE * 8) : `L2DRAM_LINE_WIDTH)
|
||||
|
||||
// DRAM request address bits
|
||||
`define L3DRAM_ADDR_WIDTH (32 - `CLOG2(`L3BANK_LINE_SIZE))
|
||||
`define L3DRAM_ADDR_WIDTH (`L3_ENABLE ? (32 - `CLOG2(`L3BANK_LINE_SIZE)) : `L2DRAM_ADDR_WIDTH)
|
||||
|
||||
// DRAM byte enable bits
|
||||
`define L3DRAM_BYTEEN_WIDTH (`L3_ENABLE ? `L3BANK_LINE_SIZE : `L2DRAM_BYTEEN_WIDTH)
|
||||
@@ -267,5 +266,16 @@
|
||||
// Number of Word requests per cycle {1, 2, 4, 8, ...}
|
||||
`define L3NUM_REQUESTS `NUM_CLUSTERS
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
`define VX_DRAM_BYTEEN_WIDTH `L3DRAM_BYTEEN_WIDTH
|
||||
`define VX_DRAM_ADDR_WIDTH `L3DRAM_ADDR_WIDTH
|
||||
`define VX_DRAM_LINE_WIDTH `L3DRAM_LINE_WIDTH
|
||||
`define VX_DRAM_TAG_WIDTH `L3DRAM_TAG_WIDTH
|
||||
`define VX_SNP_TAG_WIDTH `L3SNP_TAG_WIDTH
|
||||
`define VX_CORE_TAG_WIDTH `DCORE_TAG_WIDTH
|
||||
|
||||
`define DRAM_TO_BYTE_ADDR(x) {x, (32-$bits(x))'(0)}
|
||||
|
||||
// VX_DEFINE
|
||||
`endif
|
||||
|
||||
@@ -39,7 +39,7 @@ module VX_dmem_ctrl # (
|
||||
) dcache_core_rsp_qual_if(), smem_core_rsp_if();
|
||||
|
||||
// use "case equality" to handle uninitialized entry
|
||||
wire smem_select = ((dcache_core_req_if.core_req_addr[0] >= `BYTE_TO_WORD_ADDR(`SHARED_MEM_BASE_ADDR, `DWORD_SIZE)) === 1'b1);
|
||||
wire smem_select = (({dcache_core_req_if.core_req_addr[0], 2'b0} >= `SHARED_MEM_BASE_ADDR) === 1'b1);
|
||||
|
||||
VX_dcache_io_arb dcache_io_arb (
|
||||
.io_select (smem_select),
|
||||
|
||||
@@ -64,7 +64,7 @@ module VX_icache_stage #(
|
||||
// Icache Request
|
||||
assign icache_req_if.core_req_valid = valid_inst && ~mrq_full;
|
||||
assign icache_req_if.core_req_rw = 0;
|
||||
assign icache_req_if.core_req_byteen = 0;
|
||||
assign icache_req_if.core_req_byteen = 4'b1111;
|
||||
assign icache_req_if.core_req_addr = fe_inst_meta_fi.inst_pc[31:2];
|
||||
assign icache_req_if.core_req_data = 0;
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ module VX_lsu_unit #(
|
||||
wire[1:0] use_wb;
|
||||
wire[31:0] use_pc;
|
||||
|
||||
genvar i;
|
||||
|
||||
VX_generic_register #(
|
||||
.N(45 + `NW_BITS-1 + 1 + `NUM_THREADS*65)
|
||||
) lsu_buffer (
|
||||
@@ -49,17 +51,6 @@ module VX_lsu_unit #(
|
||||
|
||||
wire core_req_rw = (use_mem_write != `BYTE_EN_NO);
|
||||
|
||||
reg [3:0] wmask;
|
||||
always @(*) begin
|
||||
case (use_mem_write[1:0])
|
||||
0: wmask = 4'b0001;
|
||||
1: wmask = 4'b0011;
|
||||
default : wmask = 4'b1111;
|
||||
endcase
|
||||
end
|
||||
|
||||
genvar i;
|
||||
|
||||
wire [`NUM_THREADS-1:0][4:0] mem_req_offset;
|
||||
wire [`NUM_THREADS-1:0][29:0] mem_req_addr;
|
||||
wire [`NUM_THREADS-1:0][3:0] mem_req_byteen;
|
||||
@@ -68,25 +59,18 @@ module VX_lsu_unit #(
|
||||
wire [`NUM_THREADS-1:0][4:0] mem_rsp_offset;
|
||||
wire[2:0] core_rsp_mem_read;
|
||||
|
||||
for (i = 0; i < `NUM_THREADS; ++i) begin
|
||||
always @(*) begin
|
||||
case (core_req_rw ? use_mem_write[1:0] : use_mem_read[1:0])
|
||||
2'b0: begin
|
||||
case (use_address[i][1:0])
|
||||
1: mem_req_offset[i] = 8;
|
||||
2: mem_req_offset[i] = 16;
|
||||
3: mem_req_offset[i] = 24;
|
||||
default: mem_req_offset[i] = 0;
|
||||
endcase
|
||||
end
|
||||
2'b1: begin
|
||||
mem_req_offset[i] = (2 == use_address[i][1:0]) ? 16 : 0;
|
||||
end
|
||||
default: mem_req_offset[i] = 0;
|
||||
endcase
|
||||
end
|
||||
reg [3:0] wmask;
|
||||
always @(*) begin
|
||||
case ((core_req_rw ? use_mem_write[1:0] : use_mem_read[1:0]))
|
||||
0: wmask = 4'b0001;
|
||||
1: wmask = 4'b0011;
|
||||
default : wmask = 4'b1111;
|
||||
endcase
|
||||
end
|
||||
|
||||
for (i = 0; i < `NUM_THREADS; ++i) begin
|
||||
assign mem_req_addr[i] = use_address[i][31:2];
|
||||
assign mem_req_offset[i] = {3'b0, use_address[i][1:0]} << 3;
|
||||
assign mem_req_byteen[i] = (wmask << use_address[i][1:0]);
|
||||
assign mem_req_data[i] = (use_store_data[i] << mem_req_offset[i]);
|
||||
end
|
||||
@@ -96,7 +80,9 @@ module VX_lsu_unit #(
|
||||
wire [`LOG2UP(`DCREQ_SIZE)-1:0] mrq_write_addr, mrq_read_addr, dbg_mrq_write_addr;
|
||||
wire mrq_full;
|
||||
|
||||
wire mrq_push = (0 == core_req_rw) && (| dcache_req_if.core_req_valid) && dcache_req_if.core_req_ready;
|
||||
wire mrq_push = (| dcache_req_if.core_req_valid) && dcache_req_if.core_req_ready
|
||||
&& (0 == core_req_rw); // only push read requests
|
||||
|
||||
wire mrq_pop_part = (| dcache_rsp_if.core_rsp_valid) && dcache_rsp_if.core_rsp_ready;
|
||||
|
||||
assign mrq_read_addr = dcache_rsp_if.core_rsp_tag[0][`LOG2UP(`DCREQ_SIZE)-1:0];
|
||||
|
||||
@@ -59,6 +59,7 @@ module VX_scheduler (
|
||||
rename_table[w][i] <= 0;
|
||||
end
|
||||
end
|
||||
count_valid <= 0;
|
||||
end else begin
|
||||
if (valid_wb) begin
|
||||
assert(rename_table[writeback_if.warp_num][writeback_if.rd] != 0);
|
||||
|
||||
@@ -271,7 +271,7 @@ module Vortex #(
|
||||
);
|
||||
|
||||
// use "case equality" to handle uninitialized address value
|
||||
wire io_select = ((dcache_io_core_req_if.core_req_addr[0] >= `BYTE_TO_WORD_ADDR(`IO_BUS_BASE_ADDR, `DWORD_SIZE)) === 1'b1);
|
||||
wire io_select = (({dcache_io_core_req_if.core_req_addr[0], 2'b0} >= `IO_BUS_BASE_ADDR) === 1'b1);
|
||||
|
||||
VX_dcache_io_arb dcache_io_arb (
|
||||
.io_select (io_select),
|
||||
|
||||
@@ -394,10 +394,11 @@ module Vortex_Cluster #(
|
||||
end
|
||||
|
||||
VX_snp_forwarder #(
|
||||
.BANK_LINE_SIZE(`L2BANK_LINE_SIZE),
|
||||
.NUM_REQUESTS(`NUM_CORES),
|
||||
.SNRQ_SIZE(`L2SNRQ_SIZE),
|
||||
.SNP_REQ_TAG_WIDTH(`L2SNP_TAG_WIDTH)
|
||||
.CACHE_ID (`L2CACHE_ID),
|
||||
.BANK_LINE_SIZE (`L2BANK_LINE_SIZE),
|
||||
.NUM_REQUESTS (`NUM_CORES),
|
||||
.SNRQ_SIZE (`L2SNRQ_SIZE),
|
||||
.SNP_REQ_TAG_WIDTH (`L2SNP_TAG_WIDTH)
|
||||
) snp_forwarder (
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
|
||||
@@ -9,27 +9,27 @@ module Vortex_Socket (
|
||||
// DRAM request
|
||||
output wire dram_req_valid,
|
||||
output wire dram_req_rw,
|
||||
output wire[`L3DRAM_BYTEEN_WIDTH-1:0] dram_req_byteen,
|
||||
output wire[`L3DRAM_ADDR_WIDTH-1:0] dram_req_addr,
|
||||
output wire[`L3DRAM_LINE_WIDTH-1:0] dram_req_data,
|
||||
output wire[`L3DRAM_TAG_WIDTH-1:0] dram_req_tag,
|
||||
output wire[`VX_DRAM_BYTEEN_WIDTH-1:0] dram_req_byteen,
|
||||
output wire[`VX_DRAM_ADDR_WIDTH-1:0] dram_req_addr,
|
||||
output wire[`VX_DRAM_LINE_WIDTH-1:0] dram_req_data,
|
||||
output wire[`VX_DRAM_TAG_WIDTH-1:0] dram_req_tag,
|
||||
input wire dram_req_ready,
|
||||
|
||||
// DRAM response
|
||||
input wire dram_rsp_valid,
|
||||
input wire[`L3DRAM_LINE_WIDTH-1:0] dram_rsp_data,
|
||||
input wire[`L3DRAM_TAG_WIDTH-1:0] dram_rsp_tag,
|
||||
input wire[`VX_DRAM_LINE_WIDTH-1:0] dram_rsp_data,
|
||||
input wire[`VX_DRAM_TAG_WIDTH-1:0] dram_rsp_tag,
|
||||
output wire dram_rsp_ready,
|
||||
|
||||
// Snoop request
|
||||
input wire snp_req_valid,
|
||||
input wire[`L3DRAM_ADDR_WIDTH-1:0] snp_req_addr,
|
||||
input wire[`L3SNP_TAG_WIDTH-1:0] snp_req_tag,
|
||||
input wire[`VX_DRAM_ADDR_WIDTH-1:0] snp_req_addr,
|
||||
input wire[`VX_SNP_TAG_WIDTH-1:0] snp_req_tag,
|
||||
output wire snp_req_ready,
|
||||
|
||||
// Snoop response
|
||||
output wire snp_rsp_valid,
|
||||
output wire[`L3SNP_TAG_WIDTH-1:0] snp_rsp_tag,
|
||||
output wire[`VX_SNP_TAG_WIDTH-1:0] snp_rsp_tag,
|
||||
input wire snp_rsp_ready,
|
||||
|
||||
// I/O request
|
||||
@@ -38,13 +38,13 @@ module Vortex_Socket (
|
||||
output wire[3:0] io_req_byteen,
|
||||
output wire[29:0] io_req_addr,
|
||||
output wire[31:0] io_req_data,
|
||||
output wire[`DCORE_TAG_WIDTH-1:0] io_req_tag,
|
||||
output wire[`VX_CORE_TAG_WIDTH-1:0] io_req_tag,
|
||||
input wire io_req_ready,
|
||||
|
||||
// I/O response
|
||||
input wire io_rsp_valid,
|
||||
input wire[31:0] io_rsp_data,
|
||||
input wire[`DCORE_TAG_WIDTH-1:0] io_rsp_tag,
|
||||
input wire[`VX_CORE_TAG_WIDTH-1:0] io_rsp_tag,
|
||||
output wire io_rsp_ready,
|
||||
|
||||
// Status
|
||||
@@ -334,7 +334,7 @@ module Vortex_Socket (
|
||||
`ifdef DBG_PRINT_DRAM
|
||||
always_ff @(posedge clk) begin
|
||||
if (dram_req_valid && dram_req_ready) begin
|
||||
$display("%t: DRAM req: rw=%b addr=%0h, tag=%0h, byteen=%0h data=%0h", $time, dram_req_rw, {dram_req_addr, `CLOG2(`GLOBAL_BLOCK_SIZE)'(0)}, dram_req_tag, dram_req_byteen, dram_req_data);
|
||||
$display("%t: DRAM req: rw=%b addr=%0h, tag=%0h, byteen=%0h data=%0h", $time, dram_req_rw, `DRAM_TO_BYTE_ADDR(dram_req_addr), dram_req_tag, dram_req_byteen, dram_req_data);
|
||||
end
|
||||
if (dram_rsp_valid && dram_rsp_ready) begin
|
||||
$display("%t: DRAM rsp: tag=%0h, data=%0h", $time, dram_rsp_tag, dram_rsp_data);
|
||||
|
||||
1
hw/rtl/cache/VX_cache.v
vendored
1
hw/rtl/cache/VX_cache.v
vendored
@@ -169,6 +169,7 @@ module VX_cache #(
|
||||
|
||||
if (SNOOP_FORWARDING) begin
|
||||
VX_snp_forwarder #(
|
||||
.CACHE_ID (CACHE_ID),
|
||||
.BANK_LINE_SIZE (BANK_LINE_SIZE),
|
||||
.NUM_REQUESTS (NUM_SNP_REQUESTS),
|
||||
.SNRQ_SIZE (SNRQ_SIZE),
|
||||
|
||||
2
hw/rtl/cache/VX_cache_config.vh
vendored
2
hw/rtl/cache/VX_cache_config.vh
vendored
@@ -72,8 +72,6 @@
|
||||
|
||||
`define DRAM_TO_LINE_ADDR(x) x[`DRAM_ADDR_WIDTH-1:`BANK_SELECT_BITS]
|
||||
|
||||
`define BYTE_TO_WORD_ADDR(x, w) (32-`CLOG2(w))'(x >> `CLOG2(w))
|
||||
|
||||
`define LINE_TO_DRAM_ADDR(x, i) {x, `BANK_SELECT_BITS'(i)}
|
||||
|
||||
`define LINE_TO_BYTE_ADDR(x, i) {x, `BANK_SELECT_BITS'(i), `BASE_ADDR_BITS'(0)}
|
||||
|
||||
9
hw/rtl/cache/VX_snp_forwarder.v
vendored
9
hw/rtl/cache/VX_snp_forwarder.v
vendored
@@ -1,6 +1,7 @@
|
||||
`include "VX_cache_config.vh"
|
||||
|
||||
module VX_snp_forwarder #(
|
||||
parameter CACHE_ID = 0,
|
||||
parameter BANK_LINE_SIZE = 0,
|
||||
parameter NUM_REQUESTS = 0,
|
||||
parameter SNRQ_SIZE = 0,
|
||||
@@ -111,16 +112,16 @@ module VX_snp_forwarder #(
|
||||
`ifdef DBG_PRINT_CACHE_SNP
|
||||
always_ff @(posedge clk) begin
|
||||
if (snp_req_valid && snp_req_ready) begin
|
||||
$display("%t: snp req: addr=%0h, tag=%0h", $time, {snp_req_addr, `LOG2UP(BANK_LINE_SIZE)'(0)}, snp_req_tag);
|
||||
$display("%t: cache%01d snp req: addr=%0h, tag=%0h", $time, CACHE_ID, `DRAM_TO_BYTE_ADDR(snp_req_addr), snp_req_tag);
|
||||
end
|
||||
if (snp_fwdout_valid[0] && snp_fwdout_ready[0]) begin
|
||||
$display("%t: snp fwd_out: addr=%0h, tag=%0h", $time, {snp_fwdout_addr[0], `LOG2UP(BANK_LINE_SIZE)'(0)}, snp_fwdout_tag[0]);
|
||||
$display("%t: cache%01d snp fwd_out: addr=%0h, tag=%0h", $time, CACHE_ID, `DRAM_TO_BYTE_ADDR(snp_fwdout_addr[0]), snp_fwdout_tag[0]);
|
||||
end
|
||||
if (fwdin_valid && fwdin_ready) begin
|
||||
$display("%t: snp fwd_in[%01d]: tag=%0h", $time, fwdin_sel, fwdin_tag);
|
||||
$display("%t: cache%01d snp fwd_in[%01d]: tag=%0h", $time, CACHE_ID, fwdin_sel, fwdin_tag);
|
||||
end
|
||||
if (snp_rsp_valid && snp_rsp_ready) begin
|
||||
$display("%t: snp rsp: addr=%0h, tag=%0h", $time, snp_rsp_addr, snp_rsp_tag);
|
||||
$display("%t: cache%01d snp rsp: addr=%0h, tag=%0h", $time, CACHE_ID, snp_rsp_addr, snp_rsp_tag);
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
14
hw/rtl/cache/VX_tag_data_structure.v
vendored
14
hw/rtl/cache/VX_tag_data_structure.v
vendored
@@ -30,12 +30,12 @@ module VX_tag_data_structure #(
|
||||
input wire fill_sent
|
||||
);
|
||||
|
||||
reg [`BANK_LINE_WORDS-1:0][WORD_SIZE-1:0][7:0] data [`BANK_LINE_COUNT-1:0];
|
||||
reg [`BANK_LINE_WORDS-1:0][WORD_SIZE-1:0] dirtyb [`BANK_LINE_COUNT-1:0];
|
||||
reg [`BANK_LINE_WORDS-1:0][WORD_SIZE-1:0][7:0] data [`BANK_LINE_COUNT-1:0];
|
||||
reg [`TAG_SELECT_BITS-1:0] tag [`BANK_LINE_COUNT-1:0];
|
||||
reg valid [`BANK_LINE_COUNT-1:0];
|
||||
reg dirty [`BANK_LINE_COUNT-1:0];
|
||||
|
||||
reg [`BANK_LINE_WORDS-1:0][WORD_SIZE-1:0] dirtyb[`BANK_LINE_COUNT-1:0];
|
||||
reg dirty[`BANK_LINE_COUNT-1:0];
|
||||
reg [`BANK_LINE_COUNT-1:0] valid;
|
||||
|
||||
assign read_valid = valid [read_addr];
|
||||
assign read_dirty = dirty [read_addr];
|
||||
assign read_dirtyb = dirtyb [read_addr];
|
||||
@@ -48,9 +48,7 @@ module VX_tag_data_structure #(
|
||||
always @(posedge clk) begin
|
||||
if (reset) begin
|
||||
for (i = 0; i < `BANK_LINE_COUNT; i++) begin
|
||||
valid[i] <= 0;
|
||||
dirty[i] <= 0;
|
||||
dirtyb[i] <= 0;
|
||||
valid[i] <= 0;
|
||||
end
|
||||
end else if (!stall_bank_pipe) begin
|
||||
if (do_write) begin
|
||||
|
||||
Reference in New Issue
Block a user