Jump to content

maehne

Members
  • Content Count

    319
  • Joined

  • Last visited

  • Days Won

    37

Reputation Activity

  1. Like
    maehne got a reaction from omaima in (max. 20 printed)   
    You are welcome @omaima!
  2. Like
    maehne got a reaction from omaima in (max. 20 printed)   
    The cause for the empty VCD file is probably due that you call at the end the wrong closing function sca_close_tabular_trace_file(tfp_vcd) instead of the correct one sca_close_vcd_trace_file(tfp_vcd). As Martin Barnasconi wrote, VCD files are not well suited for tracing TDF, LSF, and ELN signals, because these signals tend to change at each time step. VCD is best suited for discrete event signals.
  3. Like
    maehne reacted to David Black in Using sc_trace inside SC_THREAD   
    You’re only allowed to call sc_trace one time for each variable and after that tracing is automatic. So you need to move the sc_trace calls out into the constructor or into end_of_elaboration or somewhere else before simulation starts. You also need to move your local variables in to the class as members.
  4. Like
    maehne reacted to David Black in (W170) Object cannot be traced Warning   
    The simple answer is that SystemC does not know how to trace std::string, and much less and array of std::string.
    First, std::string is a dynamically variable array of characters, which will perplex waveform viewing because you need a fixed number of signals to display.
    Changing to a fixed std::array<char,10> would help. You would still need to write an overload something like:
    template<int depth> void sc_trace( sc_trace_file* tf, const std::array<char,depth>& A, const std::string& name ) { // Code to trace individual char's for(int i=0; i<depth; ++i) { string elt_name = name + "["s + to_string(i) + "]s"; //< using modern C++14 sc_trace( tf, A[i], elt_name ); } } Even a simple array of int would need an overload.
  5. Thanks
    maehne got a reaction from coderoo in Split custom bundled signals and connect to individual ports   
    You'll have to create internal (i.e., private) signals for each member of the bundled class, which you need to connect to sub-blocks. Then, you have to register a SC_METHOD or SC_THREAD, which is sensitive to changes of the bundled input. The method/thread can then assign the correct new values to the internal signals based on the changed bundled input.
  6. Like
    maehne reacted to Runip Gopisetty in Seeking Feedback on Datatypes   
    Not sure if this topic is active. Here is some feedback.
    1. Decouple the datatypes library from other core SystemC libraries. In other words it should be a light stand-alone library of its own.
    2. Single unified bit vector library for all widths (like ac_int<W>). However having the range function for behavioral modeling (not synthesis) is also very useful. Currently we use the following c++-11 feature:
    /*----------------------------------------------------------------*/ // This uses a neat template alias trick introduced in C++-11 // to hide the underlying type of either a biguint or _bits_ull // inside a bv. This allows uniform use of bv<W> in the code // while hiding the underlying type // Refer to: Stroustrop's C++11 FAQ /*----------------------------------------------------------------*/     template<bool,int W>     struct bv_traits     {         typedef biguint<W> type;     };     template<int W>     struct bv_traits<true,W>     {         typedef _bits_ull<W> type;     };     template<int W>     using bv = typename bv_traits<W<=64,W>::type; 3.  Illegal shifts are a problem. Introduced an artificial layer with static assertion (C++-11) checks to mitigate the problem. Example of static assertion for illegal widths below. There are lots and lots of static and run-rime assertions like this.
    template <int W> class _bits_ull : public sc_uint_base { public: static const int width = W; enum { valid_ull_width = (W <= 64) }; enum { MAX_WIDTH = 64 // fits into unsigned long long }; // constructors _bits_ull() : sc_uint_base(W) { (void)cmn_static_assert<valid_ull_width>::Invalid_bits_ull_width; } 4. Speed of execution of bit-vectors is critical. I worked with Andy Goodrich to have a faster implementation of sc_biguint<W> and have it locally as a branch to 2.3.0. It does not seem to have made it into the latest standard (v2.3.3). This provides a dramatic improvement in speed. There are other things which can be done to speed it up further.
    5.  Recently I did some work on concurrency from within the SystemC simulation. Much to my surprise, I find the SystemC datatypes (range functions and the operator[int]) are not thread-safe. This is because of static variables and sc_vpool (sc_temporary) use. Here is an example which on the surface should work fine but has data_races. Note that we can have thread safety issues from either within or outside the SystemC simulation. Races can be found by clang++ thread sanitizer -fsanitize=thread
    data_race.cc #include <thread> #include <future> #include <systemc> using namespace sc_core; using namespace sc_dt; using namespace std; void thread_func() { sc_uint<32> b32; for (int i = 1; i < 32; i++) { b32[i] = 1; // RACE inside here b32.range(i, i-1) = 2; // RACE inside here } } std::vector<std::future<void>> futures; int main(int argc, char** argv) { const int N_THREADS = 2; for (int i = 0; i < N_THREADS; ++i) { auto f = std::async(std::launch::async, thread_func); futures.push_back(std::move(f)); } return 0; } ================== WARNING: ThreadSanitizer: data race (pid=19816) Read of size 4 at 0x0000016dfc90 by thread T2: #0 sc_core::sc_vpool<sc_dt::sc_uint_bitref>::allocate() /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:187:23 (data_race.x+0x4c63d5) #1 sc_dt::sc_uint_base::operator[](int) /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/datatypes/int/sc_uint_base.h:1207:55 (data_race.x+0x4c5f48) #2 thread_func() /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:15:9 (data_race.x+0x4c5c29) #3 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4ca7ba) #4 std::_Bind_simple<void (*())()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4ca685) #5 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1348:6 (data_race.x+0x4ca55a) #6 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void> >::_M_invoke(std::_Any_data const&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1725:9 (data_race.x+0x4ca3a6) #7 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:2136:14 (data_race.x+0x4c9fc1) #8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:533:27 (data_race.x+0x4c9308) #9 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:235:14 (data_race.x+0x4c9dc7) #10 std::result_of<void (std::__future_base::_State_baseV2::* const&(std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&))(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::type std::__invoke<void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:259:14 (data_race.x+0x4c9cf8) #11 _ZNKSt12_Mem_fn_baseIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbELb1EEclIJPS1_S9_SA_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOSG_ /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:613:11 (data_race.x+0x4c9b6d) #12 void std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c9ace) #13 std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c9a45) #14 void std::__once_call_impl<std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> >() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:587:7 (data_race.x+0x4c951b) #15 pthread_once /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1433 (data_race.x+0x456d92) #16 __gthread_once(int*, void (*)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/x86_64-pc-linux-gnu/bits/gthr-default.h:699:12 (data_race.x+0x4c5e0b) #17 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:619:17 (data_race.x+0x4c92a5) #18 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:392:2 (data_race.x+0x4c8ecb) #19 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1}::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1664:3 (data_race.x+0x4c8d3e) #20 void std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c8ca5) #21 std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c8c65) #22 std::thread::_State_impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()> >::_M_run() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/thread:196:13 (data_race.x+0x4c8b19) #23 execute_native_thread_routine /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:83 (data_race.x+0x54d601) Previous write of size 4 at 0x0000016dfc90 by thread T1: #0 sc_core::sc_vpool<sc_dt::sc_uint_bitref>::allocate() /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:188:11 (data_race.x+0x4c63f7) #1 sc_dt::sc_uint_base::operator[](int) /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/datatypes/int/sc_uint_base.h:1207:55 (data_race.x+0x4c5f48) #2 thread_func() /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:15:9 (data_race.x+0x4c5c29) #3 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4ca7ba) #4 std::_Bind_simple<void (*())()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4ca685) #5 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1348:6 (data_race.x+0x4ca55a) #6 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void> >::_M_invoke(std::_Any_data const&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1725:9 (data_race.x+0x4ca3a6) #7 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:2136:14 (data_race.x+0x4c9fc1) #8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:533:27 (data_race.x+0x4c9308) #9 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:235:14 (data_race.x+0x4c9dc7) #10 std::result_of<void (std::__future_base::_State_baseV2::* const&(std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&))(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::type std::__invoke<void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:259:14 (data_race.x+0x4c9cf8) #11 _ZNKSt12_Mem_fn_baseIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbELb1EEclIJPS1_S9_SA_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOSG_ /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:613:11 (data_race.x+0x4c9b6d) #12 void std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c9ace) #13 std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c9a45) #14 void std::__once_call_impl<std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> >() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:587:7 (data_race.x+0x4c951b) #15 pthread_once /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1433 (data_race.x+0x456d92) #16 __gthread_once(int*, void (*)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/x86_64-pc-linux-gnu/bits/gthr-default.h:699:12 (data_race.x+0x4c5e0b) #17 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:619:17 (data_race.x+0x4c92a5) #18 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:392:2 (data_race.x+0x4c8ecb) #19 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1}::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1664:3 (data_race.x+0x4c8d3e) #20 void std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c8ca5) #21 std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c8c65) #22 std::thread::_State_impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()> >::_M_run() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/thread:196:13 (data_race.x+0x4c8b19) #23 execute_native_thread_routine /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:83 (data_race.x+0x54d601) Location is global 'sc_dt::sc_uint_bitref::m_pool' of size 24 at 0x0000016dfc90 (data_race.x+0x0000016dfc90) Thread T2 (tid=19820, running) created by main thread at: #0 pthread_create /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992 (data_race.x+0x433b36) #1 __gthread_create /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (data_race.x+0x54d8f4) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:163 (data_race.x+0x54d8f4) #3 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1661:14 (data_race.x+0x4c7b04) #4 void __gnu_cxx::new_allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/ext/new_allocator.h:120:23 (data_race.x+0x4c7a46) #5 void std::allocator_traits<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >&, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/alloc_traits.h:455:8 (data_race.x+0x4c77cd) #6 std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:520:4 (data_race.x+0x4c74a3) #7 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:615:18 (data_race.x+0x4c7234) #8 std::__shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:1099:14 (data_race.x+0x4c7157) #9 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:319:4 (data_race.x+0x4c70ed) #10 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::allocate_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:619:14 (data_race.x+0x4c703d) #11 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::make_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:635:14 (data_race.x+0x4c6f3b) #12 std::shared_ptr<std::__future_base::_State_baseV2> std::__future_base::_S_make_async_state<std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1702:14 (data_race.x+0x4c6c0b) #13 std::future<std::result_of<std::decay<void (&)()>::type ()>::type> std::async<void (&)()>(std::launch, void (&)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1716:18 (data_race.x+0x4c61ac) #14 main /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:29:18 (data_race.x+0x4c5cd1) Thread T1 (tid=19819, finished) created by main thread at: #0 pthread_create /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992 (data_race.x+0x433b36) #1 __gthread_create /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (data_race.x+0x54d8f4) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:163 (data_race.x+0x54d8f4) #3 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1661:14 (data_race.x+0x4c7b04) #4 void __gnu_cxx::new_allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/ext/new_allocator.h:120:23 (data_race.x+0x4c7a46) #5 void std::allocator_traits<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >&, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/alloc_traits.h:455:8 (data_race.x+0x4c77cd) #6 std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:520:4 (data_race.x+0x4c74a3) #7 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:615:18 (data_race.x+0x4c7234) #8 std::__shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:1099:14 (data_race.x+0x4c7157) #9 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:319:4 (data_race.x+0x4c70ed) #10 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::allocate_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:619:14 (data_race.x+0x4c703d) #11 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::make_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:635:14 (data_race.x+0x4c6f3b) #12 std::shared_ptr<std::__future_base::_State_baseV2> std::__future_base::_S_make_async_state<std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1702:14 (data_race.x+0x4c6c0b) #13 std::future<std::result_of<std::decay<void (&)()>::type ()>::type> std::async<void (&)()>(std::launch, void (&)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1716:18 (data_race.x+0x4c61ac) #14 main /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:29:18 (data_race.x+0x4c5cd1) SUMMARY: ThreadSanitizer: data race /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:187:23 in sc_core::sc_vpool<sc_dt::sc_uint_bitref>::allocate() ================== ================== WARNING: ThreadSanitizer: data race (pid=19816) Read of size 4 at 0x0000016dfc70 by thread T2: #0 sc_core::sc_vpool<sc_dt::sc_uint_subref>::allocate() /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:187:23 (data_race.x+0x4c6538) #1 sc_dt::sc_uint_base::range(int, int) /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/datatypes/int/sc_uint_base.h:1272:55 (data_race.x+0x4c6001) #2 thread_func() /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:16:13 (data_race.x+0x4c5c45) #3 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4ca7ba) #4 std::_Bind_simple<void (*())()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4ca685) #5 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1348:6 (data_race.x+0x4ca55a) #6 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void> >::_M_invoke(std::_Any_data const&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1725:9 (data_race.x+0x4ca3a6) #7 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:2136:14 (data_race.x+0x4c9fc1) #8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:533:27 (data_race.x+0x4c9308) #9 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:235:14 (data_race.x+0x4c9dc7) #10 std::result_of<void (std::__future_base::_State_baseV2::* const&(std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&))(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::type std::__invoke<void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:259:14 (data_race.x+0x4c9cf8) #11 _ZNKSt12_Mem_fn_baseIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbELb1EEclIJPS1_S9_SA_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOSG_ /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:613:11 (data_race.x+0x4c9b6d) #12 void std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c9ace) #13 std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c9a45) #14 void std::__once_call_impl<std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> >() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:587:7 (data_race.x+0x4c951b) #15 pthread_once /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1433 (data_race.x+0x456d92) #16 __gthread_once(int*, void (*)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/x86_64-pc-linux-gnu/bits/gthr-default.h:699:12 (data_race.x+0x4c5e0b) #17 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:619:17 (data_race.x+0x4c92a5) #18 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:392:2 (data_race.x+0x4c8ecb) #19 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1}::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1664:3 (data_race.x+0x4c8d3e) #20 void std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c8ca5) #21 std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c8c65) #22 std::thread::_State_impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()> >::_M_run() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/thread:196:13 (data_race.x+0x4c8b19) #23 execute_native_thread_routine /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:83 (data_race.x+0x54d601) Previous write of size 4 at 0x0000016dfc70 by thread T1: #0 sc_core::sc_vpool<sc_dt::sc_uint_subref>::allocate() /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:188:11 (data_race.x+0x4c655a) #1 sc_dt::sc_uint_base::range(int, int) /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/datatypes/int/sc_uint_base.h:1272:55 (data_race.x+0x4c6001) #2 thread_func() /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:16:13 (data_race.x+0x4c5c45) #3 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4ca7ba) #4 std::_Bind_simple<void (*())()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4ca685) #5 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1348:6 (data_race.x+0x4ca55a) #6 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::_Bind_simple<void (*())()>, void> >::_M_invoke(std::_Any_data const&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1725:9 (data_race.x+0x4ca3a6) #7 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:2136:14 (data_race.x+0x4c9fc1) #8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:533:27 (data_race.x+0x4c9308) #9 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:235:14 (data_race.x+0x4c9dc7) #10 std::result_of<void (std::__future_base::_State_baseV2::* const&(std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&))(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::type std::__invoke<void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::* const&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:259:14 (data_race.x+0x4c9cf8) #11 _ZNKSt12_Mem_fn_baseIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS0_12_Result_baseENS4_8_DeleterEEvEEPbELb1EEclIJPS1_S9_SA_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOSG_ /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:613:11 (data_race.x+0x4c9b6d) #12 void std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c9ace) #13 std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c9a45) #14 void std::__once_call_impl<std::_Bind_simple<std::_Mem_fn<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> (std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)> >() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:587:7 (data_race.x+0x4c951b) #15 pthread_once /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:1433 (data_race.x+0x456d92) #16 __gthread_once(int*, void (*)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/x86_64-pc-linux-gnu/bits/gthr-default.h:699:12 (data_race.x+0x4c5e0b) #17 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/mutex:619:17 (data_race.x+0x4c92a5) #18 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:392:2 (data_race.x+0x4c8ecb) #19 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1}::operator()() const /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1664:3 (data_race.x+0x4c8d3e) #20 void std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1399:18 (data_race.x+0x4c8ca5) #21 std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()>::operator()() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/functional:1389:16 (data_race.x+0x4c8c65) #22 std::thread::_State_impl<std::_Bind_simple<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&)::{lambda()#1} ()> >::_M_run() /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/thread:196:13 (data_race.x+0x4c8b19) #23 execute_native_thread_routine /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:83 (data_race.x+0x54d601) Location is global 'sc_dt::sc_uint_subref::m_pool' of size 24 at 0x0000016dfc70 (data_race.x+0x0000016dfc70) Thread T2 (tid=19820, running) created by main thread at: #0 pthread_create /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992 (data_race.x+0x433b36) #1 __gthread_create /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (data_race.x+0x54d8f4) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:163 (data_race.x+0x54d8f4) #3 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1661:14 (data_race.x+0x4c7b04) #4 void __gnu_cxx::new_allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/ext/new_allocator.h:120:23 (data_race.x+0x4c7a46) #5 void std::allocator_traits<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >&, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/alloc_traits.h:455:8 (data_race.x+0x4c77cd) #6 std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:520:4 (data_race.x+0x4c74a3) #7 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:615:18 (data_race.x+0x4c7234) #8 std::__shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:1099:14 (data_race.x+0x4c7157) #9 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:319:4 (data_race.x+0x4c70ed) #10 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::allocate_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:619:14 (data_race.x+0x4c703d) #11 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::make_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:635:14 (data_race.x+0x4c6f3b) #12 std::shared_ptr<std::__future_base::_State_baseV2> std::__future_base::_S_make_async_state<std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1702:14 (data_race.x+0x4c6c0b) #13 std::future<std::result_of<std::decay<void (&)()>::type ()>::type> std::async<void (&)()>(std::launch, void (&)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1716:18 (data_race.x+0x4c61ac) #14 main /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:29:18 (data_race.x+0x4c5cd1) Thread T1 (tid=19819, finished) created by main thread at: #0 pthread_create /var/tmp/x86_64-rhel6/llvm-6.0.1.src/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992 (data_race.x+0x433b36) #1 __gthread_create /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:662 (data_race.x+0x54d8f4) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /var/tmp/x86_64-rhel6/gcc-6.1.0/objdir/x86_64-pc-linux-gnu/libstdc++-v3/src/c++11/../../../../../../gcc-6.1.0/libstdc++-v3/src/c++11/thread.cc:163 (data_race.x+0x54d8f4) #3 std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>::_Async_state_impl(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1661:14 (data_race.x+0x4c7b04) #4 void __gnu_cxx::new_allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/ext/new_allocator.h:120:23 (data_race.x+0x4c7a46) #5 void std::allocator_traits<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > >::construct<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >&, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/alloc_traits.h:455:8 (data_race.x+0x4c77cd) #6 std::_Sp_counted_ptr_inplace<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:520:4 (data_race.x+0x4c74a3) #7 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>*, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:615:18 (data_race.x+0x4c7234) #8 std::__shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr_base.h:1099:14 (data_race.x+0x4c7157) #9 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >::shared_ptr<std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::_Sp_make_shared_tag, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:319:4 (data_race.x+0x4c70ed) #10 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::allocate_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> >, std::_Bind_simple<void (*())()> >(std::allocator<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > const&, std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:619:14 (data_race.x+0x4c703d) #11 std::shared_ptr<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void> > std::make_shared<std::__future_base::_Async_state_impl<std::_Bind_simple<void (*())()>, void>, std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/bits/shared_ptr.h:635:14 (data_race.x+0x4c6f3b) #12 std::shared_ptr<std::__future_base::_State_baseV2> std::__future_base::_S_make_async_state<std::_Bind_simple<void (*())()> >(std::_Bind_simple<void (*())()>&&) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1702:14 (data_race.x+0x4c6c0b) #13 std::future<std::result_of<std::decay<void (&)()>::type ()>::type> std::async<void (&)()>(std::launch, void (&)()) /tools/oss/packages/x86_64-rhel6/gcc/6.1.0/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/future:1716:18 (data_race.x+0x4c61ac) #14 main /projects/ntsw-arch/AV/users/runipg/rg_arch40/arch/common/test/data_race/data_race.cc:29:18 (data_race.x+0x4c5cd1) SUMMARY: ThreadSanitizer: data race /projects/ntsw-arch-public/tools/systemc-22sep2015/systemc-2.3.0/x86_64-gcc8/include/sysc/utils/sc_temporary.h:187:23 in sc_core::sc_vpool<sc_dt::sc_uint_subref>::allocate() ================== ThreadSanitizer: reported 2 warnings 6. A common pattern is to use a fixed width slice of a bit-vector (both set and get). This should be optimized to take advantage of compile time templated left and right (L,R) parameters. For example:
    template< int W > class biguint { public: ... template<int L, int R, int W2> void set_fslc (const biguint<W2> &b); template<int L, int R> biguint<L - R + 1> fslc () const; } There are other interesting problems to solve as well but don't want to make this post too long.
  7. Thanks
    maehne got a reaction from A_Hoss in Systemc executable cannot be built   
    To fix the issue, you can simply create a symbolic link lib-linux64, which points to lib, inside your SystemC installation directory /home/computation/Desktop/systemc-2.3.3-install using:
    cd /home/computation/Desktop/systemc-2.3.3-install ln -s lib lib-linux64 The experimental CMake-based build system distributed with SystemC provides to this end the setting INSTALL_LIB_TARGET_ARCH_SYMLINK. If enabled (default is OFF), the symlink is automatically created during installation of the SystemC library. Ideally, all SystemC-related libraries would provide a CMake-based build system, which would detect SystemC based on the created configuration files. However, this still requires some improvements to SystemC's CMake files to update them to modern CMake conventions and then equivalent enhancements to the build systems of the other libraries. This is a considerable amount of work, we are currently lacking resources for.
  8. Like
    maehne reacted to Paul Floyd in A few Valgrind issues   
    Here is a full analysis of the first problem, and a proposed patch.
    Here's what I saw running the executable under Valgrind via the GDB server (this is required to execute the mo(nitor) command).
     
      257                     result_p->digit = (sc_digit*)sc_core::sc_temp_heap.allocate(
      258                         sizeof(sc_digit)*result_p->ndigits );
      259         #if defined(_MSC_VER)
      260                     // workaround spurious initialisation issue on MS Visual C++
      261                     memset( result_p->digit, 0, sizeof(sc_digit)*result_p->ndigits );
      262         #else
      263                     result_p->digit[result_p->ndigits-1] = 0;
      264         #endif
     >265                     right_non_zero = m_right_p->concat_get_data( result_p->digit, 0 );
     
    The above is copied from gdb. result_p->nbits is 95, result_p->ndigits is 4 and result_p->digit contains all zeroes
     
    (gdb) x /4x result_p->digit  
    0x5825bb0:      0x00000000      0x00000000      0x00000000      0x00000000
     
    However, the 1st 3 words are uninitialized, only the 4th word is initialized, as seen on line 263
    (gdb) mo xb 0x5825bb0 16
                     ff      ff      ff      ff      ff      ff      ff      ff
    0x5825BB0:      0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
                     ff      ff      ff      ff      00      00      00      00
    0x5825BB8:      0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
     
    Inside concat_get_data we execute
    >337                     dst_p[dst_i] = dst_p[dst_i] & ~mask;
     
    Where dst_i is 0, mask is 0x3fffffff, dst_p[dst_i] is all uninitialized
    After this assignment, the lower 30 bits are initialized but the top 2 bits are still uninitialized:
    (gdb) p &dst_p[dst_i]
    $27 = (sc_dt::sc_digit *) 0x5825bb0
    (gdb) mo xb 0x5825bb0 4
                     00      00      00      c0
    0x5825BB0:      0x00    0x00    0x00    0x00
    However, I don't think that the problem is here. The next call
      266                     left_non_zero = m_left_p->concat_get_data(result_p->digit, m_len_r);
    is where I reckon those two bits ought to be written to, but aren't. Watch this space.
    Update:
    In the second call to concat_get_data, the first word of dst_p doesn't get written (since dst_i is 1 rather than 0). So in summary, the 1st call to concat_get_data doesn't initialize all of word 0 of dst_p but then the 2nd call assumes that it was all initialized.
    For comparison, the concatenation with 29 bits behaves in a similar fashion to 30 bits for the 1st call, bit the second call has dst_i set to 0 so word 0 does get fully initialized. In the case of 31 bits, a different path is taken in in the first call to concat_get_data (sc_unsigned.cpp around line 352) which writes 2 whole words rather than just part of 1 word.
     
    I suggest as a fix changing this block
     
    // ALL DATA TO BE MOVED IS IN A SINGLE WORD:   if ( dst_i == end_i ) { mask = ~(~0U << real_bits) << left_shift; dst_p[dst_i] = dst_p[dst_i] & ~mask; }  
    to be
     
    // ALL DATA TO BE MOVED IS IN A SINGLE WORD:   if ( dst_i == end_i ) { if ( left_shift == 0 ) { dst_p[dst_i] = 0; } else { mask = ~(~0U << real_bits) << left_shift; dst_p[dst_i] = dst_p[dst_i] & ~mask; } } (and the same thing for signed)
    It is not easy to test this thoroughly. The problem is with the circular buffer, which reuses memory. The re-used memory never becomes uninitialized, so to check that I made this change
     
    +#include "/usr/home/paulf/tools/valgrind/include/valgrind/memcheck.h"
    +
    template<class T> T* sc_vpool<T>::allocate()
    {
           T* result_p;    // Entry to return.
     
           result_p = &m_pool_p[m_pool_i];
    +
    +   VALGRIND_MAKE_MEM_UNDEFINED(result_p, sizeof(T));
    +
           m_pool_i = (m_pool_i + 1) & m_wrap;
           return result_p;
    }
     
    I've attached a patch that seems to solve the issue.
     
    Lastly, this can also probably be changed
    #if defined(_MSC_VER) // workaround spurious initialisation issue on MS Visual C++ memset( result_p->digit, 0, sizeof(sc_digit)*result_p->ndigits ); #else result_p->digit[result_p->ndigits-1] = 0; #endif The comment is al least half wrong - it is a genuine workaround. With the attached patch the memset should not be necessary.
    concat_init.patch
  9. Like
    maehne reacted to Paul Floyd in A few Valgrind issues   
    More details on the other two issues
    systemc/misc/user_guide/chpt4.4
     
    ==165605== Invalid write of size 8
    ==165605==    at 0x49FACA6: sc_core::sc_object::orphan_child_objects() (sc_object.cpp:336)
    ==165605==    by 0x49F5D46: sc_core::sc_module::~sc_module() (sc_module.cpp:273)
    ==165605==    by 0x406CC3: stage1_2::~stage1_2() (stage1_2.h:43)
    ==165605==    by 0x406B95: pipeline::~pipeline() (pipeline.h:43)
    ==165605==    by 0x406C38: pipeline::~pipeline() (pipeline.h:43)
    ==165605==    by 0x49F5343: sc_core::sc_module_dynalloc_list::~sc_module_dynalloc_list() (sc_module.cpp:94)
    ==165605==    by 0x4EA4236: __run_exit_handlers (in /usr/lib64/libc-2.32.so)
    ==165605==    by 0x4EA43DF: exit (in /usr/lib64/libc-2.32.so)
    ==165605==    by 0x4E8C1E8: (below main) (in /usr/lib64/libc-2.32.so)
    ==165605==  Address 0x5377510 is 96 bytes inside a block of size 448 free'd
    ==165605==    at 0x483AEDD: operator delete(void*) (vg_replace_malloc.c:584)
    ==165605==    by 0x4071A6: stage1::~stage1() (stage1.h:43)
    ==165605==    by 0x49F5343: sc_core::sc_module_dynalloc_list::~sc_module_dynalloc_list() (sc_module.cpp:94)
    ==165605==    by 0x4EA4236: __run_exit_handlers (in /usr/lib64/libc-2.32.so)
    ==165605==    by 0x4EA43DF: exit (in /usr/lib64/libc-2.32.so)
    ==165605==    by 0x4E8C1E8: (below main) (in /usr/lib64/libc-2.32.so)
    ==165605==  Block was alloc'd at
    ==165605==    at 0x4839E7D: operator new(unsigned long) (vg_replace_malloc.c:342)
    ==165605==    by 0x406EAC: f_stage1(char const*, sc_core::sc_clock&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&) (stage1.cpp:66)
    ==165605==    by 0x406951: stage1_2::stage1_2(sc_core::sc_module_name, sc_core::sc_clock&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&) (stage1_2.h:56)
    ==165605==    by 0x406AA1: pipeline::pipeline(sc_core::sc_module_name, sc_core::sc_clock&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&) (pipeline.h:56)
    ==165605==    by 0x4067FB: f_pipeline(char const*, sc_core::sc_clock&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0> const&, sc_core::sc_signal<double, (sc_core::sc_writer_policy)0>&) (pipeline.cpp:55)
    ==165605==    by 0x4048D9: sc_main (main.cpp:58)
    ==165605==    by 0x49F1E8C: sc_elab_and_sim (sc_main_main.cpp:89)
    ==165605==    by 0x49F1CCE: main (sc_main.cpp:36)
    memcheck is saying that in this code [sc_object.cpp void sc_object::orphan_child_events()]
    for( ; it != end; ++it ) { (*it)->m_parent = NULL; simcontext()->add_child_object(*it); } the child object has already been deleted, so it is writing to deleted memory.
    I assume that stage1 should be destroyed after stage1_2. Should pipeline::stage1_2 be a pointer allocated with SC_NEW so that the destruction gets done in the right order? If so it's an issue with the testcase so not a very serious problem.
    And the last problem
    tlm/bus_dmi
     
    ==166842== Thread 5:
    ==166842== Conditional jump or move depends on uninitialised value(s)
    ==166842==    at 0x4278D8: tlm_utils::simple_target_socket_b<ExplicitATTarget, 32u, tlm::tlm_base_protocol_types, (sc_core::sc_port_policy)0>::bw_process::nb_transport_bw(tlm::tlm_generic_payload&, tlm::tlm_phase&, sc_core::sc_time&) (simple_target_socket.h:157)
    ==166842==    by 0x415358: ExplicitATTarget::beginResponse() (ExplicitATTarget.h:133)
    ==166842==    by 0x4A0B504: sc_core::sc_process_b::semantics() (sc_process.h:685)
    ==166842==    by 0x4A11C21: sc_core::sc_thread_cor_fn(void*) (sc_thread_process.cpp:117)
    ==166842==    by 0x49EABB0: sc_core::sc_cor_pthread::invoke_module_method(void*) (sc_cor_pthread.cpp:127)
    ==166842==    by 0x4E493F8: start_thread (in /usr/lib64/libpthread-2.32.so)
    ==166842==    by 0x4F65902: clone (in /usr/lib64/libc-2.32.so)
    ==166842==  Uninitialised value was created by a stack allocation
    ==166842==    at 0x40A8EB: sc_main (bus_dmi.cpp:37)
    ==166842==
    ==166842== Thread 1:
    ==166842== Conditional jump or move depends on uninitialised value(s)
    ==166842==    at 0x429158: tlm_utils::simple_target_socket_b<SimpleATTarget2, 32u, tlm::tlm_base_protocol_types, (sc_core::sc_port_policy)0>::bw_process::nb_transport_bw(tlm::tlm_generic_payload&, tlm::tlm_phase&, sc_core::sc_time&) (simple_target_socket.h:157)
    ==166842==    by 0x413A65: SimpleATTarget2::beginResponse() (SimpleATTarget2.h:145)
    ==166842==    by 0x4A0B504: sc_core::sc_process_b::semantics() (sc_process.h:685)
    ==166842==    by 0x4A0B788: sc_core::sc_method_process::run_process() (sc_method_process.h:305)
    ==166842==    by 0x4A0CFA3: sc_core::sc_simcontext::crunch(bool) (sc_simcontext.cpp:486)
    ==166842==    by 0x4A08D19: sc_core::sc_simcontext::simulate(sc_core::sc_time const&) (sc_simcontext.cpp:887)
    ==166842==    by 0x4A0AB61: sc_core::sc_start(sc_core::sc_time const&, sc_core::sc_starvation_policy) (sc_simcontext.cpp:1718)
    ==166842==    by 0x4A0AC8C: sc_core::sc_start() (sc_simcontext.cpp:1752)
    ==166842==    by 0x40AEBF: sc_main (bus_dmi.cpp:76)
    ==166842==    by 0x49F1E8C: sc_elab_and_sim (sc_main_main.cpp:89)
    ==166842==    by 0x49F1CCE: main (sc_main.cpp:36)
    ==166842==  Uninitialised value was created by a stack allocation
    ==166842==    at 0x40A8EB: sc_main (bus_dmi.cpp:37)
    ==166842==
    This is a very straightforward missing initialization, fixed with the following change
     
    diff --git a/src/tlm_utils/simple_target_socket.h b/src/tlm_utils/simple_target_
    socket.h                                                                        
    index 7e4c3a19..c3bd240f 100644       
    --- a/src/tlm_utils/simple_target_socket.h
    +++ b/src/tlm_utils/simple_target_socket.h
    @@ -68,6 +68,7 @@ public:
        : base_type(n)
        , m_fw_process(this)
        , m_bw_process(this)
    +    , m_current_transaction(NULL)
      {
        bind(m_fw_process);
      }

     
  10. Like
    maehne reacted to Paul Floyd in A few Valgrind issues   
    So, for the 1st item that I've looked at the most, I reproduced this on Fedora 33 amd64 with the default GCC [gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)]. The SystemC library is the latest from github and regressions systemc-regressions-2.3.3 from Accellera. Valgrind is the latest release, 3.16.1. I also reproduced the same issue on FreeBSD 12.2 with the default clang (10 I believe). That was with my own build of Valgrind, a bit more recent than 3.16.1 but no significant differences on amd64.
     
    The 2nd and 3rd items I also saw on FreeBSD and I'm rerunning the full set of tests on Fedora at the moment. Will update tomorrow.

     
  11. Like
    maehne reacted to Eyck in Error:<E109> complete binding failed: port not bound:   
    This part is wrong:
    for ( int i=0; i<N ; i++){ for ( int j=0; j<NB_elements_trans ; j++){ i_adder = new adder("i_adder"); i_adder->in[j](sig_data[i][j]); } i_adder->out(sig_add); } You create N x NB_elements_trans i_adder elements and on each of them you only connect 1 of 4 in ports. I guess you mean:
    for ( int i=0; i<N ; i++){ i_adder = new adder("i_adder"); for ( int j=0; j<NB_elements_trans ; j++){ i_adder->in[j](sig_data[i][j]); } i_adder->out(sig_add); } A few remarks:
    you create a memory leak by assigning objects created with new to the same variable you should not use raw pointer. Use C++11 unique_ptr instead Name you SystemC objects, this helps debugging. C++11 makes it easy witn in-class constructors, e.g.: sc_signal<double> sig_add{"sig_add"}; don't use plain C-style arrays, uses either std::array or std::vector. These provide range checking capabilities and help finding out-of-bounds problems don't use C  or C++arrays for SystemC objects. Use sc_core::sc_vector instead use proper formatting, this eases reading (an IDe or clang-format is your friend). Keep in mind: code is a hundret times more often read than written!
  12. Like
    maehne reacted to David Black in sc_inout class   
    Nothing wrong. Your output will be available after the delta cycle completes. You can view the new value in the next delta cycle.
    The problem for you conceptually is that you think 'S_val_out = expression' is a blocking statement. In other words, you expect the value to be transferred to the current value of S_val_out at the end of the assignment. Actually what is happening is akin to:
    S_val_out->write( A_val_in->read() +B_val_in->read() );  External to your sum class object, the S_val_out is bound to a channel sc_signal<T>, where the write() method is implemented. The write method does something like this:
    template<typename T> class sc_signal : sc_signal_in_if<T>, sc_signal_inout_if<T> { void write( T value ) { next_val = value; request_notify(); } T read() { return curr_val; } void notify() { curr_val = next_val; } }; SystemC will call notify at the end of the delta cycle after all other processes in the current delta cycle have completed their work.
    You could force code displaying the sum into the next delta cycle with:
    wait(SC_ZERO_TIME); but that could theoretically affect the other wait depending on how the inputs are being driven and cause you to miss updates.
  13. Like
    maehne reacted to Philipp A Hartmann in Memory leak when sc_event is notified twice   
    This is not really a memory leak, but a very bad „model“ for the current implementation. I wonder if you saw any such scenario in a real model?
    „Canceled“ notifications like in your case will still be kept in the kernel‘s internal data structures until the notification time is reached (1ms in your case).  You would pile up 999,999,999 of these canceled notifications until they are „deallocated“, each of them taking entries in the event queue and 16 bytes for the notification itself. Which is a lot of memory.
    I wrote „deallocated“ in quotes, because sc_event_timed uses a very simple memory pool based on a free list to reuse previously allocated structures.  So even when the canceled notifications are released, they won‘t be handed back to the OS (not even at the end of the simulation) but will be kept allocated for future notifications.  But they do not leak in an unintended way.

    If you change your example to e.g. have the same number of iterations without piling up billions of pending events, you should see a stable memory consumption:
    event.notify( 1, SC_NS ); event.notify( 1, SC_PS ); Hope that helps,
     Philipp
  14. Like
    maehne reacted to Eyck in Pipeline with Stalling Example   
    I'm not aware of any example so I will no be able to answer your question.
    But I do not see your problem. You would do it as it is done in hardware. Each stage is providing a ready signal indicating to the stage before that it can take inputs. And now the preceeding stage updates its outputs only if the ready signal of the next stage is active.
  15. Like
    maehne reacted to David Black in Clock Gating in SystemC?   
    Three thoughts might be helpful for you to consider:
    You could of course use next_trigger() in SC_METHOD:
    SC_MODULE(HARD_WAY) { sc_in<bool> clock, clock_enabled; SC_CTOR(HARD_WAY) { SC_METHOD(gated_method); sensitive << clock; ... } ... void gated_method(void) { if ( clock_enabled and clock.posedge() ) { // Normal operations } else { // Wait until clock is re-enabled next_trigger( not clock_enabled ); } } The better way is to use sc_process_handle::disable() and enable()
    #define SC_INCLUDE_DYNAMIC_PROCESSES #include <systemc> #include <vector> using namespace sc_core; std::vector<sc_process_handle> gated; //< collect processes needing gating SC_MODULE(EASY_WAY) { sc_in<bool> clock; SC_CTOR(EASY_WAY) { SC_METHOD(gated_method); sensitive << clock; gated.push_back(sc_get_current_process_handle()); ... } void gated_method(void) { // Normal operations } ... }; // Process controlling gating void control thread(void) { ... if ( turn_off_clock ) { for( auto& process : gated ) process.disable(); } if ( turn_on_clock ) { for( auto& process : gated ) process.enable(); } ... } Above approach works on all static SystemC process types. Dynamic processes might escape.
    A more comprehensive and easier approach could be done if your gated processes are all submodules of a containing module. In that case, you skip the registration issue, because you can simply do a hierarchical search to collect the list of processes that need to be disabled or enabled at the time of power down/up. This approach will also capture dynamic processes.
     
     
  16. Like
    maehne reacted to Eyck in E100 - port specified outside of module   
    I guess your problem stem from a particular implementation detail in SystemC: if you have an inheritance hierarchy you should declare all constructor parameters as ' my_module( sc_core::sc_module_name const& nm). For the leaf module can leave it as 'MyModule(sc_core::sc_module_name nm)'. In the second case a copy of the module name is created which manipulates the hierarchy stack of the kernel. I assume this way you srew up your design.
    It is save to always pass the sc_module_name by const reference in the constructors. This would makeup for a good rule in a modleing guideline
  17. Like
    maehne got a reaction from Nitin_S in Issue while calling sc_main multiple times from main   
    The primary reason is that the SystemC Proof-of-Concept (PoC) implementation uses some global data structures, which get constructed during elaboration, which are not fully cleaned up when sc_stop() is called. These data structures are only freed by the OS when the application quits. There have been some efforts improve the PoC implementation in this area, but these are currently stalled. Unfortunately, partially due to bad code examples, bad habits, and laziness, many SystemC models also not cleanly deallocate their dynamically allocated resources, as they still use manual resource allocation using the new operator, but never release that memory using delete as they don't implement a destructor out of laziness. Since the general availability of smart pointers in C++'11, especially std::unique_ptr<T>,  managing cleanly dynamic memory management has become much more convenient and there is no justification anymore to write such dirty code. However, there is a lot of legacy code out there making a bad example and hardware engineers often lack a formal education in C++ instead learning the language basically on the job. This will only resolve slowly over time. 
    @David Black's suggestion to launch your multiple simulations from a separate process implemented using your favourite scripting language or even in C++, is the easiest workaround for the above problems.
  18. Like
    maehne got a reaction from David Black in Issue while calling sc_main multiple times from main   
    The primary reason is that the SystemC Proof-of-Concept (PoC) implementation uses some global data structures, which get constructed during elaboration, which are not fully cleaned up when sc_stop() is called. These data structures are only freed by the OS when the application quits. There have been some efforts improve the PoC implementation in this area, but these are currently stalled. Unfortunately, partially due to bad code examples, bad habits, and laziness, many SystemC models also not cleanly deallocate their dynamically allocated resources, as they still use manual resource allocation using the new operator, but never release that memory using delete as they don't implement a destructor out of laziness. Since the general availability of smart pointers in C++'11, especially std::unique_ptr<T>,  managing cleanly dynamic memory management has become much more convenient and there is no justification anymore to write such dirty code. However, there is a lot of legacy code out there making a bad example and hardware engineers often lack a formal education in C++ instead learning the language basically on the job. This will only resolve slowly over time. 
    @David Black's suggestion to launch your multiple simulations from a separate process implemented using your favourite scripting language or even in C++, is the easiest workaround for the above problems.
  19. Thanks
    maehne got a reaction from Shashank V M in PSL in SystemC   
    I am not aware of a widely used free PSL implementation for SystemC. However, you can find some research papers discussing using PSL together with SystemC, e.g.:
     Ali Habibi, et al.: Assertion Based Verification of PSL for SystemC Designs, IEEE, 2004. Wolfgang Ecker, et al.: Implementation of a SystemC Assertion Library, Design & Reuse.
  20. Like
    maehne reacted to Lukas Steiner in Memory leak when sc_event is notified twice   
    The SystemC standard says:
    5.10.8 Multiple event notifications
    A given event shall have no more than one pending notification.
    If function notify is called for an event that already has a notification pending, only the notification
    scheduled to occur at the earliest time shall survive. The notification scheduled to occur at the later time
    shall be cancelled (or never be scheduled in the first place). An immediate notification is taken to occur
    earlier than a delta notification, and a delta notification earlier than a timed notification. This is irrespective
    of the order in which function notify is called.
    If I run the following example the simulation stops after 100000000 ps as intended, however, the memory usage of the program increases rapidly to 1GB and more. 
     
    #include <iostream> #include <systemc.h> SC_MODULE(Tester) {     sc_event event;     uint64_t counter = 0;     SC_CTOR(Tester)     {         SC_METHOD(process);         sensitive << event;     }     void process()     {         if (counter == 100000000)             sc_stop();         counter++;         event.notify(1, SC_MS);         event.notify(1, SC_PS);     } }; int sc_main(int argc, char **argv) {     Tester tester("Tester");     sc_start();     return 0; } When both event notifications are swapped the memory leak is gone. When SC_MS is replaced by SC_US, the memory usage increases a lot slower.
    The program was tested with the latest SystemC version from GitHub as well as SystemC 2.3.3 on the WSL with GCC 8 and GCC 6.
  21. Like
    maehne reacted to mo_ayman in Supporting Quickthreads for SC_THREADS on win64   
    Yes, I have actually created a post on the MinGW forum that can be found there: https://sourceforge.net/p/mingw-w64/discussion/723798/thread/7b5436a4d9/. I though got nothing.
    Your suggestion about overhauling this part of SystemC sounds really good. The only concern for me is that C++20 is pretty new and it might require users to upgrade their compilers to provide C++20 support.
  22. Like
    maehne reacted to mo_ayman in Supporting Quickthreads for SC_THREADS on win64   
    @maehne,
    First of all, I would like to thank you a lot for the kind words and the info you provided.
    So, since my post I have been digging deep into the issue and reached the following:
    The issue stems from the use of exceptions from within a Quickthread I managed to create a minimal testcase that only includes Quickthreads code and a part of an example that they provided in meas.c. You can find that attached. I came across a couple of good reads and found that: In case of SEH exceptions to be able to unwind a function unwind info must exist in the .pdata/.xdata sections of the binary I also found that GCC provides some assembly pseudos that start with .seh_ that adds the necessary unwind info for assembly functions The pseudos I am talking about are similar to those https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64?view=vs-2019#unwind-helpers-for-masm You can find the GCC ones at https://sourceware.org/legacy-ml/binutils/2009-08/msg00193.html I added those and it failed as it used to do I was able to verify that the unwind info was added for the qt_block function using dumpbin /unwindinfo  
    I really can't figure it out and I have lost hope to be honest, it has been quite a while that I have been trying to get this to work.
    But, I believe it is either a GCC issue with SEH or we're hitting some kind of a limitation and what we need to do is not achievable given the way Quickthreads messes with the stack and the way Microsoft does things and all the security_cookie_checks that happen.
    Either that or my code modifications to Quickthreads are bad, although I don't think so given that they work in call cases except for when exceptions are thrown.
    I really am in a desperate need of some help.
    sehissue.zip
  23. Like
    maehne reacted to mo_ayman in Supporting Quickthreads for SC_THREADS on win64   
    Hi all,
    So, I'll start by stating the problem. The problem is that it is not possible to use Quickthreads on 64 bit Windows.
    Basically, for sake of consistency with other platforms as well as 32 bit Windows, I need to be able to use Quickthreads as well.
     
    So, before I begin I have a question:
    What is the out of the box choice for SystemC threads on Windows platforms both 32 bit and 64 bit? As far as I understand from the configure script, WinFibers is what will be used for Windows if MinGW is being used: # use WinFiber on MinGW platforms AS_CASE([${TARGET_ARCH}], [mingw*],[QT_ARCH="none"]) Can someone please confirm this?  
    So, I recently had the discussion in this post https://forums.accellera.org/topic/5627-systemc-231-installation-problem-on-windows-7-with-cygwin.
    I became sure that the issue is coming from Quickthreads and started trying to get it to work.
    Starting from the 64 bit Linux Quickthreads source iX86_64.s, I created a new file x64.s which has the modifications necessary to fit the Windows 64 bit ABI/Calling convention.
    I mostly got it to work. I, however, faced an issue related to exception handling.
    The issue arises from the throw statements found in sc_thread_process.h which affect most of sync/async reset flows:
    case THROW_SYNC_RESET: DEBUG_MSG( DEBUG_NAME , this, "throwing reset for"); if ( m_reset_event_p ) m_reset_event_p->notify(); throw sc_unwind_exception( this, true ); ... case THROW_KILL: DEBUG_MSG( DEBUG_NAME, this, "throwing kill for"); throw sc_unwind_exception( this, false ); I am using MinGW GCC 7.4.0 with SEH exceptions. The throw statements up there end up calling RaiseException which is a Windows API that then causes the crash. I have spent days debugging that part and I was not able to figure it out.
    I need to use SEH exceptions instead of SJLJ exceptions. Reason being, that SJLJ exceptions while it works with additions in sc_cor_qt similar to those in sc_cor_fibers, side effects exist such as having an incomplete backtrace in case we're in a try block.
     
    So, I went ahead and created a commit here https://github.com/moayman/systemc/commit/e3790038752753bbbc2b0f30c064faae058ff227 that you may want to check out. A note about my commit:
    I started from SystemC 2.3.2 as I had a problem compiling 2.3.4 due to sc_mutex/sc_host_mutex  
    I would really appreciate any kind of help with this issue. We're so close to having Quickthreads support for 64 bit of Windows.
     
    Thanks a lot.
     
  24. Like
    maehne reacted to Eyck in Binding sc_out type of ports to sc_port<sc_signal_inout_if<T>,N> type of multiports failed   
    My point was more of a generic nature and more related to modeling guidelines. If your initiator/test_producer has many signals some of them might belong 'logically' together as they are written at the same time. E.g in AHB you have HADDR, HTRANS, HBURST, HWRITE, etc.
    Instead of declaring them as sc_out<sc_dt::sc_logic> xxx or alike:
    sc_out<sc_dt::sc_lv<32>> HADDR; sc_out<sc_dt::sc_lv<4>> HTRANS; sc_out<sc_dt::sc_logic> HWRITE; . . . it would make sense to do it this way:
    struct ahb_req { sc_dt::sc_lv<32> HADDR; sc_dt::sc_lv<4> HTRANS; sc_dt::sc_logic HWRITE; . . . }; sc_out<ahb_req> ahb_out; In the first case you have basically 3 signals/events to observe and deal with. In the latter one you only have 1 event.
    If you cannot refactor the the producer than doing so just for the receiver is point less. But if you have the option to refactor the initiator then I would recommend to do it in this or a similar way.
  25. Like
    maehne reacted to Eyck in Binding sc_out type of ports to sc_port<sc_signal_inout_if<T>,N> type of multiports failed   
    You cannot bind an output port to an input port. Ultimately each port must bind to a signal either hierarchically (this is where port to port binding can is used) or directly.
    So you need to define signal for each of the test_module output ports and bind the sc_out and sc_inout ports to it.
    2 remarks:
    you should use sc_in instead of sc_inout to indicate the purpose clearly sc_out is just a child of sc_inout to reduce the number of output ports (and hence signal) you might want to group signals logically belonging together into structs. Those can be used as data typs of signals and ports. This reduces the number of signals and events and increases simulation speed.
×
×
  • Create New...