updates build instruction and SCC to latest version
This commit is contained in:
parent
775872b190
commit
fcd60ef660
|
@ -3,3 +3,6 @@
|
||||||
/*.vcd
|
/*.vcd
|
||||||
/*.png
|
/*.png
|
||||||
/*.dot
|
/*.dot
|
||||||
|
/*.fst
|
||||||
|
/*.ftr
|
||||||
|
/.venv
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python Debugger: router_example.py",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/router_example.py",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Python Debugger: router_example2.py",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/router_example2.py",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Python Debugger: modules.py",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/modules.py",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"editor.rulers": [
|
||||||
|
{
|
||||||
|
"column": 140,
|
||||||
|
"comment": "clang-format"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd",
|
||||||
|
"cmake.buildDirectory": "${workspaceFolder}/build",
|
||||||
|
"[jsonc]": {
|
||||||
|
"editor.defaultFormatter": "vscode.json-language-features"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "router_example",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "python3 router_example.py",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "router_example2",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "python3 router_example2.py",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "modules",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "python3 modules.py",
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ include(clang-format)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
@ -63,8 +64,8 @@ boost:without_wave=True
|
||||||
set(CONAN_PACKAGE_LIST fmt/8.0.1 spdlog/1.9.2 zlib/1.2.11 boost/1.75.0 yaml-cpp/0.7.0 jsoncpp/1.9.5 lz4/1.9.3)
|
set(CONAN_PACKAGE_LIST fmt/8.0.1 spdlog/1.9.2 zlib/1.2.11 boost/1.75.0 yaml-cpp/0.7.0 jsoncpp/1.9.5 lz4/1.9.3)
|
||||||
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True spdlog:header_only=True ${BOOST_OPTIONS})
|
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True spdlog:header_only=True ${BOOST_OPTIONS})
|
||||||
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
|
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
|
||||||
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.3 systemc-cci/1.0.0)
|
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} systemc/2.3.4)
|
||||||
set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc-cci:shared=False)
|
set(CONAN_PACKAGE_OPTIONS ${CONAN_PACKAGE_OPTIONS} systemc:shared=True)
|
||||||
endif()
|
endif()
|
||||||
conan_configure(REQUIRES ${CONAN_PACKAGE_LIST}
|
conan_configure(REQUIRES ${CONAN_PACKAGE_LIST}
|
||||||
GENERATORS cmake_find_package
|
GENERATORS cmake_find_package
|
||||||
|
@ -84,7 +85,7 @@ find_package(lz4 REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(scc)
|
add_subdirectory(scc)
|
||||||
add_subdirectory(vp_components)
|
add_subdirectory(vp_components)
|
||||||
add_subdirectory(top)
|
#add_subdirectory(top)
|
||||||
|
|
||||||
# CTest is a testing tool that can be used to test your project.
|
# CTest is a testing tool that can be used to test your project.
|
||||||
# enable_testing()
|
# enable_testing()
|
||||||
|
|
27
README.md
27
README.md
|
@ -4,16 +4,29 @@ A simple C++/SystemC/CMake project to test pysysc
|
||||||
|
|
||||||
# How to build
|
# How to build
|
||||||
|
|
||||||
> Currently only Linux and MacOS are tested
|
> Currently only Linux and MacOS are tested.
|
||||||
|
|
||||||
|
The install instruction below assume using bash.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
git clone --recursive -b develop https://git.minres.com/SystemC/PySysC-SC.git
|
||||||
cd PySysC-SC
|
cd PySysC-SC
|
||||||
mkdir build
|
python3 -mvenv .venv
|
||||||
cd build
|
. .venv/bin/activate
|
||||||
conan install .. --build=missing
|
pip install "conan<2.0"
|
||||||
cmake -DBUILD_SHARED_LIBS=ON ..
|
cmake -S . -B build -DBUILD_SHARED_LIBS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
cmake --build .
|
cmake --build build -j24
|
||||||
|
export SYSTEMC_HOME=$(grep -A1 rootpath_systemc\] build/conanbuildinfo.txt | tail -1)
|
||||||
|
export STDCXX=17
|
||||||
|
pip install "cppyy<3.0"
|
||||||
|
pip install https://github.com/Minres/PySysC/tarball/master
|
||||||
|
pip install scc/contrib/pysysc/
|
||||||
|
python3 router_example.py
|
||||||
|
python3 router_example2.py
|
||||||
|
python3 modules.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
These steps clone the PySysC-SC repository and builds the shared libraries using conan 1.x.
|
||||||
|
This also downloads and builds SYSTEMC (as a conan package).
|
||||||
|
Then it installs the python packages cppyy, PySysC, and PySysC.SCC using the same settings as the cmake build.
|
||||||
|
Eventually it runs the 3 examples.
|
||||||
|
|
72
modules.py
72
modules.py
|
@ -4,46 +4,41 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
import os.path
|
|
||||||
import logging
|
import logging
|
||||||
import cppyy
|
import os.path
|
||||||
from cppyy import gbl as cpp
|
|
||||||
import pysysc
|
import pysysc
|
||||||
|
import pysysc.scc as scc
|
||||||
|
from cppyy import gbl as cpp
|
||||||
from pysysc.structural import Connection, Module, Signal, Simulation
|
from pysysc.structural import Connection, Module, Signal, Simulation
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# setup and load
|
# setup and load
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
build_type='Debug'
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
myDir = os.path.dirname(os.path.realpath(__file__))
|
myDir = os.path.dirname(os.path.realpath(__file__))
|
||||||
pysysc.read_config_from_conan(os.path.join(myDir, 'build/%s/conanfile.txt'%build_type), build_type)
|
pysysc.load_systemc(17)
|
||||||
pysysc.load_systemc()
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading SC-Components lib")
|
logging.debug("Loading SC-Components lib")
|
||||||
# pysysc.add_include_path(os.path.join(myDir, 'scc/incl'))
|
scc.load_lib(myDir)
|
||||||
# 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")
|
logging.debug("Loading Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'vp_components'))
|
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))
|
pysysc.add_library("components.h", "libvp_components.so", myDir)
|
||||||
|
###############################################################################
|
||||||
|
# configure
|
||||||
|
###############################################################################
|
||||||
|
scc.setup(logging.root.level)
|
||||||
|
scc.configure(enable_trace=False)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# define toplevel class
|
# define toplevel class
|
||||||
###############################################################################
|
###############################################################################
|
||||||
num_of_mem = 4
|
num_of_mem = 4
|
||||||
|
|
||||||
from pysysc.sysc import ScModule
|
from pysysc.sysc import ScModule
|
||||||
|
|
||||||
|
|
||||||
class TopModule(ScModule):
|
class TopModule(ScModule):
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
|
@ -54,17 +49,32 @@ class TopModule(ScModule):
|
||||||
self.clk_gen = Module(cpp.ClkGen).create("clk_gen")
|
self.clk_gen = Module(cpp.ClkGen).create("clk_gen")
|
||||||
self.rst_gen = Module(cpp.ResetGen).create("rst_gen")
|
self.rst_gen = Module(cpp.ResetGen).create("rst_gen")
|
||||||
self.initiator = Module(cpp.Initiator).create("initiator")
|
self.initiator = Module(cpp.Initiator).create("initiator")
|
||||||
self.memories = [Module(cpp.Memory).create("mem%d"%idx) for idx in range(0,num_of_mem)]
|
self.memories = [
|
||||||
|
Module(cpp.Memory).create("mem%d" % idx) for idx in range(0, num_of_mem)
|
||||||
|
]
|
||||||
self.router = Module(cpp.Router[num_of_mem]).create("router")
|
self.router = Module(cpp.Router[num_of_mem]).create("router")
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# connect them
|
# connect them
|
||||||
###############################################################################
|
###############################################################################
|
||||||
self.clk = Signal("clk").src(self.clk_gen.clk_o).sink(self.initiator.clk_i).sink(self.router.clk_i)
|
self.clk = (
|
||||||
|
Signal("clk")
|
||||||
|
.src(self.clk_gen.clk_o)
|
||||||
|
.sink(self.initiator.clk_i)
|
||||||
|
.sink(self.router.clk_i)
|
||||||
|
)
|
||||||
[self.clk.sink(m.clk_i) for m in self.memories]
|
[self.clk.sink(m.clk_i) for m in self.memories]
|
||||||
self.rst = Signal("rst").src(self.rst_gen.reset_o).sink(self.initiator.reset_i).sink(self.router.reset_i)
|
self.rst = (
|
||||||
|
Signal("rst")
|
||||||
|
.src(self.rst_gen.reset_o)
|
||||||
|
.sink(self.initiator.reset_i)
|
||||||
|
.sink(self.router.reset_i)
|
||||||
|
)
|
||||||
[self.rst.sink(m.reset_i) for m in self.memories]
|
[self.rst.sink(m.reset_i) for m in self.memories]
|
||||||
Connection().src(self.initiator.socket).sink(self.router.target_socket)
|
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)]
|
[
|
||||||
|
Connection().src(self.router.initiator_socket.at(idx)).sink(m.socket)
|
||||||
|
for idx, m in enumerate(self.memories)
|
||||||
|
]
|
||||||
self.ScThread("RunThread")
|
self.ScThread("RunThread")
|
||||||
|
|
||||||
def EndOfElaboration(self):
|
def EndOfElaboration(self):
|
||||||
|
@ -78,14 +88,15 @@ class TopModule(ScModule):
|
||||||
|
|
||||||
def RunThread(self):
|
def RunThread(self):
|
||||||
print("Starting RunThread")
|
print("Starting RunThread")
|
||||||
while(cpp.sc_core.sc_time_stamp()<cpp.sc_core.sc_time(500, cpp.sc_core.SC_NS)):
|
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.pyScWait(self.clk.signal.value_changed_event())
|
||||||
self.ScWait(cpp.sc_core.sc_time(100, cpp.sc_core.SC_NS))
|
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()))
|
print(
|
||||||
###############################################################################
|
"Hello from Thread %s, @ %s"
|
||||||
# configure
|
% (self.name(), cpp.sc_core.sc_time_stamp().to_string())
|
||||||
###############################################################################
|
)
|
||||||
Simulation.setup(logging.root.level)
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# instantiate
|
# instantiate
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -95,6 +106,5 @@ dut = Module(TopModule).create("dut")
|
||||||
# run if it is standalone
|
# run if it is standalone
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
Simulation.configure(enable_vcd=False)
|
|
||||||
Simulation.run()
|
Simulation.run()
|
||||||
logging.debug("Done")
|
logging.debug("Done")
|
||||||
|
|
|
@ -1,37 +1,45 @@
|
||||||
import os.path
|
|
||||||
import logging
|
import logging
|
||||||
from cppyy import gbl as cpp
|
import os.path
|
||||||
|
|
||||||
import pysysc
|
import pysysc
|
||||||
|
from cppyy import gbl as cpp
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# setup and load
|
# setup and load
|
||||||
###############################################################################
|
###############################################################################
|
||||||
build_type='Debug'
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
myDir = os.path.dirname(os.path.realpath(__file__))
|
myDir = os.path.dirname(os.path.realpath(__file__))
|
||||||
pysysc.load_systemc()
|
pysysc.load_systemc(17)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading SC-Components lib")
|
logging.debug("Loading SC-Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/src/sysc'))
|
pysysc.add_include_path(os.path.join(myDir, "scc/third_party/cci-1.0.0"))
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/src/common'))
|
pysysc.add_include_path(os.path.join(myDir, "scc/third_party/scv-tr/src"))
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'scc/third_party'))
|
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/common"))
|
||||||
|
pysysc.add_include_path(os.path.join(myDir, "scc/third_party"))
|
||||||
|
pysysc.add_library("scc_sysc.h", "libscc-sysc.so", myDir)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading Components lib")
|
logging.debug("Loading Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'vp_components'))
|
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))
|
pysysc.add_library("components.h", "libvp_components.so", myDir)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# configure
|
# configure
|
||||||
###############################################################################
|
###############################################################################
|
||||||
cpp.scc.init_logging(cpp.scc.log.INFO, 24, 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.sc_core.sc_report_handler.set_actions(
|
||||||
|
cpp.sc_core.SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, cpp.sc_core.SC_DO_NOTHING
|
||||||
|
)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# instantiate
|
# instantiate
|
||||||
###############################################################################
|
###############################################################################
|
||||||
clkgen = cpp.ClkGen(cpp.sc_core.sc_module_name("clk_gen"))
|
clkgen = cpp.ClkGen(cpp.sc_core.sc_module_name("clk_gen"))
|
||||||
rstgen = cpp.ResetGen(cpp.sc_core.sc_module_name("rst_gen"))
|
rstgen = cpp.ResetGen(cpp.sc_core.sc_module_name("rst_gen"))
|
||||||
initiator = cpp.Initiator(cpp.sc_core.sc_module_name("initiator"))
|
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"]]
|
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"))
|
router = cpp.Router[4](cpp.sc_core.sc_module_name("router"))
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# signals
|
# signals
|
||||||
|
@ -56,8 +64,8 @@ for idx,m in enumerate(memories):
|
||||||
# run if it is standalone
|
# run if it is standalone
|
||||||
###############################################################################
|
###############################################################################
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if os.path.isfile('router_example.json'):
|
if os.path.isfile("router_example.json"):
|
||||||
cfg = cpp.scc.configurer(cpp.std.string('router_example.json'));
|
cfg = cpp.scc.configurer(cpp.std.string("router_example.json"))
|
||||||
tracer = cpp.scc.tracer('vcd_trace', 1, True)
|
tracer = cpp.scc.tracer("vcd_trace", 1, True)
|
||||||
cpp.sc_core.sc_start()
|
cpp.sc_core.sc_start()
|
||||||
logging.debug("Done")
|
logging.debug("Done")
|
||||||
|
|
|
@ -1,33 +1,31 @@
|
||||||
import os.path
|
|
||||||
import logging
|
import logging
|
||||||
from cppyy import gbl as cpp
|
import os.path
|
||||||
|
|
||||||
import pysysc
|
import pysysc
|
||||||
import pysysc.structural as struct
|
|
||||||
import pysysc.scc as scc
|
import pysysc.scc as scc
|
||||||
|
import pysysc.structural as struct
|
||||||
|
from cppyy import gbl as cpp
|
||||||
from pysysc.structural import Connection, Module, Signal, Simulation
|
from pysysc.structural import Connection, Module, Signal, Simulation
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# setup and load
|
# setup and load
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
build_type='Debug'
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
myDir = os.path.dirname(os.path.realpath(__file__))
|
myDir = os.path.dirname(os.path.realpath(__file__))
|
||||||
pysysc.load_systemc()
|
pysysc.load_systemc(17)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading SC-Components lib")
|
logging.debug("Loading SC-Components lib")
|
||||||
#pysysc.add_include_path(os.path.join(myDir, '../install/include'))
|
scc.load_lib(myDir)
|
||||||
#pysysc.add_library('scc_util.h', os.path.join(myDir, '../install/lib64/libscc-util.so'))
|
|
||||||
#pysysc.add_library('scc_sysc.h', os.path.join(myDir, '../install/lib64/libscc-sysc.so'))
|
|
||||||
scc.load_lib(os.path.join(myDir, '../install'))
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
logging.debug("Loading Components lib")
|
logging.debug("Loading Components lib")
|
||||||
pysysc.add_include_path(os.path.join(myDir, 'vp_components'))
|
pysysc.add_include_path(os.path.join(myDir, "vp_components"))
|
||||||
pysysc.add_library('components.h', os.path.join(myDir, 'build/vp_components/libvp_components.so'))
|
pysysc.add_library("components.h", "libvp_components.so", myDir)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# configure
|
# configure
|
||||||
###############################################################################
|
###############################################################################
|
||||||
scc.setup(logging.root.level)
|
scc.setup(logging.root.level)
|
||||||
|
scc.configure(enable_trace=True)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# instantiate
|
# instantiate
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -44,7 +42,10 @@ clk = Signal("clk").src(clk_gen.clk_o).sink(initiator.clk_i).sink(router.clk_i)
|
||||||
rst = Signal("rst").src(rst_gen.reset_o).sink(initiator.reset_i).sink(router.reset_i)
|
rst = Signal("rst").src(rst_gen.reset_o).sink(initiator.reset_i).sink(router.reset_i)
|
||||||
[rst.sink(m.reset_i) for m in memories]
|
[rst.sink(m.reset_i) for m in memories]
|
||||||
Connection().src(initiator.socket).sink(router.target_socket)
|
Connection().src(initiator.socket).sink(router.target_socket)
|
||||||
[Connection().src(router.initiator_socket.at(idx)).sink(m.socket) for idx,m in enumerate(memories)]
|
[
|
||||||
|
Connection().src(router.initiator_socket.at(idx)).sink(m.socket)
|
||||||
|
for idx, m in enumerate(memories)
|
||||||
|
]
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# run if it is standalone
|
# run if it is standalone
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -52,6 +53,5 @@ struct.dump_structure()
|
||||||
simcontext = cpp.sc_core.sc_get_curr_simcontext()
|
simcontext = cpp.sc_core.sc_get_curr_simcontext()
|
||||||
objects = cpp.sc_core.sc_get_top_level_objects(simcontext)
|
objects = cpp.sc_core.sc_get_top_level_objects(simcontext)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
scc.configure(enable_trace=True)
|
|
||||||
Simulation.run()
|
Simulation.run()
|
||||||
logging.debug("Done")
|
logging.debug("Done")
|
||||||
|
|
2
scc
2
scc
|
@ -1 +1 @@
|
||||||
Subproject commit d6b718cebd9712374b0fbe145da2920800480fac
|
Subproject commit 85dc2b4e51e0197daf8d19c77d85667580a480eb
|
Loading…
Reference in New Issue