Merge branch 'feature/multi_threading' into develop

This commit is contained in:
2025-11-28 06:10:50 +01:00
14 changed files with 184 additions and 12 deletions

2
.envrc
View File

@@ -5,6 +5,8 @@ if [ $distro == "CentOS" ]; then
. /opt/rh/rh-python38/enable
elif [ $distro == "Rocky" ]; then
. /opt/rh/gcc-toolset-11/enable
elif [ $distro == "RockyLinux" ]; then
. /opt/rh/gcc-toolset-14/enable
fi
if has module; then
module load ./Modulefile

View File

@@ -1 +0,0 @@
set breakpoint pending on

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="1"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="sc_main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="--isa ?"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/${config_name:RISCV-VP}/src/riscv-vp"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RISCV-VP"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/RISCV-VP"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.DefaultEvent" value="true"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.HideUnresolvedSymbols" value="true"/>
<stringAttribute key="org.eclipse.linuxtools.internal.perf.attr.Kernel.Location" value=""/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.Kernel.SourceLineNumbers" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.ModuleSymbols" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.MultipleEvents" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.Record.Realtime" value="false"/>
<intAttribute key="org.eclipse.linuxtools.internal.perf.attr.Record.Realtime.Priority" value="1"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.Record.Verbose" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.ShowSourceDisassembly" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.ShowStat" value="false"/>
<booleanAttribute key="org.eclipse.linuxtools.internal.perf.attr.SourceLineNumbers" value="true"/>
<intAttribute key="org.eclipse.linuxtools.internal.perf.attr.StatRunCount" value="1"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
<stringAttribute key="provider" value="org.eclipse.linuxtools.perf.provider"/>
</launchConfiguration>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.remoteApplicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="riscv64-unknown-elf-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEV" value="/dev/ttyS0"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEV_SPEED" value="115200"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.HOST" value="localhost"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.PORT" value="10000"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TCP" value="true"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REMOTE_TIMEOUT_VALUE" value=""/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.RemoteApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdbserver"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/riscvfw-src/benchmarks/dhrystone/dhrystone.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RISCV-VP"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<booleanAttribute key="org.eclipse.cdt.launch.remote.RemoteCDSFDebuggerTab.DEFAULTS_SET" value="true"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_GDBSERVER_COMMAND" value="gdbserver"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_GDBSERVER_OPTIONS" value=""/>
<stringAttribute key="org.eclipse.debug.core.ATTR_GDBSERVER_PORT" value="2345"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_PRERUN_CMDS" value=""/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_SKIP_DOWNLOAD_TO_TARGET" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_TARGET_PATH" value="/scratch/eyck/workarea/MINRES/RISCV-VP/fw/hello-world/hello"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/RISCV-VP"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.REMOTE_TCP" value="Local"/>
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
<mapEntry key="[debug]" value="org.eclipse.cdt.dsf.gdb.launch.remoteCLaunch"/>
</mapAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

45
.vscode/launch.json vendored
View File

@@ -44,6 +44,41 @@
"b main"
]
},
{
"type": "gdbtarget",
"request": "launch",
"name": "Debug hello world 32bit",
"program": "fw/hello-world/hello.elf",
"imageAndSymbols": {
"symbolFileName": "fw/hello-world/hello.elf"
},
"target": {
"server": "${workspaceFolder}/build/RelWithDebInfo/src/riscv-vp",
"serverParameters": [
"--isa",
"rv32gc_msu",
"-v",
"INFO",
"-f",
"fw/hello-world/hello.elf",
"-g",
"10000"
],
"watchServerProcess": true,
"port": "10000"
},
"cwd": "${workspaceRoot}",
"gdb": "riscv64-unknown-elf-gdb",
"openGdbConsole": false,
"presentation": {
"hidden": false,
"group": "FW Debug",
"order": 2
},
"initCommands": [
"b main"
]
},
{
"type": "gdbtarget",
"request": "attach",
@@ -79,7 +114,15 @@
"name": "32bit VP",
"cwd": "${workspaceRoot}",
"program": "${workspaceFolder}/build/Debug/src/riscv-vp",
"arguments": "--isa 'rv32gc_msu' -v INFO --disass -f fw/hello-world/hello.elf"
"arguments": "--isa 'rv32gc_msu' -v INFO -f fw/hello-world/hello.elf",
"openGdbConsole": true,
"initCommands": [
"set breakpoint pending on",
"set breakpoint auto-hw on",
"set breakpoint always-inserted on",
"set output-radix 16"
],
"verbose": false
},
{
"type": "gdb",

View File

@@ -19,7 +19,9 @@
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "scc/cmake/conan_provider.cmake",
"CONAN_BUILD_PROFILE": "auto-cmake",
"CONAN_HOST_PROFILE": "auto-cmake",
"CONAN_BUILD_PROFILE": "conan_host_profile",
"CMAKE_EXECUTE_PROCESS_COMMAND_ECHO": "STDOUT",
"WITH_TCC": "OFF"
}
},

