aboutsummaryrefslogtreecommitdiff
path: root/debug/targets.py
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2016-12-27 11:34:50 -0800
committerTim Newsome <tim@sifive.com>2016-12-27 11:34:50 -0800
commit4ec77dde62f8c14df9403abf7b10a2455ea72125 (patch)
treece54ad127f65f392c149d66d1caf84c677d8daec /debug/targets.py
parentb986817eebe9bd810be371dc84ee94e8f654de42 (diff)
downloadriscv-tests-4ec77dde62f8c14df9403abf7b10a2455ea72125.zip
riscv-tests-4ec77dde62f8c14df9403abf7b10a2455ea72125.tar.gz
riscv-tests-4ec77dde62f8c14df9403abf7b10a2455ea72125.tar.bz2
Use compressed code if the target supports it.
The main change was to read misa before running any other test. If misa indicates C is supported, then use compressed code. This required changing some tests, mostly to ensure correct alignment. The single step test also needs to know the correct addresses to step through in compressed code. Only print at most 1000 lines from each log file.
Diffstat (limited to 'debug/targets.py')
-rw-r--r--debug/targets.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/debug/targets.py b/debug/targets.py
index c431a67..bcebc0b 100644
--- a/debug/targets.py
+++ b/debug/targets.py
@@ -12,6 +12,7 @@ class Target(object):
temporary_binary = None
openocd_config = []
use_fpu = False
+ misa = None
def __init__(self, cmd, run, isolate):
self.cmd = cmd
@@ -42,6 +43,8 @@ class Target(object):
march = "rv%dima" % self.xlen
if self.use_fpu:
march += "fd"
+ if self.extensionSupported("c"):
+ march += "c"
testlib.compile(sources +
("programs/entry.S", "programs/init.c",
"-I", "../env",
@@ -54,6 +57,10 @@ class Target(object):
xlen=self.xlen)
return binary_name
+ def extensionSupported(self, letter):
+ # target.misa is set by testlib.ExamineTarget
+ return self.misa & (1 << (ord(letter.upper()) - ord('A')))
+
class SpikeTarget(Target):
# pylint: disable=abstract-method
directory = "spike"