# fetch action ack trap
i = If((ft.action == FA.ack_trap) | (ft.action == FA.noerror_trap),
[self.handle_trap.eq(1),
- self.regs.w_en.eq(0) # no writing to registers
]
)
i = i.Elif((dc.act & (DA.fence | DA.fence_i |
DA.store | DA.branch)) != 0,
# do nothing
- self.regs.w_en.eq(0) # no writing to registers
)
return i
self.reset = ResetSignal()
self.handle_trap = Signal()
- self.trap_handled = Signal()
self.ft_action = Signal(fetch_action)
self.dc_action = Signal(decode_action)
self.dc_immediate = Signal(32)
s.append(i)
- self.sync += If(self.handle_trap,
- [s, self.trap_handled.eq(1)]
- ).Else(
- self.trap_handled.eq(0)
- )
+ self.sync += If(self.handle_trap, s)
if __name__ == "__main__":
print(verilog.convert(example,
{
example.handle_trap,
- example.trap_handled,
example.ft_action,
example.dc_immediate,
example.mcause,