aboutsummaryrefslogtreecommitdiff
path: root/spike_main/spike.cc
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2018-12-04 13:46:35 -0800
committerTim Newsome <tim@sifive.com>2018-12-13 12:52:03 -0800
commit5c1849722546813bae3fe6002ce8961dfd14f2f1 (patch)
treef80f549a647ae59c405120949d334f0dc14c4b91 /spike_main/spike.cc
parent65c8ac48af16235097084b413c10c7bff576b331 (diff)
downloadspike-5c1849722546813bae3fe6002ce8961dfd14f2f1.zip
spike-5c1849722546813bae3fe6002ce8961dfd14f2f1.tar.gz
spike-5c1849722546813bae3fe6002ce8961dfd14f2f1.tar.bz2
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.
Diffstat (limited to 'spike_main/spike.cc')
-rw-r--r--spike_main/spike.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/spike_main/spike.cc b/spike_main/spike.cc
index 3e5c7e6..fa974d0 100644
--- a/spike_main/spike.cc
+++ b/spike_main/spike.cc
@@ -42,6 +42,10 @@ static void help()
fprintf(stderr, " --debug-sba=<bits> Debug bus master supports up to "
"<bits> wide accesses [default 0]\n");
fprintf(stderr, " --debug-auth Debug module requires debugger to authenticate\n");
+ fprintf(stderr, " --dmi-rti=<n> Number of Run-Test/Idle cycles "
+ "required for a DMI access [default 0]\n");
+ fprintf(stderr, " --abstract-rti=<n> Number of Run-Test/Idle cycles "
+ "required for an abstract command to execute [default 0]\n");
exit(1);
}
@@ -98,6 +102,8 @@ int main(int argc, char** argv)
unsigned progsize = 2;
unsigned max_bus_master_bits = 0;
bool require_authentication = false;
+ unsigned dmi_rti = 0;
+ unsigned abstract_rti = 0;
std::vector<int> hartids;
auto const hartids_parser = [&](const char *s) {
@@ -145,6 +151,10 @@ int main(int argc, char** argv)
[&](const char* s){max_bus_master_bits = atoi(s);});
parser.option(0, "debug-auth", 0,
[&](const char* s){require_authentication = true;});
+ parser.option(0, "dmi-rti", 1,
+ [&](const char* s){dmi_rti = atoi(s);});
+ parser.option(0, "abstract-rti", 1,
+ [&](const char* s){abstract_rti = atoi(s);});
auto argv1 = parser.parse(argv);
std::vector<std::string> htif_args(argv1, (const char*const*)argv + argc);
@@ -155,9 +165,11 @@ int main(int argc, char** argv)
help();
sim_t s(isa, nprocs, halted, start_pc, mems, htif_args, std::move(hartids),
- progsize, max_bus_master_bits, require_authentication);
+ progsize, max_bus_master_bits, require_authentication,
+ abstract_rti);
std::unique_ptr<remote_bitbang_t> remote_bitbang((remote_bitbang_t *) NULL);
- std::unique_ptr<jtag_dtm_t> jtag_dtm(new jtag_dtm_t(&s.debug_module));
+ std::unique_ptr<jtag_dtm_t> jtag_dtm(
+ new jtag_dtm_t(&s.debug_module, dmi_rti));
if (use_rbb) {
remote_bitbang.reset(new remote_bitbang_t(rbb_port, &(*jtag_dtm)));
s.set_remote_bitbang(&(*remote_bitbang));