From 0ee778decc3b6b62a952d0844e642193a4242fe1 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 22 Dec 2019 18:42:28 +0100 Subject: [PATCH] Updated to latest scc version --- .cproject | 16 +- .settings/language.settings.xml | 15 +- conanfile.txt | 5 +- examples/CMakeLists.txt | 2 + examples/ahb_bfm_test/CMakeLists.txt | 10 ++ examples/ahb_bfm_test/sc_main.cpp | 151 ++++++++++++++++++ examples/simple_system/CMakeLists.txt | 6 +- examples/simple_system/gen/e300_plat_t.h | 8 +- examples/simple_system/gpio.cpp | 2 +- examples/simple_system/plic.cpp | 3 +- examples/simple_system/sc_main.cpp | 21 +-- examples/simple_system/simple_system.cpp | 4 +- examples/simple_system/spi.cpp | 2 +- examples/simple_system/uart.cpp | 2 +- examples/transaction_recording/CMakeLists.txt | 6 +- .../scv_tr_recording_example.cpp | 5 - sc-components | 2 +- 17 files changed, 212 insertions(+), 48 deletions(-) create mode 100644 examples/ahb_bfm_test/CMakeLists.txt create mode 100644 examples/ahb_bfm_test/sc_main.cpp diff --git a/.cproject b/.cproject index 33377f1..608051f 100644 --- a/.cproject +++ b/.cproject @@ -17,15 +17,15 @@ - + - - - - @@ -184,6 +184,9 @@ + + + @@ -193,6 +196,9 @@ + + + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index f872b00..f58bb36 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,11 +5,20 @@ - - + + + + + + + + + + + @@ -17,7 +26,7 @@ - + diff --git a/conanfile.txt b/conanfile.txt index b57a63b..4a73fa6 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,9 +1,8 @@ [requires] gsl_microsoft/20180102@bincrafters/stable - spdlog/0.16.3@bincrafters/stable - SystemC/2.3.2@minres/stable + SystemC/2.3.3@minres/stable SystemCVerification/2.0.1@minres/stable - SystemC-CCI/0.9.0@minres/stable + SystemC-CCI/1.0.0@minres/stable [generators] cmake diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 404c47c..0b528c0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,3 +37,5 @@ if(SCV_FOUND) endif(SCV_FOUND) add_subdirectory(simple_system) +add_subdirectory(transaction_recording) +add_subdirectory(ahb_bfm_test) diff --git a/examples/ahb_bfm_test/CMakeLists.txt b/examples/ahb_bfm_test/CMakeLists.txt new file mode 100644 index 0000000..633cf20 --- /dev/null +++ b/examples/ahb_bfm_test/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.3) +# Add executable called "transaction_recording" that is built from the source files +# "scv_tr_recording_example.cpp". The extensions are automatically found. +add_executable (ahb_bfm_test + sc_main.cpp +) +# Link the executable to the sc_components library. Since the sc_components library has +# public include directories we will use those link directories when building +# transaction_recording +target_link_libraries (ahb_bfm_test LINK_PUBLIC scc ${CONAN_LIBS}) diff --git a/examples/ahb_bfm_test/sc_main.cpp b/examples/ahb_bfm_test/sc_main.cpp new file mode 100644 index 0000000..076156e --- /dev/null +++ b/examples/ahb_bfm_test/sc_main.cpp @@ -0,0 +1,151 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace sc_core; +using namespace scc; + +class testbench: public sc_module, public scc::traceable { +public: + enum { WIDTH=64}; + scc::initiator_mixin> isck{"isck"}; + tlm::ahb::bfm::initiator intor{"intor"}; + sc_core::sc_clock HCLK{"HCLK", 10_ns}; + sc_core::sc_signal HRESETn{"HRESETn"}; + sc_core::sc_signal> HADDR{"HADDR"}; + sc_core::sc_signal> HBURST{"HBURST"}; + sc_core::sc_signal HMASTLOCK{"HMASTLOCK"}; + sc_core::sc_signal> HPROT{"HPROT"}; + sc_core::sc_signal> HSIZE{"HSIZE"}; + sc_core::sc_signal> HTRANS{"HTRANS"}; + sc_core::sc_signal> HWDATA{"HWDATA"}; + sc_core::sc_signal HWRITE{"HWRITE"}; + sc_core::sc_signal> HRDATA{"HRDATA"}; + sc_core::sc_signal HREADY{"HREADY"}; + sc_core::sc_signal HRESP{"HRESP"}; + sc_core::sc_signal HSEL{"HSEL"}; + + tlm::ahb::bfm::target target{"target"}; + scc::target_mixin> tsck{"tsck"}; + + testbench(sc_module_name nm):sc_module(nm){ + SC_HAS_PROCESS(testbench); + isck(intor.tsckt); + intor.HCLK_i(HCLK); + intor.HRESETn_i(HRESETn); + intor.HADDR_o(HADDR); + intor.HBURST_o(HBURST); + intor.HMASTLOCK_o(HMASTLOCK); + intor.HPROT_o(HPROT); + intor.HSIZE_o(HSIZE); + intor.HTRANS_o(HTRANS); + intor.HWDATA_o(HWDATA); + intor.HWRITE_o(HWRITE); + intor.HRDATA_i(HRDATA); + intor.HREADY_i(HREADY); + intor.HRESP_i(HRESP); + target.HCLK_i(HCLK); + target.HRESETn_i(HRESETn); + target.HADDR_i(HADDR); + target.HBURST_i(HBURST); + target.HMASTLOCK_i(HMASTLOCK); + target.HPROT_i(HPROT); + target.HSIZE_i(HSIZE); + target.HTRANS_i(HTRANS); + target.HWDATA_i(HWDATA); + target.HWRITE_i(HWRITE); + target.HSEL_i(HSEL); + target.HRDATA_o(HRDATA); + target.HREADY_o(HREADY); + target.HRESP_o(HRESP); + target.isckt(tsck); + SC_THREAD(run); + tsck.register_b_transport([this](tlm::tlm_generic_payload& gp, sc_time& delay){ + gp.set_response_status(tlm::TLM_OK_RESPONSE); + if(gp.is_write()){ + SCCINFO(SCMOD)<<"Received write access to addr 0x"<b_transport(gp, delay); + gp.set_address(0x1020); + gp.set_data_length(8); + gp.set_data_ptr(data); + gp.set_streaming_width(8); + gp.set_command(tlm::TLM_READ_COMMAND); + delay=SC_ZERO_TIME; + isck->b_transport(gp, delay); + for(size_t i=0; i<10; ++i) wait(HCLK.posedge_event()); + sc_stop(); + } + +}; + +int sc_main (int argc , char *argv[]){ + sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING ); + sc_report_handler::set_actions(SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, SC_DO_NOTHING); + /////////////////////////////////////////////////////////////////////////// + // create global CCI broker + /////////////////////////////////////////////////////////////////////////// + cci::cci_register_broker(new cci_utils::broker("Global Broker")); + /////////////////////////////////////////////////////////////////////////// + // configure logging + /////////////////////////////////////////////////////////////////////////// + scc::init_logging(logging::DEBUG); + /////////////////////////////////////////////////////////////////////////// + // set up configuration + /////////////////////////////////////////////////////////////////////////// + scc::configurer cfg("ahb_test.json"); + scc::configurable_tracer trace("ahb_test", tracer::TEXT, true, true); + /////////////////////////////////////////////////////////////////////////// + // create modules/channels and trace + /////////////////////////////////////////////////////////////////////////// + testbench tb("tb"); + trace.add_control(); + { + std::ofstream of{"ahb_test.default.json"}; + if (of.is_open()) cfg.dump_configuration(of); + } + cfg.configure(); + /////////////////////////////////////////////////////////////////////////// + // run the simulation + /////////////////////////////////////////////////////////////////////////// + try { + sc_core::sc_start(1_us); + if (!sc_core::sc_end_of_simulation_invoked()) sc_core::sc_stop(); + } catch (sc_core::sc_report &rep) { + sc_core::sc_report_handler::get_handler()(rep, sc_core::SC_DISPLAY | sc_core::SC_STOP); + } + return 0; +} + diff --git a/examples/simple_system/CMakeLists.txt b/examples/simple_system/CMakeLists.txt index ee736bf..b2fd00e 100644 --- a/examples/simple_system/CMakeLists.txt +++ b/examples/simple_system/CMakeLists.txt @@ -13,10 +13,6 @@ add_executable (simple_system # Link the executable to the sc_components library. Since the sc_components library has # public include directories we will use those link directories when building # simple_system -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 scc) target_link_libraries (simple_system LINK_PUBLIC ${Boost_LIBRARIES} ) -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 c0ca85f..01f24d2 100644 --- a/examples/simple_system/gpio.cpp +++ b/examples/simple_system/gpio.cpp @@ -25,7 +25,7 @@ gpio::gpio(sc_core::sc_module_name nm) , tlm_target<>(clk) , NAMED(clk_i) , NAMED(rst_i) -, NAMEDD(gpio_regs, regs) { +, NAMEDD(regs, gpio_regs) { regs->registerResources(*this); SC_METHOD(clock_cb); sensitive << clk_i; diff --git a/examples/simple_system/plic.cpp b/examples/simple_system/plic.cpp index bf02fe2..f6c13a9 100644 --- a/examples/simple_system/plic.cpp +++ b/examples/simple_system/plic.cpp @@ -50,8 +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); // register callbacks diff --git a/examples/simple_system/sc_main.cpp b/examples/simple_system/sc_main.cpp index 33141d4..dbef674 100644 --- a/examples/simple_system/sc_main.cpp +++ b/examples/simple_system/sc_main.cpp @@ -21,11 +21,12 @@ */ #include "simple_system.h" -#include -#include #include #include #include +#include +#include +#include using namespace sysc; using namespace scc; @@ -38,10 +39,12 @@ const size_t ERROR_UNHANDLED_EXCEPTION = 2; } // namespace int sc_main(int argc, char *argv[]) { + sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated", sc_core::SC_DO_NOTHING ); + sc_core::sc_report_handler::set_actions(sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_, sc_core::SC_DO_NOTHING); /////////////////////////////////////////////////////////////////////////// - // setup initial logging + // create global CCI broker /////////////////////////////////////////////////////////////////////////// - scc::Logger<>::reporting_level() = logging::INFO; + cci::cci_register_broker(new cci_utils::broker("Global Broker")); /////////////////////////////////////////////////////////////////////////// // CLI argument parsing /////////////////////////////////////////////////////////////////////////// @@ -67,12 +70,10 @@ int sc_main(int argc, char *argv[]) { std::cerr << desc << std::endl; return ERROR_IN_COMMAND_LINE; } - if (vm.count("debug")) { - LOGGER(DEFAULT)::reporting_level() = log::DEBUG; - LOGGER(SystemC)::reporting_level() = log::DEBUG; - scc::Logger<>::reporting_level() = log::DEBUG; - } - + /////////////////////////////////////////////////////////////////////////// + // configure logging + /////////////////////////////////////////////////////////////////////////// + scc::init_logging(vm.count("debug")?logging::DEBUG:logging::INFO); /////////////////////////////////////////////////////////////////////////// // set up tracing & transaction recording /////////////////////////////////////////////////////////////////////////// diff --git a/examples/simple_system/simple_system.cpp b/examples/simple_system/simple_system.cpp index 158f845..6ad54fc 100644 --- a/examples/simple_system/simple_system.cpp +++ b/examples/simple_system/simple_system.cpp @@ -42,8 +42,8 @@ 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.add_target_range(i, e.start, e.size); + i_router.initiator[i](e.target); + i_router.set_target_range(i, e.start, e.size); i++; } 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/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 bfcbd5a..e774cd4 100644 --- a/examples/transaction_recording/CMakeLists.txt +++ b/examples/transaction_recording/CMakeLists.txt @@ -7,8 +7,4 @@ add_executable (transaction_recording # Link the executable to the sc_components library. Since the sc_components library has # public include directories we will use those link directories when building # transaction_recording -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 ${CMAKE_THREAD_LIBS_INIT}) -target_link_libraries (transaction_recording LINK_PUBLIC ${CMAKE_DL_LIBS}) +target_link_libraries (transaction_recording LINK_PUBLIC scc ${CONAN_LIBS}) diff --git a/examples/transaction_recording/scv_tr_recording_example.cpp b/examples/transaction_recording/scv_tr_recording_example.cpp index 7a5c18d..7735e1a 100644 --- a/examples/transaction_recording/scv_tr_recording_example.cpp +++ b/examples/transaction_recording/scv_tr_recording_example.cpp @@ -329,13 +329,8 @@ extern void scv_tr_sqlite_init(); int sc_main(int argc, char *argv[]) { scv_startup(); -#if 0 scv_tr_text_init(); const char* fileName = "my_db.txlog"; -#else - scv_tr_sqlite_init(); - const char *fileName = "my_db"; -#endif 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 bab66d1..72806c0 160000 --- a/sc-components +++ b/sc-components @@ -1 +1 @@ -Subproject commit bab66d1744221fdce7d0634c08c5c21184539d2a +Subproject commit 72806c0fd634b15fa23666843c3db2ad7f6b5077