diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-04-26 09:13:19 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-04-26 09:14:27 -0700 |
commit | 0fd7c9f3d167b849ef5509a2c481237cb742d221 (patch) | |
tree | 68942ca5a00cae1c1aeb4b62e5634a9f962c020f /riscv/debug_module.cc | |
parent | fe678ee09925b90058ff80c037341b873e6da429 (diff) | |
download | spike-0fd7c9f3d167b849ef5509a2c481237cb742d221.zip spike-0fd7c9f3d167b849ef5509a2c481237cb742d221.tar.gz spike-0fd7c9f3d167b849ef5509a2c481237cb742d221.tar.bz2 |
Handle abstractcs.busy
Diffstat (limited to 'riscv/debug_module.cc')
-rw-r--r-- | riscv/debug_module.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc index 5f66ebe..fafddf1 100644 --- a/riscv/debug_module.cc +++ b/riscv/debug_module.cc @@ -205,19 +205,19 @@ 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 = read32(dmdata, i); + result = abstractcs.busy ? -1 : read32(dmdata, i); if (abstractcs.busy && abstractcs.cmderr == CMDERR_NONE) { abstractcs.cmderr = CMDERR_BUSY; } - if ((abstractauto.autoexecdata >> i) & 1){ + if (!abstractcs.busy && ((abstractauto.autoexecdata >> i) & 1)) { perform_abstract_command(); } } else if (address >= DMI_PROGBUF0 && address < DMI_PROGBUF0 + progsize) { unsigned i = address - DMI_PROGBUF0; - result = read32(program_buffer, i); - if ((abstractauto.autoexecprogbuf >> i) & 1) { + result = abstractcs.busy ? -1 : read32(program_buffer, i); + if (!abstractcs.busy && ((abstractauto.autoexecprogbuf >> i) & 1)) { perform_abstract_command(); } @@ -396,13 +396,14 @@ bool debug_module_t::dmi_write(unsigned address, uint32_t value) D(fprintf(stderr, "dmi_write(0x%x, 0x%x)\n", address, value)); if (address >= DMI_DATA0 && address < DMI_DATA0 + abstractcs.datacount) { unsigned i = address - DMI_DATA0; - write32(dmdata, address - DMI_DATA0, value); + if (!abstractcs.busy) + write32(dmdata, address - DMI_DATA0, value); if (abstractcs.busy && abstractcs.cmderr == CMDERR_NONE) { abstractcs.cmderr = CMDERR_BUSY; } - if ((abstractauto.autoexecdata >> i) & 1) { + if (!abstractcs.busy && ((abstractauto.autoexecdata >> i) & 1)) { perform_abstract_command(); } return true; @@ -410,9 +411,10 @@ bool debug_module_t::dmi_write(unsigned address, uint32_t value) } else if (address >= DMI_PROGBUF0 && address < DMI_PROGBUF0 + progsize) { unsigned i = address - DMI_PROGBUF0; - write32(program_buffer, i, value); + if (!abstractcs.busy) + write32(program_buffer, i, value); - if ((abstractauto.autoexecprogbuf >> i) & 1) { + if (!abstractcs.busy && ((abstractauto.autoexecprogbuf >> i) & 1)) { perform_abstract_command(); } return true; |