Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(scc-util VERSION 0.0.1 LANGUAGES CXX)
project(scc-util VERSION ${scc_VERSION} LANGUAGES CXX)

set(SRC util/io-redirector.cpp util/watchdog.cpp util/ihex.cpp)
if(TARGET lz4::lz4)
Expand Down
66 changes: 44 additions & 22 deletions src/common/nonstd/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define NONSTD_SV_LITE_H_INCLUDED

#define string_view_lite_MAJOR 1
#define string_view_lite_MINOR 7
#define string_view_lite_MINOR 8
#define string_view_lite_PATCH 0

#define string_view_lite_VERSION \
Expand All @@ -36,7 +36,7 @@
#define nssv_HAVE_TWEAK_HEADER 1
#else
#define nssv_HAVE_TWEAK_HEADER 0
// # pragma message("string_view.hpp: Note: Tweak header not supported.")
//# pragma message("string_view.hpp: Note: Tweak header not supported.")
#endif

// string_view selection and configuration:
Expand Down Expand Up @@ -70,6 +70,10 @@
#define nssv_CONFIG_NO_STREAM_INSERTION 0
#endif

#ifndef nssv_CONFIG_CONSTEXPR11_STD_SEARCH
#define nssv_CONFIG_CONSTEXPR11_STD_SEARCH 1
#endif

// Control presence of exception handling (try and auto discover):

#ifndef nssv_CONFIG_NO_EXCEPTIONS
Expand Down Expand Up @@ -133,6 +137,8 @@

#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS

#include <string>

