diff --git a/example_designs/targets/simple.py b/example_designs/targets/simple.py index f3cedd8..3e5b649 100644 --- a/example_designs/targets/simple.py +++ b/example_designs/targets/simple.py @@ -34,9 +34,36 @@ class LiteScopeSoC(SoCCore): except: pass - counter = Signal(16) + # use name override to keep naming in capture + counter = Signal(4, name_override="counter") + counter0 = Signal(name_override="counter0") + counter1 = Signal(name_override="counter1") + counter2 = Signal(name_override="counter2") + counter3 = Signal(name_override="counter3") self.sync += counter.eq(counter + 1) - self.submodules.analyzer = LiteScopeAnalyzer(counter, 512) + self.comb += [ + counter0.eq(counter[0]), + counter1.eq(counter[1]), + counter2.eq(counter[2]), + counter3.eq(counter[3]), + ] + + # group for vcd capture + vcd_group = [ + counter + ] + # group for sigrok capture (no bus support) + sigrok_group = [ + counter0, + counter1, + counter2, + counter3 + ] + analyzer_signals = { + 0 : vcd_group, + 1 : sigrok_group + } + self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 512) def do_exit(self, vns): self.analyzer.export_csv(vns, "test/analyzer.csv") diff --git a/example_designs/test/test_analyzer.py b/example_designs/test/test_analyzer.py index efc4a31..8ef02ca 100644 --- a/example_designs/test/test_analyzer.py +++ b/example_designs/test/test_analyzer.py @@ -6,15 +6,20 @@ wb.open() # # # -analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True) -analyzer.configure_trigger(cond={"counter1": 0}) -analyzer.configure_subsampler(1) -analyzer.run(offset=128, length=512) -while not analyzer.done(): - pass -analyzer.upload() -analyzer.save("dump.vcd") -analyzer.save("dump.sr") +dumps = { + 0 : "dump.vcd", + 1 : "dump.sr" +} + +for group, filename in dumps.items(): + analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True) + analyzer.configure_trigger() + analyzer.configure_subsampler(1) + analyzer.configure_group(group) + analyzer.run(offset=128, length=512) + analyzer.wait_done() + analyzer.upload() + analyzer.save(filename) # # #