From 2f37678b61d4b877bce128be2e63dbf38cbdd7a7 Mon Sep 17 00:00:00 2001 From: Simon Thornington Date: Sat, 10 Apr 2021 13:07:14 -0400 Subject: [PATCH 1/5] optional parameter to pass in the SoC CSR CSV, in addition to the analyzer CSV, necessary if the SoC was build with a --csr-csv other than csr.csv. Also improve the error messages a bit. --- litescope/software/litescope_cli.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/litescope/software/litescope_cli.py b/litescope/software/litescope_cli.py index f859476..f7eaf22 100755 --- a/litescope/software/litescope_cli.py +++ b/litescope/software/litescope_cli.py @@ -84,6 +84,7 @@ def parse_args(): metavar=("TRIGGER", "VALUE")) parser.add_argument("-l", "--list", action="store_true", help="List signal choices") parser.add_argument("--csv", default="analyzer.csv", help="Analyzer CSV file") + parser.add_argument("--csr-csv", default="csr.csv", help="SoC CSV file") parser.add_argument("--group", default="0", help="Capture Group") parser.add_argument("--subsampling", default="1", help="Capture Subsampling") parser.add_argument("--offset", default="32", help="Capture Offset") @@ -99,7 +100,8 @@ def main(): # Check if analyzer file is present and exit if not. if not os.path.exists(args.csv): - raise ValueError("{} not found, exiting.".format(args.csv)) + raise ValueError("{} not found. This is necessary to load the wires which have been tapped to scope." + "Try setting --csv to value of the csr_csv argument to LiteScopeAnalyzer in the SoC.".format(args.csv)) sys.exit(1) # Get list of signals from analyzer configuratio file. @@ -112,7 +114,10 @@ def main(): sys.exit(0) # Create and open remote control. - bus = RemoteClient() + if not os.path.exists(args.csr_csv): + raise ValueError("{} not found. This is necessary to load the 'regs' of the remote. Try setting --csr-csv here to " + "the path to the --csr-csv argument of the SoC build.".format(args.csr_csv)) + bus = RemoteClient(csr_csv=args.csr_csv) bus.open() # Configure and run LiteScope analyzer. @@ -130,7 +135,7 @@ def main(): analyzer.upload() analyzer.save(args.dump) - # Close remove control. + # Close remove control.M# finally: bus.close() From ad2a781681068595effb58e3bc4fae27dfaee773 Mon Sep 17 00:00:00 2001 From: Simon Thornington Date: Sat, 10 Apr 2021 13:58:32 -0400 Subject: [PATCH 2/5] fix value conversion for hex values --- litescope/software/driver/analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index e432cb0..f92f468 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -94,7 +94,7 @@ class LiteScopeAnalyzerDriver: v <<= 4 if mx is not None else 1 m <<= 4 if mx is not None else 1 if c != "x": - v |= int(c) + v |= int(c, 16 if mx is not None else 2) m |= 0xf if mx is not None else 0b1 value |= getattr(self, k + "_o")*v mask |= getattr(self, k + "_m") & (getattr(self, k + "_o")*m) From 53637af809265c6f1ef316d4f1250d4819084781 Mon Sep 17 00:00:00 2001 From: Simon Thornington Date: Sat, 10 Apr 2021 13:59:27 -0400 Subject: [PATCH 3/5] fix typo --- litescope/software/litescope_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litescope/software/litescope_cli.py b/litescope/software/litescope_cli.py index f7eaf22..394ea75 100755 --- a/litescope/software/litescope_cli.py +++ b/litescope/software/litescope_cli.py @@ -135,7 +135,7 @@ def main(): analyzer.upload() analyzer.save(args.dump) - # Close remove control.M# + # Close remove control. finally: bus.close() From 1e5305a2a4614c18a1d3ad5fab687c430dc7ccb8 Mon Sep 17 00:00:00 2001 From: Simon Thornington Date: Sat, 10 Apr 2021 18:58:42 -0400 Subject: [PATCH 4/5] trivial change --- litescope/software/driver/analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litescope/software/driver/analyzer.py b/litescope/software/driver/analyzer.py index f92f468..bd7c771 100644 --- a/litescope/software/driver/analyzer.py +++ b/litescope/software/driver/analyzer.py @@ -94,7 +94,7 @@ class LiteScopeAnalyzerDriver: v <<= 4 if mx is not None else 1 m <<= 4 if mx is not None else 1 if c != "x": - v |= int(c, 16 if mx is not None else 2) + v |= int(c, 16 if mx is not None else 2 ) m |= 0xf if mx is not None else 0b1 value |= getattr(self, k + "_o")*v mask |= getattr(self, k + "_m") & (getattr(self, k + "_o")*m) From fe515d43e89d8f72bd91296705e814df7aff9684 Mon Sep 17 00:00:00 2001 From: Simon Thornington Date: Sat, 10 Apr 2021 19:04:38 -0400 Subject: [PATCH 5/5] fix test, broken by the vendor_ prefixing of the platform artifacts --- test/test_examples.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_examples.py b/test/test_examples.py index d6cebd1..72829de 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -15,5 +15,4 @@ 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)