From: Luke Kenneth Casson Leighton Date: Tue, 25 Jan 2022 00:42:44 +0000 (+0000) Subject: LDSTException now passing bits of SRR1 around to the Trap Pipeline X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=90c5d19398f6f28272f320e078b94afa965f58a3;p=soc.git LDSTException now passing bits of SRR1 around to the Trap Pipeline the actual (former) value of SRR1 is not what is supposed to be used: the use of the variable "srr1" is a moniker from microwatt --- diff --git a/src/soc/fu/ldst/loadstore.py b/src/soc/fu/ldst/loadstore.py index d0bedded..2b883d0d 100644 --- a/src/soc/fu/ldst/loadstore.py +++ b/src/soc/fu/ldst/loadstore.py @@ -412,6 +412,12 @@ class LoadStore1(PortInterfaceBase): comb += exc.perm_error.eq(m_in.perm_error) comb += exc.rc_error.eq(m_in.rc_error) comb += exc.segment_fault.eq(m_in.segerr) + # conditions for 0x400 trap need these in SRR1 + with m.If(exception & ~exc.alignment & exc.instr_fault): + comb += exc.srr1[14].eq(exc.invalid) # 47-33 + comb += exc.srr1[12].eq(exc.perm_error) # 47-35 + comb += exc.srr1[3].eq(exc.badtree) # 47-44 + comb += exc.srr1[2].eq(exc.rc_error) # 47-45 # TODO, connect dcache wb_in/wb_out to "standard" nmigen Wishbone bus comb += dbus.adr.eq(dcache.bus.adr) diff --git a/src/soc/fu/trap/main_stage.py b/src/soc/fu/trap/main_stage.py index 9eb85887..f0da82b9 100644 --- a/src/soc/fu/trap/main_stage.py +++ b/src/soc/fu/trap/main_stage.py @@ -67,7 +67,9 @@ class TrapMainStage(PipeModBase): msr_i = op.msr svstate_i = op.svstate - srr1_i = self.i.srr1 + exc = LDSTException("trapexc") + comb += exc.eq(op.ldst_exc) + srr1_i = exc.srr1 # new SRR1 bits come from exception nia_o = self.o.nia svsrr0_o, srr0_o, srr1_o = self.o.svsrr0, self.o.srr0, self.o.srr1 diff --git a/src/soc/fu/trap/trap_input_record.py b/src/soc/fu/trap/trap_input_record.py index 521ab590..107bc0f4 100644 --- a/src/soc/fu/trap/trap_input_record.py +++ b/src/soc/fu/trap/trap_input_record.py @@ -20,7 +20,7 @@ class CompTrapOpSubset(CompOpSubsetBase): ('is_32bit', 1), ('traptype', TT.size), # see trap main_stage.py, PowerDecoder2 ('trapaddr', 13), - ('ldst_exc', len(LDSTException._exc_types)), + ('ldst_exc', LDSTException.length), # blech ] super().__init__(layout, name=name)