From 284253d5588748461d42e0729a4e9b0e0e1a011c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 10 Sep 2019 12:38:34 +0200 Subject: [PATCH] core: add csr_csv parameter and export csv_csv on do_exit --- litescope/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litescope/core.py b/litescope/core.py index c43baed..636076f 100644 --- a/litescope/core.py +++ b/litescope/core.py @@ -229,7 +229,7 @@ class _Storage(Module, AutoCSR): class LiteScopeAnalyzer(Module, AutoCSR): - def __init__(self, groups, depth, clock_domain="sys", trigger_depth=16, **kwargs): + def __init__(self, groups, depth, clock_domain="sys", trigger_depth=16, csr_csv=None, **kwargs): # retro-compatibility # FIXME: remove if "cd" in kwargs: print("[WARNING] Please update LiteScopeAnalyzer's \"cd\" parameter to \"clock_domain\"") @@ -241,6 +241,8 @@ class LiteScopeAnalyzer(Module, AutoCSR): self.data_width = data_width = max([sum([len(s) for s in g]) for g in groups.values()]) + self.csr_csv = csr_csv + # # # # create scope clock domain @@ -302,3 +304,7 @@ class LiteScopeAnalyzer(Module, AutoCSR): for s in signals: r += format_line("signal", str(i), vns.get_name(s), str(len(s))) write_to_file(filename, r) + + def do_exit(self, vns): + if self.csr_csv is not None: + self.export_csv(vns, self.csr_csv)