X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=cpu.py;fp=cpu.py;h=5206b34d8347896905d3581de3159eb71cf96f76;hb=6b9590fb047497743ba888c12b73617fec767712;hp=7150968bda422e1cac82a9f29341b360e8731ef0;hpb=fdb8299f8fe529c7b4c0a07825f5d8c183a03444;p=rv32.git diff --git a/cpu.py b/cpu.py index 7150968..5206b34 100644 --- a/cpu.py +++ b/cpu.py @@ -224,11 +224,15 @@ class Fetch: # branch -> misaligned=error, otherwise jump i = i.Elif((dc.act & DA.branch) != 0, - If(misaligned_jump_target, - self.action.eq(FA.error_trap) - ).Else( - self.action.eq(FA.jump) - ) + If(branch_taken, + If(misaligned_jump_target, + self.action.eq(FA.error_trap) + ).Else( + self.action.eq(FA.jump) + ) + ).Else( + self.action.eq(FA.default) + ) ) # jal/jalr -> misaligned=error, otherwise jump