LOAD STORE operations must generate exceptions on failures. these need to be identified, added to PortInterface, and implemented.
STORE operation fill fail if one tries to write to ROM. Both LOAD and STORE operations will fail if the address is outside the range that can be accessed. If the MMU is enabled, dereferencing a NULL pointer will create an exception. I propose to add an enum to PortInterface that captures the possible exception reasons: 0 for no error 1 for an invalid address 2 when attempting to write to ROM 3 page fault ..... there is an "exception if rolls" comment in soc/src/soc/scoreboard/addr_split.py which needs to be implemented properly. Currently this sets a single bit that is ignored.
yes, agreed. what i would like to do is study what microwatt does, what errors occur, from dcache.vhdl and loadstore.vhdl. this will also tell us clearly what types of exceptions need to be generated.
i just realised, this is going to need microwatt load-store (dcache path) error flags, but not instruction (icache) error flags because that is a totally diffwrent path. https://git.libre-soc.org/?p=soc.git;a=blob;f=src/soc/experiment/mem_types.py;hb=HEAD it's going to be the fields from this: MMUToLoadStore1Type
e_out.exception <= exception; e_out.alignment <= r.align_intr; e_out.instr_fault <= r.instr_fault; e_out.invalid <= m_in.invalid; e_out.badtree <= m_in.badtree; e_out.perm_error <= m_in.perm_error; e_out.rc_error <= m_in.rc_error; e_out.segment_fault <= m_in.segerr; if exception = '1' and r.instr_fault = '0' then v.dar := addr; if m_in.segerr = '0' and r.align_intr = '0' then v.dsisr := dsisr; end if; end if;
*** Bug 302 has been marked as a duplicate of this bug. ***
commit 0554b11cfc7dbbfa2022ca304b193b91b6c39c04 (HEAD -> master) Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net> Date: Tue Oct 6 14:03:53 2020 +0100 add LDSTException to PortInterface
commit 3df06e5cc2009b5918db8eee43785d1fc1f15866 (HEAD -> master, origin/master) Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net> Date: Tue Oct 6 16:07:32 2020 +0100 add LDSTException decode/handling in PowerDecoder2
commit 20afbd096e75c1fa88f6ba07a5d7804b76b8a971 (HEAD -> master) Author: Luke Kenneth Casson Leighton <lkcl@lkcl.net> Date: Tue Oct 6 16:58:14 2020 +0100 add SRR1 setting for LDST memory exception trap
the path needs much better comments, how the exception gets through to SRR1
slowly getting there. most of the cases now added: instruction fault, misalign, mmu invalid/perm_error etc.