Compare commits
17 Commits
feature/mu
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| ffb9f28f89 | |||
| 5dec262eb4 | |||
| bf2222686f | |||
| a0970534ae | |||
| cfdd5d75d7 | |||
| ac8386d0d9 | |||
| b89b86a711 | |||
| 79d76eea80 | |||
| 52114bf895 | |||
| d97bb9877e | |||
| d9a9693c77 | |||
| e2e35f6c1a | |||
| 1d4a805f1e | |||
| a710b1ae0c | |||
| c9ea0779fe | |||
| 86851e4309 | |||
| 0f4d1915a2 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
|||||||
[submodule "scc"]
|
|
||||||
path = scc
|
|
||||||
url = https://github.com/Minres/SystemC-Components.git
|
|
||||||
[submodule "cmake-conan"]
|
[submodule "cmake-conan"]
|
||||||
path = cmake-conan
|
path = cmake-conan
|
||||||
url = https://github.com/conan-io/cmake-conan.git
|
url = https://github.com/conan-io/cmake-conan.git
|
||||||
|
|||||||
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@@ -13,6 +13,15 @@
|
|||||||
"SCC_TEST_VERBOSE": "7"
|
"SCC_TEST_VERBOSE": "7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "gdb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "cci-example",
|
||||||
|
"program": "${workspaceFolder}/build/Debug/tests/configuration/cci-example",
|
||||||
|
"environment": {
|
||||||
|
"SCC_TEST_VERBOSE": "7"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cppdbg quantum_keeper_mt",
|
"name": "cppdbg quantum_keeper_mt",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake)
|
|
||||||
cmake_policy(SET CMP0110 NEW)
|
cmake_policy(SET CMP0110 NEW)
|
||||||
|
|
||||||
project(SCC_Test)
|
project(SCC_Test)
|
||||||
@@ -11,6 +10,22 @@ option(ENABLE_CLANG_FORMAT "Enable clang-format targets" OFF)
|
|||||||
option(THREAD_SANITIZER "Enable thread sanitizer TSan" OFF)
|
option(THREAD_SANITIZER "Enable thread sanitizer TSan" OFF)
|
||||||
option(ADDR_SANITIZER "Enable address sanitizer ASan" OFF)
|
option(ADDR_SANITIZER "Enable address sanitizer ASan" OFF)
|
||||||
|
|
||||||
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scc")
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/scc/cmake)
|
||||||
|
else()
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
scc_git
|
||||||
|
GIT_REPOSITORY https://github.com/Minres/SystemC-Components.git
|
||||||
|
GIT_TAG develop
|
||||||
|
)
|
||||||
|
FetchContent_GetProperties(scc_git)
|
||||||
|
if(NOT scc_git_POPULATED)
|
||||||
|
FetchContent_Populate(scc_git)
|
||||||
|
endif()
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${scc_git_SOURCE_DIR}/cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(BuildType)
|
include(BuildType)
|
||||||
|
|
||||||
@@ -72,6 +87,11 @@ include(CTest)
|
|||||||
include(Catch)
|
include(Catch)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
set(WITH_SCP4SCC ON)
|
set(WITH_SCP4SCC ON)
|
||||||
add_subdirectory(scc)
|
|
||||||
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scc")
|
||||||
|
add_subdirectory(scc)
|
||||||
|
else()
|
||||||
|
add_subdirectory(${scc_git_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|||||||
@@ -30,14 +30,22 @@
|
|||||||
"CMAKE_BUILD_TYPE": "Debug"
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "DebugCXX20",
|
"name": "DebugWFormat",
|
||||||
"inherits": "Base",
|
"inherits": "Base",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_CXX_STANDARD": "20",
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
"ENABLE_CLANG_FORMAT": "ON"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "DebugCXX20",
|
||||||
|
"inherits": "Base",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_CXX_STANDARD": "20",
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "RelWithDebInfo",
|
"name": "RelWithDebInfo",
|
||||||
"inherits": "Base",
|
"inherits": "Base",
|
||||||
|
|||||||
11
Jenkinsfile
vendored
11
Jenkinsfile
vendored
@@ -31,10 +31,11 @@ void checkout_project() {
|
|||||||
|
|
||||||
void build_n_test_project() {
|
void build_n_test_project() {
|
||||||
sh'''
|
sh'''
|
||||||
python3 -mvenv .venv
|
python3 -mvenv .venv
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
cmake -S . -B build --preset Release
|
conan remove -c "systemc/*"
|
||||||
|
cmake -S . -B build --preset Release -DCONAN_INSTALL_ARGS="--build=*" -DENABLE_CLANG_FORMAT=ON
|
||||||
cmake --build build --target format-check
|
cmake --build build --target format-check
|
||||||
cmake --build build -j12
|
cmake --build build -j12
|
||||||
cmake --build build --target test
|
cmake --build build --target test
|
||||||
@@ -71,7 +72,7 @@ pipeline {
|
|||||||
stage('Checkout') { steps { checkout_project() }}
|
stage('Checkout') { steps { checkout_project() }}
|
||||||
stage('Build & test') { steps { build_n_test_project() }}
|
stage('Build & test') { steps { build_n_test_project() }}
|
||||||
}
|
}
|
||||||
qq }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
conanfile.py
29
conanfile.py
@@ -6,9 +6,7 @@ import os
|
|||||||
|
|
||||||
class Pkg(ConanFile):
|
class Pkg(ConanFile):
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
generators = (
|
generators = "CMakeDeps"
|
||||||
"CMakeDeps"
|
|
||||||
)
|
|
||||||
default_options = {
|
default_options = {
|
||||||
"systemc/*:shared": "True",
|
"systemc/*:shared": "True",
|
||||||
"boost/*:fPIC": "True",
|
"boost/*:fPIC": "True",
|
||||||
@@ -35,24 +33,29 @@ class Pkg(ConanFile):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
self.requires("systemc/3.0.1")
|
if self.settings.compiler.cppstd:
|
||||||
self.requires("fmt/8.0.1")
|
cppstd = str(self.settings.compiler.cppstd).replace("gnu", "")
|
||||||
self.requires("spdlog/1.9.2")
|
if cppstd == "11" or cppstd == "14":
|
||||||
self.requires("boost/1.85.0")
|
self.requires("systemc/2.3.4")
|
||||||
self.requires("catch2/3.1.0")
|
else:
|
||||||
self.requires("lz4/1.9.4")
|
self.requires("systemc/3.0.1")
|
||||||
self.requires("yaml-cpp/0.7.0")
|
else:
|
||||||
self.requires("jsoncpp/1.9.5")
|
self.requires("systemc/2.3.4")
|
||||||
|
self.requires("spdlog/1.16.0")
|
||||||
|
self.requires("boost/1.89.0")
|
||||||
|
self.requires("lz4/1.10.0")
|
||||||
|
self.requires("yaml-cpp/0.8.0")
|
||||||
|
self.requires("jsoncpp/1.9.6")
|
||||||
self.requires("zlib/1.3.1")
|
self.requires("zlib/1.3.1")
|
||||||
|
self.requires("catch2/3.1.0")
|
||||||
|
|
||||||
def build_requirements(self):
|
def build_requirements(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
cmake_layout(self)
|
cmake_layout(self)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
tc = CMakeToolchain(self)
|
tc = CMakeToolchain(self)
|
||||||
tc.user_presets_path = False
|
tc.user_presets_path = False
|
||||||
tc.generate()
|
tc.generate()
|
||||||
|
|
||||||
1
scc
1
scc
Submodule scc deleted from 25252a4de6
@@ -38,6 +38,7 @@
|
|||||||
#include <tlm>
|
#include <tlm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "cci/core/cci_value.h"
|
||||||
#include "initiator.h"
|
#include "initiator.h"
|
||||||
#include "router.h"
|
#include "router.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
@@ -114,7 +115,9 @@ public:
|
|||||||
|
|
||||||
auto paramName0 = fmt::format("{}.{}.initiator_ID", name(), targetName);
|
auto paramName0 = fmt::format("{}.{}.initiator_ID", name(), targetName);
|
||||||
auto quotedTargetName = fmt::format("\"target_{}\"", i);
|
auto quotedTargetName = fmt::format("\"target_{}\"", i);
|
||||||
m_broker.set_preset_cci_value(paramName0, cci::cci_value::from_json(targetName));
|
cci::cci_value v;
|
||||||
|
v.set(targetName);
|
||||||
|
m_broker.set_preset_cci_value(paramName0, v);
|
||||||
|
|
||||||
// Set preset value for maximum target size(memory)
|
// Set preset value for maximum target size(memory)
|
||||||
auto paramName1 = fmt::format("{}.{}.initiator_ID", name(), targetName);
|
auto paramName1 = fmt::format("{}.{}.initiator_ID", name(), targetName);
|
||||||
@@ -141,7 +144,7 @@ public:
|
|||||||
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting fields of target_" << i;
|
SCCINFO(SCMOD) << "[TOP_MODULE C_TOR] : Re-setting fields of target_" << i;
|
||||||
m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str()));
|
m_broker.set_preset_cci_value(targetName, cci::cci_value::from_json(ss.str()));
|
||||||
} catch(sc_core::sc_report const& exception) {
|
} catch(sc_core::sc_report const& exception) {
|
||||||
SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what();
|
SCCINFO(SCMOD) << "[ROUTER : Caught] : " << exception.what() << " (expected)";
|
||||||
}
|
}
|
||||||
|
|
||||||
targetName = fmt::format("{}.RouterInstance.r_sa_{}", name(), i);
|
targetName = fmt::format("{}.RouterInstance.r_sa_{}", name(), i);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <deque>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
namespace scc {
|
namespace scc {
|
||||||
@@ -69,4 +67,33 @@ TEST_CASE("dmi_access", "[memory][tlm-level]") {
|
|||||||
sc_start(dut.clk.read());
|
sc_start(dut.clk.read());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("page_boundary_check", "[memory][tlm-level]") {
|
||||||
|
auto& dut = factory::get<testbench>();
|
||||||
|
constexpr uint64_t kPageSize = decltype(dut.mem3)::page_size;
|
||||||
|
|
||||||
|
std::array<uint8_t, 2> write_data{{0xAAu, 0xBBu}};
|
||||||
|
tlm::tlm_generic_payload write;
|
||||||
|
sc_core::sc_time delay = sc_core::SC_ZERO_TIME;
|
||||||
|
write.set_command(tlm::TLM_WRITE_COMMAND);
|
||||||
|
write.set_address(kPageSize - 1); // straddles page boundary
|
||||||
|
write.set_data_length(write_data.size());
|
||||||
|
write.set_streaming_width(write_data.size());
|
||||||
|
write.set_data_ptr(write_data.data());
|
||||||
|
dut.mem3.handle_operation(write, delay);
|
||||||
|
|
||||||
|
std::array<uint8_t, 4> read_buf{{0xEEu, 0x00u, 0x00u, 0xEEu}};
|
||||||
|
tlm::tlm_generic_payload read;
|
||||||
|
read.set_command(tlm::TLM_READ_COMMAND);
|
||||||
|
read.set_address(kPageSize - 1);
|
||||||
|
read.set_data_length(write_data.size());
|
||||||
|
read.set_streaming_width(write_data.size());
|
||||||
|
read.set_data_ptr(read_buf.data() + 1); // leave guard bytes at both ends
|
||||||
|
dut.mem3.handle_operation(read, delay);
|
||||||
|
|
||||||
|
REQUIRE(read_buf[0] == 0xEEu); // leading guard untouched
|
||||||
|
REQUIRE(read_buf[1] == 0xAAu); // first byte read correctly
|
||||||
|
REQUIRE(read_buf[2] == 0xBBu); // second byte read correctly
|
||||||
|
REQUIRE(read_buf[3] == 0xEEu); // trailing guard must remain
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace scc
|
} // namespace scc
|
||||||
|
|||||||
Reference in New Issue
Block a user