From e911ce6581b511651dc9996e07bf3b78d8a40a91 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 4 Nov 2018 13:43:58 +0100 Subject: [PATCH] Updated source to test LevelDB and fit to latest sc-components --- .cproject | 186 +++++------------- .gitignore | 1 + .project | 2 +- .settings/language.settings.xml | 14 +- .settings/org.eclipse.cdt.core.prefs | 11 -- .../org.eclipse.cdt.managedbuilder.core.prefs | 36 ++-- CMakeLists.txt | 24 ++- conanfile.txt | 7 +- examples/simple_system/CMakeLists.txt | 1 + examples/simple_system/gen/e300_plat_t.h | 8 +- examples/simple_system/gpio.cpp | 28 +-- examples/simple_system/plic.cpp | 10 +- examples/simple_system/simple_system.cpp | 2 +- examples/simple_system/simple_system.h | 2 +- examples/simple_system/spi.cpp | 2 +- examples/simple_system/test_initiator.cpp | 22 ++- examples/simple_system/uart.cpp | 2 +- examples/transaction_recording/CMakeLists.txt | 1 + .../scv_tr_recording_example.cpp | 51 +++-- sc-components | 2 +- 20 files changed, 179 insertions(+), 233 deletions(-) delete mode 100644 .settings/org.eclipse.cdt.core.prefs diff --git a/.cproject b/.cproject index 42903f2..2954047 100644 --- a/.cproject +++ b/.cproject @@ -1,199 +1,107 @@ - - + + - - + - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - + + - - - - + - - - - - + + + + - - - - - make - - all VERBOSE=1 - true - true - true - - - make - - clean - true - true - true - - - make - - all - true - true - true - - - + - + - - - - - - - + diff --git a/.gitignore b/.gitignore index b7eb8e8..d9e41be 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ /build/ /simple_system.txlog +/my_db* diff --git a/.project b/.project index 48a6ba2..63b8ead 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - sc-components-test + SystemC-Components-Test diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index eb68e46..9217dc6 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -1,25 +1,31 @@ - + - + + + + - + - + + + + diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs deleted file mode 100644 index eb4d582..0000000 --- a/.settings/org.eclipse.cdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/delimiter=\: -environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/operation=append -environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/SC_DEFAULT_WRITER_POLICY/value=SC_MANY_WRITERS -environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true -environment/project/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true -environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/delimiter=\: -environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/operation=append -environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/SC_DEFAULT_WRITER_POLICY/value=SC_MANY_WRITERS -environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/append=true -environment/project/cdt.managedbuild.config.macosx.exe.release.222902119/appendContributed=true diff --git a/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/.settings/org.eclipse.cdt.managedbuilder.core.prefs index 75aa130..1a45a6c 100644 --- a/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ b/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -1,13 +1,25 @@ eclipse.preferences.version=1 -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPLUS_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/CPLUS_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/C_INCLUDE_PATH/delimiter=\: -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/C_INCLUDE_PATH/operation=remove -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true -environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/LIBRARY_PATH/delimiter=\: -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/LIBRARY_PATH/operation=remove -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/append=true -environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.133691581/appendContributed=true +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPLUS_INCLUDE_PATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/C_INCLUDE_PATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/appendContributed=true +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPLUS_INCLUDE_PATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/C_INCLUDE_PATH/delimiter=\: +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.toolchain.gnu.base.2088633632/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/LIBRARY_PATH/delimiter=\: +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632.342506890/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/LIBRARY_PATH/delimiter=\: +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.toolchain.gnu.base.2088633632/appendContributed=true diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bdc279..ef11123 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.3) -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - ${CMAKE_CURRENT_SOURCE_DIR}/cmake - ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake -) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake) + +set(ENABLE_SCV TRUE CACHE BOOL "Enable use of SCV") include(GitFunctions) get_branch_from_git() @@ -22,16 +20,24 @@ include(Conan) #enable_testing() -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) +if(COMPILER_SUPPORTS_MARCH_NATIVE) +if("${CMAKE_BUILD_TYPE}" STREQUAL "") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +endif() +endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(warnings "-Wall -Wextra -Werror") set(CMAKE_CXX_FLAG_RELEASE "-O2 -DNDEBUG") set(CMAKE_C_FLAG_RELEASE "-O2 -DNDEBUG") - set(CMAKE_CXX_FLAG_DEBUG "-Og") - set(CMAKE_C_FLAG_DEBUG "-Og") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(warnings "/W4 /WX /EHsc") endif() @@ -83,3 +89,5 @@ add_subdirectory(examples) #include(PackageConfigurator) +#include(FeatureSummary) +#feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES PACKAGES_FOUND) diff --git a/conanfile.txt b/conanfile.txt index 90d461a..3adc6c8 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -4,13 +4,14 @@ SystemC/2.3.2@minres/stable SystemCVerification/2.0.1@minres/stable SystemC-CCI/1.0.0@minres/stable + LevelDB/1.21@minres/stable [generators] cmake txt [options] - SystemC:stdcxx=14 + SystemC:stdcxx=11 SystemC:shared=True - SystemCVerification:stdcxx=14 - SystemC-CCI:stdcxx=14 \ No newline at end of file + SystemCVerification:stdcxx=11 + SystemC-CCI:stdcxx=11 \ No newline at end of file diff --git a/examples/simple_system/CMakeLists.txt b/examples/simple_system/CMakeLists.txt index ee736bf..a473f3e 100644 --- a/examples/simple_system/CMakeLists.txt +++ b/examples/simple_system/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries (simple_system LINK_PUBLIC sc-components) target_link_libraries (simple_system LINK_PUBLIC ${SystemC_LIBRARIES}) target_link_libraries (simple_system LINK_PUBLIC ${SCV_LIBRARIES}) target_link_libraries (simple_system LINK_PUBLIC ${Boost_LIBRARIES} ) +target_link_libraries (simple_system LINK_PUBLIC ${CONAN_LIBS_LEVELDB}) target_link_libraries (simple_system LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (simple_system LINK_PUBLIC ${ZLIB_LIBRARY}) target_link_libraries (simple_system LINK_PUBLIC ${CMAKE_DL_LIBS}) diff --git a/examples/simple_system/gen/e300_plat_t.h b/examples/simple_system/gen/e300_plat_t.h index 6531c21..de361b1 100644 --- a/examples/simple_system/gen/e300_plat_t.h +++ b/examples/simple_system/gen/e300_plat_t.h @@ -18,10 +18,10 @@ // need double braces, see // https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191 const std::array, 4> e300_plat_map = {{ - {&i_plic, 0x0c000000, 0x200008}, - {&i_gpio, 0x10012000, 0x1000}, - {&i_uart, 0x10013000, 0x1000}, - {&i_spi, 0x10014000, 0x1000}, + {i_plic.socket, 0x0c000000, 0x200008}, + {i_gpio.socket, 0x10012000, 0x1000}, + {i_uart.socket, 0x10013000, 0x1000}, + {i_spi.socket, 0x10014000, 0x1000}, }}; #endif /* _E300_PLAT_MAP_H_ */ diff --git a/examples/simple_system/gpio.cpp b/examples/simple_system/gpio.cpp index a7e87d3..041f505 100644 --- a/examples/simple_system/gpio.cpp +++ b/examples/simple_system/gpio.cpp @@ -42,8 +42,10 @@ namespace sysc { -gpio::gpio(sc_core::sc_module_name nm) -: sc_core::sc_module(nm) +using namespace sc_core; + +gpio::gpio(sc_module_name nm) +: sc_module(nm) , tlm_target<>(clk) , NAMED(clk_i) , NAMED(rst_i) @@ -53,7 +55,7 @@ gpio::gpio(sc_core::sc_module_name nm) , NAMED(iof1_o, 32) , NAMED(iof0_i, 32) , NAMED(iof1_i, 32) -, NAMEDD(gpio_regs, regs) +, NAMEDD(regs, gpio_regs) { regs->registerResources(*this); SC_METHOD(clock_cb); @@ -62,7 +64,7 @@ gpio::gpio(sc_core::sc_module_name nm) sensitive << rst_i; dont_initialize(); auto pins_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp, - tlm::tlm_phase& phase, sc_core::sc_time& delay)->tlm::tlm_sync_enum{ + tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{ this->pin_input(tag, gp, delay); return tlm::TLM_COMPLETED; }; @@ -72,7 +74,7 @@ gpio::gpio(sc_core::sc_module_name nm) ++i; } auto iof0_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp, - tlm::tlm_phase& phase, sc_core::sc_time& delay)->tlm::tlm_sync_enum{ + tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{ last_iof0[tag]=gp.get_value(); this->iof_input(tag, 0, gp, delay); return tlm::TLM_COMPLETED; @@ -83,7 +85,7 @@ gpio::gpio(sc_core::sc_module_name nm) ++i; } auto iof1_i_cb =[this](unsigned int tag, tlm::tlm_signal_gp<>& gp, - tlm::tlm_phase& phase, sc_core::sc_time& delay)->tlm::tlm_sync_enum{ + tlm::tlm_phase& phase, sc_time& delay)->tlm::tlm_sync_enum{ last_iof1[tag]=gp.get_value(); this->iof_input(tag, 1, gp, delay); return tlm::TLM_COMPLETED; @@ -93,7 +95,7 @@ gpio::gpio(sc_core::sc_module_name nm) s.register_nb_transport(iof1_i_cb, i); ++i; } - auto update_pins_cb = [this](scc::sc_register ®, uint32_t data, sc_core::sc_time d) -> bool { + auto update_pins_cb = [this](scc::sc_register ®, uint32_t data, sc_time d) -> bool { if (!this->regs->in_reset()) { auto changed_bits = (reg.get()^data); reg.put(data); @@ -124,7 +126,7 @@ void gpio::clock_cb() { } tlm::tlm_phase gpio::write_output(tlm::tlm_signal_gp& gp, size_t i, bool val) { - sc_core::sc_time delay{SC_ZERO_TIME}; + sc_time delay{SC_ZERO_TIME}; tlm::tlm_phase phase{ tlm::BEGIN_REQ }; gp.set_command(tlm::TLM_WRITE_COMMAND); gp.set_response_status(tlm::TLM_OK_RESPONSE); @@ -134,7 +136,7 @@ tlm::tlm_phase gpio::write_output(tlm::tlm_signal_gp& gp, size_t i, bool v } void gpio::update_pins(uint32_t changed_bits) { - sc_core::sc_inout_rv<32>::data_type out_val; + sc_inout_rv<32>::data_type out_val; tlm::tlm_signal_gp gp; bool val; for(size_t i=0, mask = 1; i<32; ++i, mask<<=1){ @@ -157,7 +159,7 @@ void gpio::update_pins(uint32_t changed_bits) { } } -void gpio::pin_input(unsigned int tag, tlm::tlm_signal_gp& gp, sc_core::sc_time& delay) { +void gpio::pin_input(unsigned int tag, tlm::tlm_signal_gp& gp, sc_time& delay) { if(delay>SC_ZERO_TIME){ wait(delay); delay=SC_ZERO_TIME; @@ -182,7 +184,7 @@ void gpio::forward_pin_input(unsigned int tag, tlm::tlm_signal_gp& gp) { auto& socket = regs->iof_sel&mask?iof1_o[tag]:iof0_o[tag]; tlm::tlm_signal_gp<> new_gp; for(size_t i=0; i& gp) { } } -void gpio::iof_input(unsigned int tag, unsigned iof_idx, tlm::tlm_signal_gp<>& gp, sc_core::sc_time& delay) { +void gpio::iof_input(unsigned int tag, unsigned iof_idx, tlm::tlm_signal_gp<>& gp, sc_time& delay) { if(delay>SC_ZERO_TIME){ wait(delay); delay=SC_ZERO_TIME; @@ -204,7 +206,7 @@ void gpio::iof_input(unsigned int tag, unsigned iof_idx, tlm::tlm_signal_gp<>& g if(iof_idx == idx){ auto& socket = pins_o[tag]; for(size_t i=0; i new_gp; new_gp.set_command(tlm::TLM_WRITE_COMMAND); diff --git a/examples/simple_system/plic.cpp b/examples/simple_system/plic.cpp index bf02fe2..85fbcab 100644 --- a/examples/simple_system/plic.cpp +++ b/examples/simple_system/plic.cpp @@ -50,7 +50,7 @@ plic::plic(sc_core::sc_module_name nm) , NAMED(rst_i) , NAMED(global_interrupts_i, 256) , NAMED(core_interrupt_o) -, NAMEDD(plic_regs, regs) +, NAMEDD(regs, plic_regs) { regs->registerResources(*this); @@ -120,7 +120,7 @@ void plic::global_int_port_cb() { if (enable && global_interrupts_i[i].read() == 1) { regs->r_pending = regs->r_pending | (0x1 << i); - LOG(INFO) << "pending interrupt identified: " << i; + SCDEBUG("plic") << "pending interrupt identified: " << i; } } @@ -148,7 +148,7 @@ void plic::handle_pending_int() { claim_prio = prio; claim_int = i; raise_int = 1; - LOG(INFO) << "pending interrupt activated: " << i; + SCDEBUG("plic") << "pending interrupt activated: " << i; } } } @@ -159,14 +159,14 @@ void plic::handle_pending_int() { // todo: evluate clock period } else { regs->r_claim_complete = 0; - LOG(INFO) << "no further pending interrupt."; + SCDEBUG("plic") << "no further pending interrupt."; } } void plic::reset_pending_int(uint32_t irq) { // todo: evaluate enable register (see spec) // todo: make sure that pending is set, otherwise don't reset irq ... read spec. - LOG(INFO) << "reset pending interrupt: " << irq; + SCDEBUG("plic") << "reset pending interrupt: " << irq; // reset related pending bit regs->r_pending &= ~(0x1 << irq); core_interrupt_o.write(0); diff --git a/examples/simple_system/simple_system.cpp b/examples/simple_system/simple_system.cpp index 302f86f..da9d03a 100644 --- a/examples/simple_system/simple_system.cpp +++ b/examples/simple_system/simple_system.cpp @@ -44,7 +44,7 @@ simple_system::simple_system(sc_core::sc_module_name nm) i_master.intor(i_router.target[0]); size_t i = 0; for (const auto &e : e300_plat_map) { - i_router.initiator[i](e.target->socket); + i_router.initiator[i](e.target); i_router.add_target_range(i, e.start, e.size); i++; } diff --git a/examples/simple_system/simple_system.h b/examples/simple_system/simple_system.h index 16dac7b..3c3a17a 100644 --- a/examples/simple_system/simple_system.h +++ b/examples/simple_system/simple_system.h @@ -48,7 +48,7 @@ public: sc_core::sc_signal s_clk; sc_core::sc_signal s_rst; sc_core::sc_vector> s_global_interrupts; - sc_core::sc_signal s_core_interrupt; + sc_core::sc_signal s_core_interrupt; sc_core::sc_vector> s_gpio; simple_system(sc_core::sc_module_name nm); diff --git a/examples/simple_system/spi.cpp b/examples/simple_system/spi.cpp index 152033a..9553b32 100644 --- a/examples/simple_system/spi.cpp +++ b/examples/simple_system/spi.cpp @@ -25,7 +25,7 @@ spi::spi(sc_core::sc_module_name nm) , tlm_target<>(clk) , NAMED(clk_i) , NAMED(rst_i) -, NAMEDD(spi_regs, regs) { +, NAMEDD(regs, spi_regs) { regs->registerResources(*this); SC_METHOD(clock_cb); sensitive << clk_i; diff --git a/examples/simple_system/test_initiator.cpp b/examples/simple_system/test_initiator.cpp index fb8f6c8..e176afc 100644 --- a/examples/simple_system/test_initiator.cpp +++ b/examples/simple_system/test_initiator.cpp @@ -36,8 +36,10 @@ #define PLIC_CLAIM_COMPLETE_REG 0x0C200004 namespace sysc { -test_initiator::test_initiator(sc_core::sc_module_name nm) -: sc_core::sc_module(nm) +using namespace sc_core; + +test_initiator::test_initiator(sc_module_name nm) +: sc_module(nm) , NAMED(intor) , NAMED(rst_i) , NAMED(global_interrupts_o, 256) @@ -62,6 +64,8 @@ void test_initiator::run() { test_irq_stress(); // todo: review irq sequences from FW point of view ... expected ??? + wait(100_ns); + sc_stop(); } void test_initiator::test_unique_irq() { @@ -211,14 +215,14 @@ void test_initiator::write_bus(std::uint32_t adr, std::uint32_t dat) { data[1] = 0xff & dat >> 8; data[0] = 0xff & dat; - LOG(INFO) << "write_bus(0x" << std::hex << adr << ") : " << dat; + SCDEBUG("test_initiator") << "write_bus(0x" << std::hex << adr << ") : " << dat; gp.set_command(tlm::TLM_WRITE_COMMAND); gp.set_address(adr); gp.set_data_ptr(data.data()); gp.set_data_length(data.size()); gp.set_streaming_width(4); - sc_core::sc_time delay; + sc_time delay; intor->b_transport(gp, delay); if (gp.get_response_status() != tlm::TLM_OK_RESPONSE) { @@ -236,7 +240,7 @@ std::uint32_t test_initiator::read_bus(std::uint32_t adr) { gp.set_data_ptr(data.data()); gp.set_data_length(data.size()); gp.set_streaming_width(4); - sc_core::sc_time delay; + sc_time delay; intor->b_transport(gp, delay); if (gp.get_response_status() != tlm::TLM_OK_RESPONSE) { @@ -248,21 +252,21 @@ std::uint32_t test_initiator::read_bus(std::uint32_t adr) { // todo: use reinterpret_cast instead std::uint32_t rdat = data[3] << 24 | data[2] << 16 | data[1] << 8 | data[0]; - LOG(INFO) << "read_bus(0x" << std::hex << adr << ") -> " << rdat; + SCDEBUG("test_initiator") << "read_bus(0x" << std::hex << adr << ") -> " << rdat; return rdat; } void test_initiator::reg_check(std::uint32_t adr, std::uint32_t exp) { uint32_t dat = read_bus(adr); if (dat != exp) { - LOG(ERROR) << "register check failed for address 0x" << std::hex << adr << ": " << dat << " != " << exp; + SCERR("test_initiator") << "register check failed for address 0x" << std::hex << adr << ": " << dat << " != " << exp; } else { - LOG(INFO) << "register check passed for address 0x" << std::hex << adr << ": " << dat; + SCDEBUG("test_initiator") << "register check passed for address 0x" << std::hex << adr << ": " << dat; } } void test_initiator::core_irq_handler() { - LOG(INFO) << "core_interrupt_i edge detected -> " << core_interrupt_i.read(); + SCDEBUG("test_initiator") << "core_interrupt_i edge detected -> " << core_interrupt_i.read(); } } /* namespace sysc */ diff --git a/examples/simple_system/uart.cpp b/examples/simple_system/uart.cpp index 7b57bf7..864ecd2 100644 --- a/examples/simple_system/uart.cpp +++ b/examples/simple_system/uart.cpp @@ -25,7 +25,7 @@ uart::uart(sc_core::sc_module_name nm) , tlm_target<>(clk) , NAMED(clk_i) , NAMED(rst_i) -, NAMEDD(uart_regs, regs) { +, NAMEDD(regs, uart_regs) { regs->registerResources(*this); SC_METHOD(clock_cb); sensitive << clk_i; diff --git a/examples/transaction_recording/CMakeLists.txt b/examples/transaction_recording/CMakeLists.txt index 2e13eeb..d34e774 100644 --- a/examples/transaction_recording/CMakeLists.txt +++ b/examples/transaction_recording/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries (transaction_recording LINK_PUBLIC sc-components) target_link_libraries (transaction_recording LINK_PUBLIC ${SystemC_LIBRARIES}) target_link_libraries (transaction_recording LINK_PUBLIC ${SCV_LIBRARIES}) target_link_libraries (transaction_recording LINK_PUBLIC ${Boost_LIBRARIES} ) +target_link_libraries (transaction_recording LINK_PUBLIC ${CONAN_LIBS_LEVELDB}) target_link_libraries (transaction_recording LINK_PUBLIC ${ZLIB_LIBRARIES} ) target_link_libraries (transaction_recording LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries (transaction_recording LINK_PUBLIC ${CMAKE_DL_LIBS}) diff --git a/examples/transaction_recording/scv_tr_recording_example.cpp b/examples/transaction_recording/scv_tr_recording_example.cpp index 9b5eece..3414c54 100644 --- a/examples/transaction_recording/scv_tr_recording_example.cpp +++ b/examples/transaction_recording/scv_tr_recording_example.cpp @@ -19,11 +19,11 @@ #include "scc/scv_tr_db.h" #include "scc/report.h" -//47ms #define SQLITE_DB -//27ms -#define CTXT_DB -//29ms #define BINARY_DB -//27ms TEXT_DB +// text 11308µs/11602µs +// compressed 10365µs/ 9860µs +// binary 13233µs/10698µs +// SQLite 30363µs/30018µs +// LeveDB 23898µs/22367µs // hack to fake a true fifo_mutex #define fifo_mutex sc_mutex @@ -330,25 +330,38 @@ inline void design::data_phase() { } } +inline const char* init_db(char type){ + switch(type){ + case '2': + scv_tr_compressed_init(); + return "my_db.txlog"; + break; + case '3': + scv_tr_binary_init(); + return "my_db.txb"; + break; + case '4': + scv_tr_sqlite_init(); + return "my_db.txdb"; + break; + case '5': + scv_tr_ldb_init(); + return "my_db.txldb"; + break; + default: + scv_tr_text_init(); + return "my_db.txlog"; + break; + } +} + int sc_main(int argc, char *argv[]) { auto start = std::chrono::system_clock::now(); scv_startup(); scc::init_logging(logging::INFO); LOGGER(SystemC)::print_time() = false; - -#if defined(BINARY_DB) - scv_tr_binary_init(); - const char *fileName = "my_db"; -#elif defined(CTXT_DB) - scv_tr_compressed_init(); - const char* fileName = "my_db.txlog"; -#elif defined(SQLITE_DB) - scv_tr_sqlite_init(); - const char* fileName = "my_db.txdb"; -#else - scv_tr_text_init(); - const char* fileName = "my_db.txlog"; -#endif + const char *fileName = argc==2? init_db(argv[1][0]): "my_db.txlog"; + if(argc<2) scv_tr_text_init(); scv_tr_db db(fileName); scv_tr_db::set_default_db(&db); sc_trace_file *tf = sc_create_vcd_trace_file("my_db"); diff --git a/sc-components b/sc-components index 523fb4b..53ff553 160000 --- a/sc-components +++ b/sc-components @@ -1 +1 @@ -Subproject commit 523fb4b985728d36e31be3cb673b0cab5b699fc1 +Subproject commit 53ff55301ca66162b036c9fcfd4683712f5261a5