Merge branch 'develop'

This commit is contained in:
Eyck Jentzsch 2021-03-13 14:59:10 +01:00
commit 3ea1961deb
17 changed files with 53 additions and 118 deletions

View File

@ -16,7 +16,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.1318364290.1772265551" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.23298673" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.base.155199250" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder buildPath="/PySC/build/Debug" id="de.marw.cdt.cmake.core.genscriptbuilder.254681974" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CMake Builder (portable)" parallelBuildOn="false" superClass="de.marw.cdt.cmake.core.genscriptbuilder"/>
<builder buildPath="/PySC/build/Debug" id="de.marw.cdt.cmake.core.genscriptbuilder.254681974" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CMake Builder" parallelBuildOn="false" superClass="de.marw.cdt.cmake.core.genscriptbuilder"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1512061726" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2080867410" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1337388874" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@ -49,6 +49,9 @@
<defs/>
<undefs/>
</win32>
<defs>
<def name="BUILD_SHARED_LIBS" type="BOOL" val="ON"/>
</defs>
</storageModule>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248">
@ -118,4 +121,4 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
</cproject>

2
.gitignore vendored
View File

@ -1 +1,3 @@
/build/
/.settings
/*.vcd

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "sc-components"]
path = sc-components
url = https://git.minres.com/SystemC/SystemC-Components.git
url = https://github.com/Minres/SystemC-Components.git

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">PySysC Python 3.6.3</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_ADDITIONAL_GRAMMAR_VALIDATION">3.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_ADDITIONAL_GRAMMAR_VALIDATION">3.6</pydev_property>
</pydev_project>

View File

@ -5,13 +5,11 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="90396921960217303" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1296301851541847385" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="de.marw.cmake.cdt.language.settings.providers.BuiltinsCompileCommandsJsonParser" id="de.marw.cmake.cdt.language.settings.providers.BuiltinsCompileCommandsJsonParser" name="CMAKE_EXPORT_COMPILE_COMMANDS Compiler Built-ins" store-entries-with-project="true"/>
<provider class="de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser" id="de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser" name="CMAKE_EXPORT_COMPILE_COMMANDS Parser" store-entries-with-project="true"/>
</extension>
</configuration>
<configuration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248" name="Release">
@ -19,11 +17,11 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="90396921960217303" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1296301851541847385" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>
</project>

View File

@ -1,22 +1,13 @@
cmake_minimum_required(VERSION 3.3)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
project(pysysc-sc)
set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV")
set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries")
include(GitFunctions)
get_branch_from_git()
### set the directory names of the submodules
set(GIT_SUBMODULES sc-components)
set(GIT_SUBMODULE_DIR_sc-components .)
### set each submodules's commit or tag that is to be checked out
### (leave empty if you want master)
#set(GIT_SUBMODULE_VERSION_sc-components 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd)
set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
include(GNUInstallDirs)
include(Submodules)
include(Conan)
include(BuildType)
@ -48,11 +39,11 @@ endif()
setup_conan()
# This line finds the boost lib and headers.
#set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
#find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install.
find_package(Boost COMPONENTS program_options system thread REQUIRED)
# set-up SystemC and SCV
find_package(SystemC)
find_package(OSCISystemC)
if(SystemC_FOUND)
include_directories(${SystemC_INCLUDE_DIRS})
link_directories(${SystemC_LIBRARY_DIRS})
@ -63,8 +54,8 @@ endif()
if(CCI_FOUND)
include_directories(${CCI_INCLUDE_DIRS})
link_directories(${CCI_LIBRARY_DIRS})
else()
message( FATAL_ERROR "SystemC CCI library not found." )
#else()
#message( FATAL_ERROR "SystemC CCI library not found." )
endif()
include(sc-components/cmake/clang-format.cmake)

View File

@ -1,20 +0,0 @@
# Function to link between sub-projects
function(add_dependent_subproject subproject_name)
#if (NOT TARGET ${subproject_name}) # target unknown
if(NOT PROJECT_${subproject_name}) # var unknown because we build only this subproject
find_package(${subproject_name} CONFIG REQUIRED)
else () # we know the target thus we are doing a build from the top directory
include_directories(../${subproject_name}/incl)
endif ()
endfunction(add_dependent_subproject)
# Make sure we tell the topdir CMakeLists that we exist (if build from topdir)
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
set(PROJECT_${PROJECT_NAME} true PARENT_SCOPE)
endif()
# Function to link between sub-projects
function(add_dependent_header subproject_name)
include_directories(../${subproject_name}/incl)
endfunction(add_dependent_header)

View File

@ -1,45 +0,0 @@
macro(setup_conan)
find_program(conan conan)
if(NOT EXISTS ${conan})
message(FATAL_ERROR "Conan is required. Please see README.md")
return()
endif()
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Darwin)
set(os Macos)
else()
set(os ${CMAKE_HOST_SYSTEM_NAME})
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
set(compiler gcc)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL AppleClang)
set(compiler apple-clang)
else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
string(SUBSTRING ${CMAKE_CXX_COMPILER_VERSION} 0 3 compiler_version)
set(conanfile ${CMAKE_SOURCE_DIR}/conanfile.txt)
set(conanfile_cmake ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
set(compiler_libcxx libstdc++11)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CONAN_BUILD_TYPE Debug)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(CONAN_BUILD_TYPE Release)
else()
set(CONAN_BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif()
execute_process(COMMAND ${conan} install --build=missing
-s build_type=${CONAN_BUILD_TYPE} -s compiler.libcxx=${compiler_libcxx}
${CMAKE_SOURCE_DIR} RESULT_VARIABLE return_code)
if(NOT ${return_code} EQUAL 0)
message(FATAL_ERROR "conan install command failed.")
endif()
include(${conanfile_cmake})
conan_basic_setup()
endmacro()

View File

@ -10,5 +10,5 @@ set(LIB_SOURCES
set(LIBRARY_NAME components)
# Define the library
add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES})
target_link_libraries (${LIBRARY_NAME} LINK_PUBLIC sc-components)
target_link_libraries (${LIBRARY_NAME} LINK_PUBLIC scc)
target_include_directories (components PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -55,7 +55,7 @@ void Initiator::thread_process() {
wait( dmi_data.get_write_latency() );
}
SCINFO() << "DMI = { " << (cmd ? 'W' : 'R') << ", " << hex << i
SCCINFO() << "DMI = { " << (cmd ? 'W' : 'R') << ", " << hex << i
<< " } , data = " << hex << data << " at time " << sc_time_stamp();
}
else
@ -101,7 +101,7 @@ void Initiator::thread_process() {
dmi_ptr_valid = socket->get_direct_mem_ptr( *trans, dmi_data );
}
SCINFO() << "trans = { " << (cmd ? 'W' : 'R') << ", " << hex << i
SCCINFO() << "trans = { " << (cmd ? 'W' : 'R') << ", " << hex << i
<< " } , data = " << hex << data << " at time " << sc_time_stamp();
}
}
@ -119,7 +119,7 @@ void Initiator::thread_process() {
for (unsigned int i = 0; i < n_bytes; i += 4)
{
SCINFO() << "mem[" << (A + i) << "] = "
SCCINFO() << "mem[" << (A + i) << "] = "
<< *(reinterpret_cast<unsigned int*>( &data[i] ));
}
@ -131,7 +131,7 @@ void Initiator::thread_process() {
for (unsigned int i = 0; i < n_bytes; i += 4)
{
SCINFO() << "mem[" << (A + i) << "] = "
SCCINFO() << "mem[" << (A + i) << "] = "
<< *(reinterpret_cast<unsigned int*>( &data[i] ));
}
}

View File

@ -124,14 +124,14 @@ struct Router: sc_module
// Simple fixed address decoding
inline unsigned int decode_address( sc_dt::uint64 address, sc_dt::uint64& masked_address )
{
unsigned int target_nr = static_cast<unsigned int>( (address >> 8) & 0x3 );
masked_address = address & 0xFF;
unsigned int target_nr = static_cast<unsigned int>( (address >> 10) % initiator_socket.size() );
masked_address = address & 0x3FF;
return target_nr;
}
inline sc_dt::uint64 compose_address( unsigned int target_nr, sc_dt::uint64 address)
{
return (target_nr << 8) | (address & 0xFF);
return (target_nr << 10) | (address & 0x3FF);
}
};

View File

@ -1,7 +1,6 @@
[requires]
fmt/5.2.1@bincrafters/stable
SystemC/2.3.2@minres/stable
SystemC-CCI/1.0.0@minres/stable
SystemC/2.3.3@minres/stable
[generators]
cmake
@ -10,4 +9,3 @@ cmake
fmt:header_only=True
SystemC:stdcxx=11
SystemC:shared=True
SystemC-CCI:stdcxx=11

View File

@ -14,7 +14,7 @@ pysysc.load_systemc()
###############################################################################
logging.debug("Loading SC-Components lib")
pysysc.add_include_path(os.path.join(myDir, 'sc-components/incl'))
pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libsc-components.so'%build_type))
pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libscc.so'%build_type))
###############################################################################
logging.debug("Loading Components lib")
pysysc.add_include_path(os.path.join(myDir, 'components'))
@ -22,7 +22,7 @@ pysysc.add_library('components.h', os.path.join(myDir, 'build/%s/lib/libcomponen
###############################################################################
# configure
###############################################################################
cpp.scc.init_logging(cpp.logging.INFO, False);
cpp.scc.init_logging(cpp.scc.log.INFO, 24, False);
cpp.sc_core.sc_report_handler.set_actions(cpp.sc_core.SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, cpp.sc_core.SC_DO_NOTHING);
cpp.scc.init_cci("GlobalBroker")
###############################################################################
@ -58,7 +58,6 @@ for idx,m in enumerate(memories):
if __name__ == "__main__":
if os.path.isfile('router_example.json'):
cfg = cpp.scc.configurer(cpp.std.string('router_example.json'));
trace = cpp.scc.configurable_tracer("router_example", 1, True, True)
trace.add_control()
tracer = cpp.scc.tracer('vcd_trace', 1, True)
cpp.sc_core.sc_start()
logging.debug("Done")

View File

@ -2,6 +2,7 @@ import os.path
import logging
from cppyy import gbl as cpp
import pysysc
import pysysc.structural as struct
from pysysc.structural import Connection, Module, Signal, Simulation
###############################################################################
@ -16,7 +17,7 @@ pysysc.load_systemc()
###############################################################################
logging.debug("Loading SC-Components lib")
pysysc.add_include_path(os.path.join(myDir, 'sc-components/incl'))
pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libsc-components.so'%build_type))
pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libscc.so'%build_type))
###############################################################################
logging.debug("Loading Components lib")
pysysc.add_include_path(os.path.join(myDir, 'components'))
@ -31,8 +32,8 @@ Simulation.setup(logging.root.level)
clk_gen = Module(cpp.ClkGen).create("clk_gen")
rst_gen = Module(cpp.ResetGen).create("rst_gen")
initiator = Module(cpp.Initiator).create("initiator")
memories = [Module(cpp.Memory).create(name) for name in ["mem0", "mem1", "mem2", "mem3"]]
router = Module(cpp.Router[4]).create("router")
memories = [Module(cpp.Memory).create("mem%d"%i) for i in range(2)]
router = Module(cpp.Router[len(memories)]).create("router")
###############################################################################
# connect it
###############################################################################
@ -45,6 +46,9 @@ Connection().src(initiator.socket).sink(router.target_socket)
###############################################################################
# run if it is standalone
###############################################################################
struct.dump_structure()
simcontext = cpp.sc_core.sc_get_curr_simcontext()
objects = cpp.sc_core.sc_get_top_level_objects(simcontext)
if __name__ == "__main__":
Simulation.configure(enable_vcd=True)
Simulation.run()

@ -1 +1 @@
Subproject commit 1859c341ab0576c70f1cfbd67a18e3d300a5eb16
Subproject commit 385eed07957bed93669ae6c453d706414e95aebc

View File

@ -29,8 +29,8 @@ int sc_main(int argc, char *argv[]) {
///////////////////////////////////////////////////////////////////////////
// configure logging
///////////////////////////////////////////////////////////////////////////
scc::init_logging(logging::INFO);
//scc::init_logging(logging::WARNING);
scc::init_logging(log::INFO);
//scc::init_logging(log::WARNING);
///////////////////////////////////////////////////////////////////////////
// instantiate top level

View File

@ -7,13 +7,14 @@
#include <target.h>
#include <router.h>
enum { SLV_CNT=2};
SC_MODULE(Top) {
ClkGen * clk_gen;
ResetGen* reset_gen;
Initiator* initiator;
Router<4>* router;
Memory* memory[4];
Router<SLV_CNT>* router;
Memory* memory[SLV_CNT];
Top(const sc_core::sc_module_name& nm)
: sc_core::sc_module()
@ -24,8 +25,8 @@ SC_MODULE(Top) {
clk_gen=new ClkGen("clk_gen");
reset_gen=new ResetGen("reset_gen");
initiator = new Initiator("initiator");
router = new Router<4>("router");
for (int i = 0; i < 4; i++) {
router = new Router<SLV_CNT>("router");
for (int i = 0; i < SLV_CNT; i++) {
char txt[20];
sprintf(txt, "memory_%d", i);
memory[i] = new Memory(txt);
@ -33,7 +34,7 @@ SC_MODULE(Top) {
// Bind sockets
initiator->socket.bind(router->target_socket);
for (int i = 0; i < 4; i++)
for (int i = 0; i < SLV_CNT; i++)
router->initiator_socket[i].bind(memory[i]->socket);
// connect signals
clk_gen->clk_o(clk);