From: Megan Wachs Date: Fri, 17 Nov 2017 00:34:02 +0000 (-0800) Subject: Debug: Use the --32 and --64 command line arguments (#97) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4590b79bc7241f3fa2424f96b4c6666a864fb6a9;p=riscv-tests.git 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 --- 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<