update SCC

This commit is contained in:
Eyck Jentzsch 2020-10-08 17:45:57 +02:00
parent 117b0e4375
commit 27f4e93027
13 changed files with 48 additions and 39 deletions

View File

@ -16,7 +16,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.1318364290.1772265551" name="/" resourcePath=""> <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"> <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"/> <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.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"> <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"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1337388874" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@ -49,6 +49,9 @@
<defs/> <defs/>
<undefs/> <undefs/>
</win32> </win32>
<defs>
<def name="BUILD_SHARED_LIBS" type="BOOL" val="ON"/>
</defs>
</storageModule> </storageModule>
</cconfiguration> </cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248"> <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248">

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project> <?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_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_ADDITIONAL_GRAMMAR_VALIDATION">3.6</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> </pydev_project>

View File

@ -5,13 +5,11 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> <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.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-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> </extension>
</configuration> </configuration>
<configuration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248" name="Release"> <configuration id="cdt.managedbuild.toolchain.gnu.base.1318364290.125067248" name="Release">
@ -19,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> <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.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>

View File

@ -52,7 +52,7 @@ setup_conan()
#find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED) #find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED)
# set-up SystemC and SCV # set-up SystemC and SCV
find_package(SystemC) find_package(OSCISystemC)
if(SystemC_FOUND) if(SystemC_FOUND)
include_directories(${SystemC_INCLUDE_DIRS}) include_directories(${SystemC_INCLUDE_DIRS})
link_directories(${SystemC_LIBRARY_DIRS}) link_directories(${SystemC_LIBRARY_DIRS})
@ -63,8 +63,8 @@ endif()
if(CCI_FOUND) if(CCI_FOUND)
include_directories(${CCI_INCLUDE_DIRS}) include_directories(${CCI_INCLUDE_DIRS})
link_directories(${CCI_LIBRARY_DIRS}) link_directories(${CCI_LIBRARY_DIRS})
else() #else()
message( FATAL_ERROR "SystemC CCI library not found." ) #message( FATAL_ERROR "SystemC CCI library not found." )
endif() endif()
include(sc-components/cmake/clang-format.cmake) include(sc-components/cmake/clang-format.cmake)

View File

@ -10,5 +10,5 @@ set(LIB_SOURCES
set(LIBRARY_NAME components) set(LIBRARY_NAME components)
# Define the library # Define the library
add_library(${LIBRARY_NAME} SHARED ${LIB_SOURCES}) 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}) 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() ); 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(); << " } , data = " << hex << data << " at time " << sc_time_stamp();
} }
else else
@ -101,7 +101,7 @@ void Initiator::thread_process() {
dmi_ptr_valid = socket->get_direct_mem_ptr( *trans, dmi_data ); 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(); << " } , 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) for (unsigned int i = 0; i < n_bytes; i += 4)
{ {
SCINFO() << "mem[" << (A + i) << "] = " SCCINFO() << "mem[" << (A + i) << "] = "
<< *(reinterpret_cast<unsigned int*>( &data[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) for (unsigned int i = 0; i < n_bytes; i += 4)
{ {
SCINFO() << "mem[" << (A + i) << "] = " SCCINFO() << "mem[" << (A + i) << "] = "
<< *(reinterpret_cast<unsigned int*>( &data[i] )); << *(reinterpret_cast<unsigned int*>( &data[i] ));
} }
} }

View File

@ -124,14 +124,14 @@ struct Router: sc_module
// Simple fixed address decoding // Simple fixed address decoding
inline unsigned int decode_address( sc_dt::uint64 address, sc_dt::uint64& masked_address ) 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 ); unsigned int target_nr = static_cast<unsigned int>( (address >> 10) % initiator_socket.size() );
masked_address = address & 0xFF; masked_address = address & 0x3FF;
return target_nr; return target_nr;
} }
inline sc_dt::uint64 compose_address( unsigned int target_nr, sc_dt::uint64 address) 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,7 @@
[requires] [requires]
fmt/5.2.1@bincrafters/stable fmt/5.2.1@bincrafters/stable
SystemC/2.3.2@minres/stable SystemC/2.3.3@minres/stable
SystemC-CCI/1.0.0@minres/stable #SystemC-CCI/1.0.0@minres/stable
[generators] [generators]
cmake cmake
@ -10,4 +10,4 @@ cmake
fmt:header_only=True fmt:header_only=True
SystemC:stdcxx=11 SystemC:stdcxx=11
SystemC:shared=True SystemC:shared=True
SystemC-CCI:stdcxx=11 #SystemC-CCI:stdcxx=11

View File

@ -14,7 +14,7 @@ pysysc.load_systemc()
############################################################################### ###############################################################################
logging.debug("Loading SC-Components lib") logging.debug("Loading SC-Components lib")
pysysc.add_include_path(os.path.join(myDir, 'sc-components/incl')) 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") logging.debug("Loading Components lib")
pysysc.add_include_path(os.path.join(myDir, 'components')) 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 # 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.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") cpp.scc.init_cci("GlobalBroker")
############################################################################### ###############################################################################
@ -58,7 +58,6 @@ for idx,m in enumerate(memories):
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'));
trace = cpp.scc.configurable_tracer("router_example", 1, True, True) tracer = cpp.scc.tracer('vcd_trace', 1, True)
trace.add_control()
cpp.sc_core.sc_start() cpp.sc_core.sc_start()
logging.debug("Done") logging.debug("Done")

View File

@ -2,6 +2,7 @@ import os.path
import logging import logging
from cppyy import gbl as cpp from cppyy import gbl as cpp
import pysysc import pysysc
import pysysc.structural as struct
from pysysc.structural import Connection, Module, Signal, Simulation from pysysc.structural import Connection, Module, Signal, Simulation
############################################################################### ###############################################################################
@ -16,7 +17,7 @@ pysysc.load_systemc()
############################################################################### ###############################################################################
logging.debug("Loading SC-Components lib") logging.debug("Loading SC-Components lib")
pysysc.add_include_path(os.path.join(myDir, 'sc-components/incl')) 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") logging.debug("Loading Components lib")
pysysc.add_include_path(os.path.join(myDir, 'components')) 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") clk_gen = Module(cpp.ClkGen).create("clk_gen")
rst_gen = Module(cpp.ResetGen).create("rst_gen") rst_gen = Module(cpp.ResetGen).create("rst_gen")
initiator = Module(cpp.Initiator).create("initiator") initiator = Module(cpp.Initiator).create("initiator")
memories = [Module(cpp.Memory).create(name) for name in ["mem0", "mem1", "mem2", "mem3"]] memories = [Module(cpp.Memory).create("mem%d"%i) for i in range(2)]
router = Module(cpp.Router[4]).create("router") router = Module(cpp.Router[len(memories)]).create("router")
############################################################################### ###############################################################################
# connect it # connect it
############################################################################### ###############################################################################
@ -45,6 +46,9 @@ Connection().src(initiator.socket).sink(router.target_socket)
############################################################################### ###############################################################################
# run if it is standalone # 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__": if __name__ == "__main__":
Simulation.configure(enable_vcd=True) Simulation.configure(enable_vcd=True)
Simulation.run() Simulation.run()

@ -1 +1 @@
Subproject commit 3419e182354b400d397c3f62b8b47383249dd1d0 Subproject commit 2d83649df082540eb37fa03b8658f08361addda8

View File

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

View File

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