Compare commits
4 Commits
0833198d34
...
00e02bf565
Author | SHA1 | Date | |
---|---|---|---|
00e02bf565 | |||
1ad66a71d8 | |||
e60fa3d5e6 | |||
8407f6287f |
@ -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}<%}%>
|
||||||
|
@ -120,9 +120,9 @@ public:
|
|||||||
|
|
||||||
status packetsize_query(std::string &out_buf) override;
|
status packetsize_query(std::string &out_buf) override;
|
||||||
|
|
||||||
status add_break(int type, uint64_t addr, unsigned int length) override;
|
status add_break(break_type type, uint64_t addr, unsigned int length) override;
|
||||||
|
|
||||||
status remove_break(int type, uint64_t addr, unsigned int length) override;
|
status remove_break(break_type type, uint64_t addr, unsigned int length) override;
|
||||||
|
|
||||||
status resume_from_addr(bool step, int sig, uint64_t addr, rp_thread_ref thread,
|
status resume_from_addr(bool step, int sig, uint64_t addr, rp_thread_ref thread,
|
||||||
std::function<void(unsigned)> stop_callback) override;
|
std::function<void(unsigned)> stop_callback) override;
|
||||||
@ -331,7 +331,12 @@ template <typename ARCH> status riscv_target_adapter<ARCH>::packetsize_query(std
|
|||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ARCH> status riscv_target_adapter<ARCH>::add_break(int type, uint64_t addr, unsigned int length) {
|
template <typename ARCH> status riscv_target_adapter<ARCH>::add_break(break_type type, uint64_t addr, unsigned int length) {
|
||||||
|
switch(type) {
|
||||||
|
default:
|
||||||
|
return Err;
|
||||||
|
case SW_EXEC:
|
||||||
|
case HW_EXEC: {
|
||||||
auto saddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr});
|
auto saddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr});
|
||||||
auto eaddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr + length});
|
auto eaddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr + length});
|
||||||
target_adapter_base::bp_lut.addEntry(++target_adapter_base::bp_count, saddr.val, eaddr.val - saddr.val);
|
target_adapter_base::bp_lut.addEntry(++target_adapter_base::bp_count, saddr.val, eaddr.val - saddr.val);
|
||||||
@ -340,8 +345,15 @@ template <typename ARCH> status riscv_target_adapter<ARCH>::add_break(int type,
|
|||||||
LOG(TRACE) << "Now having " << target_adapter_base::bp_lut.size() << " breakpoints";
|
LOG(TRACE) << "Now having " << target_adapter_base::bp_lut.size() << " breakpoints";
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ARCH> status riscv_target_adapter<ARCH>::remove_break(int type, uint64_t addr, unsigned int length) {
|
template <typename ARCH> status riscv_target_adapter<ARCH>::remove_break(break_type type, uint64_t addr, unsigned int length) {
|
||||||
|
switch(type) {
|
||||||
|
default:
|
||||||
|
return Err;
|
||||||
|
case SW_EXEC:
|
||||||
|
case HW_EXEC: {
|
||||||
auto saddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr});
|
auto saddr = map_addr({iss::access_type::FETCH, iss::address_type::PHYSICAL, 0, addr});
|
||||||
unsigned handle = target_adapter_base::bp_lut.getEntry(saddr.val);
|
unsigned handle = target_adapter_base::bp_lut.getEntry(saddr.val);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
@ -355,6 +367,8 @@ template <typename ARCH> status riscv_target_adapter<ARCH>::remove_break(int typ
|
|||||||
LOG(TRACE) << "Now having " << target_adapter_base::bp_lut.size() << " breakpoints";
|
LOG(TRACE) << "Now having " << target_adapter_base::bp_lut.size() << " breakpoints";
|
||||||
return Err;
|
return Err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ARCH>
|
template <typename ARCH>
|
||||||
status riscv_target_adapter<ARCH>::resume_from_addr(bool step, int sig, uint64_t addr, rp_thread_ref thread,
|
status riscv_target_adapter<ARCH>::resume_from_addr(bool step, int sig, uint64_t addr, rp_thread_ref thread,
|
||||||
|
@ -69,7 +69,7 @@ struct core_trace;
|
|||||||
|
|
||||||
class core_complex : public sc_core::sc_module, public scc::traceable {
|
class core_complex : public sc_core::sc_module, public scc::traceable {
|
||||||
public:
|
public:
|
||||||
tlm::scc::initiator_mixin<tlm::scc::scv::tlm_rec_initiator_socket<32>> initiator{"intor"};
|
tlm::scc::initiator_mixin<tlm::tlm_initiator_socket<32>> initiator{"intor"};
|
||||||
|
|
||||||
sc_core::sc_in<bool> rst_i{"rst_i"};
|
sc_core::sc_in<bool> rst_i{"rst_i"};
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public:
|
|||||||
#ifndef CWR_SYSTEMC
|
#ifndef CWR_SYSTEMC
|
||||||
sc_core::sc_in<sc_core::sc_time> clk_i{"clk_i"};
|
sc_core::sc_in<sc_core::sc_time> clk_i{"clk_i"};
|
||||||
|
|
||||||
sc_core::sc_port<tlm::tlm_peek_if<uint64_t>, 1, sc_core::SC_ZERO_OR_MORE_BOUND> mtime_o;
|
sc_core::sc_port<tlm::tlm_peek_if<uint64_t>, 1, sc_core::SC_ZERO_OR_MORE_BOUND> mtime_o{"mtime_o"};
|
||||||
|
|
||||||
cci::cci_param<std::string> elf_file{"elf_file", ""};
|
cci::cci_param<std::string> elf_file{"elf_file", ""};
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
Reference in New Issue
Block a user