Skip to content

Cache branch#50

Open
tpcannon7 wants to merge 20 commits intomainfrom
cache_branch
Open

Cache branch#50
tpcannon7 wants to merge 20 commits intomainfrom
cache_branch

Conversation

@tpcannon7
Copy link
Contributor

No description provided.

@tpcannon7
Copy link
Contributor Author

need to still work on AXI interfaces; dcache still requires work for write back / write allocate

mru.sv is current replacement policy module

fifty1-fifty and others added 3 commits February 6, 2026 18:37
feat: added prelim logic for write allocate and write back policies
Changed misspelled port definition from "dcahce_tlb_req_valid_o" to ""dcache_tlb_req_valid_o"
Copy link
Collaborator

@Meowcaroni Meowcaroni left a comment

Choose a reason for hiding this comment

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

Good job overall, dcache and icache are especially well-organized. I also appreciate the header and body comments in general.

dcache.sv and lru.sv have some necessary fixes to-do regarding combinational and sequential logic, but everything else is good/can be fixed later.


CACHE_LOOKUP: begin
dcache_tlb_req_valid_o = 1'b1;
dcache_tlb_resp_ready = 1'b0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Issue: Since dcache_tlb_resp_ready (what I'm assuming is meant to be "dcache_tlb_resp_ready_o") is treated sequentially with non-blocking statements in the TLB Translation Logic block, this may conflict with the combinational usage here.

Delete this line if that's the case.


CACHE_ALLOCATE: begin
dcache_bridge_req_valid_o = 1'b1;
dcache_bridge_req_addr_o = phys_addr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Issue: dcache_bridge_req_addr_o also faces the same issue as dcache_tlb_resp_ready_o with the sequential block in Cache Allocate.

Delete this line or its usage in that block.


CACHE_WRITEBACK: begin
dcache_bridge_req_valid_o = 1'b1;
dcache_bridge_req_addr_o = phys_addr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Issue: dcache_bridge_req_addr_o also faces the same issue as dcache_tlb_resp_ready_o with the sequential block in Cache Writeback.

Delete this line or its usage in that block.

Comment on lines +308 to +309
dcache_resp_valid_o = 1'b0;
dcache_resp_rdata_o = '0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Issue: dcache_resp_valid_o and dcache_resp_rdata_o have the same issue with combinational/sequential block driving in the CPU Load block

Alter its usage here and/or in that block.

Comment on lines +49 to +50
if (way_to_evict_o == 1'b0) assign evicted_line_o = way1_line_i;
else assign evicted_line_o = way2_line_i;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Issue: If-else statements cannot be used in the module's top scope (directly within module) to select individual assign statements. In this case, I recommend using a conditional operator:

Suggested change
if (way_to_evict_o == 1'b0) assign evicted_line_o = way1_line_i;
else assign evicted_line_o = way2_line_i;
assign evicted_line_o = (way_to_evict_o == 1'b0) ? way1_line_i : way2_line_i;

Copy link
Collaborator

Choose a reason for hiding this comment

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

For scalability, any "way" variables can be converted into packed/unpacked arrays with a WAYS parameter. For example: input logic [WAYS-1:0] isWay_valid_i

(Note: This can be added later on, not a top priority)

end else if (isthere_miss_i) begin

// if there's a miss, invert bit to track the victim way
mru_bits[set_index_i] <= way_to_evict_o;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Functionality Note: This may cause a race condition with way_to_evict_o = ~mru_bits[set_index_i]; earlier. Consider changing if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants