add backend selection and improve logging
This commit is contained in:
parent
ea4657b77c
commit
6f53970c40
@ -88,23 +88,27 @@ CLIParser::CLIParser(int argc, char *argv[])
|
||||
auto log_file_name = vm_["log-file"].as<std::string>();
|
||||
scc::init_logging(scc::LogConfig()
|
||||
.logFileName(log_file_name)
|
||||
.logLevel(static_cast<scc::log>(dbg_level))
|
||||
.logLevel(dbg_level)
|
||||
.logFilterRegex(log_regex)
|
||||
.coloredOutput(colored_output)
|
||||
);
|
||||
} else {
|
||||
scc::init_logging(scc::LogConfig()
|
||||
.logLevel(static_cast<scc::log>(dbg_level))
|
||||
.logLevel(dbg_level)
|
||||
.logFilterRegex(log_regex)
|
||||
.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() {
|
||||
// clang-format off
|
||||
desc.add_options()
|
||||
("help,h", "Print help message")
|
||||
("help,h", "Print help message")
|
||||
("verbose,v", po::value<unsigned>()->implicit_value(3), "Sets logging verbosity")
|
||||
("Verbose,V", po::value<unsigned>()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored")
|
||||
("debug-level,D", po::value<scc::log>(), "Debug output level (textual) as with --verbose")
|
||||
@ -113,13 +117,15 @@ void CLIParser::build() {
|
||||
("disass,d", po::value<std::string>()->implicit_value(""), "Enables disassembly")
|
||||
("elf,l", po::value<std::string>(), "ELF file to load")
|
||||
("gdb-port,g", po::value<unsigned short>()->default_value(0), "enable gdb server and specify port to use")
|
||||
("ir-dump", "dump the intermediate representation")
|
||||
("ir-dump", "dump the intermediate representation")
|
||||
("quantum", po::value<unsigned>(), "SystemC quantum time in ns")
|
||||
("reset,r", po::value<std::string>(), "reset address")
|
||||
("trace-level,t", po::value<unsigned>()->default_value(0), "enable tracing, or combination of 1=signals and 2=TX text, 4=TX compressed text, 6=TX in SQLite")
|
||||
("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")
|
||||
("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")
|
||||
("dump-config,dc", po::value<std::string>()->default_value(""), "dump configuration to file file");
|
||||
// clang-format on
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <scc/configurable_tracer.h>
|
||||
#include <scc/configurer.h>
|
||||
#include <scc/perf_estimator.h>
|
||||
#include <scc/report.h>
|
||||
#include <scc/scv_tr_db.h>
|
||||
#include <scc/tracer.h>
|
||||
@ -50,6 +51,7 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace sc_core;
|
||||
using namespace sysc;
|
||||
namespace po = boost::program_options;
|
||||
|
||||
@ -67,6 +69,8 @@ int sc_main(int argc, char *argv[]) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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);
|
||||
if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE;
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -90,6 +94,7 @@ int sc_main(int argc, char *argv[]) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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");
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// add non-implemented 'enableTracing' properties
|
||||
@ -106,6 +111,7 @@ int sc_main(int argc, char *argv[]) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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.dump_ir", parser.is_set("dump-ir"));
|
||||
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]);
|
||||
}
|
||||
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")) {
|
||||
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);
|
||||
@ -137,12 +143,22 @@ int sc_main(int argc, char *argv[]) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
try {
|
||||
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
|
||||
sc_core::sc_start();
|
||||
if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop();
|
||||
} catch (sc_core::sc_report &rep) {
|
||||
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
|
||||
sc_start();
|
||||
} catch(sc_report& e) {
|
||||
SCCERR() << "Caught sc_report exception during simulation: " << e.what() << ":" << e.get_msg();
|
||||
} 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
Block a user