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

Ifu cache update #769

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
28f3f69
adding test file
muhammad3mar Nov 2, 2024
88ba556
initializing files
abdkeb Dec 9, 2024
17994bf
Merge branch 'ifu_cache' of https://github.com/amichai-bd/fpga_mafia …
muhammad3mar Dec 9, 2024
e4dc181
Merge branch 'ifu_cache' of https://github.com/amichai-bd/fpga_mafia …
muhammad3mar Dec 9, 2024
8212f20
initail cach design
Abdullahkeblawi Dec 9, 2024
4e8aca5
Merge branch 'ifu_cache' of https://github.com/amichai-bd/fpga_mafia …
muhammad3mar Dec 11, 2024
a832289
test
muhammad3mar Dec 11, 2024
569bdac
test
muhammad3mar Dec 11, 2024
f9c1583
cache update
abdkeb Dec 11, 2024
48c8557
ifu_cache_tb1
muhammad3mar Dec 11, 2024
dc2464a
comiling module and test bench
abdkeb Dec 11, 2024
85a9ce5
updating file lists
abdkeb Dec 14, 2024
df6f352
remove uneccessary unnecessary dir's and syntax errors
roman012285 Dec 14, 2024
ff8641a
ifu_cache compilation success
abdkeb Dec 14, 2024
2a6c332
Merge branch 'ifu_cache' of https://github.com/amichai-bd/fpga_mafia …
abdkeb Dec 14, 2024
a54ec6c
simulation mini success
Abdullahkeblawi Dec 15, 2024
a596d79
adding the PLRU algorithim to the cache
muhammad3mar Dec 16, 2024
6889e37
fixing LRU cmpilation
Abdullahkeblawi Dec 20, 2024
bbe5ddb
converting cache to always_comb + new tb
abdkeb Dec 21, 2024
f426719
inserting the new cache with with always_comb
abdkeb Dec 21, 2024
f090227
fixing some width issues
abdkeb Dec 21, 2024
7081f51
changing the implementation of the getPLRUIndex
muhammad3mar Dec 24, 2024
4335684
this is the updated files, it was a mistake in the
muhammad3mar Dec 24, 2024
1325bc8
compiation, FFed arrays
abdkeb Dec 24, 2024
c8dfa10
update ifu arrays
abdkeb Dec 26, 2024
cf674b9
running plru tb
muhammad3mar Dec 26, 2024
9fbbb75
submodule problem
muhammad3mar Dec 26, 2024
5624ae6
submodules problem fixed
muhammad3mar Dec 26, 2024
50bfc64
adding debug signals and updating the testbench
muhammad3mar Dec 27, 2024
028dd91
PLRU simple test 1-3 working, 4 not working
abdkeb Dec 27, 2024
39e0560
merge the two submodules into the big module
muhammad3mar Dec 30, 2024
cd54d7a
Initialization the IFU unit interface.
muhammad3mar Jan 2, 2025
630df38
plru testing for cache
Abdullahkeblawi Jan 4, 2025
feea367
plru testing for cache
Abdullahkeblawi Jan 4, 2025
d679136
added Prefetcher and IFU top basic logic, changed interface, changed …
Abdullahkeblawi Jan 13, 2025
5658c23
adding state machine to prefetcher + test bench + adjusting interface…
Abdullahkeblawi Jan 25, 2025
6ef3c25
implementation of IDU and testbench
muhammad3mar Jan 29, 2025
26814d9
fixing ompilation IDu
Abdullahkeblawi Feb 1, 2025
deda30b
updating the IDU testbench to cover more cases
muhammad3mar Feb 1, 2025
d596a2f
initializing mini_core_di
Abdullahkeblawi Feb 18, 2025
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
22 changes: 9 additions & 13 deletions source/ifu/ifu_cache.sv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you have been talking about. It's better to separate and put each module into different files.

Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ always_ff @(posedge Clock or posedge Rst) begin
end
end

endmodule

///////////////////
// Internal Modules
///////////////////

