# after a failed LD/ST.
with m.If(exc.happened):
with m.If(exc.alignment):
- self.trap(m, TT.MEMEXC, 0x600)
+ self.trap(m, TT.PRIV, 0x600)
with m.Elif(exc.instr_fault):
with m.If(exc.segment_fault):
- self.trap(m, TT.MEMEXC, 0x480)
+ self.trap(m, TT.PRIV, 0x480)
with m.Else():
- # TODO
- #srr1(63 - 33) <= exc.invalid;
- #srr1(63 - 35) <= exc.perm_error; -- noexec fault
- #srr1(63 - 44) <= exc.badtree;
- #srr1(63 - 45) <= exc.rc_error;
- self.trap(m, TT.MEMEXC, 0x400)
+ #spass exception info to trap to create SRR1
+ self.trap(m, TT.MEMEXC, 0x400, exc)
with m.Else():
with m.If(exc.segment_fault):
- self.trap(m, TT.MEMEXC, 0x380)
+ self.trap(m, TT.PRIV, 0x380)
with m.Else():
- self.trap(m, TT.MEMEXC, 0x300)
+ self.trap(m, TT.PRIV, 0x300)
# decrement counter (v3.0B p1099): TODO 32-bit version (MSR.LPCR)
with m.Elif(dec_irq_ok):
return m
- def trap(self, m, traptype, trapaddr):
+ def trap(self, m, traptype, trapaddr, exc=None):
"""trap: this basically "rewrites" the decoded instruction as a trap
"""
comb = m.d.comb
comb += self.do_copy("fn_unit", Function.TRAP, True)
comb += self.do_copy("trapaddr", trapaddr >> 4, True) # bottom 4 bits
comb += self.do_copy("traptype", traptype, True) # request type
+ comb += self.do_copy("ldst_exc", exc, True) # request type
comb += self.do_copy("msr", self.state.msr, True) # copy of MSR "state"
comb += self.do_copy("cia", self.state.pc, True) # copy of PC "state"