From 1e4936c6c5770d3614f2dd35a719c00e19c125a1 Mon Sep 17 00:00:00 2001 From: Marek Materzok Date: Tue, 26 Nov 2024 12:30:37 +0100 Subject: [PATCH 1/2] Delay flush by one cycle --- coreblocks/backend/retirement.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/coreblocks/backend/retirement.py b/coreblocks/backend/retirement.py index 38c45040c..fce0956b2 100644 --- a/coreblocks/backend/retirement.py +++ b/coreblocks/backend/retirement.py @@ -2,7 +2,6 @@ from coreblocks.interface.layouts import RetirementLayouts from transactron.core import Method, Transaction, TModule, def_method -from transactron.lib.simultaneous import condition from transactron.utils.dependencies import DependencyContext from transactron.lib.metrics import * @@ -180,15 +179,8 @@ def flush_instr(rob_entry): # Normally retire all non-trap instructions m.d.av_comb += commit.eq(1) - # Condition is used to avoid FRAT locking during normal operation - with condition(m) as cond: - with cond(commit): - retire_instr(rob_entry) - with cond(): - # Not using default condition, because we want to block if branch is not ready - flush_instr(rob_entry) - - m.d.comb += core_flushing.eq(1) + with m.If(commit): + retire_instr(rob_entry) validate_transaction.schedule_before(retire_transaction) From 32b3bebde1f6b51d7072cb04b498c330722d2da2 Mon Sep 17 00:00:00 2001 From: Marek Materzok Date: Tue, 26 Nov 2024 13:01:34 +0100 Subject: [PATCH 2/2] Remove core_flushing signal --- coreblocks/backend/retirement.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/coreblocks/backend/retirement.py b/coreblocks/backend/retirement.py index fce0956b2..1621ed382 100644 --- a/coreblocks/backend/retirement.py +++ b/coreblocks/backend/retirement.py @@ -114,7 +114,6 @@ def flush_instr(rob_entry): continue_pc_override = Signal() continue_pc = Signal(self.gen_params.isa.xlen) - core_flushing = Signal() with m.FSM("NORMAL") as fsm: with m.State("NORMAL"): @@ -197,8 +196,6 @@ def flush_instr(rob_entry): with m.If(core_empty): m.next = "TRAP_RESUME" - m.d.comb += core_flushing.eq(1) - with m.State("TRAP_RESUME"): with Transaction().body(m): # Resume core operation @@ -219,7 +216,8 @@ def flush_instr(rob_entry): m.next = "NORMAL" # Disable executing any side effects from instructions in core when it is flushed - m.d.comb += side_fx.eq(~fsm.ongoing("TRAP_FLUSH")) + core_flushing = fsm.ongoing("TRAP_FLUSH") + m.d.comb += side_fx.eq(~core_flushing) @def_method(m, self.core_state) def _():