From 27f4e930279e8a4e0773c44eebfbf3db9b0781b4 Mon Sep 17 00:00:00 2001 From: eyck Date: Thu, 8 Oct 2020 17:45:57 +0200 Subject: [PATCH] update SCC --- .cproject | 7 +++++-- .pydevproject | 10 +++++++--- .settings/language.settings.xml | 8 +++----- CMakeLists.txt | 6 +++--- components/CMakeLists.txt | 2 +- components/initiator.cpp | 8 ++++---- components/router.h | 6 +++--- conanfile.txt | 6 +++--- router_example.py | 7 +++---- router_example2.py | 10 +++++++--- sc-components | 2 +- top/sc_main.cpp | 4 ++-- top/top.h | 11 ++++++----- 13 files changed, 48 insertions(+), 39 deletions(-) diff --git a/.cproject b/.cproject index 57cad41..bd78173 100644 --- a/.cproject +++ b/.cproject @@ -16,7 +16,7 @@ - + @@ -49,6 +49,9 @@ + + + @@ -118,4 +121,4 @@ - + \ No newline at end of file diff --git a/.pydevproject b/.pydevproject index 37ae0d1..9708187 100644 --- a/.pydevproject +++ b/.pydevproject @@ -1,6 +1,10 @@ -PySysC Python 3.6.3 -python interpreter -3.6 + + Default + + python interpreter + + 3.6 + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 2adf654..238ce28 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,13 +5,11 @@ - + - - @@ -19,11 +17,11 @@ - + - + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 714b4e5..f2a1484 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ setup_conan() #find_package(Boost COMPONENTS program_options filesystem system thread REQUIRED) # set-up SystemC and SCV -find_package(SystemC) +find_package(OSCISystemC) if(SystemC_FOUND) include_directories(${SystemC_INCLUDE_DIRS}) link_directories(${SystemC_LIBRARY_DIRS}) @@ -63,8 +63,8 @@ endif() if(CCI_FOUND) include_directories(${CCI_INCLUDE_DIRS}) link_directories(${CCI_LIBRARY_DIRS}) -else() - message( FATAL_ERROR "SystemC CCI library not found." ) +#else() + #message( FATAL_ERROR "SystemC CCI library not found." ) endif() include(sc-components/cmake/clang-format.cmake) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 7e747a5..b60cdb3 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -10,5 +10,5 @@ set(LIB_SOURCES set(LIBRARY_NAME components) # Define the library 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}) diff --git a/components/initiator.cpp b/components/initiator.cpp index 90f64f1..a13c127 100644 --- a/components/initiator.cpp +++ b/components/initiator.cpp @@ -55,7 +55,7 @@ void Initiator::thread_process() { 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(); } else @@ -101,7 +101,7 @@ void Initiator::thread_process() { 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(); } } @@ -119,7 +119,7 @@ void Initiator::thread_process() { for (unsigned int i = 0; i < n_bytes; i += 4) { - SCINFO() << "mem[" << (A + i) << "] = " + SCCINFO() << "mem[" << (A + i) << "] = " << *(reinterpret_cast( &data[i] )); } @@ -131,7 +131,7 @@ void Initiator::thread_process() { for (unsigned int i = 0; i < n_bytes; i += 4) { - SCINFO() << "mem[" << (A + i) << "] = " + SCCINFO() << "mem[" << (A + i) << "] = " << *(reinterpret_cast( &data[i] )); } } diff --git a/components/router.h b/components/router.h index 34e62b8..8e2420c 100644 --- a/components/router.h +++ b/components/router.h @@ -124,14 +124,14 @@ struct Router: sc_module // Simple fixed address decoding inline unsigned int decode_address( sc_dt::uint64 address, sc_dt::uint64& masked_address ) { - unsigned int target_nr = static_cast( (address >> 8) & 0x3 ); - masked_address = address & 0xFF; + unsigned int target_nr = static_cast( (address >> 10) % initiator_socket.size() ); + masked_address = address & 0x3FF; return target_nr; } 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); } }; diff --git a/conanfile.txt b/conanfile.txt index 941d2c2..92ae706 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,7 +1,7 @@ [requires] fmt/5.2.1@bincrafters/stable -SystemC/2.3.2@minres/stable -SystemC-CCI/1.0.0@minres/stable +SystemC/2.3.3@minres/stable +#SystemC-CCI/1.0.0@minres/stable [generators] cmake @@ -10,4 +10,4 @@ cmake fmt:header_only=True SystemC:stdcxx=11 SystemC:shared=True -SystemC-CCI:stdcxx=11 \ No newline at end of file +#SystemC-CCI:stdcxx=11 diff --git a/router_example.py b/router_example.py index b54ea26..05fa02f 100644 --- a/router_example.py +++ b/router_example.py @@ -14,7 +14,7 @@ pysysc.load_systemc() ############################################################################### logging.debug("Loading SC-Components lib") 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") 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 ############################################################################### -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.scc.init_cci("GlobalBroker") ############################################################################### @@ -58,7 +58,6 @@ for idx,m in enumerate(memories): if __name__ == "__main__": if os.path.isfile('router_example.json'): cfg = cpp.scc.configurer(cpp.std.string('router_example.json')); - trace = cpp.scc.configurable_tracer("router_example", 1, True, True) - trace.add_control() + tracer = cpp.scc.tracer('vcd_trace', 1, True) cpp.sc_core.sc_start() logging.debug("Done") diff --git a/router_example2.py b/router_example2.py index a04f81a..b4927b8 100644 --- a/router_example2.py +++ b/router_example2.py @@ -2,6 +2,7 @@ import os.path import logging from cppyy import gbl as cpp import pysysc +import pysysc.structural as struct from pysysc.structural import Connection, Module, Signal, Simulation ############################################################################### @@ -16,7 +17,7 @@ pysysc.load_systemc() ############################################################################### logging.debug("Loading SC-Components lib") 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") 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") rst_gen = Module(cpp.ResetGen).create("rst_gen") initiator = Module(cpp.Initiator).create("initiator") -memories = [Module(cpp.Memory).create(name) for name in ["mem0", "mem1", "mem2", "mem3"]] -router = Module(cpp.Router[4]).create("router") +memories = [Module(cpp.Memory).create("mem%d"%i) for i in range(2)] +router = Module(cpp.Router[len(memories)]).create("router") ############################################################################### # connect it ############################################################################### @@ -45,6 +46,9 @@ Connection().src(initiator.socket).sink(router.target_socket) ############################################################################### # 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__": Simulation.configure(enable_vcd=True) Simulation.run() diff --git a/sc-components b/sc-components index 3419e18..2d83649 160000 --- a/sc-components +++ b/sc-components @@ -1 +1 @@ -Subproject commit 3419e182354b400d397c3f62b8b47383249dd1d0 +Subproject commit 2d83649df082540eb37fa03b8658f08361addda8 diff --git a/top/sc_main.cpp b/top/sc_main.cpp index 1c5faae..f57004b 100644 --- a/top/sc_main.cpp +++ b/top/sc_main.cpp @@ -29,8 +29,8 @@ int sc_main(int argc, char *argv[]) { /////////////////////////////////////////////////////////////////////////// // configure logging /////////////////////////////////////////////////////////////////////////// - scc::init_logging(logging::INFO); - //scc::init_logging(logging::WARNING); + scc::init_logging(log::INFO); + //scc::init_logging(log::WARNING); /////////////////////////////////////////////////////////////////////////// // instantiate top level diff --git a/top/top.h b/top/top.h index 0b5ea74..6e152c5 100644 --- a/top/top.h +++ b/top/top.h @@ -7,13 +7,14 @@ #include #include +enum { SLV_CNT=2}; SC_MODULE(Top) { ClkGen * clk_gen; ResetGen* reset_gen; Initiator* initiator; - Router<4>* router; - Memory* memory[4]; + Router* router; + Memory* memory[SLV_CNT]; Top(const sc_core::sc_module_name& nm) : sc_core::sc_module() @@ -24,8 +25,8 @@ SC_MODULE(Top) { clk_gen=new ClkGen("clk_gen"); reset_gen=new ResetGen("reset_gen"); initiator = new Initiator("initiator"); - router = new Router<4>("router"); - for (int i = 0; i < 4; i++) { + router = new Router("router"); + for (int i = 0; i < SLV_CNT; i++) { char txt[20]; sprintf(txt, "memory_%d", i); memory[i] = new Memory(txt); @@ -33,7 +34,7 @@ SC_MODULE(Top) { // Bind sockets 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); // connect signals clk_gen->clk_o(clk);