aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.cc
diff options
context:
space:
mode:
authorWill Hawkins <8715530+hawkinsw@users.noreply.github.com>2020-11-29 19:09:50 -0500
committerGitHub <noreply@github.com>2020-11-29 16:09:50 -0800
commitf4f6e12eeeabccc31853ab4e8570219d1f5cba37 (patch)
tree6861e5831a07a0725c659ce5133129f29ac619e1 /riscv/sim.cc
parent4b04d715298c7c0542badf30828f65d1f02e1c1d (diff)
downloadspike-f4f6e12eeeabccc31853ab4e8570219d1f5cba37.zip
spike-f4f6e12eeeabccc31853ab4e8570219d1f5cba37.tar.gz
spike-f4f6e12eeeabccc31853ab4e8570219d1f5cba37.tar.bz2
Fix #607: Add a core parameter to the interactive str command (#608)
Add a core parameter to the interactive str command. This makes it possible for the spike user to specify the device whose memory contains the NUL-terminated string to be printed.
Diffstat (limited to 'riscv/sim.cc')
-rw-r--r--riscv/sim.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc
index 20895d6..0261f86 100644
--- a/riscv/sim.cc
+++ b/riscv/sim.cc
@@ -351,9 +351,13 @@ char* sim_t::addr_to_mem(reg_t addr) {
if (!paddr_ok(addr))
return NULL;
auto desc = bus.find_device(addr);
- if (auto mem = dynamic_cast<mem_t*>(desc.second))
+ if (auto mem = dynamic_cast<mem_t*>(desc.second)) {
if (addr - desc.first < mem->size())
return mem->contents() + (addr - desc.first);
+ } else if (auto mem = dynamic_cast<clint_t*>(desc.second)) {
+ fprintf(stdout, "clint_t\n");
+ return NULL;
+ }
return NULL;
}