namespace nonstd {

template <class CharT, class Traits, class Allocator = std::allocator<CharT>>
Expand All @@ -158,22 +164,22 @@ using namespace std::literals::string_view_literals;
inline namespace literals {
inline namespace string_view_literals {

constexpr std::string_view operator"" _sv(const char* str, size_t len) noexcept // (1)
constexpr std::string_view operator""_sv(const char* str, size_t len) noexcept // (1)
{
return std::string_view{str, len};
}

constexpr std::u16string_view operator"" _sv(const char16_t* str, size_t len) noexcept // (2)
constexpr std::u16string_view operator""_sv(const char16_t* str, size_t len) noexcept // (2)
{
return std::u16string_view{str, len};
}

constexpr std::u32string_view operator"" _sv(const char32_t* str, size_t len) noexcept // (3)
constexpr std::u32string_view operator""_sv(const char32_t* str, size_t len) noexcept // (3)
{
return std::u32string_view{str, len};
}

constexpr std::wstring_view operator"" _sv(const wchar_t* str, size_t len) noexcept // (4)
constexpr std::wstring_view operator""_sv(const wchar_t* str, size_t len) noexcept // (4)
{
return std::wstring_view{str, len};
}
Expand Down Expand Up @@ -266,7 +272,7 @@ using std::operator<<;
#define nssv_HAS_CPP0X 0
#endif

// Unless defined otherwise below, consider VC14 as C++11 for variant-lite:
// Unless defined otherwise below, consider VC14 as C++11 for string-view-lite:

#if nssv_COMPILER_MSVC_VER >= 1900
#undef nssv_CPP11_OR_GREATER
Expand Down Expand Up @@ -389,13 +395,13 @@ using std::operator<<;
#define nssv_noexcept /*noexcept*/
#endif

// #if nssv_HAVE_REF_QUALIFIER
// # define nssv_ref_qual &
// # define nssv_refref_qual &&
// #else
// # define nssv_ref_qual /*&*/
// # define nssv_refref_qual /*&&*/
// #endif
//#if nssv_HAVE_REF_QUALIFIER
//# define nssv_ref_qual &
//# define nssv_refref_qual &&
//#else
//# define nssv_ref_qual /*&*/
//# define nssv_refref_qual /*&&*/
//#endif

#if nssv_HAVE_NULLPTR
#define nssv_nullptr nullptr
Expand Down Expand Up @@ -551,11 +557,27 @@ nssv_DISABLE_MSVC_WARNINGS(4455 26481 26472)

// non-recursive:

#if nssv_CONFIG_CONSTEXPR11_STD_SEARCH

template <class CharT, class Traits = std::char_traits<CharT>>
constexpr const CharT* search(basic_string_view<CharT, Traits> haystack, basic_string_view<CharT, Traits> needle) {
return std::search(haystack.begin(), haystack.end(), needle.begin(), needle.end());
}

#else // nssv_CONFIG_CONSTEXPR11_STD_SEARCH

template <class CharT, class Traits = std::char_traits<CharT>>
nssv_constexpr14 const CharT* search(basic_string_view<CharT, Traits> haystack, basic_string_view<CharT, Traits> needle) {
while(needle.size() <= haystack.size()) {
if(haystack.starts_with(needle)) {
return haystack.cbegin();
}
haystack = basic_string_view<CharT, Traits>{haystack.begin() + 1, haystack.size() - 1U};
}
return haystack.cend();
}
#endif // nssv_CONFIG_CONSTEXPR11_STD_SEARCH

#endif // OPTIMIZE
#endif // nssv_CPP11_OR_GREATER && ! nssv_CPP17_OR_GREATER

Expand Down Expand Up @@ -1366,22 +1388,22 @@ nssv_inline_ns namespace literals {

#if nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS

nssv_constexpr nonstd::sv_lite::string_view operator"" sv(const char* str, size_t len) nssv_noexcept // (1)
nssv_constexpr nonstd::sv_lite::string_view operator""sv(const char* str, size_t len)nssv_noexcept // (1)
{
return nonstd::sv_lite::string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::u16string_view operator"" sv(const char16_t* str, size_t len) nssv_noexcept // (2)
nssv_constexpr nonstd::sv_lite::u16string_view operator""sv(const char16_t* str, size_t len)nssv_noexcept // (2)
{
return nonstd::sv_lite::u16string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::u32string_view operator"" sv(const char32_t* str, size_t len) nssv_noexcept // (3)
nssv_constexpr nonstd::sv_lite::u32string_view operator""sv(const char32_t* str, size_t len)nssv_noexcept // (3)
{
return nonstd::sv_lite::u32string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::wstring_view operator"" sv(const wchar_t* str, size_t len) nssv_noexcept // (4)
nssv_constexpr nonstd::sv_lite::wstring_view operator""sv(const wchar_t* str, size_t len)nssv_noexcept // (4)
{
return nonstd::sv_lite::wstring_view{str, len};
}
Expand All @@ -1390,22 +1412,22 @@ nssv_inline_ns namespace literals {

#if nssv_CONFIG_USR_SV_OPERATOR

nssv_constexpr nonstd::sv_lite::string_view operator"" _sv(const char* str, size_t len) nssv_noexcept // (1)
nssv_constexpr nonstd::sv_lite::string_view operator""_sv(const char* str, size_t len)nssv_noexcept // (1)
{
return nonstd::sv_lite::string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::u16string_view operator"" _sv(const char16_t* str, size_t len) nssv_noexcept // (2)
nssv_constexpr nonstd::sv_lite::u16string_view operator""_sv(const char16_t* str, size_t len)nssv_noexcept // (2)
{
return nonstd::sv_lite::u16string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::u32string_view operator"" _sv(const char32_t* str, size_t len) nssv_noexcept // (3)
nssv_constexpr nonstd::sv_lite::u32string_view operator""_sv(const char32_t* str, size_t len)nssv_noexcept // (3)
{
return nonstd::sv_lite::u32string_view{str, len};
}

nssv_constexpr nonstd::sv_lite::wstring_view operator"" _sv(const wchar_t* str, size_t len) nssv_noexcept // (4)
nssv_constexpr nonstd::sv_lite::wstring_view operator""_sv(const wchar_t* str, size_t len)nssv_noexcept // (4)
{
return nonstd::sv_lite::wstring_view{str, len};
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(components VERSION 0.0.1 LANGUAGES CXX)
project(components VERSION ${scc_VERSION} LANGUAGES CXX)

add_library(${PROJECT_NAME} INTERFACE)
add_library(scc::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(interfaces VERSION 0.0.1 LANGUAGES CXX)
project(interfaces VERSION ${scc_VERSION} LANGUAGES CXX)

set(LIB_SOURCES
apb/apb_tlm.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/sysc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(scc-sysc VERSION 0.0.1 LANGUAGES CXX)
project(scc-sysc VERSION ${scc_VERSION} LANGUAGES CXX)

find_package(Threads REQUIRED)
find_package(Boost REQUIRED QUIET COMPONENTS date_time filesystem)
Expand Down
6 changes: 5 additions & 1 deletion third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ if(SystemC_FOUND)
add_subdirectory(axi_chi)
add_subdirectory(scv-tr)
if(NOT TARGET systemc-cci::systemc-cci AND NOT TARGET SystemC::cci)
add_subdirectory(cci-1.0.1)
if(USE_CCI_100)
add_subdirectory(cci-1.0.0)
else()
add_subdirectory(cci-1.0.1)
endif()
endif()
add_subdirectory(lwtr4sc/src)
if(WITH_SCP4SCC)
Expand Down
87 changes: 87 additions & 0 deletions third_party/cci-1.0.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
project(SystemC-CCI VERSION "1.0.0" LANGUAGES CXX)

add_library(cciapi
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_broker_handle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_broker_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_originator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_param_if.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_param_untyped.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_param_untyped_handle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_cfg/cci_report_handler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_core/cci_name_gen.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_core/cci_value.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_core/cci_value_converter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_utils/broker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cci_utils/consuming_broker.cpp)
#set_target_properties(cciapi PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1)

if(USE_NCSC_SYSTEMC OR USE_CWR_SYSTEMC)
target_compile_definitions(cciapi PUBLIC SC_VERSION_CODE=200301)
endif()
target_include_directories(cciapi PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # for headers when building
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> # for client in install mode
)
if(USE_CWR_SYSTEMC)
get_target_property(SC_COMPILE_OPTIONS ${SystemC_LIBRARIES} INTERFACE_COMPILE_OPTIONS)
if(SC_COMPILE_OPTIONS)
target_compile_definitions(cciapi PUBLIC ${SC_COMPILE_OPTIONS})
else()
target_compile_definitions(cciapi PUBLIC ${SystemC_DEFINITIONS})
endif()
get_target_property(SC_INCLUDE_DIRS ${SystemC_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
if(SC_INCLUDE_DIRS)
target_include_directories(cciapi PUBLIC ${SC_INCLUDE_DIRS})
else()
target_include_directories(cciapi PUBLIC ${SystemC_INCLUDE_DIRS})
endif()
else()
target_link_libraries(cciapi PUBLIC SystemC::systemc)
endif()
target_link_libraries(cciapi PUBLIC RapidJSON)

if(NOT TARGET systemc-cci::systemc-cci)
add_library(systemc-cci::systemc-cci ALIAS cciapi)
endif()

set_target_properties(cciapi PROPERTIES
VERSION ${PROJECT_VERSION}
FRAMEWORK FALSE
PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/cci_configuration
CXX_CLANG_TIDY ""
)

set(CCIAPI_CMAKE_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/cciapi)
install(TARGETS cciapi COMPONENT cci EXPORT cciapi-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${SCC_LIBRARY_DIR_MODIFIER}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${SCC_LIBRARY_DIR_MODIFIER}${SCC_ARCHIVE_DIR_MODIFIER}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(EXPORT cciapi-targets
DESTINATION ${CCIAPI_CMAKE_CONFIG_DIR})

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/cciapi-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)

configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cciapi-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cciapi-config.cmake
INSTALL_DESTINATION ${CCIAPI_CMAKE_CONFIG_DIR}
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cciapi-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/cciapi-config-version.cmake
DESTINATION ${CCIAPI_CMAKE_CONFIG_DIR})

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/. COMPONENT cci
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # target directory
FILES_MATCHING # install only matched files
PATTERN "*.h" # select header files
)
89 changes: 89 additions & 0 deletions third_party/cci-1.0.0/cci_cfg/cci_broker_callbacks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*****************************************************************************

Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
more contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright ownership.
Accellera licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.

****************************************************************************/

#ifndef CCI_CFG_CCI_BROKER_CALLBACKS_H_INCLUDED_
#define CCI_CFG_CCI_BROKER_CALLBACKS_H_INCLUDED_

#include "cci_core/cci_callback.h"
#include "cci_core/cci_value.h"

CCI_OPEN_NAMESPACE_

class cci_param_untyped_handle;
class cci_originator;

/// Parameter creation callback
typedef cci_callback<const cci_param_untyped_handle& >
cci_param_create_callback;

/// Parameter creation callback handle
typedef cci_callback_typed_handle<const cci_param_untyped_handle& >
cci_param_create_callback_handle;

/// Parameter destruction callback
typedef cci_callback<const cci_param_untyped_handle& >
cci_param_destroy_callback;

/// Parameter destruction callback handle
typedef cci_callback_typed_handle<const cci_param_untyped_handle& >
cci_param_destroy_callback_handle;

/// Parameter predicate
typedef cci_callback<const cci_param_untyped_handle&, bool >
cci_param_predicate;

/// Parameter predicate handle
typedef cci_callback_typed_handle<const cci_param_untyped_handle&, bool >
cci_param_predicate_handle;

/// Preset value predicate
typedef cci_callback<const std::pair<std::string, cci_value>&, bool >
cci_preset_value_predicate;

/// Preset value predicate handle
typedef cci_callback_typed_handle<const std::pair<std::string, cci_value>&,
bool > cci_preset_value_predicate_handle;

/* ------------------------------------------------------------------------ */

/// Callback API of CCI brokers
struct cci_broker_callback_if
{
virtual cci_param_create_callback_handle
register_create_callback( const cci_param_create_callback& cb
, const cci_originator& orig ) = 0;
virtual bool
unregister_create_callback( const cci_param_create_callback_handle& cb
, const cci_originator& orig ) = 0;

virtual cci_param_destroy_callback_handle
register_destroy_callback( const cci_param_destroy_callback& cb
, const cci_originator& orig ) = 0;
virtual bool
unregister_destroy_callback( const cci_param_destroy_callback_handle& cb
, const cci_originator& orig ) = 0;

virtual bool unregister_all_callbacks(const cci_originator& orig) = 0;

virtual bool has_callbacks() const = 0;
};

CCI_CLOSE_NAMESPACE_

#endif // CCI_CFG_CCI_BROKER_CALLBACKS_H_INCLUDED_
Loading
Loading