add backend selection and improve logging
This commit is contained in:
parent
ea4657b77c
commit
6f53970c40
|
@ -88,17 +88,21 @@ CLIParser::CLIParser(int argc, char *argv[])
|
||||||
auto log_file_name = vm_["log-file"].as<std::string>();
|
auto log_file_name = vm_["log-file"].as<std::string>();
|
||||||
scc::init_logging(scc::LogConfig()
|
scc::init_logging(scc::LogConfig()
|
||||||
.logFileName(log_file_name)
|
.logFileName(log_file_name)
|
||||||
.logLevel(static_cast<scc::log>(dbg_level))
|
.logLevel(dbg_level)
|
||||||
.logFilterRegex(log_regex)
|
.logFilterRegex(log_regex)
|
||||||
.coloredOutput(colored_output)
|
.coloredOutput(colored_output)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
scc::init_logging(scc::LogConfig()
|
scc::init_logging(scc::LogConfig()
|
||||||
.logLevel(static_cast<scc::log>(dbg_level))
|
.logLevel(dbg_level)
|
||||||
.logFilterRegex(log_regex)
|
.logFilterRegex(log_regex)
|
||||||
.coloredOutput(colored_output)
|
.coloredOutput(colored_output)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
LOGGER(DEFAULT)::reporting_level()=static_cast<logging::log_level>(dbg_level);
|
||||||
|
LOGGER(DEFAULT)::print_time()=false;
|
||||||
|
LOGGER(DEFAULT)::print_severity()=false;
|
||||||
|
LOG_OUTPUT(DEFAULT)::ostream() = &std::cout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLIParser::build() {
|
void CLIParser::build() {
|
||||||
|
@ -120,6 +124,8 @@ void CLIParser::build() {
|
||||||
("trace-default-on", "enables tracing for all unspecified modules")
|
("trace-default-on", "enables tracing for all unspecified modules")
|
||||||
("trace-file", po::value<std::string>()->default_value("system"), "set th ename of the trace file")
|
("trace-file", po::value<std::string>()->default_value("system"), "set th ename of the trace file")
|
||||||
("max_time,m", po::value<std::string>(), "maximum time to run")
|
("max_time,m", po::value<std::string>(), "maximum time to run")
|
||||||
|
("backend", po::value<std::string>()->default_value("tcc"), "ISS engine to use")
|
||||||
|
("heart-beat,b", "Enable heartbeat printing")
|
||||||
("config-file,c", po::value<std::string>()->default_value(""), "read configuration from file")
|
("config-file,c", po::value<std::string>()->default_value(""), "read configuration from file")
|
||||||
("dump-config,dc", po::value<std::string>()->default_value(""), "dump configuration to file file");
|
("dump-config,dc", po::value<std::string>()->default_value(""), "dump configuration to file file");
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include <scc/configurable_tracer.h>
|
#include <scc/configurable_tracer.h>
|
||||||
#include <scc/configurer.h>
|
#include <scc/configurer.h>
|
||||||
|
#include <scc/perf_estimator.h>
|
||||||
#include <scc/report.h>
|
#include <scc/report.h>
|
||||||
#include <scc/scv_tr_db.h>
|
#include <scc/scv_tr_db.h>
|
||||||
#include <scc/tracer.h>
|
#include <scc/tracer.h>
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace sc_core;
|
||||||
using namespace sysc;
|
using namespace sysc;
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
@ -67,6 +69,8 @@ int sc_main(int argc, char *argv[]) {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// CLI argument parsing & logging setup
|
// CLI argument parsing & logging setup
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
scc::stream_redirection cout_redir(std::cout, scc::log::INFO);
|
||||||
|
scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR);
|
||||||
CLIParser parser(argc, argv);
|
CLIParser parser(argc, argv);
|
||||||
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -90,6 +94,7 @@ int sc_main(int argc, char *argv[]) {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// instantiate top level
|
// instantiate top level
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
auto estimator = scc::make_unique<scc::perf_estimator>(parser.is_set("heart-beat") ? 10_us : SC_ZERO_TIME);
|
||||||
auto i_system = scc::make_unique<sysc::system>("i_system");
|
auto i_system = scc::make_unique<sysc::system>("i_system");
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// add non-implemented 'enableTracing' properties
|
// add non-implemented 'enableTracing' properties
|
||||||
|
@ -106,6 +111,7 @@ int sc_main(int argc, char *argv[]) {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// overwrite config with command line settings
|
// overwrite config with command line settings
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.backend", parser.get<std::string>("backend"));
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.gdb_server_port", parser.get<unsigned short>("gdb-port"));
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.gdb_server_port", parser.get<unsigned short>("gdb-port"));
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir"));
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir"));
|
||||||
if (parser.is_set("elf"))
|
if (parser.is_set("elf"))
|
||||||
|
@ -116,7 +122,7 @@ int sc_main(int argc, char *argv[]) {
|
||||||
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
|
cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);
|
||||||
}
|
}
|
||||||
if (parser.is_set("quantum"))
|
if (parser.is_set("quantum"))
|
||||||
tlm::tlm_global_quantum::instance().set(sc_core::sc_time(parser.get<unsigned>("quantum"), sc_core::SC_NS));
|
tlm::tlm_global_quantum::instance().set(sc_time(parser.get<unsigned>("quantum"), SC_NS));
|
||||||
if (parser.is_set("reset")) {
|
if (parser.is_set("reset")) {
|
||||||
auto str = parser.get<std::string>("reset");
|
auto str = parser.get<std::string>("reset");
|
||||||
uint64_t start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10);
|
uint64_t start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10);
|
||||||
|
@ -137,12 +143,22 @@ int sc_main(int argc, char *argv[]) {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
try {
|
try {
|
||||||
if (parser.is_set("max_time")) {
|
if (parser.is_set("max_time")) {
|
||||||
sc_core::sc_start(scc::parse_from_string(parser.get<std::string>("max_time")));
|
sc_start(scc::parse_from_string(parser.get<std::string>("max_time")));
|
||||||
} else
|
} else
|
||||||
sc_core::sc_start();
|
sc_start();
|
||||||
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();
|
} catch(sc_report& e) {
|
||||||
} catch (sc_core::sc_report &rep) {
|
SCCERR() << "Caught sc_report exception during simulation: " << e.what() << ":" << e.get_msg();
|
||||||
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
|
} catch(std::exception& e) {
|
||||||
|
SCCERR() << "Caught exception during simulation: " << e.what();
|
||||||
|
} catch(...) {
|
||||||
|
SCCERR() << "Caught unspecified exception during simulation";
|
||||||
}
|
}
|
||||||
return 0;
|
if(sc_is_running()) {
|
||||||
|
SCCERR() << "Simulation timeout!"; // calls sc_stop
|
||||||
|
}
|
||||||
|
auto errcnt = sc_report_handler::get_count(SC_ERROR);
|
||||||
|
auto warncnt = sc_report_handler::get_count(SC_WARNING);
|
||||||
|
SCCINFO() << "Finished, there were " << errcnt << " error" << (errcnt == 1 ? "" : "s") << " and " << warncnt << " warning"
|
||||||
|
<< (warncnt == 1 ? "" : "s");
|
||||||
|
return errcnt + warncnt;
|
||||||
}
|
}
|
||||||
|
|
2
riscv
2
riscv
|
@ -1 +1 @@
|
||||||
Subproject commit edeff7add807ab0e524b5d05b16defe58be2a867
|
Subproject commit 71b976811b43557fa0610aef01989d54df841a2c
|
2
scc
2
scc
|
@ -1 +1 @@
|
||||||
Subproject commit 01458535fa10e3bd5794d50df82ce94f214bfbe1
|
Subproject commit 529cb29a483e00bc2bfc1fba25dbbf595b077235
|
Loading…
Reference in New Issue