update scc, move to inline conan, test SC thread supports

This commit is contained in:
Eyck Jentzsch 2021-08-30 18:03:30 +02:00
parent 6ed7d882c9
commit 1997acfb30
4 changed files with 83 additions and 16 deletions

View File

@ -1,14 +1,18 @@
<?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">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">pysysc-env</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

@ -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})

View File

@ -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()<cpp.sc_core.sc_time(500, cpp.sc_core.SC_NS)):
#self.pyScWait(self.clk.signal.value_changed_event())
self.ScWait(cpp.sc_core.sc_time(100, cpp.sc_core.SC_NS))
print("Hello from Thread %s, @ %s"%(self.name(), cpp.sc_core.sc_time_stamp().to_string()))
###############################################################################
# configure
###############################################################################

2
scc

@ -1 +1 @@
Subproject commit e98dde35c4b8502eb0abef51e34f45fad8c72b81
Subproject commit 1b28dadcb3510550fea0d7c383511e502bae2582