From 7757727f5b9fe4cb4979897fa0aab934b4af6e88 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 17 Nov 2017 15:11:03 +0100 Subject: [PATCH] implement memory flush in hardware instead of software --- litescope/core.py | 4 +++- litescope/software/driver/analyzer.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/litescope/core.py b/litescope/core.py index 817ba30..7bb1d89 100644 --- a/litescope/core.py +++ b/litescope/core.py @@ -119,6 +119,7 @@ class AnalyzerStorage(Module, AutoCSR): self.wait = CSRStatus() self.run = CSRStatus() + self.mem_flush = CSR() self.mem_valid = CSRStatus() self.mem_ready = CSR() self.mem_data = CSRStatus(dw) @@ -126,7 +127,8 @@ class AnalyzerStorage(Module, AutoCSR): # # # mem = stream.SyncFIFO([("data", dw)], depth//cd_ratio, buffered=True) - self.submodules += mem + self.submodules += ResetInserter()(mem) + self.comb += mem.reset.eq(self.mem_flush.re) fsm = FSM(reset_state="IDLE") self.submodules += fsm diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index 15fd71e..f8a7c03 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -74,8 +74,7 @@ class LiteScopeAnalyzerDriver: self.frontend_subsampler_value.write(value-1) def run(self, offset, length): - while self.storage_mem_valid.read(): - self.storage_mem_ready.write(1) + self.storage_mem_flush.write(1) if self.debug: print("[running]...") self.storage_offset.write(offset)