module updatePLruTree (
module updatePLruTree
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have 2 modules in the same file.

Each file one module, and the name of the module and the file must match

import ifu_pkg::*;
(
input logic [NUM_LINES - 2:0] currentTree,
input logic [P_BITS - 1:0] line,
output logic [NUM_LINES - 2:0] updatedTree
Expand All @@ -147,7 +151,9 @@ module updatePLruTree (
end
endmodule

module getPLRUIndex (
module getPLRUIndex
import ifu_pkg::*;
(
input logic [NUM_LINES - 2:0] tree,
output logic [P_BITS - 1:0] index
);
Expand All @@ -159,16 +165,6 @@ module getPLRUIndex (
end
endmodule

// Instantiations
updatePLruTree update_plru_inst (
.currentTree(plruTree),
.line(lineForPLRU),
.updatedTree(updatedTree)
);

getPLRUIndex plru_index_inst (
.tree(plruTree),
.index(plruIndex)
);

endmodule

23 changes: 14 additions & 9 deletions verif/ifu/tb/PLRU_tb.sv
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out simulator does not support assertion. you don't have to use assertion. If you want we have a special macro inside macros.vh that imitates that but its not necessary to use it

Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ module PLRU_tb;
#20; // Hold reset for 20 ns
Rst = 0;
#10;
// Verify PLRU tree is reset
assert(dut.plruTreeOut == 0) else $fatal("PLRU tree reset failed.");
// Monitor PLRU tree reset
$display("PLRU tree reset to: %0h", dut.plruTreeOut);

// 2. Basic Cache Miss
$display("Test %0d: Basic Cache Miss", ++test_counter);
Expand All @@ -76,20 +76,23 @@ module PLRU_tb;
mem_rspInsLineValidIn = 1;
#10; // Wait for one clock cycle
mem_rspInsLineValidIn = 0;
assert(dut.cpu_rspInsLineValidOut == 0) else $fatal("Cache miss handling failed.");
// Monitor cache miss handling
$display("cpu_rspInsLineValidOut: %0h", dut.cpu_rspInsLineValidOut);

// Simulate response from memory
mem_rspInsLineValidIn = 1;
#10;
mem_rspInsLineValidIn = 0;
assert(dut.cpu_rspInsLineOut == 128'hDEADBEEFDEADBEEFDEADBEEFDEADBEEF) else $fatal("Incorrect data inserted in cache.");
// Monitor data insertion
$display("Inserted data: %0h", dut.cpu_rspInsLineOut);

// 3. Basic Cache Hit
$display("Test %0d: Basic Cache Hit", ++test_counter);
cpu_reqAddrIn = 32'h1000; // Access the same address
#10;
assert(dut.cpu_rspInsLineValidOut == 1) else $fatal("Cache hit failed.");
assert(dut.cpu_rspInsLineOut == 128'hDEADBEEFDEADBEEFDEADBEEFDEADBEEF) else $fatal("Incorrect data retrieved on cache hit.");
// Monitor cache hit
$display("cpu_rspInsLineValidOut: %0h", dut.cpu_rspInsLineValidOut);
$display("Retrieved data: %0h", dut.cpu_rspInsLineOut);

// 4. PLRU Replacement
$display("Test %0d: PLRU Replacement", ++test_counter);
Expand All @@ -100,6 +103,8 @@ module PLRU_tb;
mem_rspTagIn = cpu_reqAddrIn[ADDR_WIDTH-1:OFFSET_WIDTH];
#10;
mem_rspInsLineValidIn = 0;
// Monitor each insertion
$display("Inserted data for address %0h: %0h", cpu_reqAddrIn, dut.cpu_rspInsLineOut);
end
// Insert one more line to trigger replacement
cpu_reqAddrIn = 32'hFFFF;
Expand All @@ -109,10 +114,10 @@ module PLRU_tb;
#10;
mem_rspInsLineValidIn = 0;

// Check replacement
assert(dut.cpu_rspInsLineValidOut == 0) else $fatal("PLRU replacement failed.");
// Monitor replacement
$display("PLRU replacement check for address %0h: %0h", cpu_reqAddrIn, dut.cpu_rspInsLineOut);

$display("All tests passed!");
$display("All tests completed!");
$stop;
end

Expand Down
Loading