|
|
|
|
@@ -73,12 +73,12 @@ module VX_tag_data_access
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reg[`DBANK_LINE_SIZE_RNG][31:0] readdata_st[STAGE_1_CYCLES-2:0];
|
|
|
|
|
reg[`DBANK_LINE_SIZE_RNG][31:0] readdata_st[STAGE_1_CYCLES-1:0];
|
|
|
|
|
|
|
|
|
|
reg read_valid_st1c[STAGE_1_CYCLES-2:0];
|
|
|
|
|
reg read_dirty_st1c[STAGE_1_CYCLES-2:0];
|
|
|
|
|
reg[`TAG_SELECT_SIZE_RNG] read_tag_st1c [STAGE_1_CYCLES-2:0];
|
|
|
|
|
reg[`DBANK_LINE_SIZE_RNG][31:0] read_data_st1c [STAGE_1_CYCLES-2:0];
|
|
|
|
|
reg read_valid_st1c[STAGE_1_CYCLES-1:0];
|
|
|
|
|
reg read_dirty_st1c[STAGE_1_CYCLES-1:0];
|
|
|
|
|
reg[`TAG_SELECT_SIZE_RNG] read_tag_st1c [STAGE_1_CYCLES-1:0];
|
|
|
|
|
reg[`DBANK_LINE_SIZE_RNG][31:0] read_data_st1c [STAGE_1_CYCLES-1:0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wire qual_read_valid_st1;
|
|
|
|
|
@@ -94,6 +94,9 @@ module VX_tag_data_access
|
|
|
|
|
wire[`DBANK_LINE_SIZE_RNG][31:0] use_write_data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wire real_writefill = writefill_st1e && miss_st1e;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wire fill_sent;
|
|
|
|
|
wire invalidate_line;
|
|
|
|
|
VX_tag_data_structure #(
|
|
|
|
|
@@ -128,13 +131,14 @@ module VX_tag_data_access
|
|
|
|
|
|
|
|
|
|
.invalidate (invalidate_line),
|
|
|
|
|
.write_enable(use_write_enable),
|
|
|
|
|
.write_fill (writefill_st1e),
|
|
|
|
|
.write_fill (real_writefill),
|
|
|
|
|
.write_addr (writeaddr_st1e),
|
|
|
|
|
.write_data (use_write_data),
|
|
|
|
|
.fill_sent (fill_sent)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
VX_generic_register #(.N( 1 + 1 + `TAG_SELECT_NUM_BITS + (`DBANK_LINE_SIZE_WORDS*32) )) s0_1_c0 (
|
|
|
|
|
// VX_generic_register #(.N( 1 + 1 + `TAG_SELECT_NUM_BITS + (`DBANK_LINE_SIZE_WORDS*32) )) s0_1_c0 (
|
|
|
|
|
VX_generic_register #(.N( 1 + 1 + `TAG_SELECT_NUM_BITS + (`DBANK_LINE_SIZE_WORDS*32) ), .Valid(0)) s0_1_c0 (
|
|
|
|
|
.clk (clk),
|
|
|
|
|
.reset(reset),
|
|
|
|
|
.stall(stall),
|
|
|
|
|
@@ -145,7 +149,7 @@ module VX_tag_data_access
|
|
|
|
|
|
|
|
|
|
genvar curr_stage;
|
|
|
|
|
generate
|
|
|
|
|
for (curr_stage = 1; curr_stage < STAGE_1_CYCLES-2; curr_stage = curr_stage + 1) begin
|
|
|
|
|
for (curr_stage = 1; curr_stage < STAGE_1_CYCLES-1; curr_stage = curr_stage + 1) begin
|
|
|
|
|
VX_generic_register #(.N( 1 + 1 + `TAG_SELECT_NUM_BITS + (`DBANK_LINE_SIZE_WORDS*32) )) s0_1_cc (
|
|
|
|
|
.clk (clk),
|
|
|
|
|
.reset(reset),
|
|
|
|
|
@@ -158,13 +162,13 @@ module VX_tag_data_access
|
|
|
|
|
endgenerate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assign use_read_valid_st1e = read_valid_st1c[STAGE_1_CYCLES-2] || (FUNC_ID == `SFUNC_ID); // If shared memory, always valid
|
|
|
|
|
assign use_read_dirty_st1e = read_dirty_st1c[STAGE_1_CYCLES-2] && (FUNC_ID == `DFUNC_ID); // Dirty only applies in Dcache
|
|
|
|
|
assign use_read_tag_st1e = (FUNC_ID == `SFUNC_ID) ? writeaddr_st1e[`TAG_SELECT_ADDR_RNG] : read_tag_st1c [STAGE_1_CYCLES-2]; // Tag is always the same in SM
|
|
|
|
|
assign use_read_valid_st1e = read_valid_st1c[STAGE_1_CYCLES-1] || (FUNC_ID == `SFUNC_ID); // If shared memory, always valid
|
|
|
|
|
assign use_read_dirty_st1e = read_dirty_st1c[STAGE_1_CYCLES-1] && (FUNC_ID != `SFUNC_ID); // Dirty only applies in Dcache
|
|
|
|
|
assign use_read_tag_st1e = (FUNC_ID == `SFUNC_ID) ? writeaddr_st1e[`TAG_SELECT_ADDR_RNG] : read_tag_st1c [STAGE_1_CYCLES-1]; // Tag is always the same in SM
|
|
|
|
|
|
|
|
|
|
genvar curr_w;
|
|
|
|
|
for (curr_w = 0; curr_w < `DBANK_LINE_SIZE_WORDS; curr_w = curr_w+1) assign use_read_data_st1e[curr_w][31:0] = read_data_st1c[STAGE_1_CYCLES-2][curr_w][31:0];
|
|
|
|
|
// assign use_read_data_st1e = read_data_st1c [STAGE_1_CYCLES-2];
|
|
|
|
|
for (curr_w = 0; curr_w < `DBANK_LINE_SIZE_WORDS; curr_w = curr_w+1) assign use_read_data_st1e[curr_w][31:0] = read_data_st1c[STAGE_1_CYCLES-1][curr_w][31:0];
|
|
|
|
|
// assign use_read_data_st1e = read_data_st1c [STAGE_1_CYCLES-1];
|
|
|
|
|
|
|
|
|
|
/////////////////////// LOAD LOGIC ///////////////////
|
|
|
|
|
|
|
|
|
|
@@ -182,12 +186,12 @@ module VX_tag_data_access
|
|
|
|
|
wire b2 = (byte_select == 2);
|
|
|
|
|
wire b3 = (byte_select == 3);
|
|
|
|
|
|
|
|
|
|
wire[31:0] w0 = read_data_st1c[STAGE_1_CYCLES-2][0][31:0];
|
|
|
|
|
wire[31:0] w1 = read_data_st1c[STAGE_1_CYCLES-2][1][31:0];
|
|
|
|
|
wire[31:0] w2 = read_data_st1c[STAGE_1_CYCLES-2][2][31:0];
|
|
|
|
|
wire[31:0] w3 = read_data_st1c[STAGE_1_CYCLES-2][3][31:0];
|
|
|
|
|
wire[31:0] w0 = read_data_st1c[STAGE_1_CYCLES-1][0][31:0];
|
|
|
|
|
wire[31:0] w1 = read_data_st1c[STAGE_1_CYCLES-1][1][31:0];
|
|
|
|
|
wire[31:0] w2 = read_data_st1c[STAGE_1_CYCLES-1][2][31:0];
|
|
|
|
|
wire[31:0] w3 = read_data_st1c[STAGE_1_CYCLES-1][3][31:0];
|
|
|
|
|
|
|
|
|
|
wire[31:0] data_unmod = read_data_st1c[STAGE_1_CYCLES-2][block_offset][31:0];
|
|
|
|
|
wire[31:0] data_unmod = read_data_st1c[STAGE_1_CYCLES-1][block_offset][31:0];
|
|
|
|
|
|
|
|
|
|
wire[31:0] data_unQual = (b0 || lw) ? (data_unmod) :
|
|
|
|
|
b1 ? (data_unmod >> 8) :
|
|
|
|
|
@@ -234,7 +238,7 @@ module VX_tag_data_access
|
|
|
|
|
wire[3:0] sh_mask = (b0 ? 4'b0011 : 4'b1100);
|
|
|
|
|
|
|
|
|
|
wire should_write = (sw || sb || sh) && valid_req_st1e && use_read_valid_st1e && !miss_st1e;
|
|
|
|
|
wire force_write = writefill_st1e && valid_req_st1e && (!use_read_valid_st1e || (use_read_valid_st1e && !miss_st1e));
|
|
|
|
|
wire force_write = writefill_st1e && valid_req_st1e && miss_st1e && (!use_read_valid_st1e || (use_read_valid_st1e && !miss_st1e));
|
|
|
|
|
|
|
|
|
|
wire[`DBANK_LINE_SIZE_RNG][3:0] we;
|
|
|
|
|
wire[`DBANK_LINE_SIZE_RNG][31:0] data_write;
|
|
|
|
|
@@ -262,7 +266,7 @@ module VX_tag_data_access
|
|
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
|
if (FUNC_ID == `LLFUNC_ID) begin
|
|
|
|
|
assign readword_st1e = read_data_st1c[STAGE_1_CYCLES-2];
|
|
|
|
|
assign readword_st1e = read_data_st1c[STAGE_1_CYCLES-1];
|
|
|
|
|
end else begin
|
|
|
|
|
assign readword_st1e = data_Qual;
|
|
|
|
|
end
|
|
|
|
|
@@ -272,7 +276,7 @@ module VX_tag_data_access
|
|
|
|
|
assign readdata_st1e = use_read_data_st1e;
|
|
|
|
|
assign readtag_st1e = use_read_tag_st1e;
|
|
|
|
|
assign fill_sent = miss_st1e;
|
|
|
|
|
assign fill_saw_dirty_st1e = force_write && dirty_st1e;
|
|
|
|
|
assign fill_saw_dirty_st1e = force_write && dirty_st1e && miss_st1e;
|
|
|
|
|
assign invalidate_line = is_snp_st1e && !miss_st1e;
|
|
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
|