diff --git a/.pydevproject b/.pydevproject index a16af72..7a6fcf5 100644 --- a/.pydevproject +++ b/.pydevproject @@ -1,14 +1,18 @@ - + + + + Default + - pysysc-env - python interpreter - + + 3.6 - + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 8818c6c..5c9016c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,10 +3,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${C project(pysysc-sc) -set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV") set(ENABLE_SHARED TRUE CACHE BOOL "Build shared libraries") - include(GNUInstallDirs) include(BuildType) include(clang-format) @@ -34,12 +32,60 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(warnings "/W4 /WX /EHsc") endif() +include(ConanInline) +conan_check() +set(CONAN_BOOST_OPTIONS +boost:fPIC=True +boost:shared=True +boost:header_only=False +boost:without_context=True +boost:without_contract=True +boost:without_coroutine=True +boost:without_fiber=True +boost:without_graph=True +boost:without_graph_parallel=True +boost:without_iostreams=True +boost:without_json=True +boost:without_locale=True +boost:without_log=True +boost:without_math=True +boost:without_mpi=True +boost:without_nowide=True +boost:without_python=True +boost:without_random=True +boost:without_regex=True +boost:without_serialization=True +boost:without_stacktrace=True +boost:without_test=True +boost:without_timer=True +boost:without_type_erasure=True +boost:without_wave=True +) +set(CONAN_PACKAGES boost/1.75.0) +set(CONAN_SETTINGS ${CONAN_BOOST_OPTIONS}) +if(NOT DEFINED ENV{SYSTEMC_HOME}) + set(CONAN_PACKAGES ${CONAN_PACKAGES} + systemc/2.3.3 + systemc-cci/1.0.0 + ) + set(CONAN_SETTINGS ${CONAN_SETTINGS} + #systemc:phase_cb=False + systemc-cci:shared=False + ) +endif() +conan_configure(REQUIRES ${CONAN_PACKAGES} + GENERATORS cmake_find_package + OPTIONS ${CONAN_SETTINGS} + ) +conan_install() +conan_setup(TARGETS) + # 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 system thread REQUIRED) # set-up SystemC and SCV -find_package(OSCISystemC) +include(SystemCPackage) if(SystemC_FOUND) include_directories(${SystemC_INCLUDE_DIRS}) link_directories(${SystemC_LIBRARY_DIRS}) diff --git a/modules.py b/modules.py index de62405..f202049 100644 --- a/modules.py +++ b/modules.py @@ -18,26 +18,36 @@ logging.basicConfig(level=logging.DEBUG) build_type='Debug' ############################################################################### myDir = os.path.dirname( os.path.realpath(__file__)) -pysysc.read_config_from_conan(os.path.join(myDir, 'conanfile.txt'), build_type) +pysysc.read_config_from_conan(os.path.join(myDir, 'build/%s/conanfile.txt'%build_type), build_type) pysysc.load_systemc() ############################################################################### logging.debug("Loading SC-Components lib") -pysysc.add_include_path(os.path.join(myDir, 'scc/incl')) -pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libscc.so'%build_type)) +# pysysc.add_include_path(os.path.join(myDir, 'scc/incl')) +# pysysc.add_library('scc.h', os.path.join(myDir, 'build/%s/lib/libscc.so'%build_type)) +pysysc.add_include_path(os.path.join(myDir, 'scc/src/common')) +pysysc.add_library('scc_util.h', os.path.join(myDir, 'build/%s/scc/src/common/libscc-util.so'%build_type)) +pysysc.add_include_path(os.path.join(myDir, 'scc/third_party')) +pysysc.add_include_path(os.path.join(myDir, 'scc/third_party/scv-tr/src')) +pysysc.add_library('scv-tr.h', os.path.join(myDir, 'build/%s/scc/third_party/scv-tr/src/libscv-tr.so'%build_type)) +pysysc.add_include_path(os.path.join(myDir, 'scc/src/sysc')) +pysysc.add_library('scc_sysc.h', os.path.join(myDir, 'build/%s/scc/src/sysc/libscc-sysc.so'%build_type)) +pysysc.add_include_path(os.path.join(myDir, 'scc/src/components')) +cppyy.include('scc_components.h') ############################################################################### logging.debug("Loading Components lib") -pysysc.add_include_path(os.path.join(myDir, 'components')) -pysysc.add_library('components.h', os.path.join(myDir, 'build/%s/lib/libcomponents.so'%build_type)) +pysysc.add_include_path(os.path.join(myDir, 'vp_components')) +pysysc.add_library('components.h', os.path.join(myDir, 'build/%s/vp_components/libvp_components.so'%build_type)) ############################################################################### # define toplevel class ############################################################################### num_of_mem = 4 -class TopModule(cpp.scc.PyScModule): +from pysysc.sysc import ScModule +class TopModule(ScModule): def __init__(self, name): - super().__init__(self, name) + ScModule.__init__(self, name) ############################################################################### # instantiate ############################################################################### @@ -55,6 +65,7 @@ class TopModule(cpp.scc.PyScModule): [self.rst.sink(m.reset_i) for m in self.memories] Connection().src(self.initiator.socket).sink(self.router.target_socket) [Connection().src(self.router.initiator_socket.at(idx)).sink(m.socket) for idx,m in enumerate(self.memories)] + self.ScThread("RunThread") def EndOfElaboration(self): print("Elaboration finished") @@ -65,6 +76,12 @@ class TopModule(cpp.scc.PyScModule): def EndOfSimulation(self): print("Simulation finished") + def RunThread(self): + print("Starting RunThread") + while(cpp.sc_core.sc_time_stamp()