cleanup VSCode settings and linux setup

This commit is contained in:
2025-09-13 15:40:58 +02:00
parent 35a9fe95cb
commit 26d03549ea
14 changed files with 61 additions and 41 deletions

3
.gitignore vendored
View File

@@ -24,3 +24,6 @@ CMakeSettings.json
/.envrc.* /.envrc.*
.clangd .clangd
/install /install
.gdb_history
.launch/TGC-VP interp.launch
.launch/TGC-VP-FW-Debug dhrystone.launch

View File

@@ -1,10 +1,15 @@
{ {
"recommendations": [ "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", "llvm-vs-code-extensions.vscode-clangd",
"eclipse-cdt.cdt-gdb-vscode", "eclipse-cdt.cdt-gdb-vscode",
"eclipse-cdt.memory-inspector", "eclipse-cdt.memory-inspector",
"eclipse-cdt.peripheral-inspector", "eclipse-cdt.peripheral-inspector"
] ]
} }

22
.vscode/launch.json vendored
View File

@@ -56,16 +56,34 @@
"program": "${workspaceFolder}/build/Debug/src/riscv-vp", "program": "${workspaceFolder}/build/Debug/src/riscv-vp",
"arguments": "-v DEBUG --isa 'tgc5c|mu_p' --backend asmjit -f fw/hello-world/hello.elf", "arguments": "-v DEBUG --isa 'tgc5c|mu_p' --backend asmjit -f fw/hello-world/hello.elf",
"openGdbConsole": true "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": [ "compounds": [
{ {
"name": "FW-Debug 32bit", "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", "name": "FW-Debug 64bit",
"configurations": ["64bit VP with gdbserver", "Attach to VP"] "configurations": ["64bit VP with gdbserver", "Attach GDB to VP"]
} }
] ]
} }

View File

@@ -2,7 +2,7 @@
"files.associations": { "files.associations": {
"platform.h": "c" "platform.h": "c"
}, },
"debug.allowBreakpointsEverywhere": true, "debug.disassemblyView.showSourceCode": true,
"editor.rulers": [ "editor.rulers": [
{ {
"column": 140, "column": 140,
@@ -14,10 +14,15 @@
"--background-index", "--background-index",
"--compile-commands-dir=${workspaceFolder}/build" "--compile-commands-dir=${workspaceFolder}/build"
], ],
"cmake.buildDirectory": "${workspaceFolder}/build",
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", "cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json",
"cmake.options.statusBarVisibility": "hidden", "cmake.options.statusBarVisibility": "hidden",
"cmake.options.advanced": { "cmake.options.advanced": {
"configure": {"projectStatusVisibility": "visible"}, "configure": {"projectStatusVisibility": "visible"},
"build": {"statusBarVisibility": "visible"} "build": {"statusBarVisibility": "visible"}
},
"todo-tree.ripgrep.ripgrep": "/bin/rg",
"files.watcherExclude": {
"**/target": true
} }
} }

View File

@@ -77,8 +77,6 @@ if(NOT LIBS_ONLY)
add_subdirectory(src) add_subdirectory(src)
endif() endif()
find_package(ClangFormat)
if(FW_BUILD) if(FW_BUILD)
include(FetchContent) include(FetchContent)
set(FETCHCONTENT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) set(FETCHCONTENT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/..)

2
scc

Submodule scc updated: badc373aae...214d4fc7b0

View File

