Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 08/01/2020 in all areas

  1. Managed to run SystemC on new Apple M1 silicon, following are the steps 1. modify configure file, add the following code highlighted in red # check CPU architecture case ${target_cpu} in #( x86_64|amd64) : TARGET_ARCH="${TARGET_ARCH}64" CPU_ARCH="x86_64" QT_ARCH="x86_64" ;; #( x*86|i*86) : CPU_ARCH="i386" QT_ARCH="iX86" ;; #( powerpc64) : TARGET_ARCH="${TARGET_ARCH}ppc64" CPU_ARCH="ppc64" QT_ARCH="pthreads" ;; #( powerpc) : TARGET_ARCH="${TARGET_ARCH}ppc" CPU_ARCH="ppc" QT_ARCH="powerpc-apple-macosx" ;; #( arm) : TARGET_ARCH="${TARGET_ARCH}arm" CPU_ARCH="arm64" QT_ARCH="pthreads" ;; #( *) : as_fn_error $? "\"sorry...architecture not supported\"" "$LINENO" 5 ;; 2. install g++ using homebrew brew install gcc 3. setting CXX and point to the homebrew g++-11 in step 2, run configure export CXX=g++-11 ./configure 4. make all 5. make check I would like to encourage others to share their experience of porting systemC to this new mac silicon.
    2 points
  2. Thanks @William Lock, for sharing your experience of building SystemC on macOS for the Apple M1 architecture. I opened an issue on the LWG’s internal tracker to update our build scripts so that it will work out of the box in the future.
    2 points
  3. Matthias Jung

    C++20 Co-routines

    For my SystemC-Lecture, I wrote a simple DES simulator to reduce to the minimal mechanisms that are required to understand the DES concept. (https://github.com/myzinsky/des/tree/main/sw). For that I used C++20 co-routines for the 'processes'. Therefore, I was wondering if somebody has considered these co-routines also as co-routines for SystemC, instead of qt, pthreads or fibers?
    2 points
  4. Actually the usual bus protocols allow to send larger number of requests and the interconnect is allowed to answer them 'out of order' (e.g. AMBA AXI or CHI). But you are free to define you onw protocol and its own rules. The LRM states exactly how to do this. One example can be found at https://github.com/Arteris-IP/tlm2-interfaces which defines the extensions and phases for the AXI/ACE and the CHI protocol.
    2 points
  5. Hello @berry_runner, Regarding a dedicated training look here: https://www.doulos.com/training/ But as a starter in this, I would recommend getting to know following in no particular order: C++11/14/17: Useful for writing concise and clean code. SystemC from Ground Up 2nd Edition by @David Black. https://github.com/dcblack/SCFTGU_BOOK/ Look into the examples directory in SystemC sources. https://github.com/accellera-official/systemc/tree/master/examples Look into publicly released projects on Github: https://github.com/topics/systemc Follow similar discussions in this forums: If you still have queries you can post in the forum for community support. Hope this helps. Regards, Ameya Vikram Singh
    2 points
  6. Port requires a pointer towards the object containing implementations of methods specified in the interface. Export provides the very pointer that port needs. Port goes from caller towards callee. Export goes from callee towards caller. Pseudo-graphically: // +----------------------------------------------------------------------------------+ // |struct Top : sc_module { | // | | // | initiator.p1.bind( target.x1 ); | // | | // | Initiator initiator{"orgin"}; Target target{"target"}; | // | +------------------------------------+ +--------------------------------------+ | // | |struct Initiator : sc_module { | |struct Target : sc_module { | | // | | | | | | // | | sc_port<IF> p1{"p1"}; | | sc_export<IF> x1{"x1"}; | | // | | caller.p0.bind( p1 ); | | x1.bind( callee.x0 ); | | // | | | | | | // | | Caller caller{"caller"}; | | Callee callee{"callee"}; | | // | | +----------------------------+ | | +------------------------------+ | | // | | |struct Caller : sc_module { | | | |struct Callee : sc_module, IF | | | // | | | | | | | | | | // | | | sc_port<IF> p0{"p0"}; | | | | sc_export<IF> x0{"x0"}; | | | // | | | SC_THREAD(thread1); | | | | Data m_data; | | | // | | | | | | | x0.bind(*this); | | | // | | | | | | | | | | // | | | .------------------. | | | | .----------------------. | | | // | | | | void thread1() | | | | | | void xfer( data& d ) | | | | // | | | | { | | | | | | { | | | | // | | | | p0->xfer( v ); | [p0]->[p1]->[x1]->[x0] | // Save/load d | | | | // | | | | } | | | | | | auto t = d; | | | | // | | | | | | | | | | d = m_data; | | | | // | | | | | | | | | | // Transform t | | | | // | | | | | | | | | | m_data = t; | | | | // | | | | | | | | | | } | | | | // | | | '------------------' | | | | '----------------------' | | | // | | | | | | | | | | // | | |}; | | | | | | | // | | +----------------------------+ | | +------------------------------+ | | // | | | | | | // | |}; | |}; | | // | +------------------------------------+ +--------------------------------------+ | // | | // |}; | // +----------------------------------------------------------------------------------+
    2 points
  7. Your observations are correct, but it really is not a problem. Even in Verilog you cannot do differently: // Verilog/SystemVerilog module Design( input CLK, AV, RD ); always @(posedge CLK) if ( AV == 0 && RD == 1 ) begin WriteDataOut(...); end endmodule So in SystemC: #include <systemc> using namespace sc_core; //< Simplifying bad practice SC_MODULE(Design) { sc_in<bool> CLK, AV, RD SC_CTOR(Design) { SC_METHOD(main_method); sensitive << CLK.pos(); } void main_method() { if( not AV->read() && RD->read() ) { WriteDataOut(...); } } }; Event driven simulators trigger on events, not values. In case you get distracted, here is a solution that will not work despite appearances: #include <systemc> using namespace sc_core; //< Simplifying bad practice SC_MODULE(Design) { sc_in<bool> CLK, AV, RD SC_CTOR(Design) { SC_METHOD(main_method); } void main_method() { next_trigger( CLK->posedge_event() & AV->posedge_event() & RD->negedge_event()); //< not what you might think if( not AV->read() && RD->read() ) { WriteDataOut(...); } } }; The & in the next trigger means that invocation will occur when all three events have happened; however, there is no requirement on when they occur. In other words, they won't be lined up correctly.
    1 point
  8. You could use: #define SC_INCLUDE_DYNAMIC_PROCESSES #include <systemc> //... sc_signal<int, SC_MANY_WRITERS> sig; //... sc_spawn( [&](){ wait(DELAY); sig.write(VALUE); } ); See https://www.edaplayground.com/x/WjWw for an example.
    1 point
  9. Show your code please. Better: get a free account on EDAplayground.com and share your code from there.
    1 point
  10. It is not correct to bind a port to another port directly except in the case of a hierarchical connection. Furthermore, there is no such thing as an input port or an output port in SystemC. Ports are simply sophisticated pointers to channel objects that provide methods for exchanging information. Some methods are directional in nature by g to heir behavior. For instance, sc_signal<int>::write(value) deposits it’s contents into memory managed by the sc_signal<int> channel.
    1 point
  11. SystemC is a single-thread simulator and moreover not thread-safe due to various reasons. The problem you are facing is that you modify datastructures in the SystemC kernel (by calling notify() ) asyncronously since you are running it in another (OS-)thread. This might work in some case but in most cases it will not. To cut a long story short you cannot use sc_event to syncronize os-threads. But there are means to handle this case namely async_request_update(). To see an example you might check out https://stackoverflow.com/questions/49814756/async-request-update-example-in-systemc esp. the implementation of class ThreadSafeEvent. One remark: I strongly suggest to use C++11 and there std::thread since it makes your code more readable and abstracts from the underlying API. E.g. PThread is not a native Windows thread implementation rather belongs to some POSIX layer which might introduce additional issues.
    1 point
  12. Be aware that SystemC kernel is not threadsafe with exception of async_request_update(). So you must code accordingly.
    1 point
  13. maehne

    (max. 20 printed)

    You are welcome @omaima!
    1 point
  14. maehne

    (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.
    1 point
  15. 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.
    1 point
  16. 1. uvm_resource_db is a datbase which is used as basis for uvm_config_db. uvm_config_db is adding more flexibility to uvm_resource_db. 2. You should never use uvm_resource_db 3. Is obsolete because of 2.
    1 point
  17. No, you cannot run the SystemC simulator kernel as a Linux kernel module for sevberal reasons: SystemC requires quite some libraries (libc, libqt, ...) that are not available in kernel space You would taint the kernel and open up a security hole large as a gate. You would alos risk the system integrity. SystemC is simply not meant for such things. A proper design would make a distinction between (as little as possibel) code to run in kernel space providing interfaces (devices or shared memory) to interact with and a userspace application which could be the SystemC simulation e.g. running as a daemon. Even linux kernel hackers move everything into this direction... Yes, the simulation is a simple userspace process being constraint by the OS permissions. So it can use all resources a process is allowed. It can open socket connections and ports and whatever it needs. In the past I wrote some interface which allowed the SystemC simulation running on a Linux system to talk to another simulator running on a Windows host using network sockets (it also worked with UNIX domain sockets). And actually we are implementing a SystemC simulation talking to an FPGA on an accelerator card via device files. Unfortunately I'm not aware of freely available examples to do so. But if you have some C/C++ code to deal with the netlink sockets you can just embed this code into the simulator e.g. as part of a sc_module and tie it to the simulation phases (open the socket during start_of_simulation(), closing them during end_of_simulation()).
    1 point
  18. If you can avoid global variables at all cost. They will bite you more than you think. If you need to have static global variables (e.g. for loggers or memory managers) use the Meyers-SIngleton. Those will be initialized upon first use which usually gives you some control over the life cycle. Another example can be found here: https://github.com/Minres/SystemC-Components/blob/master/incl/tlm/tlm_mm.h
    1 point
  19. 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.
    1 point
  20. 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.
    1 point
  21. 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.
    1 point
  22. On a side note, you might also consider moving to SystemC 2.3.3; SystemC 2.3.1 is fairly old.
    1 point
  23. Code itself looks fine. I ran the above on EDAplayground without problem. I also ran on MacOS 10.15.7 (Catalina) with Apple clang++ 12.0 (LLVM ) Here is a link to where I ran it: https://edaplayground.com/x/V25h SystemC 2.3.3-Accellera --- Sep 21 2020 10:55:34g++ 7.5Using C++ standard 201402Ubuntu 18.04 You might consider upgrading g++ (4.8 is pretty old). I use g++ 9.3 normally.
    1 point
  24. @plafrattTLM2 is built to allow any protocols you like. The "base protocol" was deemed sufficient for most needs; however, TLM2 was designed specifically to allow alternatives. Furthermore, the standard provides mechanisms to keep the cost of adapters/bridges between protocols simulation efficient. [Plug - ignore if you like] The Doulos course on TLM 2.0 <https://www.doulos.com/training/systemc-tlm-20/systemc-modeling-using-tlm-20-online/> investigates the base protocol and then builds up to a module describing custom protocols.
    1 point
  25. Paul Floyd

    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
    1 point
  26. Have a goal. Do you want to learn the design side or verification? Either way, create some small design, then a testbench to check its operation. There are a lot of great resources out there. Sometimes you can get a simulator license by taking a course. Or use the EDA Playground. Stu Sutherland has an excellent book on design with SystemVerilog. Highly recommended! Personally, I learned a lot by writing many small examples. You can do a lot in a dozen lines. I have a directory filled with little modules, most under 20 lines. If you keep it small, you can stay focused. Once you have mastered the concept, apply it to your design and testbench. Cheers, Chris Spear Mentor Graphics
    1 point
  27. Paul Floyd

    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.
    1 point
  28. 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!
    1 point
  29. Actually you cannot use sc_core::sc_fifo for this as it takes ownership of the data which doesn't play well with the concepts of the generic payload. But there are event queues in tlm_utils for this (tlm_utils::peq_with_get and tlm_utils::peq_with_cb_and_phase).
    1 point
  30. In the constructor list you would provide a creator function. This is a functor(a function pointer, a std::function object, a Functor classinstance, a lambda function, ...) which accepts a char const* and a size_type and returns a constructed object. In your case it would look like (C++11): class example: public sc_core::sc_module { public: sc_core::sc_vector<sc_core::sc_fifo<unsigned>> fifos; example(sc_core::sc_module_name nm, unsigned outputs) : sc_core::sc_module(nm) , fifos("fifos", outputs, [](char const* name, unsigned i)->sc_core::sc_fifo<unsigned> { return new sc_core::sc_fifo<unsigned>(5000); } { // some construction code } }
    1 point
  31. Hello @Beginner_KOR, I would recommend going through details on SystemC TLM modeling using the following resources in no particular order: SystemC Standard document: IEEE 1666-2011(Must read) SystemC from Ground Up 2nd Edition by @David Black. https://github.com/dcblack/SCFTGU_BOOK/ Looking at SystemC TLM examples in the SystemC Sources: https://github.com/accellera-official/systemc/tree/master/examples/tlm SystemC TLM-2.0 examples on EDA Playground: https://www.edaplayground.com/playgrounds?searchString=&language=C%2B%2B+only&simulator=&methodologies=&_libraries=on&_svx=on&_easierUVM=on&curated=true&_curated=on For specific reference to AHB or APB Specific Implementation you could look into: https://socrocket.github.io/modeling.html#modeling6_3 Regarding the maximum compatibility for SystemC TLM models, I would recommend going with TLM-2.0 base protocols. Hope it helps. Regards, Ameya Vikram Singh
    1 point
  32. 4,770 downloads

    This file, when sourced via your .vimrc file, highlights the HDL (Verilog, SystemVerilog) and Methodology layer (UVM) keywords in the vim editor.
    1 point
  33. Let me start by observing that you probably don't want to initialize an input port. After all, inputs observe information from outside the module. So I will assume you mean an output port. If need be, you could change to use an sc_inout<T> port, but you might create a nasty race condition. The cleanest and most general approach is to write to the port during the start_of_simulation phase. How? Just create a override method, void sc_start_of_simulation(void), in your module. SC_MODULE( Example ) { sc_out<bool> oport{"oport"}; sc_signal<int> local_sig{"local_sig"}; void sc_start_of_simulation( void ) { oport->write( false ); // initialize an external signal via a port local_sig.write( 42 ); // initialize an internal signal } ... the rest of your module ... }; One other thing, I need to clear up a misconception: SystemC ports do not have a value despite the unfortunate presence of the overloaded operator=. The value that you are thinking comes from the port, actually comes from the channel it is connected to. In the case of sc_in<T> and sc_out<T>, the channels are specifically sc_signal<T>. Also, a channel itself is not data. Channels are vehicles for communication and synchronization. When you write to an sc_signal, you are depositing a value into an internal buffer, the future value buffer. When you read from an sc_signal, you are obtaining the value from another buffer, the current value. How and when the future value gets copied to the current value, is the subject of a deeper idea. For sc_signal channels, there used to be special method, init, but that is not standard. It is also the case that a constructor exists in the Proof-of-Concept implementation with a second constructor argument for initialization; however, this is also not yet standardized. So I would avoid either of these approaches.
    1 point
  34. 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.
    1 point
  35. You can use group_of_animals_c::pre_randomize to create the array to the maximum possible size (12, given your constraint) and construct each element of the array. The array may shrink during randomization to satisfy other constraints. Something like this: function void pre_randomize(); animal_da = new[12]; foreach(animal_da) begin if(animal_da == null) animal_da=new(); end endfunction Using array reduction is the right idea to constraint the sum of animal weights. You can use a "with" clause to sum the individual animal weights. Something like this: constraint total_weight { (animal_da.sum with (item.weight)) == 100; }
    1 point
  36. 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
    1 point
  37. Hello Suhyun, Yes you are right on Q1 and Q2. On Q2, you miss one zero. It should be 0x40001 rather than 0x4001. Best regards, Erwin
    1 point
  38. Basically yes but just add_attribute is not enough. From the top of my head: you need to declare in your sc_module: sc_core::sc_attribute<A*> attr{"attr", nullptr}; sc_core::sc_in<bool> pin{"pin"}; in the constructor of your sc_module you need to add the attribute to the sc_object/sc_port: pin.add_attribute(attr); via attr.value = new A(); you can assign a value. This way the attribute can be found e.g. via the SystemC object tree (sc_core::sc_get_top_level_objects() ). Alternatives depend of your goal. One option would be to use CCI, esp. cci_param. But again, it depends what you want to achieve...
    1 point
  39. Just to add 2 cents to @David Black proposal: If the instantiation is exepensive you could fork() (https://en.wikipedia.org/wiki/Fork_(system_call)) your programm after instantiating the design. Basically you create a new OS process as copy of the current one and here you can continue the simulation. But in essence it is the same approach as David described.
    1 point
  40. 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.
    1 point
  41. have a look at uvm_enum_wrapper in uvm12+. you could simply do the following (untested) class myenumwrapper#(type T) extends uvm_enum_wrapper#(T); static function bit is_inside(string x); return map.exists(x); endfunction endclass // and later myenumwrapper#(my_enum)::is_inside("alpha") /uwe
    1 point
  42. what are the major differences between sc_port and sc_export?
    1 point
  43. TLM payload is used for untyped raw data transfers. Data format is usually a property of device. Let's consider an example: Initiator is CPU model, and target is Convolution filter accelerator. Accelerator accepts a 2d matrix (2d array) of coefficients as an input. Documentation of accelerator must specify a binary format of data, for example: coefficients are stored in row-major order, each coefficient is 8-byte signed integer. Using this documentation initiator converts 2d array into a raw data of tlm payload. And device model converts raw data back into 2d array. This is how it is usually done.
    1 point
  44. sc_spawn creates same kind of processes as sC_METHOD, SC_THREAD, etc, but is not limited to the elaboration phase. Please either read the official documentation for IEEE-1666 (available as pdf free via Accellera) or get a good book on SystemC or take a class.
    1 point
  45. tymonx

    Unit testing with gtest

    You must create all necessary SystemC signals, SystemC modules and make connection between them before you run any test in gtest. This require to create own gtest_main.cc implementation. Naturally in SystemC you must put everything in sc_main() function. For this, I would use registry design pattern. First create registry class (registry + factory + singleton). This class will be responsible for storing registered constructors using dynamic allocation with new and smart pointer in lambda expression (see factory::add class). Create all objects using factory::create() method before running all tests. Then you can get object using factory::get() method in you test execution. factory.hpp #ifndef FACTORY_HPP #define FACTORY_HPP #include <map> #include <string> #include <memory> #include <functional> class factory { public: static factory& get_instance(); template<typename T, typename ...Args> class add { public: add(Args&&... args); add(const std::string& name, Args&&... args); }; template<typename T> static T* get(const std::string& name = ""); void create(); void destroy(); private: using destructor = std::function<void(void*)>; using object = std::unique_ptr<void, destructor>; using constructor = std::function<object(void)>; factory(); factory(const factory& other) = delete; factory& operator=(const factory& other) = delete; void add_object(const std::string& name, constructor create); void* get_object(const std::string& name); std::map<std::string, constructor> m_constructors; std::map<std::string, object> m_objects; }; template<typename T, typename ...Args> factory::add<T, Args...>::add(Args&&... args) { add("", args...); } template<typename T, typename ...Args> factory::add<T, Args...>::add(const std::string& name, Args&&... args) { factory::get_instance().add_object(name, [args...] () -> object { return object{ new T(std::forward<Args>(args)...), [] (void* obj) { delete static_cast<T*>(obj); } }; } ); } template<typename T> auto factory::get(const std::string& name) -> T* { return static_cast<T*>(factory::get_instance().get_object(name)); } #endif /* FACTORY_HPP */ factory.cpp #include "factory.hpp" #include <stdexcept> auto factory::get_instance() -> factory& { static factory instance{}; return instance; } factory::factory() : m_constructors{}, m_objects{} { } void factory::create() { for (const auto& item : m_constructors) { m_objects[item.first] = item.second(); } } void factory::destroy() { m_objects.clear(); } void factory::add_object(const std::string& name, constructor create) { auto it = m_constructors.find(name); if (it == m_constructors.cend()) { m_constructors[name] = create; } else { throw std::runtime_error("factory::add(): " + name + " object already exist in factory"); } } auto factory::get_object(const std::string& name) -> void* { auto it = m_objects.find(name); if (it == m_objects.cend()) { throw std::runtime_error("factory::get(): " + name + " object doesn't exist in factory"); } return it->second.get(); } Create your own version of gtest_main.cc implementation. Call factory::create() method to create all SystemC signals and SystemC modules before running any tests RUN_ALL_TESTS(). Because factory class is a singleton design pattern, call factory::destroy() method after finishing all tests to destroy all created SystemC objects. main.cpp #include "factory.hpp" #include <systemc> #include <gtest/gtest.h> int sc_main(int argc, char* argv[]) { factory::get_instance().create(); testing::InitGoogleTest(&argc, argv); int status = RUN_ALL_TESTS(); factory::get_instance().destroy(); return status; } Then define dut class in your test than will create SystemC signals and SystemC modules. In constructor do connection between created SystemC signals and modules. Register defined dut class to registry object using global constructor like this factory::add<dut> g. After than you can get your dut object using simple factory::get<dut>() method. test.cpp #include "my_module.h" #include "factory.hpp" #include <gtest/gtest.h> #include <systemc> class dut { public: sc_core::sc_clock aclk{"aclk"}; sc_core::sc_signal<bool> areset_n{"areset_n"}; sc_core::sc_signal<bool> in{"in"}; sc_core::sc_signal<bool> out{"out"}; dut() { m_dut.aclk(aclk); m_dut.areset_n(areset_n); m_dut.in(in); m_dut.out(out); } private: my_module m_dut{"my_module"}; }; static factory::add<dut> g; TEST(my_module, simple) { auto test = factory::get<dut>(); test->areset_n = 0; test->in = 0; sc_start(3, SC_NS); test->areset_n = 1; test->in = 1; sc_start(3, SC_NS); EXPECT_TRUE(test->out.read()); } For more inspiration, you can check my logic library for SystemC verification: https://github.com/tymonx/logic
    1 point
  46. Hello @katang, Here is a modified source for Bit_Adder.h which emulates the delay between component/modules: #ifndef BIT_ADDER_H_ #define BIT_ADDER_H_ #include <systemc> #include <queue> template<typename T = bool> SC_MODULE(BIT_ADDER) { public: sc_core::sc_in<T> a, b, cin; sc_core::sc_out<T> sum, cout; SC_CTOR(BIT_ADDER): a("a") , b("b") , ci("cin") , sum("sum") , cout("cout") , delay(sc_core::sc_time(2, sc_core::SC_NS)) , eqSum("eqSum") , eqCarry("eqCarry") { SC_METHOD(do_add); sensitive << a << b << cin; dont_initialize(); SC_METHOD(drive_sum); sensitive << eqSum; dont_initialize(); SC_METHOD(drive_carry); sensitive << eqCarry; dont_initialize(); } void do_add(void) { T valA = a.read(); T valB = b.read(); T valCi = cin.read(); T tmpCo = (valA & valB) | (valB & valCi) | (valA & valCi); T tmpSum = valA ^ valB ^ valCi; coq.push(tmpCo); sumq.push(tmpSum); eqSum.notify(delay); eqCarry.notify(delay); } void drive_sum(void) { T valSum = sumq.front(); sum.write(valSum); sumq.pop(); } void drive_carry(void) { T valCarry = coq.front(); cout.write(valCarry); coq.pop(); } private: sc_core::sc_time delay; sc_core::sc_event_queue eqSum; sc_core::sc_event_queue eqCarry; std::queue<T> sumq; std::queue<T> coq; }; // BIT_ADDER #endif // BIT_ADDER_H_ This should be drop-in replacement for your module. One thing you will have to change is the declaration where it would change something from: BIT_ADDER bitAdder to: BIT_ADDER<sc_logic> bitAdder Let us know if you need further clarification on how the module behavior is modeled. Regards, Ameya Vikram Singh
    1 point
  47. Than you have a typo in another place: class target : public sc_module { public: sc_export<sc_signal_in_if<bool> > in; ---- > Change to sc_export<sc_signal_inout_if<bool> > in; sc_signal<bool> sig; target(sc_module_name name){in(sig);} }; The problem is that you try to bind port and export with different interfaces
    1 point
  48. this sounds like a bug. normally the sequence and/or items do know on which sequencer they run on *or should run on". there are a few situations where that in of is/was missing. a recent issue i remember was one where when an item was sent to a low level bfm sequencer from a virtual sequence running on a null sequencer then the sequencer info was wrong leading to similar fails.. /uwe
    1 point
  49. A1: You can start your simulation with the +UVM_CONFIG_DB_TRACE plusarg to see messages for set(...)/get(...) in the log file. A2: You can have both use models. You can either tell the sequencer to start a sequence of a certain type by providing a type wrapper (like you did and the sequencer will instantiate it itself) or you can directly provide an instantiated sequence which you randomized/configured to your heart's desire (and the sequencer will start it). If you run your simulation with UVM_FULL (at least on the sequencer) you should see a message saying that it started the phase sequence and what type of sequence. A3: This error comes from start_item(...) when it can't figure out on which sequencer to start it. If you aren't starting any sequences yourself, the seq name there for the sequence probably comes from the phase sequence which is getting started. I assume you have some problems with your register model configuration (something like a sequencer not being set for the register map). Also, these built in register sequences need a register or a register block to know what to access. I don't see how you can pass the phase sequence a reference to either on of these without creating an instance first, setting the register field and only then setting it as a phase sequence.
    1 point
  50. Hi Amit, I didn't say "Concept of multiple interfaces in sc_export is a benefit of sc_export over sc_port". I said "You have to parameterize the export by the interface. So if you have two interfaces, and you want them to be exported by a single export, you'd have to create a derived class." You can do that with sc_port as well (i.e. use a single derived class interface that is derived from another set of interface classes) - see the code for sc_inout, for instance, regards Alan
    1 point
×
×
  • Create New...