diff options
author | Megan Wachs <megan@sifive.com> | 2017-11-16 16:34:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-16 16:34:02 -0800 |
commit | 4590b79bc7241f3fa2424f96b4c6666a864fb6a9 (patch) | |
tree | a3fe091008fc28a7464a9e595f28c1cad87720eb /debug | |
parent | 96b21fa7b8912cc2ecc86f6b0e91d19a65103a55 (diff) | |
download | riscv-tests-4590b79bc7241f3fa2424f96b4c6666a864fb6a9.zip riscv-tests-4590b79bc7241f3fa2424f96b4c6666a864fb6a9.tar.gz riscv-tests-4590b79bc7241f3fa2424f96b4c6666a864fb6a9.tar.bz2 |
Debug: Use the --32 and --64 command line arguments (#97)
* Debug: Actually use the --32 and --64 command line arguments
* debug: make XLEN mismatch message clearer
Diffstat (limited to 'debug')
-rwxr-xr-x | debug/gdbserver.py | 4 | ||||
-rw-r--r-- | debug/targets.py | 5 | ||||
-rw-r--r-- | debug/testlib.py | 18 |
3 files changed, 17 insertions, 10 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 3e61449..09938d3 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -869,12 +869,8 @@ def main(): global parsed # pylint: disable=global-statement parsed = parser.parse_args() target = targets.target(parsed) - testlib.print_log_names = parsed.print_log_names - if parsed.xlen: - target.xlen = parsed.xlen - module = sys.modules[__name__] return testlib.run_all_tests(module, target, parsed) diff --git a/debug/targets.py b/debug/targets.py index eb6862b..e92b593 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -180,5 +180,10 @@ def target(parsed): t = found[0](parsed.target, parsed) assert t.harts, "%s doesn't have any harts defined!" % t.name + for h in t.harts : + if (h.xlen == 0): + h.xlen = parsed.xlen + elif (h.xlen != parsed.xlen): + raise Exception("The target has an XLEN of %d, but the command line specified an XLEN of %d. They must match." % (h.xlen, parsed.xlen)) return t diff --git a/debug/testlib.py b/debug/testlib.py index 8d05100..b19eafc 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -825,16 +825,22 @@ class ExamineTarget(GdbTest): hart.misa = self.gdb.p("$misa") txt = "RV" - if (hart.misa >> 30) == 1: - txt += "32" - elif (hart.misa >> 62) == 2: - txt += "64" - elif (hart.misa >> 126) == 3: - txt += "128" + misa_xlen = 0 + if ((hart.misa & 0xFFFFFFFF) >> 30) == 1: + misa_xlen = 32 + elif ((hart.misa & 0xFFFFFFFFFFFFFFFF) >> 62) == 2: + misa_xlen = 64 + elif ((hart.misa & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) >> 126) == 3: + misa_xlen = 128 else: raise TestFailed("Couldn't determine XLEN from $misa (0x%x)" % self.hart.misa) + if (misa_xlen != hart.xlen): + raise TestFailed("MISA reported XLEN of %d but we were expecting XLEN of %d\n" % (misa_xlen, hart.xlen)) + + txt += ("%d" % misa_xlen) + for i in range(26): if hart.misa & (1<<i): txt += chr(i + ord('A')) |