From 72c9930705ccc5f997b95987126fc139718dd1dd Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 3 May 2021 12:12:16 +0200 Subject: [PATCH 1/4] test/test_examples: Update. --- test/test_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_examples.py b/test/test_examples.py index d6cebd1..8a9fae3 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -15,5 +15,5 @@ class TestExamples(unittest.TestCase): def test_arty(self): os.system(f"rm -rf {root_dir}/build") os.system(f"cd {root_dir}/examples && python3 arty.py") - self.assertEqual(os.path.isfile(f"{root_dir}/examples/build/arty/gateware/arty.v"), True) + self.assertEqual(os.path.isfile(f"{root_dir}/examples/build/digilent_arty/gateware/digilent_arty.v"), True) From fab60ab5e0dc94a1ffa5741016493b3888948857 Mon Sep 17 00:00:00 2001 From: Arnaud Durand Date: Mon, 24 May 2021 03:51:09 +0200 Subject: [PATCH 2/4] litescope/core: add function to clear scope The analyzer driver can be reused for further capturing by calling the clear() function. --- litescope/software/driver/analyzer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index e432cb0..3476e69 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -134,6 +134,13 @@ class LiteScopeAnalyzerDriver: self.storage_enable.write(1) self.trigger_enable.write(1) + def clear(self): + self.data = DumpData(self.data_width) + self.offset = 0 + self.length = None + self.trigger_enable.write(0) + self.storage_enable.write(0) + def done(self): return self.storage_done.read() From 1243ab3c81fc33ddacb3c15d18b6c63a45e6989e Mon Sep 17 00:00:00 2001 From: Arnaud Durand Date: Mon, 24 May 2021 01:21:35 +0200 Subject: [PATCH 3/4] software/dump: add JSON dump --- litescope/software/driver/analyzer.py | 2 ++ litescope/software/dump/__init__.py | 1 + litescope/software/dump/json.py | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 litescope/software/dump/json.py diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index e432cb0..4ce8743 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -168,6 +168,8 @@ class LiteScopeAnalyzerDriver: dump = CSVDump() elif ext == ".py": dump = PythonDump() + elif ext == ".json": + dump = JSONDump() elif ext == ".sr": dump = SigrokDump(samplerate=samplerate) else: diff --git a/litescope/software/dump/__init__.py b/litescope/software/dump/__init__.py index 0183987..5062041 100644 --- a/litescope/software/dump/__init__.py +++ b/litescope/software/dump/__init__.py @@ -1,5 +1,6 @@ from litescope.software.dump.common import DumpData, DumpVariable, Dump from litescope.software.dump.csv import CSVDump from litescope.software.dump.python import PythonDump +from litescope.software.dump.json import JSONDump from litescope.software.dump.sigrok import SigrokDump from litescope.software.dump.vcd import VCDDump diff --git a/litescope/software/dump/json.py b/litescope/software/dump/json.py new file mode 100644 index 0000000..d83bc72 --- /dev/null +++ b/litescope/software/dump/json.py @@ -0,0 +1,25 @@ +# +# This file is part of LiteScope. +# +# Copyright (c) 2021 Arnaud Durand +# SPDX-License-Identifier: BSD-2-Clause + +import json + +from litescope.software.dump.common import Dump + + +class JSONDump(Dump): + def __init__(self, dump=None): + Dump.__init__(self) + self.variables = [] if dump is None else dump.variables + + def generate_data(self): + return {v.name: v.values for v in self.variables} + + def write(self, filename): + with open(filename, "w") as f: + json.dump(self.generate_data(), f) + + def read(self, filename): + raise NotImplementedError("Python files can not (yet) be read, please contribute!") From 431c7308742da173fac6e19d9df1740fca343989 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 25 Aug 2021 13:05:53 +0200 Subject: [PATCH 4/4] software/dump/json: Fix typo. --- litescope/software/dump/json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litescope/software/dump/json.py b/litescope/software/dump/json.py index d83bc72..f98be8f 100644 --- a/litescope/software/dump/json.py +++ b/litescope/software/dump/json.py @@ -22,4 +22,4 @@ class JSONDump(Dump): json.dump(self.generate_data(), f) def read(self, filename): - raise NotImplementedError("Python files can not (yet) be read, please contribute!") + raise NotImplementedError("JSON files can not (yet) be read, please contribute!")