2018-12-31 15:23:37 +01:00
|
|
|
import json
|
|
|
|
import cppyy
|
|
|
|
import os.path
|
|
|
|
import pysysc as scpy
|
|
|
|
from cppyy import gbl as cpp
|
2019-01-01 14:48:37 +01:00
|
|
|
|
|
|
|
proj_home='../../PySysC-SC'
|
|
|
|
conan_res = scpy.read_config_from_conan(os.path.join(proj_home, 'conanfile.txt'))
|
2018-12-31 15:23:37 +01:00
|
|
|
scpy.load_systemc()
|
2019-01-01 14:48:37 +01:00
|
|
|
scpy.add_include_path(os.path.join(proj_home, 'components'))
|
|
|
|
scpy.add_library('components.h', os.path.join(proj_home, 'build/Debug/lib/libcomponents.so'))
|
2018-12-31 15:23:37 +01:00
|
|
|
|
|
|
|
initiator = cpp.Initiator(cpp.sc_core.sc_module_name("initiator"))
|
|
|
|
memories = [cpp.Memory(cpp.sc_core.sc_module_name(name)) for name in ["mem0", "mem1", "mem2", "mem3"]]
|
|
|
|
router = cpp.Router[4](cpp.sc_core.sc_module_name("router"))
|
|
|
|
|
|
|
|
members = scpy.get_members(initiator)
|
|
|
|
methods = scpy.get_methods(initiator)
|
|
|
|
|
|
|
|
ports = scpy.get_ports(initiator)
|
|
|
|
intors = scpy.get_inititator_sockets(initiator)
|
|
|
|
tgts = scpy.get_target_sockets(initiator)
|
|
|
|
childs = scpy.get_submodules(initiator)
|
|
|
|
|
|
|
|
initiator.socket.bind(router.target_socket)
|
|
|
|
for idx,m in enumerate(memories):
|
|
|
|
router.initiator_socket.at(idx).bind(m.socket)
|
2019-01-01 14:48:37 +01:00
|
|
|
time = cpp.sc_core.sc_time_stamp()
|
|
|
|
print(intors[0].name(), "connects to sc_object:", isinstance(intors[0][0], cpp.sc_core.sc_object))
|
2018-12-31 15:23:37 +01:00
|
|
|
cpp.sc_core.sc_in_action=True
|
|
|
|
cpp.sc_core.sc_start()
|
2019-01-01 14:48:37 +01:00
|
|
|
print("Done at", cpp.sc_core.sc_time_stamp())
|