From 5c1849722546813bae3fe6002ce8961dfd14f2f1 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Tue, 4 Dec 2018 13:46:35 -0800 Subject: Add --dmi-rti and --abstract-rti to test OpenOCD. Optionally make spike behave more like real hardware, to automatically test OpenOCD's handling of such hardware. --- riscv/debug_module.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'riscv/debug_module.cc') diff --git a/riscv/debug_module.cc b/riscv/debug_module.cc index 96de3c8..081b606 100644 --- a/riscv/debug_module.cc +++ b/riscv/debug_module.cc @@ -18,11 +18,12 @@ ///////////////////////// debug_module_t debug_module_t::debug_module_t(sim_t *sim, unsigned progbufsize, unsigned max_bus_master_bits, - bool require_authentication) : + bool require_authentication, unsigned abstract_rti) : progbufsize(progbufsize), program_buffer_bytes(4 + 4*progbufsize), max_bus_master_bits(max_bus_master_bits), require_authentication(require_authentication), + abstract_rti(abstract_rti), debug_progbuf_start(debug_data_start - program_buffer_bytes), debug_abstract_start(debug_progbuf_start - debug_abstract_size*4), custom_base(0), @@ -183,7 +184,7 @@ bool debug_module_t::store(reg_t addr, size_t len, const uint8_t* bytes) if (dmcontrol.hartsel == id) { if (0 == (debug_rom_flags[id] & (1 << DEBUG_ROM_FLAG_GO))){ if (dmcontrol.hartsel == id) { - abstractcs.busy = false; + abstract_command_completed = true; } } } @@ -488,6 +489,16 @@ bool debug_module_t::dmi_read(unsigned address, uint32_t *value) return true; } +void debug_module_t::run_test_idle() +{ + if (rti_remaining > 0) { + rti_remaining--; + } + if (rti_remaining == 0 && abstractcs.busy && abstract_command_completed) { + abstractcs.busy = false; + } +} + bool debug_module_t::perform_abstract_command() { if (abstractcs.cmderr != CMDERR_NONE) @@ -629,6 +640,8 @@ bool debug_module_t::perform_abstract_command() } debug_rom_flags[dmcontrol.hartsel] |= 1 << DEBUG_ROM_FLAG_GO; + rti_remaining = abstract_rti; + abstract_command_completed = false; abstractcs.busy = true; } else { -- cgit v1.1