13
Linux.code-workspace Normal file
View File

@@ -0,0 +1,13 @@
{
"folders": [
{
"path": "build/Linux4TGC/buildroot"
},
{
"path": "build/Linux4TGC/opensbi"
},
{
"path": "build/Linux4TGC/linux"
}
]
}

View File

@@ -12,6 +12,7 @@ class Pkg(ConanFile):
)
default_options = {
"llvm-core/*:targets": "X86",
"llvm-core/*:components": "Native",
"boost/*:fPIC": "True",
"boost/*:header_only": "False",
"boost/*:without_contract": "True",

2
scc

Submodule scc updated: 03567fbece...82602d000f

View File

@@ -40,9 +40,10 @@ CLIParser::CLIParser(int argc, char* argv[])
}
auto log_level = vm_["verbose"].as<scc::log>();
auto log_level_num = static_cast<unsigned>(log_level);
LOGGER(DEFAULT)::set_reporting_level(logging::as_log_level(log_level_num > 6 ? 6 : log_level_num));
LOGGER(connection)::set_reporting_level(logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num));
LOGGER(dbt_rise_iss)::set_reporting_level(logging::as_log_level(log_level_num > 4 ? log_level_num - 1 : log_level_num));
auto level = logging::as_log_level(log_level_num > 6 ? 6 : log_level_num);
LOGGER(DEFAULT)::set_reporting_level(level);
LOGGER(connection)::set_reporting_level(level);
LOGGER(dbt_rise_iss)::set_reporting_level(level);
///////////////////////////////////////////////////////////////////////////
// configure logging
///////////////////////////////////////////////////////////////////////////
@@ -86,7 +87,7 @@ void CLIParser::build() {
"dump the intermediate representation")
("dump-structure", po::value<std::string>(),
"dump model structure to ELK file")
("quantum", po::value<unsigned>(),
("quantum", po::value<unsigned>()->default_value(100),
"SystemC quantum time in ns")
("reset,r", po::value<std::string>(),
"reset address")

9
src/mcount.c Normal file
View File

@@ -0,0 +1,9 @@
/* The canonical name for the function is `_mcount' in both C and asm,
but some old asm code might assume it's `mcount'. */
void _mcount (void);
weak_alias (_mcount, mcount);
void _mcount (void)
{
mcount_internal ((u_long) __builtin_return_address (1), (u_long) __builtin_return_address(0));
}

View File

@@ -7,6 +7,7 @@
#ifndef SRC_VP_SYSTEM_H_
#define SRC_VP_SYSTEM_H_
#include "tlm/scc/quantum_keeper.h"
#include <cci_configuration>
#include <minres/aclint.h>
#include <minres/gpio.h>
@@ -48,7 +49,8 @@ public:
system(sc_core::sc_module_name nm);
private:
sysc::riscv::core_complex<> core_complex{"core_complex"};
#include "../vp/gen/PipelinedMemoryBusToApbBridge.h" // IWYU pragma: keep
sysc::riscv::core_complex<scc::LT, tlm::scc::quantumkeeper_mt> core_complex{"core_complex"};
scc::router<> ahb_router, apbBridge;
vpvper::minres::gpio_tl gpio0{"gpio0"};
vpvper::minres::uart_tl uart0{"uart0"};
@@ -67,7 +69,6 @@ private:
sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> core_int_s{"core_int_s"};
sc_core::sc_signal<uint64_t> mtime_s{"mtime_s"};
void gen_reset();
#include "../vp/gen/PipelinedMemoryBusToApbBridge.h" // IWYU pragma: keep
};
} // namespace vp