From 6b9590fb047497743ba888c12b73617fec767712 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 26 Nov 2018 11:12:54 +0000 Subject: [PATCH] whoops missed out branch_taken logic from fetch_action --- cpu.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 -- 2.30.2