Merge branch 'master' into master
This commit is contained in:
commit
bf1c37864a
|
@ -134,6 +134,13 @@ class LiteScopeAnalyzerDriver:
|
||||||
self.storage_enable.write(1)
|
self.storage_enable.write(1)
|
||||||
self.trigger_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):
|
def done(self):
|
||||||
return self.storage_done.read()
|
return self.storage_done.read()
|
||||||
|
|
||||||
|
@ -168,6 +175,8 @@ class LiteScopeAnalyzerDriver:
|
||||||
dump = CSVDump()
|
dump = CSVDump()
|
||||||
elif ext == ".py":
|
elif ext == ".py":
|
||||||
dump = PythonDump()
|
dump = PythonDump()
|
||||||
|
elif ext == ".json":
|
||||||
|
dump = JSONDump()
|
||||||
elif ext == ".sr":
|
elif ext == ".sr":
|
||||||
dump = SigrokDump(samplerate=samplerate)
|
dump = SigrokDump(samplerate=samplerate)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from litescope.software.dump.common import DumpData, DumpVariable, Dump
|
from litescope.software.dump.common import DumpData, DumpVariable, Dump
|
||||||
from litescope.software.dump.csv import CSVDump
|
from litescope.software.dump.csv import CSVDump
|
||||||
from litescope.software.dump.python import PythonDump
|
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.sigrok import SigrokDump
|
||||||
from litescope.software.dump.vcd import VCDDump
|
from litescope.software.dump.vcd import VCDDump
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# This file is part of LiteScope.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 Arnaud Durand <arnaud.durand@unifr.ch>
|
||||||
|
# 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("JSON files can not (yet) be read, please contribute!")
|
Loading…
Reference in New Issue