diff --git a/example_designs/test/test_analyzer.py b/example_designs/test/test_analyzer.py index b7bd10d..efc4a31 100644 --- a/example_designs/test/test_analyzer.py +++ b/example_designs/test/test_analyzer.py @@ -14,6 +14,7 @@ while not analyzer.done(): pass analyzer.upload() analyzer.save("dump.vcd") +analyzer.save("dump.sr") # # # diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index 9b7b959..fbb8ffc 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -9,18 +9,12 @@ import csv class LiteScopeAnalyzerDriver: - def __init__(self, regs, name, config_csv=None, clk_freq=None, debug=False): + def __init__(self, regs, name, config_csv=None, debug=False): self.regs = regs self.name = name self.config_csv = config_csv if self.config_csv is None: self.config_csv = name + ".csv" - if clk_freq is None: - self.clk_freq = None - self.samplerate = None - else: - self.clk_freq = clk_freq - self.samplerate = clk_freq self.debug = debug self.get_config() self.get_layouts() @@ -78,10 +72,6 @@ class LiteScopeAnalyzerDriver: def configure_subsampler(self, value): self.frontend_subsampler_value.write(value-1) - if self.clk_freq is not None: - self.samplerate = self.clk_freq//n - else: - self.samplerate = None def done(self): return self.storage_idle.read() @@ -117,7 +107,7 @@ class LiteScopeAnalyzerDriver: self.data = new_data return self.data - def save(self, filename): + def save(self, filename, samplerate=None): if self.debug: print("[writing to " + filename + "]...") name, ext = os.path.splitext(filename) @@ -128,9 +118,7 @@ class LiteScopeAnalyzerDriver: elif ext == ".py": dump = PythonDump() elif ext == ".sr": - if self.samplerate is None: - raise ValueError("Unable to automatically retrieve clk_freq, clk_freq parameter required") - dump = SigrokDump(samplerate=self.samplerate) + dump = SigrokDump(samplerate=samplerate) else: raise NotImplementedError dump.add_from_layout(self.layouts[self.group], self.data) diff --git a/litescope/software/dump/sigrok.py b/litescope/software/dump/sigrok.py index ecfcfb4..00f3c06 100644 --- a/litescope/software/dump/sigrok.py +++ b/litescope/software/dump/sigrok.py @@ -9,10 +9,10 @@ from litescope.software.dump.common import Dump, DumpVariable class SigrokDump(Dump): - def __init__(self, dump=None, samplerate=50000000): + def __init__(self, dump=None, samplerate=None): Dump.__init__(self) self.variables = [] if dump is None else dump.variables - self.samplerate = samplerate + self.samplerate = 100e6 if samplerate is None else samplerate def write_version(self): f = open("version", "w")