extends cxs_tlm test to support tracing
Some checks failed
SCC Test/pipeline/head There was a failure building this commit

This commit is contained in:
2025-09-22 11:54:46 +02:00
parent 572b4a2b27
commit 73e4d5d644
9 changed files with 71 additions and 45 deletions

6
.envrc
View File

@@ -1,4 +1,8 @@
module load ./Modulefile
module load tools/utilities
module load tools/cmake/3.28
module load tools/clang/14.0
module load tools/vscode
distro=`/bin/lsb_release -i -s`
if [ $distro == "CentOS" ]; then
. /opt/rh/devtoolset-8/enable

1
.gitignore vendored
View File

@@ -48,3 +48,4 @@
/.venv/
/.cache
/CMakeUserPresets.json
*.scview

20
.vscode/launch.json vendored
View File

@@ -3,20 +3,36 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"configurations": [
{
"name": "cci_param_restricted",
"type": "gdb",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/build/Debug/tests/cci_param_restricted/cci_param_restricted",
"preLaunchTask": "CMake: build"
},{
},
{
"name": "dmi_access",
"type": "gdb",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/build/Debug/tests/memory_subsys/memory_subsys",
"preLaunchTask": "CMake: build"
},
{
"name": "cxs_tlm",
"type": "gdb",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/build/Debug/tests/cxs_tlm/cxs_tlm",
"arguments": "-n single-packet",
"preLaunchTask": "CMake: build",
"environment": {
"SCC_TEST_TRACE": "1",
"SCC_TEST_VERBOSE": "1"
},
"openGdbConsole": true
}
]
}

12
.vscode/settings.json vendored
View File

@@ -11,8 +11,8 @@
"--background-index",
"--compile-commands-dir=${workspaceFolder}/build"
],
"cmake.buildDirectory" : "${workspaceRoot}/build/${buildType}",
"cmake.configureArgs": ["-B", "${workspaceRoot}/build/${buildType}"],
"cmake.buildDirectory": "${workspaceRoot}/build/${buildType}",
//"cmake.configureArgs": ["-B", "${workspaceRoot}/build/${buildType}"],
"cmake.configureOnOpen": false,
"cmake.configureOnEdit": true,
"cmake.autoSelectActiveFolder": true,
@@ -21,8 +21,12 @@
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json",
"cmake.options.statusBarVisibility": "hidden",
"cmake.options.advanced": {
"configure": {"projectStatusVisibility": "visible"},
"build": {"statusBarVisibility": "visible"}
"configure": {
"projectStatusVisibility": "visible"
},
"build": {
"statusBarVisibility": "visible"
}
},
"todo-tree.ripgrep.ripgrep": "/bin/rg",
"files.watcherExclude": {

View File

@@ -1,17 +0,0 @@
#%Module######################################################################
##
## Project Module
##
proc ModulesHelp { } {
puts stderr "\tThe SCC Tests Project Module\n"
puts stderr "\tThis module loads PATHs and variables for SCC tests."
}
set distro [exec /usr/bin/lsb_release -i -s]
if { $distro == "CentOS" && ![info exists ::env(PROJECT)] && ![info exists ::env(PCP_DIR)] } {
puts stderr "Don't forget to execute 'scl enable devtoolset-7 llvm-toolset-7 bash'"
}
module load tools/utilities
module load tools/cmake/3.28
module load tools/clang/14.0

2
scc

Submodule scc updated: 50de0c564a...4429911c18

View File

@@ -10,6 +10,7 @@
#include <csetjmp>
#include <csignal>
#include <cstdlib>
#include <scc/configurer.h>
#include <scc/report.h>
#include <scc/trace.h>
#include <scc/tracer.h>
@@ -27,10 +28,12 @@ int sc_main(int argc, char* argv[]) {
auto level = getenv("SCC_TEST_VERBOSE");
auto log_lvl = level ? static_cast<scc::log>(std::min(strtoul(level, nullptr, 10) + 4, 7UL)) : log::FATAL;
scc::init_logging(LogConfig().logLevel(log_lvl).logAsync(false).msgTypeFieldWidth(35));
scc::configurer cfg("");
// create tracer if environment variable SCC_TEST_TRACE is defined
std::unique_ptr<scc::tracer> tracer;
if(auto* test_trace = getenv("SCC_TEST_TRACE")) {
tracer = std::make_unique<scc::tracer>(my_name, scc::tracer::ENABLE, scc::tracer::ENABLE);
cfg.set_value("scc_tracer.default_trace_enable", true);
}
int result = -1;
if(setjmp(abrt) == 0) {

View File

@@ -5,7 +5,6 @@
#undef CHECK
#include <catch2/catch_all.hpp>
#include <deque>
#include <unordered_map>
using namespace sc_core;
namespace cxs {
@@ -17,6 +16,7 @@ template <unsigned WIDTH, typename STATE> unsigned run_scenario(STATE& state, un
auto& dut = factory::get<testbench<WIDTH>>();
if(burst_factor)
dut.tx.burst_len.set_value(burst_factor);
dut.rx.max_credit.set_value(5);
dut.rst.write(true);
sc_start(state.reset_cycles * dut.clk.period());
dut.rst.write(false);

View File

@@ -2,12 +2,12 @@
#define _TESTBENCH_H_
#include <cxs/cxs_tlm.h>
#include <cxs/scv/tlm_recording.h>
#include <scc/cci_util.h>
#include <scc/configurer.h>
#include <scc/observer.h>
#include <scc/sc_variable.h>
#include <scc/tracer.h>
#include <string>
#include <systemc>
#include <tlm/nw/initiator_mixin.h>
#include <tlm/nw/target_mixin.h>
@@ -27,7 +27,9 @@ template <unsigned PHIT_WIDTH> struct testbench : public sc_core::sc_module {
sc_core::sc_signal<bool> rst{"rst"};
tlm::nw::initiator_mixin<cxs_pkt_initiator_socket<>, cxs_packet_types> isck{"isck"};
cxs_transmitter<PHIT_WIDTH> tx{"tx"};
tlm::nw::scv::tlm_recorder_module<CXS_CMD, PHIT_WIDTH, cxs_flit_types> tx_rec{"tx_rec"};
cxs_channel<PHIT_WIDTH> cxs_chan{"cxs_chan"};
tlm::nw::scv::tlm_recorder_module<CXS_CMD, PHIT_WIDTH, cxs_flit_types> rx_rec{"rx_rec"};
cxs_receiver<PHIT_WIDTH> rx{"rx"};
tlm::nw::target_mixin<cxs_pkt_target_socket<>, false, cxs_packet_types> tsck{"tsck"};
@@ -43,12 +45,25 @@ template <unsigned PHIT_WIDTH> struct testbench : public sc_core::sc_module {
isck(tx.tsck);
tx.clk_i(clk);
tx.rst_i(rst);
cxs_chan.tx_clk_i(clk);
cxs_chan.rx_clk_i(clk);
#if 0
tx.isck(cxs_chan.tsck);
cxs_chan.isck(rx.tsck);
#else
tx.isck(tx_rec.ts);
tx_rec.is(cxs_chan.tsck);
cxs_chan.isck(rx_rec.ts);
rx_rec.is(rx.tsck);
#endif
rx.clk_i(clk);
rx.rst_i(rst);
rx.isck(tsck);
tx.clock_period.set_value(1_ns);
cxs_chan.tx_clock_period.set_value(1_ns);
cxs_chan.channel_delay.set_value(100_ns);
cxs_chan.rx_clock_period.set_value(1_ns);
rx.clock_period.set_value(1_ns);
rx.max_credit.set_value(15);
}