Remove access exception - everything is a PF

This commit is contained in:
Florian Zaruba 2017-09-10 18:34:31 +02:00
parent e0de70e02b
commit b74d776a13
2 changed files with 15 additions and 11 deletions

View file

@ -260,7 +260,7 @@ module mmu #(
ierr_valid_n = 1'b1; ierr_valid_n = 1'b1;
end end
// throw a page fault // throw a page fault
fetch_exception = {INSTR_ACCESS_FAULT, fetch_vaddr_i, 1'b1}; fetch_exception = {INSTR_PAGE_FAULT, fetch_vaddr_i, 1'b1};
end end
end else end else
// --------- // ---------
@ -372,16 +372,14 @@ module mmu #(
// this is a store // this is a store
if (lsu_is_store_q) begin if (lsu_is_store_q) begin
// check if the page is write-able and we are not violating privileges // check if the page is write-able and we are not violating privileges
if (!dtlb_pte_q.w || daccess_err) begin // also check if the dirty flag is set
lsu_exception_o = {ST_ACCESS_FAULT, lsu_vaddr_q, 1'b1}; if (!dtlb_pte_q.w || daccess_err || !dtlb_pte_q.d) begin
end
// check if the dirty flag is set
if (!dtlb_pte_q.d) begin
lsu_exception_o = {STORE_PAGE_FAULT, lsu_vaddr_q, 1'b1}; lsu_exception_o = {STORE_PAGE_FAULT, lsu_vaddr_q, 1'b1};
end end
// this is a load, check for sufficient access privileges
// this is a load, check for sufficient access privileges - throw a page fault if necessary
end else if (daccess_err) begin end else if (daccess_err) begin
lsu_exception_o = {LD_ACCESS_FAULT, lsu_vaddr_q, 1'b1}; lsu_exception_o = {LOAD_PAGE_FAULT, lsu_vaddr_q, 1'b1};
end end
end else end else

View file

@ -42,7 +42,13 @@ class exception_trace_item;
INSTR_PAGE_FAULT: this.cause_s = "Instruction Page Fault"; INSTR_PAGE_FAULT: this.cause_s = "Instruction Page Fault";
LOAD_PAGE_FAULT: this.cause_s = "Load Page Fault"; LOAD_PAGE_FAULT: this.cause_s = "Load Page Fault";
STORE_PAGE_FAULT: this.cause_s = "Store Page Fault"; STORE_PAGE_FAULT: this.cause_s = "Store Page Fault";
default: this.cause = "Interrupt"; S_SW_INTERRUPT: this.cause_s = "Supervisor Software Interrupt";
M_SW_INTERRUPT: this.cause_s = "Machine Software Interrupt";
S_TIMER_INTERRUPT: this.cause_s = "Supervisor Timer Interrupt";
M_TIMER_INTERRUPT: this.cause_s = "Machine Timer Interrupt";
S_EXT_INTERRUPT: this.cause_s = "Supervisor External Interrupt";
M_EXT_INTERRUPT: this.cause_s = "Machine External Interrupt";
default: this.cause_s = "Interrupt";
endcase endcase
this.tval = tval; this.tval = tval;
@ -52,8 +58,8 @@ class exception_trace_item;
function string printException(); function string printException();
string s; string s;
s = $sformatf("Exception @%10t, PC: %h, Cause: %s", $time, this.pc, this.cause_s); s = $sformatf("Exception @%10t, PC: %h, Cause: %s", $time, this.pc, this.cause_s);
// write out tval if it wasn't an environment call, in that case the tval field has no meaning // write out tval if it wasn't an environment call or interrupt, in that case the tval field has no meaning
if (!(this.cause inside {ENV_CALL_MMODE, ENV_CALL_SMODE, ENV_CALL_UMODE})) if (!(this.cause inside {ENV_CALL_MMODE, ENV_CALL_SMODE, ENV_CALL_UMODE, S_SW_INTERRUPT, M_SW_INTERRUPT, S_TIMER_INTERRUPT, M_TIMER_INTERRUPT, S_EXT_INTERRUPT, M_EXT_INTERRUPT}))
s = $sformatf("%s, \n\t\t\t\ttval: %h", s, this.tval); s = $sformatf("%s, \n\t\t\t\ttval: %h", s, this.tval);
return s; return s;
endfunction endfunction