-
Notifications
You must be signed in to change notification settings - Fork 719
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
Mmu unify - task 1 #1722
Mmu unify - task 1 #1722
Conversation
correct also ASID_LEN parameter propagation
Correct value assignment req_port_o.data_be and req_port_o.data_be for the sv39 case.
This reverts commit bcbe49b.
This reverts commit 53125fb.
This reverts commit ace52fe.
This reverts commit 9ffe052.
This reverts commit bcbe49b.
This reverts commit 2a10823.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
verible-verilog-format
core/mmu_unify/cva6_mmu.sv|605|
core/mmu_unify/cva6_mmu.sv|626|
core/mmu_unify/cva6_ptw.sv|37|
core/mmu_unify/cva6_ptw.sv|102|
core/mmu_unify/cva6_ptw.sv|113|
core/mmu_unify/cva6_ptw.sv|139|
core/mmu_unify/cva6_ptw.sv|143|
core/mmu_unify/cva6_ptw.sv|146|
core/mmu_unify/cva6_ptw.sv|151|
core/mmu_unify/cva6_ptw.sv|156|
core/mmu_unify/cva6_ptw.sv|189|
core/mmu_unify/cva6_ptw.sv|247|
core/mmu_unify/cva6_ptw.sv|328|
core/mmu_unify/cva6_ptw.sv|392|
core/mmu_unify/cva6_shared_tlb.sv|167|
core/mmu_unify/cva6_tlb.sv|204|
core/mmu_unify/cva6_tlb.sv|247|
core/mmu_unify/cva6_mmu.sv
Outdated
|
||
|
||
module cva6_mmu | ||
import ariane_pkg::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
import ariane_pkg::*; | |
import ariane_pkg::*; |
core/mmu_unify/cva6_mmu.sv
Outdated
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty, | ||
parameter int unsigned INSTR_TLB_ENTRIES = 4, | ||
parameter int unsigned DATA_TLB_ENTRIES = 4, | ||
parameter int unsigned ASID_WIDTH = 1, | ||
parameter int unsigned ASID_LEN = 1, | ||
parameter int unsigned VPN_LEN = 1, | ||
parameter int unsigned PT_LEVELS = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty, | |
parameter int unsigned INSTR_TLB_ENTRIES = 4, | |
parameter int unsigned DATA_TLB_ENTRIES = 4, | |
parameter int unsigned ASID_WIDTH = 1, | |
parameter int unsigned ASID_LEN = 1, | |
parameter int unsigned VPN_LEN = 1, | |
parameter int unsigned PT_LEVELS = 1 | |
parameter config_pkg::cva6_cfg_t CVA6Cfg = config_pkg::cva6_cfg_empty, | |
parameter int unsigned INSTR_TLB_ENTRIES = 4, | |
parameter int unsigned DATA_TLB_ENTRIES = 4, | |
parameter int unsigned ASID_WIDTH = 1, | |
parameter int unsigned ASID_LEN = 1, | |
parameter int unsigned VPN_LEN = 1, | |
parameter int unsigned PT_LEVELS = 1 |
core/mmu_unify/cva6_mmu.sv
Outdated
logic dtlb_lu_hit; | ||
|
||
logic shared_tlb_access; | ||
logic [riscv::VLEN-1:0] shared_tlb_vaddr; | ||
logic shared_tlb_hit; | ||
|
||
logic itlb_req; | ||
|
||
// Assignments | ||
assign itlb_lu_access = icache_areq_i.fetch_req; | ||
assign dtlb_lu_access = lsu_req_i; | ||
|
||
|
||
cva6_tlb #( | ||
.CVA6Cfg (CVA6Cfg), | ||
.TLB_ENTRIES(INSTR_TLB_ENTRIES), | ||
.ASID_WIDTH (ASID_WIDTH), | ||
.ASID_LEN (ASID_LEN), | ||
.VPN_LEN(VPN_LEN), | ||
.PT_LEVELS(PT_LEVELS), | ||
.pte_cva6_t(pte_cva6_t), | ||
.tlb_update_cva6_t(tlb_update_cva6_t) | ||
) i_itlb ( | ||
.clk_i (clk_i), | ||
.rst_ni (rst_ni), | ||
.flush_i(flush_tlb_i), | ||
|
||
.update_i(update_itlb), | ||
|
||
.lu_access_i (itlb_lu_access), | ||
.lu_asid_i (asid_i), | ||
.asid_to_be_flushed_i (asid_to_be_flushed_i), | ||
.vaddr_to_be_flushed_i(vaddr_to_be_flushed_i), | ||
.lu_vaddr_i (icache_areq_i.fetch_vaddr), | ||
.lu_content_o (itlb_content), | ||
|
||
.lu_is_page_o(itlb_is_page), | ||
.lu_hit_o (itlb_lu_hit) | ||
); | ||
|
||
cva6_tlb #( | ||
.CVA6Cfg (CVA6Cfg), | ||
.TLB_ENTRIES(DATA_TLB_ENTRIES), | ||
.ASID_WIDTH (ASID_WIDTH), | ||
.ASID_LEN (ASID_LEN), | ||
.VPN_LEN(VPN_LEN), | ||
.PT_LEVELS(PT_LEVELS), | ||
.pte_cva6_t(pte_cva6_t), | ||
.tlb_update_cva6_t(tlb_update_cva6_t) | ||
) i_dtlb ( | ||
.clk_i (clk_i), | ||
.rst_ni (rst_ni), | ||
.flush_i(flush_tlb_i), | ||
|
||
.update_i(update_dtlb), | ||
|
||
.lu_access_i (dtlb_lu_access), | ||
.lu_asid_i (asid_i), | ||
.asid_to_be_flushed_i (asid_to_be_flushed_i), | ||
.vaddr_to_be_flushed_i(vaddr_to_be_flushed_i), | ||
.lu_vaddr_i (lsu_vaddr_i), | ||
.lu_content_o (dtlb_content), | ||
|
||
.lu_is_page_o(dtlb_is_page), | ||
.lu_hit_o (dtlb_lu_hit) | ||
); | ||
|
||
cva6_shared_tlb #( | ||
.CVA6Cfg (CVA6Cfg), | ||
.SHARED_TLB_DEPTH(64), | ||
.SHARED_TLB_WAYS (2), | ||
.ASID_WIDTH (ASID_WIDTH), | ||
.ASID_LEN (ASID_LEN), | ||
.VPN_LEN(VPN_LEN), | ||
.PT_LEVELS(PT_LEVELS), | ||
.pte_cva6_t(pte_cva6_t), | ||
.tlb_update_cva6_t(tlb_update_cva6_t) | ||
) i_shared_tlb ( | ||
.clk_i (clk_i), | ||
.rst_ni (rst_ni), | ||
.flush_i(flush_tlb_i), | ||
|
||
.enable_translation_i (enable_translation_i), | ||
.en_ld_st_translation_i(en_ld_st_translation_i), | ||
|
||
.asid_i (asid_i), | ||
// from TLBs | ||
// did we miss? | ||
.itlb_access_i(itlb_lu_access), | ||
.itlb_hit_i (itlb_lu_hit), | ||
.itlb_vaddr_i (icache_areq_i.fetch_vaddr), | ||
|
||
.dtlb_access_i(dtlb_lu_access), | ||
.dtlb_hit_i (dtlb_lu_hit), | ||
.dtlb_vaddr_i (lsu_vaddr_i), | ||
|
||
// to TLBs, update logic | ||
.itlb_update_o(update_itlb), | ||
.dtlb_update_o(update_dtlb), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
input logic clk_i, | |
input logic rst_ni, | |
input logic flush_i, | |
input logic enable_translation_i, | |
input logic en_ld_st_translation_i, // enable virtual memory translation for load/stores | |
// IF interface | |
input icache_arsp_t icache_areq_i, | |
output icache_areq_t icache_areq_o, | |
// LSU interface | |
// this is a more minimalistic interface because the actual addressing logic is handled | |
// in the LSU as we distinguish load and stores, what we do here is simple address translation | |
input exception_t misaligned_ex_i, | |
input logic lsu_req_i, // request address translation | |
input logic [riscv::VLEN-1:0] lsu_vaddr_i, // virtual address in | |
input logic lsu_is_store_i, // the translation is requested by a store | |
// if we need to walk the page table we can't grant in the same cycle | |
// Cycle 0 | |
output logic lsu_dtlb_hit_o, // sent in the same cycle as the request if translation hits in the DTLB | |
output logic [riscv::PPNW-1:0] lsu_dtlb_ppn_o, // ppn (send same cycle as hit) | |
// Cycle 1 | |
output logic lsu_valid_o, // translation is valid | |
output logic [riscv::PLEN-1:0] lsu_paddr_o, // translated address | |
output exception_t lsu_exception_o, // address translation threw an exception | |
// General control signals | |
input riscv::priv_lvl_t priv_lvl_i, | |
input riscv::priv_lvl_t ld_st_priv_lvl_i, | |
input logic sum_i, | |
input logic mxr_i, | |
// input logic flag_mprv_i, | |
input logic [riscv::PPNW-1:0] satp_ppn_i, | |
input logic [ASID_WIDTH-1:0] asid_i, | |
input logic [ASID_WIDTH-1:0] asid_to_be_flushed_i, | |
input logic [riscv::VLEN-1:0] vaddr_to_be_flushed_i, | |
input logic flush_tlb_i, | |
// Performance counters | |
output logic itlb_miss_o, | |
output logic dtlb_miss_o, | |
// PTW memory interface | |
input dcache_req_o_t req_port_i, | |
output dcache_req_i_t req_port_o, | |
// PMP | |
input riscv::pmpcfg_t [15:0] pmpcfg_i, | |
input logic [15:0][riscv::PLEN-3:0] pmpaddr_i | |
); | |
// memory management, pte for cva6 | |
localparam type pte_cva6_t = struct packed { | |
// typedef struct packed { | |
logic [riscv::PPNW-1:0] ppn; // PPN length for | |
logic [1:0] rsw; | |
logic d; | |
logic a; | |
logic g; | |
logic u; | |
logic x; | |
logic w; | |
logic r; | |
logic v; | |
} ; | |
localparam type tlb_update_cva6_t = struct packed { | |
// typedef struct packed { | |
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; | |
} ; | |
logic iaccess_err; // insufficient privilege to access this instruction page | |
logic daccess_err; // insufficient privilege to access this data page | |
logic ptw_active; // PTW is currently walking a page table | |
logic walking_instr; // PTW is walking because of an ITLB miss | |
logic ptw_error; // PTW threw an exception | |
logic ptw_access_exception; // PTW threw an access exception (PMPs) | |
logic [riscv::PLEN-1:0] ptw_bad_paddr; // PTW PMP exception bad physical addr | |
logic [riscv::VLEN-1:0] update_vaddr; | |
// tlb_update_t update_ptw_itlb, update_ptw_dtlb; | |
tlb_update_cva6_t update_itlb, update_dtlb, update_shared_tlb; | |
logic itlb_lu_access; | |
pte_cva6_t itlb_content; | |
logic [PT_LEVELS-2:0] itlb_is_page; | |
logic itlb_lu_hit; | |
logic dtlb_lu_access; | |
pte_cva6_t dtlb_content; | |
logic [PT_LEVELS-2:0] dtlb_is_page; | |
logic dtlb_lu_hit; | |
logic shared_tlb_access; | |
logic [riscv::VLEN-1:0] shared_tlb_vaddr; | |
logic shared_tlb_hit; | |
logic itlb_req; | |
// Assignments | |
assign itlb_lu_access = icache_areq_i.fetch_req; | |
assign dtlb_lu_access = lsu_req_i; | |
cva6_tlb #( | |
.CVA6Cfg (CVA6Cfg), | |
.TLB_ENTRIES(INSTR_TLB_ENTRIES), | |
.ASID_WIDTH (ASID_WIDTH), | |
.ASID_LEN (ASID_LEN), | |
.VPN_LEN(VPN_LEN), | |
.PT_LEVELS(PT_LEVELS), | |
.pte_cva6_t(pte_cva6_t), | |
.tlb_update_cva6_t(tlb_update_cva6_t) | |
) i_itlb ( | |
.clk_i (clk_i), | |
.rst_ni (rst_ni), | |
.flush_i(flush_tlb_i), | |
.update_i(update_itlb), | |
.lu_access_i (itlb_lu_access), | |
.lu_asid_i (asid_i), | |
.asid_to_be_flushed_i (asid_to_be_flushed_i), | |
.vaddr_to_be_flushed_i(vaddr_to_be_flushed_i), | |
.lu_vaddr_i (icache_areq_i.fetch_vaddr), | |
.lu_content_o (itlb_content), | |
.lu_is_page_o(itlb_is_page), | |
.lu_hit_o (itlb_lu_hit) | |
); | |
cva6_tlb #( | |
.CVA6Cfg (CVA6Cfg), | |
.TLB_ENTRIES(DATA_TLB_ENTRIES), | |
.ASID_WIDTH (ASID_WIDTH), | |
.ASID_LEN (ASID_LEN), | |
.VPN_LEN(VPN_LEN), | |
.PT_LEVELS(PT_LEVELS), | |
.pte_cva6_t(pte_cva6_t), | |
.tlb_update_cva6_t(tlb_update_cva6_t) | |
) i_dtlb ( | |
.clk_i (clk_i), | |
.rst_ni (rst_ni), | |
.flush_i(flush_tlb_i), | |
.update_i(update_dtlb), | |
.lu_access_i (dtlb_lu_access), | |
.lu_asid_i (asid_i), | |
.asid_to_be_flushed_i (asid_to_be_flushed_i), | |
.vaddr_to_be_flushed_i(vaddr_to_be_flushed_i), | |
.lu_vaddr_i (lsu_vaddr_i), | |
.lu_content_o (dtlb_content), | |
.lu_is_page_o(dtlb_is_page), | |
.lu_hit_o (dtlb_lu_hit) | |
); | |
cva6_shared_tlb #( | |
.CVA6Cfg (CVA6Cfg), | |
.SHARED_TLB_DEPTH(64), | |
.SHARED_TLB_WAYS (2), | |
.ASID_WIDTH (ASID_WIDTH), | |
.ASID_LEN (ASID_LEN), | |
.VPN_LEN(VPN_LEN), | |
.PT_LEVELS(PT_LEVELS), | |
.pte_cva6_t(pte_cva6_t), | |
.tlb_update_cva6_t(tlb_update_cva6_t) | |
) i_shared_tlb ( | |
.clk_i (clk_i), | |
.rst_ni (rst_ni), | |
.flush_i(flush_tlb_i), | |
.enable_translation_i (enable_translation_i), | |
.en_ld_st_translation_i(en_ld_st_translation_i), | |
.asid_i (asid_i), | |
// from TLBs | |
// did we miss? | |
.itlb_access_i(itlb_lu_access), | |
.itlb_hit_i (itlb_lu_hit), | |
.itlb_vaddr_i (icache_areq_i.fetch_vaddr), | |
.dtlb_access_i(dtlb_lu_access), | |
.dtlb_hit_i (dtlb_lu_hit), | |
.dtlb_vaddr_i (lsu_vaddr_i), | |
// to TLBs, update logic | |
.itlb_update_o(update_itlb), | |
.dtlb_update_o(update_dtlb), | |
input logic clk_i, | |
input logic rst_ni, | |
input logic flush_i, | |
input logic enable_translation_i, | |
input logic en_ld_st_translation_i, // enable virtual memory translation for load/stores | |
// IF interface | |
input icache_arsp_t icache_areq_i, | |
output icache_areq_t icache_areq_o, | |
// LSU interface | |
// this is a more minimalistic interface because the actual addressing logic is handled | |
// in the LSU as we distinguish load and stores, what we do here is simple address translation | |
input exception_t misaligned_ex_i, | |
input logic lsu_req_i, // request address translation | |
input logic [riscv::VLEN-1:0] lsu_vaddr_i, // virtual address in | |
input logic lsu_is_store_i, // the translation is requested by a store | |
// if we need to walk the page table we can't grant in the same cycle | |
// Cycle 0 | |
output logic lsu_dtlb_hit_o, // sent in the same cycle as the request if translation hits in the DTLB | |
output logic [riscv::PPNW-1:0] lsu_dtlb_ppn_o, // ppn (send same cycle as hit) | |
// Cycle 1 | |
output logic lsu_valid_o, // translation is valid | |
output logic [riscv::PLEN-1:0] lsu_paddr_o, // translated address | |
output exception_t lsu_exception_o, // address translation threw an exception | |
// General control signals | |
input riscv::priv_lvl_t priv_lvl_i, | |
input riscv::priv_lvl_t ld_st_priv_lvl_i, | |
input logic sum_i, | |
input logic mxr_i, | |
// input logic flag_mprv_i, | |
input logic [riscv::PPNW-1:0] satp_ppn_i, | |
input logic [ASID_WIDTH-1:0] asid_i, | |
input logic [ASID_WIDTH-1:0] asid_to_be_flushed_i, | |
input logic [riscv::VLEN-1:0] vaddr_to_be_flushed_i, | |
input logic flush_tlb_i, |
core/mmu_unify/cva6_mmu.sv
Outdated
.itlb_miss_o(itlb_miss_o), | ||
.dtlb_miss_o(dtlb_miss_o), | ||
|
||
.shared_tlb_access_o(shared_tlb_access), | ||
.shared_tlb_hit_o (shared_tlb_hit), | ||
.shared_tlb_vaddr_o (shared_tlb_vaddr), | ||
|
||
.itlb_req_o (itlb_req), | ||
// to update shared tlb | ||
.shared_tlb_update_i(update_shared_tlb) | ||
); | ||
|
||
cva6_ptw #( | ||
.CVA6Cfg (CVA6Cfg), | ||
.ASID_WIDTH(ASID_WIDTH), | ||
.VPN_LEN(VPN_LEN), | ||
.PT_LEVELS(PT_LEVELS), | ||
.pte_cva6_t(pte_cva6_t), | ||
.tlb_update_cva6_t(tlb_update_cva6_t) | ||
) i_ptw ( | ||
.clk_i (clk_i), | ||
.rst_ni (rst_ni), | ||
.flush_i(flush_i), | ||
|
||
.ptw_active_o (ptw_active), | ||
.walking_instr_o (walking_instr), | ||
.ptw_error_o (ptw_error), | ||
.ptw_access_exception_o(ptw_access_exception), | ||
|
||
.lsu_is_store_i(lsu_is_store_i), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
.itlb_miss_o(itlb_miss_o), | |
.dtlb_miss_o(dtlb_miss_o), | |
.shared_tlb_access_o(shared_tlb_access), | |
.shared_tlb_hit_o (shared_tlb_hit), | |
.shared_tlb_vaddr_o (shared_tlb_vaddr), | |
.itlb_req_o (itlb_req), | |
// to update shared tlb | |
.shared_tlb_update_i(update_shared_tlb) | |
); | |
cva6_ptw #( | |
.CVA6Cfg (CVA6Cfg), | |
.ASID_WIDTH(ASID_WIDTH), | |
.VPN_LEN(VPN_LEN), | |
.PT_LEVELS(PT_LEVELS), | |
.pte_cva6_t(pte_cva6_t), | |
.tlb_update_cva6_t(tlb_update_cva6_t) | |
) i_ptw ( | |
.clk_i (clk_i), | |
.rst_ni (rst_ni), | |
.flush_i(flush_i), | |
.ptw_active_o (ptw_active), | |
.walking_instr_o (walking_instr), | |
.ptw_error_o (ptw_error), | |
.ptw_access_exception_o(ptw_access_exception), | |
.lsu_is_store_i(lsu_is_store_i), | |
output logic itlb_miss_o, | |
output logic dtlb_miss_o, |
core/mmu_unify/cva6_mmu.sv
Outdated
.req_port_i (req_port_i), | ||
.req_port_o (req_port_o), | ||
|
||
// to Shared TLB, update logic | ||
.shared_tlb_update_o(update_shared_tlb), | ||
|
||
.update_vaddr_o(update_vaddr), | ||
|
||
.asid_i(asid_i), | ||
|
||
// from shared TLB | ||
// did we miss? | ||
.shared_tlb_access_i(shared_tlb_access), | ||
.shared_tlb_hit_i (shared_tlb_hit), | ||
.shared_tlb_vaddr_i (shared_tlb_vaddr), | ||
|
||
.itlb_req_i(itlb_req), | ||
|
||
// from CSR file | ||
.satp_ppn_i(satp_ppn_i), // ppn from satp | ||
.mxr_i (mxr_i), | ||
|
||
// Performance counters | ||
.shared_tlb_miss_o(), //open for now | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
.req_port_i (req_port_i), | |
.req_port_o (req_port_o), | |
// to Shared TLB, update logic | |
.shared_tlb_update_o(update_shared_tlb), | |
.update_vaddr_o(update_vaddr), | |
.asid_i(asid_i), | |
// from shared TLB | |
// did we miss? | |
.shared_tlb_access_i(shared_tlb_access), | |
.shared_tlb_hit_i (shared_tlb_hit), | |
.shared_tlb_vaddr_i (shared_tlb_vaddr), | |
.itlb_req_i(itlb_req), | |
// from CSR file | |
.satp_ppn_i(satp_ppn_i), // ppn from satp | |
.mxr_i (mxr_i), | |
// Performance counters | |
.shared_tlb_miss_o(), //open for now | |
input dcache_req_o_t req_port_i, | |
output dcache_req_i_t req_port_o, |
core/mmu_unify/cva6_mmu.sv
Outdated
1'b1 | ||
}; | ||
end else begin | ||
lsu_exception_o = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
lsu_exception_o = { | |
// check for sufficient access privileges - throw a page fault if necessary | |
if (daccess_err) begin | |
lsu_exception_o = { | |
riscv::LOAD_PAGE_FAULT, | |
{{riscv::XLEN - riscv::VLEN{lsu_vaddr_q[riscv::VLEN-1]}}, lsu_vaddr_q}, | |
1'b1 | |
}; | |
// Check if any PMPs are violated | |
end else if (!pmp_data_allow) begin | |
lsu_exception_o = { | |
riscv::LD_ACCESS_FAULT, | |
lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN>riscv::VLEN)?(riscv::PLEN-riscv::VLEN) : 0], | |
1'b1 | |
}; | |
end | |
end | |
end else | |
// --------- | |
// DTLB Miss | |
// --------- | |
// watch out for exceptions | |
if (ptw_active && !walking_instr) begin | |
// page table walker threw an exception | |
if (ptw_error) begin | |
// an error makes the translation valid | |
lsu_valid_o = 1'b1; | |
// the page table walker can only throw page faults | |
if (lsu_is_store_q) begin | |
lsu_exception_o = { | |
riscv::STORE_PAGE_FAULT, | |
{{riscv::XLEN - riscv::VLEN{lsu_vaddr_q[riscv::VLEN-1]}}, update_vaddr}, | |
1'b1 | |
}; | |
end else begin | |
lsu_exception_o = { | |
riscv::LOAD_PAGE_FAULT, | |
{{riscv::XLEN - riscv::VLEN{lsu_vaddr_q[riscv::VLEN-1]}}, update_vaddr}, | |
1'b1 | |
}; | |
end | |
end | |
if (ptw_access_exception) begin | |
// an error makes the translation valid | |
lsu_valid_o = 1'b1; | |
// Any fault of the page table walk should be based of the original access type | |
lsu_exception_o = { |
core/mmu_unify/cva6_mmu.sv
Outdated
riscv::LOAD_PAGE_FAULT, | ||
{{riscv::XLEN - riscv::VLEN{lsu_vaddr_q[riscv::VLEN-1]}}, update_vaddr}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
riscv::LOAD_PAGE_FAULT, | |
{{riscv::XLEN - riscv::VLEN{lsu_vaddr_q[riscv::VLEN-1]}}, update_vaddr}, | |
riscv::LD_ACCESS_FAULT, | |
ptw_bad_paddr[riscv::PLEN-1:(riscv::PLEN>riscv::VLEN)?(riscv::PLEN-riscv::VLEN) : 0], |
core/mmu_unify/cva6_mmu.sv
Outdated
|
||
if (ptw_access_exception) begin | ||
// an error makes the translation valid | ||
lsu_valid_o = 1'b1; | ||
// Any fault of the page table walk should be based of the original access type | ||
lsu_exception_o = {riscv::LD_ACCESS_FAULT, ptw_bad_paddr[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; | ||
end | ||
end | ||
end // If translation is not enabled, check the paddr immediately against PMPs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
if (ptw_access_exception) begin | |
// an error makes the translation valid | |
lsu_valid_o = 1'b1; | |
// Any fault of the page table walk should be based of the original access type | |
lsu_exception_o = {riscv::LD_ACCESS_FAULT, ptw_bad_paddr[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; | |
end | |
end | |
end // If translation is not enabled, check the paddr immediately against PMPs | |
end // If translation is not enabled, check the paddr immediately against PMPs |
core/mmu_unify/cva6_mmu.sv
Outdated
if (lsu_is_store_q) begin | ||
lsu_exception_o = {riscv::ST_ACCESS_FAULT, lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; | ||
end else begin | ||
lsu_exception_o = {riscv::LD_ACCESS_FAULT, lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
if (lsu_is_store_q) begin | |
lsu_exception_o = {riscv::ST_ACCESS_FAULT, lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; | |
end else begin | |
lsu_exception_o = {riscv::LD_ACCESS_FAULT, lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0], 1'b1}; | |
if (lsu_is_store_q) begin | |
lsu_exception_o = { | |
riscv::ST_ACCESS_FAULT, | |
lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN>riscv::VLEN)?(riscv::PLEN-riscv::VLEN) : 0], | |
1'b1 | |
}; | |
end else begin | |
lsu_exception_o = { | |
riscv::LD_ACCESS_FAULT, | |
lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN>riscv::VLEN)?(riscv::PLEN-riscv::VLEN) : 0], | |
1'b1 | |
}; | |
end |
core/mmu_unify/cva6_mmu.sv
Outdated
end | ||
|
||
// Load/store PMP check | ||
pmp #( | ||
.CVA6Cfg (CVA6Cfg), | ||
.PLEN (riscv::PLEN), | ||
.PMP_LEN (riscv::PLEN - 2), | ||
.NR_ENTRIES(CVA6Cfg.NrPMPEntries) | ||
) i_pmp_data ( | ||
.addr_i (lsu_paddr_o), | ||
.priv_lvl_i (ld_st_priv_lvl_i), | ||
.access_type_i(pmp_access_type), | ||
// Configuration | ||
.conf_addr_i (pmpaddr_i), | ||
.conf_i (pmpcfg_i), | ||
.allow_o (pmp_data_allow) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
end | |
// Load/store PMP check | |
pmp #( | |
.CVA6Cfg (CVA6Cfg), | |
.PLEN (riscv::PLEN), | |
.PMP_LEN (riscv::PLEN - 2), | |
.NR_ENTRIES(CVA6Cfg.NrPMPEntries) | |
) i_pmp_data ( | |
.addr_i (lsu_paddr_o), | |
.priv_lvl_i (ld_st_priv_lvl_i), | |
.access_type_i(pmp_access_type), | |
// Configuration | |
.conf_addr_i (pmpaddr_i), | |
.conf_i (pmpcfg_i), | |
.allow_o (pmp_data_allow) | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
verible-verilog-format
core/mmu_unify/cva6_mmu.sv|541|
core/mmu_unify/cva6_mmu.sv|576|
core/mmu_unify/cva6_mmu.sv|582|
core/mmu_unify/cva6_mmu.sv|584|
core/mmu_unify/cva6_mmu.sv|627|
core/mmu_unify/cva6_ptw.sv|37|
core/mmu_unify/cva6_ptw.sv|102|
core/mmu_unify/cva6_ptw.sv|113|
core/mmu_unify/cva6_ptw.sv|139|
core/mmu_unify/cva6_ptw.sv|143|
core/mmu_unify/cva6_ptw.sv|146|
core/mmu_unify/cva6_ptw.sv|151|
core/mmu_unify/cva6_ptw.sv|156|
core/mmu_unify/cva6_ptw.sv|189|
core/mmu_unify/cva6_ptw.sv|247|
core/mmu_unify/cva6_ptw.sv|328|
core/mmu_unify/cva6_ptw.sv|392|
core/mmu_unify/cva6_shared_tlb.sv|167|
core/mmu_unify/cva6_tlb.sv|204|
core/mmu_unify/cva6_tlb.sv|247|
core/mmu_unify/cva6_mmu.sv
Outdated
// PMP | ||
input riscv::pmpcfg_t [15:0] pmpcfg_i, | ||
input logic [15:0][riscv::PLEN-3:0] pmpaddr_i | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
); | |
); |
core/mmu_unify/cva6_mmu.sv
Outdated
input logic [15:0][riscv::PLEN-3:0] pmpaddr_i | ||
); | ||
|
||
// memory management, pte for cva6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
// memory management, pte for cva6 | |
// memory management, pte for cva6 |
core/mmu_unify/cva6_mmu.sv
Outdated
// typedef struct packed { | ||
logic [riscv::PPNW-1:0] ppn; // PPN length for | ||
logic [1:0] rsw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
// typedef struct packed { | |
logic [riscv::PPNW-1:0] ppn; // PPN length for | |
logic [1:0] rsw; | |
// typedef struct packed { | |
logic [riscv::PPNW-1:0] ppn; // PPN length for | |
logic [1:0] rsw; |
core/mmu_unify/cva6_mmu.sv
Outdated
logic w; | ||
logic r; | ||
logic v; | ||
} ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
} ; | |
}; |
core/mmu_unify/cva6_mmu.sv
Outdated
// typedef struct packed { | ||
logic valid; // valid flag | ||
logic [PT_LEVELS-2:0] is_page; // | ||
logic [VPN_LEN-1:0] vpn; // | ||
logic [ASID_LEN-1:0] asid; // | ||
pte_cva6_t content; | ||
} ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
// typedef struct packed { | |
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; | |
} ; | |
// typedef struct packed { | |
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; | |
}; |
core/mmu_unify/cva6_mmu.sv
Outdated
generate | ||
|
||
for (i=0; i < PT_LEVELS-1; i++) begin | ||
assign lsu_paddr_o [PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | ||
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | ||
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | ||
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; | ||
|
||
assign lsu_dtlb_ppn_o[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | ||
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | ||
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | ||
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
generate | |
for (i=0; i < PT_LEVELS-1; i++) begin | |
assign lsu_paddr_o [PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; | |
assign lsu_dtlb_ppn_o[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | |
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? | |
generate | |
for (i = 0; i < PT_LEVELS - 1; i++) begin | |
assign lsu_paddr_o [PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; | |
assign lsu_dtlb_ppn_o[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] = // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? |
core/mmu_unify/cva6_mmu.sv
Outdated
(VPN_LEN/PT_LEVELS)'(lsu_vaddr_n[((riscv::PLEN > riscv::VLEN) ? riscv::VLEN -1 : (24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-1) ) -1): (riscv::PLEN > riscv::VLEN) ? 24 :24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-2)])); | ||
end | ||
if(riscv::IS_XLEN64) begin | ||
assign lsu_dtlb_ppn_o[riscv::PPNW-1:PPNWMin+1] = (en_ld_st_translation_i && !misaligned_ex_q.valid) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
(VPN_LEN/PT_LEVELS)'(lsu_vaddr_n[((riscv::PLEN > riscv::VLEN) ? riscv::VLEN -1 : (24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-1) ) -1): (riscv::PLEN > riscv::VLEN) ? 24 :24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-2)])); | |
end | |
if(riscv::IS_XLEN64) begin | |
assign lsu_dtlb_ppn_o[riscv::PPNW-1:PPNWMin+1] = (en_ld_st_translation_i && !misaligned_ex_q.valid) ? | |
(VPN_LEN/PT_LEVELS)'(lsu_vaddr_n[((riscv::PLEN > riscv::VLEN) ? riscv::VLEN -1 : (24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-1) ) -1): (riscv::PLEN > riscv::VLEN) ? 24 :24 + (VPN_LEN/PT_LEVELS)*(PT_LEVELS-i-2)])); | |
end | |
if (riscv::IS_XLEN64) begin | |
assign lsu_dtlb_ppn_o[riscv::PPNW-1:PPNWMin+1] = (en_ld_st_translation_i && !misaligned_ex_q.valid) ? |
core/mmu_unify/cva6_mmu.sv
Outdated
assign lsu_dtlb_ppn_o[riscv::PPNW-1:PPNWMin+1] = (en_ld_st_translation_i && !misaligned_ex_q.valid) ? | ||
dtlb_content.ppn[riscv::PPNW-1:PPNWMin+1] : | ||
lsu_vaddr_n[riscv::PLEN-1:PPNWMin+1] ; | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
end | |
end |
core/mmu_unify/cva6_mmu.sv
Outdated
lsu_vaddr_n[riscv::PLEN-1:PPNWMin+1] ; | ||
end | ||
|
||
endgenerate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
endgenerate | |
endgenerate |
// Check if any PMPs are violated | ||
end else if (!pmp_data_allow) begin | ||
lsu_exception_o = { | ||
riscv::ST_ACCESS_FAULT, riscv::XLEN'(lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0]), 1'b1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
riscv::ST_ACCESS_FAULT, riscv::XLEN'(lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0]), 1'b1 | |
riscv::ST_ACCESS_FAULT, | |
riscv::XLEN'(lsu_paddr_o[riscv::PLEN-1:(riscv::PLEN > riscv::VLEN) ? (riscv::PLEN - riscv::VLEN) : 0]), | |
1'b1 |
core/mmu_unify/cva6_mmu.sv
Outdated
logic [riscv::PPNW-1:0] ppn; // PPN length for | ||
logic [1:0] rsw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
logic [riscv::PPNW-1:0] ppn; // PPN length for | |
logic [1:0] rsw; | |
logic [riscv::PPNW-1:0] ppn; // PPN length for | |
logic [1:0] rsw; |
core/mmu_unify/cva6_mmu.sv
Outdated
logic valid; // valid flag | ||
logic [PT_LEVELS-2:0] is_page; // | ||
logic [VPN_LEN-1:0] vpn; // | ||
logic [ASID_LEN-1:0] asid; // | ||
pte_cva6_t content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; | |
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; |
core/mmu_unify/cva6_mmu.sv
Outdated
|
||
for (i=0; i < PT_LEVELS-1; i++) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
for (i=0; i < PT_LEVELS-1; i++) begin | |
for (i = 0; i < PT_LEVELS - 1; i++) begin |
core/mmu_unify/cva6_mmu.sv
Outdated
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | ||
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | ||
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | ||
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | ||
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]==0)) ? // | |
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_content.ppn[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1] : // | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0]!=0)? |
core/mmu_unify/cva6_ptw.sv
Outdated
// pointer to next level of page table | ||
|
||
if (ptw_lvl_q == PT_LEVELS-1) begin | ||
// Should already be the last level page table => Error | ||
ptw_lvl_n = PT_LEVELS-1; | ||
state_d = PROPAGATE_ERROR; | ||
end | ||
else begin | ||
// if (ptw_lvl_q == 1) begin | ||
// we are in the second level now | ||
ptw_lvl_n = ptw_lvl_q+1; | ||
ptw_pptr_n = {pte.ppn, vaddr_lvl[ptw_lvl_q], (PT_LEVELS)'(0)}; | ||
state_d = WAIT_GRANT; | ||
// end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
// pointer to next level of page table | |
if (ptw_lvl_q == PT_LEVELS-1) begin | |
// Should already be the last level page table => Error | |
ptw_lvl_n = PT_LEVELS-1; | |
state_d = PROPAGATE_ERROR; | |
end | |
else begin | |
// if (ptw_lvl_q == 1) begin | |
// we are in the second level now | |
ptw_lvl_n = ptw_lvl_q+1; | |
ptw_pptr_n = {pte.ppn, vaddr_lvl[ptw_lvl_q], (PT_LEVELS)'(0)}; | |
state_d = WAIT_GRANT; | |
// end | |
end | |
// pointer to next level of page table | |
if (ptw_lvl_q == PT_LEVELS - 1) begin | |
// Should already be the last level page table => Error | |
ptw_lvl_n = PT_LEVELS - 1; | |
state_d = PROPAGATE_ERROR; | |
end else begin | |
// if (ptw_lvl_q == 1) begin | |
// we are in the second level now | |
ptw_lvl_n = ptw_lvl_q + 1; | |
ptw_pptr_n = {pte.ppn, vaddr_lvl[ptw_lvl_q], (PT_LEVELS)'(0)}; | |
state_d = WAIT_GRANT; | |
// end | |
end |
core/mmu_unify/cva6_ptw.sv
Outdated
else state_d = LATENCY; | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
itlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : // | ||
((en_ld_st_translation_i & dtlb_access_i & ~dtlb_hit_i) ? // | ||
dtlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : vpn_q[w]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
itlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : // | |
((en_ld_st_translation_i & dtlb_access_i & ~dtlb_hit_i) ? // | |
dtlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : vpn_q[w]); | |
itlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : // | |
((en_ld_st_translation_i & dtlb_access_i & ~dtlb_hit_i) ? // | |
dtlb_vaddr_i[12+((VPN_LEN/PT_LEVELS)*(w+1))-1:12+((VPN_LEN/PT_LEVELS)*w)] : vpn_q[w]); |
for (int unsigned i = 0; i < TLB_ENTRIES; i++) begin | ||
// we got a hit so update the pointer as it was least recently used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
for (int unsigned i = 0; i < TLB_ENTRIES; i++) begin | |
// we got a hit so update the pointer as it was least recently used | |
for ( | |
int unsigned i = 0; i < TLB_ENTRIES; i++ | |
) begin | |
// we got a hit so update the pointer as it was least recently used |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
✔️ successful run, report available here. |
2 similar comments
✔️ successful run, report available here. |
✔️ successful run, report available here. |
✔️ successful run, report available here. |
core/mmu_unify/cva6_mmu.sv
Outdated
// memory management, pte for cva6 | ||
localparam type pte_cva6_t = struct packed { | ||
logic [riscv::PPNW-1:0] ppn; // PPN length for | ||
logic [1:0] rsw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
logic [1:0] rsw; | |
logic [1:0] rsw; |
core/mmu_unify/cva6_mmu.sv
Outdated
logic valid; // valid flag | ||
logic [PT_LEVELS-2:0] is_page; // | ||
logic [VPN_LEN-1:0] vpn; // | ||
logic [ASID_LEN-1:0] asid; // | ||
pte_cva6_t content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; | |
logic valid; // valid flag | |
logic [PT_LEVELS-2:0] is_page; // | |
logic [VPN_LEN-1:0] vpn; // | |
logic [ASID_LEN-1:0] asid; // | |
pte_cva6_t content; |
✔️ successful run, report available here. |
core/mmu_unify/cva6_mmu.sv
Outdated
|
||
for (i = 0; i < PT_LEVELS - 1; i++) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
for (i = 0; i < PT_LEVELS - 1; i++) begin | |
for (i = 0; i < PT_LEVELS - 1; i++) begin |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | ||
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | ||
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; | |
(en_ld_st_translation_i && !misaligned_ex_q.valid && (|dtlb_is_page_q[i:0] == 0)) ? // | |
dtlb_pte_q.ppn [(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i))-1):(riscv::PPNW - (riscv::PLEN - PPNWMin-1)-((VPN_LEN/PT_LEVELS)*(i+1)))] : // | |
lsu_vaddr_q[PPNWMin-((VPN_LEN/PT_LEVELS)*(i)):PPNWMin-((VPN_LEN/PT_LEVELS)*(i+1))+1]; |
core/mmu_unify/cva6_ptw.sv
Outdated
// this is a pointer to the next TLB level | ||
end else begin | ||
// pointer to next level of page table | ||
if (ptw_lvl_q == PT_LEVELS-1) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
if (ptw_lvl_q == PT_LEVELS-1) begin | |
if (ptw_lvl_q == PT_LEVELS - 1) begin |
core/mmu_unify/cva6_ptw.sv
Outdated
// pointer to next level of page table | ||
if (ptw_lvl_q == PT_LEVELS-1) begin | ||
// Should already be the last level page table => Error | ||
ptw_lvl_n = PT_LEVELS-1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
ptw_lvl_n = PT_LEVELS-1; | |
ptw_lvl_n = PT_LEVELS - 1; |
core/mmu_unify/cva6_ptw.sv
Outdated
end | ||
else begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
end | |
else begin | |
end else begin |
core/mmu_unify/cva6_ptw.sv
Outdated
end | ||
else begin | ||
// we are in the second level now | ||
ptw_lvl_n = ptw_lvl_q+1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
ptw_lvl_n = ptw_lvl_q+1; | |
ptw_lvl_n = ptw_lvl_q + 1; |
✔️ successful run, report available here. |
lsu_vaddr_n[23:12]; | ||
|
||
genvar i; | ||
generate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶
generate | |
generate |
Merge of sv32 and sv39 MMUs.
Parametrization strategy followed for new parameters.