diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-05-15 18:33:27 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-05-15 18:33:27 -0700 |
commit | 9b539c8f0ee5075cbc3a0505d7fb6be39e9d7352 (patch) | |
tree | d9c15ce98fe9394a054600617c4a29fe9477327d /riscv/debug_module.cc | |
parent | a5c5d0ccf2ac85452107af473016418626ad969b (diff) | |
download | spike-9b539c8f0ee5075cbc3a0505d7fb6be39e9d7352.zip spike-9b539c8f0ee5075cbc3a0505d7fb6be39e9d7352.tar.gz spike-9b539c8f0ee5075cbc3a0505d7fb6be39e9d7352.tar.bz2 |
Better error message when doing DMI operations and we're busy
Diffstat (limited to 'riscv/debug_module.cc')
-rw-r--r-- | riscv/debug_module.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc index fafddf1..db035e3 100644 --- a/riscv/debug_module.cc +++ b/riscv/debug_module.cc @@ -205,7 +205,11 @@ bool debug_module_t::dmi_read(unsigned address, uint32_t *value) D(fprintf(stderr, "dmi_read(0x%x) -> ", address)); if (address >= DMI_DATA0 && address < DMI_DATA0 + abstractcs.datacount) { unsigned i = address - DMI_DATA0; - result = abstractcs.busy ? -1 : read32(dmdata, i); + result = read32(dmdata, i); + if (abstractcs.busy) { + result = -1; + fprintf(stderr, "\ndmi_read(0x%02x (data[%d]) -> -1 because abstractcs.busy==true\n", address, i); + } if (abstractcs.busy && abstractcs.cmderr == CMDERR_NONE) { abstractcs.cmderr = CMDERR_BUSY; @@ -216,7 +220,11 @@ bool debug_module_t::dmi_read(unsigned address, uint32_t *value) } } else if (address >= DMI_PROGBUF0 && address < DMI_PROGBUF0 + progsize) { unsigned i = address - DMI_PROGBUF0; - result = abstractcs.busy ? -1 : read32(program_buffer, i); + result = read32(program_buffer, i); + if (abstractcs.busy) { + result = -1; + fprintf(stderr, "\ndmi_read(0x%02x (progbuf[%d]) -> -1 because abstractcs.busy==true\n", address, i); + } if (!abstractcs.busy && ((abstractauto.autoexecprogbuf >> i) & 1)) { perform_abstract_command(); } |