diff --git a/.gitignore b/.gitignore index 07dbbb3..8d194cb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ /output.trc CMakeSettings.json /.venv +/src-gen/ +/*.json diff --git a/CMakeLists.txt b/CMakeLists.txt index b6d9da5..f8b6c58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ option(EN_EXT_DEBUG "Enable extended debug output at runtime" OFF) option(ENABLE_COVERAGE "Enable code coverage" OFF) option(ENABLE_SANITIZER "Enable address sanitizer" OFF) option(ENABLE_CLANGTIDY "Enable static analysis with clang-tidy." OFF) -option(ENABLE_TCC "Enable the use of TCC" ON) set(SCC_LIB_ONLY ON) set(CMAKE_CXX_STANDARD 14) @@ -63,7 +62,7 @@ boost:without_type_erasure=True boost:without_wave=True ) -set(B2_VERSION 4.9.3) +set(B2_VERSION 4.9.6) set(CONAN_PACKAGE_LIST fmt/8.0.1 spdlog/1.9.2 @@ -76,13 +75,19 @@ set(CONAN_PACKAGE_LIST ) set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS}) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - list(APPEND CONAN_PACKAGE_LIST seasocks/1.4.4 lua/5.4.3) + list(APPEND CONAN_PACKAGE_LIST seasocks/1.4.4 tcc/0.9.27) list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False ) - if(ENABLE_TCC) - list(APPEND CONAN_PACKAGE_LIST tcc/0.9.27) - endif() + set(WITH_TCC ON) endif() - +if(WITH_LLVM) + list(APPEND CONAN_PACKAGE_LIST llvm-core/13.0.0) + list(APPEND CONAN_PACKAGE_OPTIONS libiconv:shared=True) +endif() +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tgc-iss/dbt-rise-plugins) + list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False) + list(APPEND CONAN_PACKAGE_LIST lua/5.4.3) +endif() + if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME}) set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 @@ -153,9 +158,12 @@ endif () add_subdirectory(scc) add_subdirectory(tgc-iss/dbt-rise-core) add_subdirectory(tgc-iss/dbt-rise-tgc) -#if(NOT USE_CWR_SYSTEMC) +if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tgc-iss//dbt-rise-plugins) + add_subdirectory(tgc-iss/dbt-rise-plugins) +endif() +if(NOT USE_CWR_SYSTEMC) add_subdirectory(vpvper) -#endif() +endif() if(NOT LIBS_ONLY) add_subdirectory(src) endif() diff --git a/contrib/eclipse_launch/TGC-VP.launch b/contrib/eclipse_launch/TGC-VP interp.launch similarity index 100% rename from contrib/eclipse_launch/TGC-VP.launch rename to contrib/eclipse_launch/TGC-VP interp.launch diff --git a/contrib/eclipse_launch/TGC-VP tcc.launch b/contrib/eclipse_launch/TGC-VP tcc.launch new file mode 100644 index 0000000..d854972 --- /dev/null +++ b/contrib/eclipse_launch/TGC-VP tcc.launch @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/CLIParser.cpp b/src/CLIParser.cpp index fcbfabb..f94518c 100644 --- a/src/CLIParser.cpp +++ b/src/CLIParser.cpp @@ -10,12 +10,16 @@ #include #include #include +#include #ifdef ERROR #undef ERROR #endif namespace po = boost::program_options; using namespace sc_core; +namespace { +std::unordered_set backend_opts = {"interp", "tcc"}; +} CLIParser::CLIParser(int argc, char *argv[]) : desc("Options") , valid(false) { @@ -28,9 +32,12 @@ CLIParser::CLIParser(int argc, char *argv[]) } po::notify(vm_); // throws on error, so do after help in case there are any problems valid = true; + if(backend_opts.find(vm_["backend"].as())== std::end(backend_opts)) + throw po::error("Illegal value for switch backend"); } catch (po::error &e) { std::cerr << "ERROR: " << e.what() << std::endl << std::endl; std::cerr << desc << std::endl; + exit(-1); } auto log_level = vm_["verbose"].as(); auto log_level_num = static_cast(log_level); @@ -74,6 +81,8 @@ void CLIParser::build() { "ELF file to load") ("gdb-port,g", po::value()->default_value(0), "enable gdb server and specify port to use") + ("backend", po::value()->default_value("interp"), + "the ISS backend to use, options are: interp, tcc") ("dump-ir", "dump the intermediate representation") ("dump-structure", po::value(), diff --git a/src/sc_main.cpp b/src/sc_main.cpp index 2d875ae..193ca75 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -87,6 +87,7 @@ int sc_main(int argc, char *argv[]) { /////////////////////////////////////////////////////////////////////////// cfg.set_value(core_path + ".gdb_server_port", parser.get("gdb-port")); cfg.set_value(core_path + ".dump_ir", parser.is_set("dump-ir")); + cfg.set_value(core_path + ".backend", parser.get("backend")); if(parser.is_set("plugin")){ auto plugins = util::join(parser.get>("plugin"),","); cfg.set_value(core_path + ".plugins", plugins); diff --git a/tgc-iss/dbt-rise-core b/tgc-iss/dbt-rise-core index bb85be4..e256725 160000 --- a/tgc-iss/dbt-rise-core +++ b/tgc-iss/dbt-rise-core @@ -1 +1 @@ -Subproject commit bb85be481cfd71c9fdaad5217a044b207465f4c4 +Subproject commit e2567254a3bf6c93f68bd1d8a40e9ba7cb2e0f53 diff --git a/tgc-iss/dbt-rise-tgc b/tgc-iss/dbt-rise-tgc index 720236e..e151416 160000 --- a/tgc-iss/dbt-rise-tgc +++ b/tgc-iss/dbt-rise-tgc @@ -1 +1 @@ -Subproject commit 720236ec3faf87246d15252278532a054c042875 +Subproject commit e151416f5878ccc2bfca00e7e7c86084c46e40bd