@@ -41,10 +41,8 @@ CLIParser::CLIParser(int argc, char* argv[])
auto log_level = vm_["verbose"].as<scc::log>(); auto log_level = vm_["verbose"].as<scc::log>();
auto log_level_num = static_cast<unsigned>(log_level); auto log_level_num = static_cast<unsigned>(log_level);
LOGGER(DEFAULT)::reporting_level() = logging::as_log_level(log_level_num > 6 ? 6 : log_level_num); LOGGER(DEFAULT)::reporting_level() = logging::as_log_level(log_level_num > 6 ? 6 : log_level_num);
LOGGER(connection)::reporting_level() = LOGGER(connection)::reporting_level() = logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num);
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(dbt_rise_iss)::reporting_level() =
logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// configure logging // configure logging
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@@ -57,8 +55,8 @@ CLIParser::CLIParser(int argc, char* argv[])
scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR); 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("/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_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_report_handler::set_actions(sc_core::SC_ERROR,
sc_core::SC_DISPLAY | sc_core::SC_STOP); sc_core::SC_LOG | sc_core::SC_CACHE_REPORT | sc_core::SC_DISPLAY | sc_core::SC_STOP);
} }
void CLIParser::build() { void CLIParser::build() {
@@ -100,6 +98,8 @@ void CLIParser::build() {
"set th ename of the trace file") "set th ename of the trace file")
("max_time,m", po::value<std::string>(), ("max_time,m", po::value<std::string>(),
"maximum time to run") "maximum time to run")
("heartbeat", po::value<std::string>()->default_value("0"),
"print a heartbeat message at specifeid time intervals")
("config-file,c", po::value<std::string>()->default_value(""), ("config-file,c", po::value<std::string>()->default_value(""),
"read configuration from file") "read configuration from file")
("plugin,p", po::value<std::vector<std::string>>(), ("plugin,p", po::value<std::vector<std::string>>(),

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 -2021 MINRES Technolgies GmbH * Copyright (c) 2019 -2025 MINRES Technolgies GmbH
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -22,7 +22,6 @@
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream>
#ifdef ERROR #ifdef ERROR
#undef ERROR #undef ERROR
#endif #endif
@@ -31,7 +30,6 @@ const std::string core_path{"tb.top.core_complex"};
using namespace sysc; using namespace sysc;
using namespace sc_core; using namespace sc_core;
namespace po = boost::program_options;
namespace { namespace {
const size_t ERRORR_IN_COMMAND_LINE = 1; const size_t ERRORR_IN_COMMAND_LINE = 1;
@@ -60,7 +58,7 @@ int sc_main(int argc, char* argv[]) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// create the performance estimation module // create the performance estimation module
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
scc::perf_estimator estimator; scc::perf_estimator estimator(scc::parse_from_string(parser.get<std::string>("heartbeat")));
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// set up configuration // set up configuration
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@@ -72,9 +70,8 @@ int sc_main(int argc, char* argv[]) {
std::unique_ptr<scc::configurable_tracer> tracer; std::unique_ptr<scc::configurable_tracer> tracer;
if(auto trace_level = parser.get<unsigned>("trace-level")) { if(auto trace_level = parser.get<unsigned>("trace-level")) {
auto file_name = parser.get<std::string>("trace-file"); auto file_name = parser.get<std::string>("trace-file");
auto enable_sig_trace = (trace_level & 0x1) != 0; // bit0 enables sig trace auto enable_sig_trace = (trace_level & 0x1) != 0; // bit0 enables sig trace
auto tx_trace_type = auto tx_trace_type = static_cast<scc::tracer::file_type>(trace_level >> 1); // bit3-bit1 define the kind of transaction trace
static_cast<scc::tracer::file_type>(trace_level >> 1); // bit3-bit1 define the kind of transaction trace
auto trace_default_on = parser.is_set("trace-default-on"); auto trace_default_on = parser.is_set("trace-default-on");
if(parser.is_set("trace-default-off")) if(parser.is_set("trace-default-off"))
cfg.set_value("scc_tracer.default_trace_enable", false); cfg.set_value("scc_tracer.default_trace_enable", false);
@@ -102,8 +99,7 @@ int sc_main(int argc, char* argv[]) {
cfg.configure(); cfg.configure();
std::unique_ptr<scc::hierarchy_dumper> dumper; std::unique_ptr<scc::hierarchy_dumper> dumper;
if(parser.is_set("dump-structure")) if(parser.is_set("dump-structure"))
dumper.reset( dumper.reset(new scc::hierarchy_dumper(parser.get<std::string>("dump-structure"), scc::hierarchy_dumper::D3JSON));
new scc::hierarchy_dumper(parser.get<std::string>("dump-structure"), scc::hierarchy_dumper::D3JSON));
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// overwrite config with command line settings // 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<unsigned>("quantum"), sc_core::SC_NS)); tlm::tlm_global_quantum::instance().set(sc_core::sc_time(parser.get<unsigned>("quantum"), sc_core::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 = uint64_t start_address = str.find("0x") == 0 ? std::stoull(str.substr(2), nullptr, 16) : std::stoull(str, nullptr, 10);
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); cfg.set_value(core_path + ".reset_address", start_address);
} }
if(parser.is_set("disass")) { if(parser.is_set("disass")) {

View File

@@ -18,5 +18,5 @@ const std::array<scc::target_memory_map_entry<scc::LT>, 7> PipelinedMemoryBusToA
{aclint.socket, 0x30000, 0xc000}, {aclint.socket, 0x30000, 0xc000},
{irq_ctrl.socket, 0x40000, 0x8}, {irq_ctrl.socket, 0x40000, 0x8},
{qspi.socket, 0x50000, 0x5c}, {qspi.socket, 0x50000, 0x5c},
{boot_rom.target, 0x80000, 0x2000}, {boot_rom.target, 0x80000, 0x100000},
}}; }};

View File

@@ -15,6 +15,7 @@ namespace vp {
using namespace sc_core; using namespace sc_core;
using namespace vpvper::minres; using namespace vpvper::minres;
SC_HAS_PROCESS(system); // NOLINT
system::system(sc_core::sc_module_name nm) system::system(sc_core::sc_module_name nm)
: sc_core::sc_module(nm) : sc_core::sc_module(nm)
, NAMED(ahb_router, 3, 2) , 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.ibus(ahb_router.target[0]);
core_complex.dbus(ahb_router.target[1]); core_complex.dbus(ahb_router.target[1]);
ahb_router.initiator.at(0)(qspi.xip_sck); ahb_router.bind_target(qspi.xip_sck, 0, 0x20000000, 16_MB);
ahb_router.set_target_range(0, 0x20000000, 16_MB); ahb_router.bind_target(mem_ram.target, 1, 0x00000000, 32_MB);
ahb_router.initiator.at(1)(mem_ram.target); ahb_router.bind_target(apbBridge.target[0], 2, 0x10000000, 256_MB);
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);
size_t i = 0; size_t i = 0;
for(const auto& e : PipelinedMemoryBusToApbBridge_map) { for(const auto& e : PipelinedMemoryBusToApbBridge_map) {
apbBridge.initiator.at(i)(e.target); apbBridge.bind_target(e.target, i, e.start, e.size);
apbBridge.set_target_range(i, e.start, e.size);
i++; i++;
} }

View File

@@ -30,8 +30,6 @@ namespace vp {
class system : public sc_core::sc_module { class system : public sc_core::sc_module {
public: public:
SC_HAS_PROCESS(system); // NOLINT
sc_core::sc_vector<sc_core::sc_out<bool>> pins_o{"pins_o", 32}; sc_core::sc_vector<sc_core::sc_out<bool>> pins_o{"pins_o", 32};
sc_core::sc_vector<sc_core::sc_out<bool>> pins_oe_o{"pins_oe_o", 32}; sc_core::sc_vector<sc_core::sc_out<bool>> pins_oe_o{"pins_oe_o", 32};
sc_core::sc_vector<sc_core::sc_in<bool>> pins_i{"pins_i", 32}; sc_core::sc_vector<sc_core::sc_in<bool>> pins_i{"pins_i", 32};
@@ -57,8 +55,8 @@ private:
vpvper::minres::irq_tl irq_ctrl{"irq_ctrl"}; vpvper::minres::irq_tl irq_ctrl{"irq_ctrl"};
vpvper::minres::qspi_tl qspi{"qspi"}; vpvper::minres::qspi_tl qspi{"qspi"};
scc::memory<128_kB, scc::LT> mem_ram{"mem_ram"}; scc::memory<32_MB, scc::LT> mem_ram{"mem_ram"};
scc::memory<8_kB, scc::LT> boot_rom{"boot_rom"}; scc::memory<1_MB, scc::LT> boot_rom{"boot_rom"};
sc_core::sc_signal<sc_core::sc_time> mtime_clk{"mtime_clk"}; sc_core::sc_signal<sc_core::sc_time> mtime_clk{"mtime_clk"};
sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> rst_s{"rst_s"}, mtime_int_s{"mtime_int_s"}, msip_int_s{"msip_int_s"}; sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> rst_s{"rst_s"}, mtime_int_s{"mtime_int_s"}, msip_int_s{"msip_int_s"};

View File

@@ -20,6 +20,7 @@ public:
tb(sc_core::sc_module_name const& nm); tb(sc_core::sc_module_name const& nm);
vp::system top{"top"}; vp::system top{"top"};
vpvper::generic::rst_gen rst_gen{"rst_gen"}; vpvper::generic::rst_gen rst_gen{"rst_gen"};
vpvper::generic::terminal term;
sc_core::sc_signal<bool> rst_n{"rst_n"}; sc_core::sc_signal<bool> rst_n{"rst_n"};
sc_core::sc_vector<sc_core::sc_signal<bool>> pins_o{"pins_o", 32}; sc_core::sc_vector<sc_core::sc_signal<bool>> pins_o{"pins_o", 32};
sc_core::sc_vector<sc_core::sc_signal<bool>> pins_oe_o{"pins_oe_o", 32}; sc_core::sc_vector<sc_core::sc_signal<bool>> pins_oe_o{"pins_oe_o", 32};