whoops missed out branch_taken logic from fetch_action
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 26 Nov 2018 11:12:54 +0000 (11:12 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 26 Nov 2018 11:12:54 +0000 (11:12 +0000)
cpu.py

diff --git a/cpu.py b/cpu.py
index 7150968bda422e1cac82a9f29341b360e8731ef0..5206b34d8347896905d3581de3159eb71cf96f76 100644 (file)
--- 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