mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-23 05:37:16 -04:00
Add page fault exceptions to displayer
This commit is contained in:
parent
74aad5fbae
commit
c48f160021
3 changed files with 16 additions and 11 deletions
|
@ -192,6 +192,7 @@ module ariane
|
|||
// CSR <-> *
|
||||
// --------------
|
||||
logic enable_translation_csr_ex;
|
||||
priv_lvl_t ld_st_priv_lvl_csr_ex;
|
||||
logic sum_csr_ex;
|
||||
logic mxr_csr_ex;
|
||||
logic [43:0] satp_ppn_csr_ex;
|
||||
|
|
|
@ -144,6 +144,9 @@ module commit_stage (
|
|||
ENV_CALL_UMODE: cause = "Environment Call User Mode";
|
||||
ENV_CALL_SMODE: cause = "Environment Call Supervisor Mode";
|
||||
ENV_CALL_MMODE: cause = "Environment Call Machine Mode";
|
||||
INSTR_PAGE_FAULT: cause = "Instruction Page Fault";
|
||||
LOAD_PAGE_FAULT: cause = "Load Page Fault";
|
||||
STORE_PAGE_FAULT: cause = "Store Page Fault";
|
||||
default: cause = "Interrupt";
|
||||
endcase
|
||||
$display("Exception @%t, PC: %0h, TVal: %0h, Cause: %s", $time, commit_instr_i.pc, exception_o.tval, cause);
|
||||
|
|
23
src/mmu.sv
23
src/mmu.sv
|
@ -207,14 +207,14 @@ module mmu #(
|
|||
// Exceptions are always signaled together with the fetch_valid_o signal
|
||||
always_comb begin : instr_interface
|
||||
// MMU disabled: just pass through
|
||||
instr_if_data_req_o = fetch_req_i;
|
||||
fetch_paddr = fetch_vaddr_i; // play through in case we disabled address translation
|
||||
fetch_gnt_o = instr_if_data_gnt_i;
|
||||
// two potential error sources:
|
||||
instr_if_data_req_o = fetch_req_i;
|
||||
fetch_paddr = fetch_vaddr_i; // play through in case we disabled address translation
|
||||
fetch_gnt_o = instr_if_data_gnt_i;
|
||||
// two potential exception sources:
|
||||
// 1. HPTW threw an exception -> signal with a page fault exception
|
||||
// 2. We got an access error because of insufficient permissions -> throw an access exception
|
||||
fetch_ex_n = '0;
|
||||
ierr_valid_n = 1'b0;
|
||||
fetch_ex_n = '0;
|
||||
ierr_valid_n = 1'b0; // we keep a separate valid signal in case of an error
|
||||
|
||||
// MMU enabled: address from TLB, request delayed until hit. Error when TLB
|
||||
// hit and no access right or TLB hit and translated address not valid (e.g.
|
||||
|
@ -222,19 +222,18 @@ module mmu #(
|
|||
// an error.
|
||||
if (enable_translation_i) begin
|
||||
instr_if_data_req_o = 1'b0;
|
||||
|
||||
// 4K page
|
||||
fetch_paddr = {itlb_content.ppn, fetch_vaddr_i[11:0]};
|
||||
// this is a mega page
|
||||
// Mega page
|
||||
if (itlb_is_2M) begin
|
||||
fetch_paddr[20:12] = fetch_vaddr_i[20:12];
|
||||
end
|
||||
// this is a giga page
|
||||
// Giga page
|
||||
if (itlb_is_1G) begin
|
||||
fetch_paddr[29:12] = fetch_vaddr_i[29:12];
|
||||
end
|
||||
|
||||
fetch_gnt_o = instr_if_data_gnt_i;
|
||||
|
||||
// ---------
|
||||
// ITLB Hit
|
||||
// --------
|
||||
|
@ -265,9 +264,11 @@ module mmu #(
|
|||
// the fetch is valid if we either got an error in the previous cycle or the I$ gave us a valid signal.
|
||||
fetch_valid_o = instr_if_data_rvalid_i || ierr_valid_q;
|
||||
end
|
||||
|
||||
//-----------------------
|
||||
// Data interface
|
||||
// Data Interface
|
||||
//-----------------------
|
||||
// The data interface is simpler and only consists of a request/response interface
|
||||
always_comb begin : data_interface
|
||||
// stub
|
||||
// lsu_req_i
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue