From 0c41c6a204fab8e31b3a982b3ac709f92fe68687 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sun, 3 Apr 2016 18:26:50 +0200 Subject: [PATCH] core: minor fixes --- litescope/core.py | 7 ++++--- test/analyzer_tb.py | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/litescope/core.py b/litescope/core.py index bdccc23..62ef558 100644 --- a/litescope/core.py +++ b/litescope/core.py @@ -134,13 +134,14 @@ class AnalyzerStorage(Module, AutoCSR): If(self.sink.valid & self.sink.hit, NextState("RUN") ), - mem.source.ready.eq(mem.level == self.offset.storage) + mem.source.ready.eq(mem.level >= self.offset.storage) ) fsm.act("RUN", self.run.status.eq(1), self.sink.connect(mem.sink, leave_out=set(["hit"])), - If(~mem.sink.ready | (mem.level == self.length.storage), - NextState("IDLE") + If(~mem.sink.ready | (mem.level >= self.length.storage), + NextState("IDLE"), + mem.source.ready.eq(1) ) ) self.comb += [ diff --git a/test/analyzer_tb.py b/test/analyzer_tb.py index 140a1ae..2e6317c 100755 --- a/test/analyzer_tb.py +++ b/test/analyzer_tb.py @@ -8,15 +8,15 @@ class TB(Module): counter = Signal(16) self.sync += counter.eq(counter + 1) - self.submodules.analyzer = LiteScopeAnalyzer(counter, 128) + self.submodules.analyzer = LiteScopeAnalyzer(counter, 512) def main_generator(dut): yield dut.analyzer.frontend.trigger.value.storage.eq(0x0080) yield dut.analyzer.frontend.trigger.mask.storage.eq(0xfff0) - yield dut.analyzer.frontend.subsampler.value.storage.eq(0) + yield dut.analyzer.frontend.subsampler.value.storage.eq(2) yield - yield dut.analyzer.storage.length.storage.eq(64) - yield dut.analyzer.storage.offset.storage.eq(32) + yield dut.analyzer.storage.length.storage.eq(256) + yield dut.analyzer.storage.offset.storage.eq(8) for i in range(16): yield yield dut.analyzer.storage.start.re.eq(1) @@ -31,9 +31,12 @@ def main_generator(dut): yield dut.analyzer.storage.mem_ready.re.eq(1) yield dut.analyzer.storage.mem_ready.r.eq(1) yield + yield dut.analyzer.storage.mem_ready.re.eq(0) + yield dut.analyzer.storage.mem_ready.r.eq(0) + yield + print(data) print(len(data)) - print(data[32]) if __name__ == "__main__": tb = TB()