fixes FW load handling in SysC wrapper, reports now na error if failed

This commit is contained in:
2025-07-02 13:49:16 +02:00
parent 9fcbeb478b
commit d5d195845c

View File

@ -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
@ -308,19 +307,22 @@ 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) {
string basename(this->name()); string basename(this->name());
trc->stream_handle = new scv_tr_stream((basename + ".instr").c_str(), "TRANSACTOR", trc->m_db); trc->stream_handle = new scv_tr_stream((basename + ".instr").c_str(), "TRANSACTOR", trc->m_db);