LDSTException now passing bits of SRR1 around to the Trap Pipeline
[soc.git] / src / soc / fu / ldst / loadstore.py
index d0beddedbf6d4571d24dfdff0045a9deb59ef077..2b883d0d529c1ce77bf2001668de9058cdcc28fe 100644 (file)
@@ -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)