From 8b00f4f2e8168737672ba9d199c880cd2c71e229 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 12 Dec 2021 20:45:49 +0000 Subject: [PATCH] when an exception happens, if it is a fetch_failed take the exception from the MMU not from LDST. at some point need a much more sophisticated way of detecting which unit created which exception --- src/soc/simple/issuer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/soc/simple/issuer.py b/src/soc/simple/issuer.py index 3d285baa..6f822726 100644 --- a/src/soc/simple/issuer.py +++ b/src/soc/simple/issuer.py @@ -892,7 +892,14 @@ class TestIssuerInternal(Elaboratable): # nothing else needs to be done other than to note # the change of PC and MSR (and, later, SVSTATE) with m.If(exc_happened): - sync += pdecode2.ldst_exc.eq(core.fus.get_exc("ldst0")) + mmu = core.fus.get_exc("mmu0") + ldst = core.fus.get_exc("ldst0") + with m.If(fetch_failed): + # instruction fetch: exception is from MMU + sync += pdecode2.ldst_exc.eq(mmu) + with m.Else(): + # otherwise assume it was a LDST exception + sync += pdecode2.ldst_exc.eq(ldst) with m.If(exec_pc_o_valid): -- 2.30.2