aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-10-21 10:51:44 -0700
committerTim Newsome <tim@sifive.com>2016-10-21 10:51:44 -0700
commitf204b5c2b6b8914060614cd77ea10509968c3fa4 (patch)
tree9e22a0ca2b30ee95bdfe57b979cc78eb61b79a62 /debug
parent30d113085a08b0cde585c7e0d8b19e0cc6cbc046 (diff)
downloadriscv-tests-f204b5c2b6b8914060614cd77ea10509968c3fa4.zip
riscv-tests-f204b5c2b6b8914060614cd77ea10509968c3fa4.tar.gz
riscv-tests-f204b5c2b6b8914060614cd77ea10509968c3fa4.tar.bz2
Improve reg test a little.
Diffstat (limited to 'debug')
-rwxr-xr-xdebug/openocd.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/debug/openocd.py b/debug/openocd.py
index 3807210..0ab8810 100755
--- a/debug/openocd.py
+++ b/debug/openocd.py
@@ -22,16 +22,26 @@ class OpenOcdTest(testlib.BaseTest):
self.cli = testlib.OpenocdCli()
self.cli.command("halt")
+ def write_nops(self, count):
+ for address in range(self.target.ram, self.target.ram + 4 * count, 4):
+ # 0x13 is nop
+ self.cli.command("mww 0x%x 0x13" % address)
+
class RegTest(OpenOcdTest):
def test(self):
+ self.write_nops(4)
+
regs = self.cli.reg()
assertIn("x18", regs)
+ self.cli.command("reg x18 0x11782")
+ self.cli.command("step 0x%x" % self.target.ram)
+
+ assertEqual(self.cli.reg("x18"), 0x11782)
+
class StepTest(OpenOcdTest):
def test(self):
- # 0x13 is nop
- for address in range(self.target.ram, self.target.ram + 16, 4):
- self.cli.command("mww 0x%x 0x13" % address)
+ self.write_nops(4)
self.cli.command("step 0x%x" % self.target.ram)
for i in range(4):
@@ -41,9 +51,7 @@ class StepTest(OpenOcdTest):
class ResumeTest(OpenOcdTest):
def test(self):
- # 0x13 is nop
- for address in range(self.target.ram, self.target.ram + 32, 4):
- self.cli.command("mww 0x%x 0x13" % address)
+ self.write_nops(16)
self.cli.command("bp 0x%x 4" % (self.target.ram + 12))
self.cli.command("bp 0x%x 4" % (self.target.ram + 24))