# use this in the simulator
class PIb:
+ INVALID = 33 # 1 for an invalid mem err
+ PERMERR = 35 # 1 for an permanent mem err
TM_BAD_THING = 42 # 1 for a TM Bad Thing type interrupt
FP = 43 # 1 if FP exception
ILLEG = 44 # 1 if illegal instruction (not doing hypervisor)
# 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;
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):
from soc.fu.trap.pipe_data import TrapInputData, TrapOutputData
from soc.fu.branch.main_stage import br_ext
from soc.decoder.power_enums import MicrOp
+from soc.experiment.mem_types import LDSTException
from soc.decoder.power_fields import DecodeFields
from soc.decoder.power_fieldsn import SignalBitRange
comb += srr1_o.data[PI.FP].eq(1)
with m.If(traptype & TT.ADDR):
comb += srr1_o.data[PI.ADR].eq(1)
+ with m.If(traptype & TT.MEMEXC):
+ # decode exception bits, store in SRR1
+ exc = LDSTException("trapexc")
+ comb += exc.eq(op.ldst_exc)
+ comb += srr1_o.data[PI.INVALID].eq(exc.invalid)
+ comb += srr1_o.data[PI.PERMERR].eq(exc.perm_error)
+ comb += srr1_o.data[PI.ILLEG].eq(exc.badtree)
+ comb += srr1_o.data[PI.PRIV].eq(exc.rc_error)
with m.If(traptype & TT.EINT):
# do nothing unusual? see 3.0B Book III 6.5.7 p1073
pass