adds coverage plugin
This commit is contained in:
32
src/plugin/cov.cpp
Normal file
32
src/plugin/cov.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <iss/plugin/cov.h>
|
||||
#include <iss/arch_if.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
iss::plugin::cov::cov() {
|
||||
std::cout << "Entering Constructor"<<std::endl;
|
||||
output.open("output.txt");
|
||||
|
||||
}
|
||||
|
||||
iss::plugin::cov::~cov() {
|
||||
std::cout << "Entering Destructor"<<std::endl;
|
||||
output.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool iss::plugin::cov::registration(const char *const version, vm_if& vm) {
|
||||
instr_if = vm.get_arch()->get_instrumentation_if();
|
||||
return true;
|
||||
}
|
||||
void iss::plugin::cov::callback(instr_info_t iinfo, const exec_info&) {
|
||||
// if((instr_if->get_next_pc() - instr_if->get_pc() != 4) ||( instr_if->get_next_pc() - instr_if->get_pc() != 2)){
|
||||
// std::cout << "jump from " << std::hex << instr_if->get_pc() << " to " << instr_if->get_next_pc()<< " after " << std::dec << counter <<" linear instructions" <<std::endl;
|
||||
// counter = 0;
|
||||
// }else {
|
||||
// counter++;
|
||||
// }
|
||||
|
||||
output<<std::hex << instr_if->get_pc() << std::endl;
|
||||
}
|
@ -69,6 +69,8 @@ using tgc_d_xrb_nn_plat_type = iss::arch::riscv_hart_mu_p<iss::arch::tgc_d_xrb_n
|
||||
#include <array>
|
||||
#include <iss/plugin/cycle_estimate.h>
|
||||
#include <iss/plugin/instruction_count.h>
|
||||
#include <iss/plugin/cov.h>
|
||||
|
||||
// clang-format on
|
||||
|
||||
#define STR(X) #X
|
||||
@ -423,6 +425,10 @@ void core_complex::before_end_of_elaboration() {
|
||||
auto *plugin = new iss::plugin::cycle_estimate(filename);
|
||||
cpu->vm->register_plugin(*plugin);
|
||||
plugin_list.push_back(plugin);
|
||||
} else if (plugin_name == "cov") {
|
||||
auto *plugin = new iss::plugin::cov();
|
||||
cpu->vm->register_plugin(*plugin);
|
||||
plugin_list.push_back(plugin);
|
||||
} else {
|
||||
std::array<char const*, 1> a{{filename.c_str()}};
|
||||
iss::plugin::loader l(plugin_name, {{"initPlugin"}});
|
||||
|
Reference in New Issue
Block a user