diff --git a/.gitignore b/.gitignore index 371559b..2064412 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ CMakeSettings.json /.envrc.* .clangd /install +.gdb_history +.launch/TGC-VP interp.launch +.launch/TGC-VP-FW-Debug dhrystone.launch diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c15ab36..2793523 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,15 @@ { "recommendations": [ - "ms-vscode.cpptools-extension-pack", + "mkhl.direnv", + "sanaajani.taskrunnercode", + "ms-vscode.cpptools-themes", + "cnshenj.vscode-task-manager", + "twxs.cmake", + "kylinideteam.cmake-intellisence", + "kylinideteam.kylin-cmake-tools", "llvm-vs-code-extensions.vscode-clangd", "eclipse-cdt.cdt-gdb-vscode", "eclipse-cdt.memory-inspector", - "eclipse-cdt.peripheral-inspector", - + "eclipse-cdt.peripheral-inspector" ] } \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 488d4f1..22b683b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -56,16 +56,34 @@ "program": "${workspaceFolder}/build/Debug/src/riscv-vp", "arguments": "-v DEBUG --isa 'tgc5c|mu_p' --backend asmjit -f fw/hello-world/hello.elf", "openGdbConsole": true + }, + { + "type": "gdb", + "request": "launch", + "name": "64bit VP with Linux", + "cwd": "${workspaceRoot}", + "program": "${workspaceFolder}/build/Debug/src/riscv-vp", + "arguments": "--isa 'rv64gc|msu_vp' -v DEBUG --disass -l run.log -f build/Linux4TGC/opensbi/build/platform/riscv_vp/firmware/fw_payload.elf -m 40ms", + "openGdbConsole": true + }, + { + "type": "gdb", + "request": "launch", + "name": "64bit VP with Linux with gdbserver", + "cwd": "${workspaceRoot}", + "program": "${workspaceFolder}/build/Debug/src/riscv-vp", + "arguments": "--isa 'rv64gc|msu_vp' -f build/Linux4TGC/opensbi/build/platform/riscv_vp/firmware/fw_payload.elf -m 40ms -g 10000", + "openGdbConsole": true } ], "compounds": [ { "name": "FW-Debug 32bit", - "configurations": ["32bit VP with gdbserver", "Attach to VP"] + "configurations": ["32bit VP with gdbserver", "Attach GDB to VP"] }, { "name": "FW-Debug 64bit", - "configurations": ["64bit VP with gdbserver", "Attach to VP"] + "configurations": ["64bit VP with gdbserver", "Attach GDB to VP"] } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 347762a..4f9123e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "files.associations": { "platform.h": "c" }, - "debug.allowBreakpointsEverywhere": true, + "debug.disassemblyView.showSourceCode": true, "editor.rulers": [ { "column": 140, @@ -14,10 +14,15 @@ "--background-index", "--compile-commands-dir=${workspaceFolder}/build" ], + "cmake.buildDirectory": "${workspaceFolder}/build", "cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", "cmake.options.statusBarVisibility": "hidden", "cmake.options.advanced": { "configure": {"projectStatusVisibility": "visible"}, "build": {"statusBarVisibility": "visible"} + }, + "todo-tree.ripgrep.ripgrep": "/bin/rg", + "files.watcherExclude": { + "**/target": true } } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7418014..d5d92d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,8 +77,6 @@ if(NOT LIBS_ONLY) add_subdirectory(src) endif() -find_package(ClangFormat) - if(FW_BUILD) include(FetchContent) set(FETCHCONTENT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) diff --git a/dbt-rise-core b/dbt-rise-core index b0fd676..e60892d 160000 --- a/dbt-rise-core +++ b/dbt-rise-core @@ -1 +1 @@ -Subproject commit b0fd6762be2a39e4b05667f71778be4fb1bd6019 +Subproject commit e60892d2f9645231d24b02c864b6583ffda0c327 diff --git a/dbt-rise-riscv b/dbt-rise-riscv index c99d195..1260c9d 160000 --- a/dbt-rise-riscv +++ b/dbt-rise-riscv @@ -1 +1 @@ -Subproject commit c99d195faa93daaa9f00f52ee13408c76443e302 +Subproject commit 1260c9db5ec97242d07b20254654a057db3e7288 diff --git a/scc b/scc index badc373..214d4fc 160000 --- a/scc +++ b/scc @@ -1 +1 @@ -Subproject commit badc373aae58a9745dac803862edb522e6674321 +Subproject commit 214d4fc7b0faad1918ef42ecda34b046569c6642 diff --git a/src/CLIParser.cpp b/src/CLIParser.cpp index fa2ddea..f72d5b1 100644 --- a/src/CLIParser.cpp +++ b/src/CLIParser.cpp @@ -41,10 +41,8 @@ CLIParser::CLIParser(int argc, char* argv[]) auto log_level = vm_["verbose"].as(); auto log_level_num = static_cast(log_level); LOGGER(DEFAULT)::reporting_level() = logging::as_log_level(log_level_num > 6 ? 6 : log_level_num); - LOGGER(connection)::reporting_level() = - logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num); - LOGGER(dbt_rise_iss)::reporting_level() = - logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num); + LOGGER(connection)::reporting_level() = logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num); + LOGGER(dbt_rise_iss)::reporting_level() = logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num); /////////////////////////////////////////////////////////////////////////// // configure logging /////////////////////////////////////////////////////////////////////////// @@ -57,8 +55,8 @@ CLIParser::CLIParser(int argc, char* argv[]) scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR); sc_core::sc_report_handler::set_actions("/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING); sc_core::sc_report_handler::set_actions(sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, sc_core::SC_DO_NOTHING); - sc_core::sc_report_handler::set_actions(sc_core::SC_ERROR, sc_core::SC_LOG | sc_core::SC_CACHE_REPORT | - sc_core::SC_DISPLAY | sc_core::SC_STOP); + sc_core::sc_report_handler::set_actions(sc_core::SC_ERROR, + sc_core::SC_LOG | sc_core::SC_CACHE_REPORT | sc_core::SC_DISPLAY | sc_core::SC_STOP); } void CLIParser::build() { @@ -100,6 +98,8 @@ void CLIParser::build() { "set th ename of the trace file") ("max_time,m", po::value(), "maximum time to run") + ("heartbeat", po::value()->default_value("0"), + "print a heartbeat message at specifeid time intervals") ("config-file,c", po::value()->default_value(""), "read configuration from file") ("plugin,p", po::value>(), diff --git a/src/sc_main.cpp b/src/sc_main.cpp index 21c2276..0b573ed 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 -2021 MINRES Technolgies GmbH + * Copyright (c) 2019 -2025 MINRES Technolgies GmbH * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,7 +22,6 @@ #include #include #include -#include #ifdef ERROR #undef ERROR #endif @@ -31,7 +30,6 @@ 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; @@ -60,7 +58,7 @@ int sc_main(int argc, char* argv[]) { /////////////////////////////////////////////////////////////////////////// // create the performance estimation module /////////////////////////////////////////////////////////////////////////// - scc::perf_estimator estimator; + scc::perf_estimator estimator(scc::parse_from_string(parser.get("heartbeat"))); /////////////////////////////////////////////////////////////////////////// // set up configuration /////////////////////////////////////////////////////////////////////////// @@ -72,9 +70,8 @@ int sc_main(int argc, char* argv[]) { std::unique_ptr tracer; if(auto trace_level = parser.get("trace-level")) { auto file_name = parser.get("trace-file"); - auto enable_sig_trace = (trace_level & 0x1) != 0; // bit0 enables sig trace - auto tx_trace_type = - static_cast(trace_level >> 1); // bit3-bit1 define the kind of transaction trace + auto enable_sig_trace = (trace_level & 0x1) != 0; // bit0 enables sig trace + auto tx_trace_type = static_cast(trace_level >> 1); // bit3-bit1 define the kind of transaction trace 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); @@ -102,8 +99,7 @@ int sc_main(int argc, char* argv[]) { cfg.configure(); std::unique_ptr dumper; if(parser.is_set("dump-structure")) - dumper.reset( - new scc::hierarchy_dumper(parser.get("dump-structure"), scc::hierarchy_dumper::D3JSON)); + dumper.reset(new scc::hierarchy_dumper(parser.get("dump-structure"), scc::hierarchy_dumper::D3JSON)); /////////////////////////////////////////////////////////////////////////// // overwrite config with command line settings /////////////////////////////////////////////////////////////////////////// @@ -121,8 +117,7 @@ int sc_main(int argc, char* argv[]) { tlm::tlm_global_quantum::instance().set(sc_core::sc_time(parser.get("quantum"), sc_core::SC_NS)); if(parser.is_set("reset")) { auto str = parser.get("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); cfg.set_value(core_path + ".reset_address", start_address); } if(parser.is_set("disass")) { diff --git a/src/vp/gen/PipelinedMemoryBusToApbBridge.h b/src/vp/gen/PipelinedMemoryBusToApbBridge.h index 2bdb616..ce22cb1 100644 --- a/src/vp/gen/PipelinedMemoryBusToApbBridge.h +++ b/src/vp/gen/PipelinedMemoryBusToApbBridge.h @@ -18,5 +18,5 @@ const std::array, 7> PipelinedMemoryBusToA {aclint.socket, 0x30000, 0xc000}, {irq_ctrl.socket, 0x40000, 0x8}, {qspi.socket, 0x50000, 0x5c}, - {boot_rom.target, 0x80000, 0x2000}, + {boot_rom.target, 0x80000, 0x100000}, }}; diff --git a/src/vp/system.cpp b/src/vp/system.cpp index 3d48159..b95f16f 100644 --- a/src/vp/system.cpp +++ b/src/vp/system.cpp @@ -15,6 +15,7 @@ namespace vp { using namespace sc_core; using namespace vpvper::minres; +SC_HAS_PROCESS(system); // NOLINT system::system(sc_core::sc_module_name nm) : sc_core::sc_module(nm) , NAMED(ahb_router, 3, 2) @@ -24,17 +25,13 @@ system::system(sc_core::sc_module_name nm) core_complex.ibus(ahb_router.target[0]); core_complex.dbus(ahb_router.target[1]); - ahb_router.initiator.at(0)(qspi.xip_sck); - ahb_router.set_target_range(0, 0x20000000, 16_MB); - ahb_router.initiator.at(1)(mem_ram.target); - ahb_router.set_target_range(1, 0x00000000, 128_kB); - ahb_router.initiator.at(2)(apbBridge.target[0]); - ahb_router.set_target_range(2, 0x10000000, 256_MB); + ahb_router.bind_target(qspi.xip_sck, 0, 0x20000000, 16_MB); + ahb_router.bind_target(mem_ram.target, 1, 0x00000000, 32_MB); + ahb_router.bind_target(apbBridge.target[0], 2, 0x10000000, 256_MB); size_t i = 0; for(const auto& e : PipelinedMemoryBusToApbBridge_map) { - apbBridge.initiator.at(i)(e.target); - apbBridge.set_target_range(i, e.start, e.size); + apbBridge.bind_target(e.target, i, e.start, e.size); i++; } diff --git a/src/vp/system.h b/src/vp/system.h index dfb2ca3..025892f 100644 --- a/src/vp/system.h +++ b/src/vp/system.h @@ -30,8 +30,6 @@ namespace vp { class system : public sc_core::sc_module { public: - SC_HAS_PROCESS(system); // NOLINT - sc_core::sc_vector> pins_o{"pins_o", 32}; sc_core::sc_vector> pins_oe_o{"pins_oe_o", 32}; sc_core::sc_vector> pins_i{"pins_i", 32}; @@ -57,8 +55,8 @@ private: vpvper::minres::irq_tl irq_ctrl{"irq_ctrl"}; vpvper::minres::qspi_tl qspi{"qspi"}; - scc::memory<128_kB, scc::LT> mem_ram{"mem_ram"}; - scc::memory<8_kB, scc::LT> boot_rom{"boot_rom"}; + scc::memory<32_MB, scc::LT> mem_ram{"mem_ram"}; + scc::memory<1_MB, scc::LT> boot_rom{"boot_rom"}; sc_core::sc_signal mtime_clk{"mtime_clk"}; sc_core::sc_signal rst_s{"rst_s"}, mtime_int_s{"mtime_int_s"}, msip_int_s{"msip_int_s"}; diff --git a/src/vp/tb.h b/src/vp/tb.h index aeba73f..29b315c 100644 --- a/src/vp/tb.h +++ b/src/vp/tb.h @@ -20,6 +20,7 @@ public: tb(sc_core::sc_module_name const& nm); vp::system top{"top"}; vpvper::generic::rst_gen rst_gen{"rst_gen"}; + vpvper::generic::terminal term; sc_core::sc_signal rst_n{"rst_n"}; sc_core::sc_vector> pins_o{"pins_o", 32}; sc_core::sc_vector> pins_oe_o{"pins_oe_o", 32};