Compare commits
2 Commits
9fcbeb478b
...
develop
Author | SHA1 | Date | |
---|---|---|---|
c1aed64a41 | |||
d5d195845c |
@ -230,11 +230,6 @@ public:
|
|||||||
trap_load_access_fault(uint64_t badaddr)
|
trap_load_access_fault(uint64_t badaddr)
|
||||||
: trap_access(5 << 16, badaddr) {}
|
: trap_access(5 << 16, badaddr) {}
|
||||||
};
|
};
|
||||||
class illegal_instruction_fault : public trap_access {
|
|
||||||
public:
|
|
||||||
illegal_instruction_fault(uint64_t badaddr)
|
|
||||||
: trap_access(2 << 16, badaddr) {}
|
|
||||||
};
|
|
||||||
class trap_instruction_page_fault : public trap_access {
|
class trap_instruction_page_fault : public trap_access {
|
||||||
public:
|
public:
|
||||||
trap_instruction_page_fault(uint64_t badaddr)
|
trap_instruction_page_fault(uint64_t badaddr)
|
||||||
@ -523,10 +518,10 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
return iss::Err;
|
return iss::Err;
|
||||||
auto req_priv_lvl = (addr >> 8) & 0x3;
|
auto req_priv_lvl = (addr >> 8) & 0x3;
|
||||||
if(this->reg.PRIV < req_priv_lvl) // not having required privileges
|
if(this->reg.PRIV < req_priv_lvl) // not having required privileges
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
auto it = csr_rd_cb.find(addr);
|
auto it = csr_rd_cb.find(addr);
|
||||||
if(it == csr_rd_cb.end() || !it->second) // non existent register
|
if(it == csr_rd_cb.end() || !it->second) // non existent register
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
return it->second(addr, val);
|
return it->second(addr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,12 +530,12 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
return iss::Err;
|
return iss::Err;
|
||||||
auto req_priv_lvl = (addr >> 8) & 0x3;
|
auto req_priv_lvl = (addr >> 8) & 0x3;
|
||||||
if(this->reg.PRIV < req_priv_lvl) // not having required privileges
|
if(this->reg.PRIV < req_priv_lvl) // not having required privileges
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
if((addr & 0xc00) == 0xc00) // writing to read-only region
|
if((addr & 0xc00) == 0xc00) // writing to read-only region
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
auto it = csr_wr_cb.find(addr);
|
auto it = csr_wr_cb.find(addr);
|
||||||
if(it == csr_wr_cb.end() || !it->second) // non existent register
|
if(it == csr_wr_cb.end() || !it->second) // non existent register
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
return it->second(addr, val);
|
return it->second(addr, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,7 +632,7 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
|
|
||||||
iss::status write_dcsr(unsigned addr, reg_t val) {
|
iss::status write_dcsr(unsigned addr, reg_t val) {
|
||||||
if(!debug_mode_active())
|
if(!debug_mode_active())
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
// +-------------- ebreakm
|
// +-------------- ebreakm
|
||||||
// | +---------- stepi
|
// | +---------- stepi
|
||||||
// | | +++----- cause
|
// | | +++----- cause
|
||||||
@ -648,28 +643,28 @@ template <typename BASE, typename LOGCAT = logging::disass> struct riscv_hart_co
|
|||||||
|
|
||||||
iss::status read_debug(unsigned addr, reg_t& val) {
|
iss::status read_debug(unsigned addr, reg_t& val) {
|
||||||
if(!debug_mode_active())
|
if(!debug_mode_active())
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
val = csr[addr];
|
val = csr[addr];
|
||||||
return iss::Ok;
|
return iss::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
iss::status write_dscratch(unsigned addr, reg_t val) {
|
iss::status write_dscratch(unsigned addr, reg_t val) {
|
||||||
if(!debug_mode_active())
|
if(!debug_mode_active())
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
csr[addr] = val;
|
csr[addr] = val;
|
||||||
return iss::Ok;
|
return iss::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
iss::status read_dpc(unsigned addr, reg_t& val) {
|
iss::status read_dpc(unsigned addr, reg_t& val) {
|
||||||
if(!debug_mode_active())
|
if(!debug_mode_active())
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
val = this->reg.DPC;
|
val = this->reg.DPC;
|
||||||
return iss::Ok;
|
return iss::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
iss::status write_dpc(unsigned addr, reg_t val) {
|
iss::status write_dpc(unsigned addr, reg_t val) {
|
||||||
if(!debug_mode_active())
|
if(!debug_mode_active())
|
||||||
throw illegal_instruction_fault(this->fault_data);
|
return iss::Err;
|
||||||
this->reg.DPC = val;
|
this->reg.DPC = val;
|
||||||
return iss::Ok;
|
return iss::Ok;
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,10 @@
|
|||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <util/ities.h>
|
#include <util/ities.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <numeric>
|
|
||||||
#include <iss/plugin/cycle_estimate.h>
|
#include <iss/plugin/cycle_estimate.h>
|
||||||
#include <iss/plugin/instruction_count.h>
|
#include <iss/plugin/instruction_count.h>
|
||||||
|
#include <util/ities.h>
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@ -269,7 +268,7 @@ template <unsigned int BUSWIDTH> void core_complex<BUSWIDTH>::before_end_of_elab
|
|||||||
sc_assert(cpu->vm != nullptr);
|
sc_assert(cpu->vm != nullptr);
|
||||||
auto disass = GET_PROP_VALUE(enable_disass);
|
auto disass = GET_PROP_VALUE(enable_disass);
|
||||||
if(disass && trc->m_db)
|
if(disass && trc->m_db)
|
||||||
SCCINFO(SCMOD)<<"Disasssembly will only be in transaction trace database!";
|
SCCINFO(SCMOD) << "Disasssembly will only be in transaction trace database!";
|
||||||
cpu->vm->setDisassEnabled(disass || trc->m_db != nullptr);
|
cpu->vm->setDisassEnabled(disass || trc->m_db != nullptr);
|
||||||
if(GET_PROP_VALUE(plugins).length()) {
|
if(GET_PROP_VALUE(plugins).length()) {
|
||||||
auto p = util::split(GET_PROP_VALUE(plugins), ';');
|
auto p = util::split(GET_PROP_VALUE(plugins), ';');
|
||||||
@ -308,17 +307,20 @@ template <unsigned int BUSWIDTH> void core_complex<BUSWIDTH>::before_end_of_elab
|
|||||||
template <unsigned int BUSWIDTH> void core_complex<BUSWIDTH>::start_of_simulation() {
|
template <unsigned int BUSWIDTH> void core_complex<BUSWIDTH>::start_of_simulation() {
|
||||||
// quantum_keeper.reset();
|
// quantum_keeper.reset();
|
||||||
if(GET_PROP_VALUE(elf_file).size() > 0) {
|
if(GET_PROP_VALUE(elf_file).size() > 0) {
|
||||||
istringstream is(GET_PROP_VALUE(elf_file));
|
auto file_names = util::split(GET_PROP_VALUE(elf_file), ',');
|
||||||
string s;
|
for(auto& s : file_names) {
|
||||||
while(getline(is, s, ',')) {
|
std::pair<uint64_t, bool> load_result = cpu->load_file(s);
|
||||||
std::pair<uint64_t, bool> start_addr = cpu->load_file(s);
|
if(!std::get<1>(load_result)) {
|
||||||
|
SCCWARN(SCMOD) << "Could not load FW file " << s;
|
||||||
|
} else {
|
||||||
#ifndef CWR_SYSTEMC
|
#ifndef CWR_SYSTEMC
|
||||||
if(reset_address.is_default_value() && start_addr.second == true)
|
if(reset_address.is_default_value())
|
||||||
reset_address.set_value(start_addr.first);
|
reset_address.set_value(load_result.first);
|
||||||
#else
|
#else
|
||||||
if(start_addr.second == true)
|
if(start_addr.second == true)
|
||||||
reset_address = start_addr.first;
|
reset_address = start_addr.first;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(trc->m_db != nullptr && trc->stream_handle == nullptr) {
|
if(trc->m_db != nullptr && trc->stream_handle == nullptr) {
|
||||||
|
Reference in New Issue
Block a user