adds support for different branch types in tracing
This commit is contained in:
parent
1ad66a71d8
commit
00e02bf565
|
@ -137,44 +137,6 @@ protected:
|
||||||
using coro_t = boost::coroutines2::coroutine<void>::pull_type;
|
using coro_t = boost::coroutines2::coroutine<void>::pull_type;
|
||||||
std::vector<coro_t> spawn_blocks;
|
std::vector<coro_t> spawn_blocks;
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& pc_assign(T& val){super::ex_info.branch_taken=true; return val;}
|
|
||||||
inline uint8_t readSpace1(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint8_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint16_t readSpace2(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint16_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint32_t readSpace4(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint32_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint64_t readSpace8(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint64_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline void writeSpace1(typename super::mem_type_e space, uint64_t addr, uint8_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace2(typename super::mem_type_e space, uint64_t addr, uint16_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace4(typename super::mem_type_e space, uint64_t addr, uint32_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace8(typename super::mem_type_e space, uint64_t addr, uint64_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
template<unsigned W, typename U, typename S = typename std::make_signed<U>::type>
|
template<unsigned W, typename U, typename S = typename std::make_signed<U>::type>
|
||||||
inline S sext(U from) {
|
inline S sext(U from) {
|
||||||
auto mask = (1ULL<<W) - 1;
|
auto mask = (1ULL<<W) - 1;
|
||||||
|
@ -183,12 +145,15 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void process_spawn_blocks() {
|
inline void process_spawn_blocks() {
|
||||||
|
if(spawn_blocks.size()==0) return;
|
||||||
|
std::swap(super::ex_info.branch_taken, super::ex_info.hw_branch_taken);
|
||||||
for(auto it = std::begin(spawn_blocks); it!=std::end(spawn_blocks);)
|
for(auto it = std::begin(spawn_blocks); it!=std::end(spawn_blocks);)
|
||||||
if(*it){
|
if(*it){
|
||||||
(*it)();
|
(*it)();
|
||||||
++it;
|
++it;
|
||||||
} else
|
} else
|
||||||
spawn_blocks.erase(it);
|
spawn_blocks.erase(it);
|
||||||
|
std::swap(super::ex_info.branch_taken, super::ex_info.hw_branch_taken);
|
||||||
}
|
}
|
||||||
<%functions.each{ it.eachLine { %>
|
<%functions.each{ it.eachLine { %>
|
||||||
${it}<%}%>
|
${it}<%}%>
|
||||||
|
|
|
@ -131,44 +131,6 @@ protected:
|
||||||
using coro_t = boost::coroutines2::coroutine<void>::pull_type;
|
using coro_t = boost::coroutines2::coroutine<void>::pull_type;
|
||||||
std::vector<coro_t> spawn_blocks;
|
std::vector<coro_t> spawn_blocks;
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T& pc_assign(T& val){super::ex_info.branch_taken=true; return val;}
|
|
||||||
inline uint8_t readSpace1(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint8_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint16_t readSpace2(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint16_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint32_t readSpace4(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint32_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline uint64_t readSpace8(typename super::mem_type_e space, uint64_t addr){
|
|
||||||
auto ret = super::template read_mem<uint64_t>(space, addr);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
inline void writeSpace1(typename super::mem_type_e space, uint64_t addr, uint8_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace2(typename super::mem_type_e space, uint64_t addr, uint16_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace4(typename super::mem_type_e space, uint64_t addr, uint32_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
inline void writeSpace8(typename super::mem_type_e space, uint64_t addr, uint64_t data){
|
|
||||||
super::write_mem(space, addr, data);
|
|
||||||
if(this->core.trap_state) throw 0;
|
|
||||||
}
|
|
||||||
template<unsigned W, typename U, typename S = typename std::make_signed<U>::type>
|
template<unsigned W, typename U, typename S = typename std::make_signed<U>::type>
|
||||||
inline S sext(U from) {
|
inline S sext(U from) {
|
||||||
auto mask = (1ULL<<W) - 1;
|
auto mask = (1ULL<<W) - 1;
|
||||||
|
@ -177,12 +139,15 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void process_spawn_blocks() {
|
inline void process_spawn_blocks() {
|
||||||
|
if(spawn_blocks.size()==0) return;
|
||||||
|
std::swap(super::ex_info.branch_taken, super::ex_info.hw_branch_taken);
|
||||||
for(auto it = std::begin(spawn_blocks); it!=std::end(spawn_blocks);)
|
for(auto it = std::begin(spawn_blocks); it!=std::end(spawn_blocks);)
|
||||||
if(*it){
|
if(*it){
|
||||||
(*it)();
|
(*it)();
|
||||||
++it;
|
++it;
|
||||||
} else
|
} else
|
||||||
spawn_blocks.erase(it);
|
spawn_blocks.erase(it);
|
||||||
|
std::swap(super::ex_info.branch_taken, super::ex_info.hw_branch_taken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue