mirror of
https://github.com/Minres/RISCV-VP.git
synced 2025-12-17 08:51:35 +00:00
updates submodule and adds abort handling in sc_main
This commit is contained in:
Submodule dbt-rise-riscv updated: 05f7051db2...a0ff1294e3
2
scc
2
scc
Submodule scc updated: f626f0259f...947064144c
@@ -20,9 +20,10 @@
|
||||
|
||||
#include "vp/tb.h"
|
||||
#include <boost/program_options.hpp>
|
||||
#include <csetjmp>
|
||||
#include <csignal>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#ifdef ERROR
|
||||
#undef ERROR
|
||||
#endif
|
||||
@@ -31,14 +32,20 @@ const std::string core_path{"tb.top.core_complex"};
|
||||
|
||||
using namespace sysc;
|
||||
using namespace sc_core;
|
||||
namespace po = boost::program_options;
|
||||
|
||||
namespace {
|
||||
const size_t ERRORR_IN_COMMAND_LINE = 1;
|
||||
const size_t SUCCESS = 0;
|
||||
} // namespace
|
||||
|
||||
jmp_buf abrt;
|
||||
void ABRThandler(int sig) { longjmp(abrt, sig); }
|
||||
|
||||
int sc_main(int argc, char* argv[]) {
|
||||
signal(SIGINT, ABRThandler);
|
||||
signal(SIGABRT, ABRThandler);
|
||||
signal(SIGSEGV, ABRThandler);
|
||||
signal(SIGTERM, ABRThandler);
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SystemC >=2.2 got picky about multiple drivers so disable check
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -73,8 +80,7 @@ int sc_main(int argc, char* argv[]) {
|
||||
if(auto trace_level = parser.get<unsigned>("trace-level")) {
|
||||
auto file_name = parser.get<std::string>("trace-file");
|
||||
auto trace_default_on = parser.is_set("trace-default-on");
|
||||
if(parser.is_set("trace-default-off"))
|
||||
cfg.set_value("scc_tracer.default_trace_enable", false);
|
||||
cfg.set_value("scc_tracer.default_trace_enable", !parser.is_set("trace-default-off"));
|
||||
cfg.set_value("scc_tracer.tx_trace_type", static_cast<unsigned>(scc::tracer::file_type::FTR));
|
||||
cfg.set_value("scc_tracer.sig_trace_type", static_cast<unsigned>(scc::tracer::file_type::FST));
|
||||
tracer = scc::make_unique<scc::configurable_tracer>(file_name, static_cast<bool>(trace_level & 0x2),
|
||||
@@ -90,7 +96,7 @@ int sc_main(int argc, char* argv[]) {
|
||||
if(tracer)
|
||||
tracer->add_control();
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// dump configuration if requested
|
||||
// dump configuration if requested and/or structure
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
if(parser.get<std::string>("dump-config").size() > 0) {
|
||||
std::ofstream of{parser.get<std::string>("dump-config")};
|
||||
@@ -133,6 +139,9 @@ int sc_main(int argc, char* argv[]) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// run simulation
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
if(auto res = setjmp(abrt)) {
|
||||
SCCERR() << "Simulation aborted with signal " << res << "!";
|
||||
} else {
|
||||
try {
|
||||
if(parser.is_set("max_time")) {
|
||||
sc_core::sc_start(scc::parse_from_string(parser.get<std::string>("max_time")));
|
||||
@@ -143,5 +152,6 @@ int sc_main(int argc, char* argv[]) {
|
||||
} catch(sc_core::sc_report& rep) {
|
||||
sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user