Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock faster tests #57

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ all_source_files = [
"rtl/CompareRecFN.sv",
"rtl/ComposedBranchPredictorBank.sv",
"rtl/CSRFile.sv",
"rtl/data_2048x8.sv",
"mock/data_2048x8.sv",
"mock/dataArrayB_256x64.sv",
"rtl/DebugTransportModuleJTAG.sv",
"rtl/DecodeUnit.sv",
Expand Down Expand Up @@ -359,7 +359,7 @@ all_source_files = [
"rtl/table_128x52.sv",
"rtl/table_256x48.sv",
"rtl/tag_array_64x168.sv",
"rtl/tag_array_64x184.sv",
"mock/tag_array_64x184.sv",
"rtl/TageBranchPredictorBank.sv",
"rtl/TageTable_1.sv",
"rtl/TageTable_2.sv",
Expand Down Expand Up @@ -740,7 +740,9 @@ digital_top_srams=[
'data_data_40x128':'mock',
'ebtb_128x40':'mock',
'ghist_40x64':'mock',
'l2_tlb_ram_0_512x45':'mock'}.get(ram, "rtl") + "/" + ram + ".sv"],
'l2_tlb_ram_0_512x45':'mock',
'tag_array_64x184':'mock',
'data_2048x8':'mock'}.get(ram, "rtl") + "/" + ram + ".sv"],
sdc_constraints = ":constraints-sram",
stage_args={
'synth': ['SYNTH_MEMORY_MAX_BITS=16384'],
Expand All @@ -752,7 +754,7 @@ digital_top_srams=[
},
mock_abstract=True,
mock_stage='cts',
mock_area={'tag_array_64x184':0.20,
mock_area={
'meta_40x240':0.3,
'data_data_40x128':1,
'ram_256x8':0.2,
Expand Down
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ git_override(
# 1. uncomment below
# 2. comment git_override() above
#
# local_path_override(
# module_name = "bazel-orfs", path = "../bazel-orfs"
# )
#local_path_override(
# module_name = "bazel-orfs", path = "../bazel-orfs"
#)
55 changes: 55 additions & 0 deletions mock/data_2048x8.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Standard header to adapt well known macros for prints and assertions.

// Users can define 'ASSERT_VERBOSE_COND' to add an extra gate to assert error printing.
`ifndef ASSERT_VERBOSE_COND_
`ifdef ASSERT_VERBOSE_COND
`define ASSERT_VERBOSE_COND_ (`ASSERT_VERBOSE_COND)
`else // ASSERT_VERBOSE_COND
`define ASSERT_VERBOSE_COND_ 1
`endif // ASSERT_VERBOSE_COND
`endif // not def ASSERT_VERBOSE_COND_

// Users can define 'STOP_COND' to add an extra gate to stop conditions.
`ifndef STOP_COND_
`ifdef STOP_COND
`define STOP_COND_ (`STOP_COND)
`else // STOP_COND
`define STOP_COND_ 1
`endif // STOP_COND
`endif // not def STOP_COND_

// VCS coverage exclude_file
module data_2048x8(
input [10:0] R0_addr,
input R0_en,
R0_clk,
output [7:0] R0_data,
input [10:0] W0_addr,
input W0_en,
W0_clk,
input [7:0] W0_data,
input [3:0] W0_mask
);

reg [7:0] Memory[0:3]; // Reduced to 4 rows
reg _R0_en_d0;
reg [1:0] _R0_addr_d0; // Reduced to 2 bits
reg [1:0] _W0_addr_d0; // Reduced to 2 bits
always @(posedge R0_clk) begin
_R0_en_d0 <= R0_en;
_R0_addr_d0 <= R0_addr[1:0] ^ R0_addr[5:4] ^ R0_addr[9:8]; // XOR upper and lower bits
end // always @(posedge)
always @(posedge W0_clk) begin
_W0_addr_d0 <= W0_addr[1:0] ^ W0_addr[5:4] ^ W0_addr[9:8]; // XOR upper and lower bits
if (W0_en & W0_mask[0])
Memory[_W0_addr_d0][32'h0 +: 2] <= W0_data[1:0];
if (W0_en & W0_mask[1])
Memory[_W0_addr_d0][32'h2 +: 2] <= W0_data[3:2];
if (W0_en & W0_mask[2])
Memory[_W0_addr_d0][32'h4 +: 2] <= W0_data[5:4];
if (W0_en & W0_mask[3])
Memory[_W0_addr_d0][32'h6 +: 2] <= W0_data[7:6];
end // always @(posedge)
assign R0_data = _R0_en_d0 ? Memory[_R0_addr_d0] : 8'bx;
endmodule

67 changes: 67 additions & 0 deletions mock/tag_array_64x184.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Standard header to adapt well known macros for prints and assertions.

// Users can define 'ASSERT_VERBOSE_COND' to add an extra gate to assert error printing.
`ifndef ASSERT_VERBOSE_COND_
`ifdef ASSERT_VERBOSE_COND
`define ASSERT_VERBOSE_COND_ (`ASSERT_VERBOSE_COND)
`else // ASSERT_VERBOSE_COND
`define ASSERT_VERBOSE_COND_ 1
`endif // ASSERT_VERBOSE_COND
`endif // not def ASSERT_VERBOSE_COND_

// Users can define 'STOP_COND' to add an extra gate to stop conditions.
`ifndef STOP_COND_
`ifdef STOP_COND
`define STOP_COND_ (`STOP_COND)
`else // STOP_COND
`define STOP_COND_ 1
`endif // STOP_COND
`endif // not def STOP_COND_

// VCS coverage exclude_file
module tag_array_64x184(
input [5:0] R0_addr,
input R0_en,
R0_clk,
output [183:0] R0_data,
input [5:0] W0_addr,
input W0_en,
W0_clk,
input [183:0] W0_data,
input [7:0] W0_mask
);

reg [183:0] Memory[0:15];
reg _R0_en_d0;
reg [5:0] _R0_addr_d0;
reg [3:0] _W0_addr_d0, _R0_addr_d1;

always @(posedge R0_clk) begin
_R0_en_d0 <= R0_en;
_R0_addr_d0 <= R0_addr;
_R0_addr_d1 <= R0_addr[5:2] ^ R0_addr[1:0];
end // always @(posedge)

always @(posedge W0_clk) begin
_W0_addr_d0 <= W0_addr[5:2] ^ W0_addr[1:0];
if (W0_en & W0_mask[0])
Memory[_W0_addr_d0][32'h0 +: 23] <= W0_data[22:0];
if (W0_en & W0_mask[1])
Memory[_W0_addr_d0][32'h17 +: 23] <= W0_data[45:23];
if (W0_en & W0_mask[2])
Memory[_W0_addr_d0][32'h2E +: 23] <= W0_data[68:46];
if (W0_en & W0_mask[3])
Memory[_W0_addr_d0][32'h45 +: 23] <= W0_data[91:69];
if (W0_en & W0_mask[4])
Memory[_W0_addr_d0][32'h5C +: 23] <= W0_data[114:92];
if (W0_en & W0_mask[5])
Memory[_W0_addr_d0][32'h73 +: 23] <= W0_data[137:115];
if (W0_en & W0_mask[6])
Memory[_W0_addr_d0][32'h8A +: 23] <= W0_data[160:138];
if (W0_en & W0_mask[7])
Memory[_W0_addr_d0][32'hA1 +: 23] <= W0_data[183:161];
end // always @(posedge)

assign R0_data = _R0_en_d0 ? Memory[_R0_addr_d1] : 184'bx;
endmodule

Loading