Jump to content

Philipp A Hartmann

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Philipp A Hartmann

  1. Because current C++ features makes it possible to implement SC_THREAD etc. without the SC_HAS_PROCESS helper macro .
  2. In IEEE 1666-2023 (i.e. SystemC 3.0), you can just skip SC_HAS_PROCESS entirely, the SC_THREAD, SC_METHOD macros no longer require it.
  3. I would think that 7.3 only applies to the conversion to a SystemC datatype. If the literal would be smaller than the target type, the sign extension applies, quoting the very next sentence from the section you quoted: ... unless you omit the prefix: In your example, you pass in a literal with the matching length of the destination type and there should not be any extension anyway.
  4. The corresponding clause in 1666-2011 is 7.2.9 Integer conversion, quoting from there: I would read this as: logic vectors shall not be sign-extended.
  5. In PIM.h:38, you are not defining a port, but a literal sc_bv value. sc_bv<2*N> sY{"sY_PIM"}; So the debugger could have helped you eventually. 😉
  6. Keeping declarations in their smallest required scope is generally a good practice in C++. To me, this applies to SC_HAS_PROCESS as well, which currently is a typedef underneath. I agree, that a repetition in multiple constructors (or before_end_of_ekaboration()) is not a big concern.
  7. Actually, SC_HAS_PROCESS will no longer be needed at all in future versions of SystemC when using C++11 (and maybe the next standard?).
  8. I don't think there's such a way without changing the SystemC library? You can certainly change the aforementioned part to raise a warning/error instead, when calling sc_sensitive for SC_CTHREAD with an event finder during sc_get_status() == SC_END_OF_ELABORATION.
  9. I would assume, it's an oversight as it is currently not supported by the IEEE 1666-2011 standard. You can likely "fix" it by changing line 248 in src/sysc/kernel/sc_sensitivity.cpp: void sc_sensitive::make_static_sensitivity( sc_process_b* handle_, sc_event_finder& event_finder_) { if (sc_is_running() || event_finder_.port().get_interface()) { // line 248, check for already bound port handle_->add_static_event( event_finder_.find_event() ); } else { Greetings from Linz, Philipp
  10. A better solution is to compile for C++11 (or later) instead, where sem_* APIs are not required.
  11. The event is triggered() between the wait(1, SC_NS) and the following wait(..., e). Therefore, you will always run into the "timeout". You can probably validate this, by adding another e.triggered() check between the two wait() calls.
  12. This is not really a memory leak, but a very bad „model“ for the current implementation. I wonder if you saw any such scenario in a real model? „Canceled“ notifications like in your case will still be kept in the kernel‘s internal data structures until the notification time is reached (1ms in your case). You would pile up 999,999,999 of these canceled notifications until they are „deallocated“, each of them taking entries in the event queue and 16 bytes for the notification itself. Which is a lot of memory. I wrote „deallocated“ in quotes, because sc_event_timed uses a very simple memory pool based on a free list to reuse previously allocated structures. So even when the canceled notifications are released, they won‘t be handed back to the OS (not even at the end of the simulation) but will be kept allocated for future notifications. But they do not leak in an unintended way. If you change your example to e.g. have the same number of iterations without piling up billions of pending events, you should see a stable memory consumption: event.notify( 1, SC_NS ); event.notify( 1, SC_PS ); Hope that helps, Philipp
  13. Make sure to include /vmg in your project's compiler settings, see https://github.com/accellera-official/systemc/blob/master/INSTALL.md#creating-systemc-applications
  14. From the code itself, it's not obvious to me, where the unexpected overload of sc_core::wait(int) is called. Can you try attaching a debugger and break on the exception (catch throw in gdb) and check from the backtrace, where from the exception is thrown?
  15. I suggest to move to SystemC 2.3.3, if possible. (The error message indicates, that you seem to be using SystemC 2.3.1). Secondly, can you show the derived class of the fifo as well (including its constructor)?
  16. Which compiler/platform are you using? If you are on MSVC, make sure to include /vmg in your compiler settings as described in the INSTALL file. Hope that helps, Philipp
  17. On MinGW, you would be supposed to use the Windows Fiber-based implementation, e.g. when using the Automake-based build. Maybe the CMake setup for SystemC fails to select this correctly for this compiler?
  18. Looking at the source code of any SystemC implementation is sometimes misleading. Check IEEE 1666-2011, Annex C (deprecated features), item (n):
  19. ... and sc_method_process is a non-standard class, which even is incomplete on the model side when including <systemc(.h)>. So I would not call this clean. Regarding your original solution, it is important to note that you are not supposed to change an sc_event_list object while processes are sensitive to it. In your case, it works because you trigger the process immediately, which then 're-reads' the event list right away and therefore updates the sensitivity without breaking the kernel state What do you want to achieve that makes you want to do this? /Philipp
  20. Valgrind does not play well with the Quickthreads package used for the SystemC threads by default. As Torsten said, please try with SystemC 2.3.3 and configure your SystemC library build with --enable-pthreads to switch to the posix-based thread implementation, see https://github.com/accellera-official/systemc/blob/master/INSTALL.md.
  21. You can check the commit history of the file in the public GitHub repository. The chain of relevant changes are: b276fd3b ff4581f1 41ae779d Here are related discussions from the forum: Hope that helps, Philipp
  22. The only normative reference for SystemC is defined by the IEEE Std. 1666-2011, see http://ieeexplore.ieee.org/document/6134619/. The is_reset() was never part any version of the standard, so one could never rely on its presence. You would to check, why the ReChannel library tries to call this function and then find another way to implement this functionality. /Philipp
  23. Actually, it is expected that you don't have the QuickThreads package built on MinGW. As you can see from your config.log, the threading package to use is But it seems that the source code is missing an explicit check for _WIN64 to catch the MinGW-64 case. Can you try compiling with WIN64 defined (without leading underscore): ../configure CXXFLAGS="-DWIN64" Hope that helps, Philipp
  24. This compiler warning is a false positive. There is a loop in sc_fifo<T>::read(T&) ensuring that the fifo is not empty (and the success of the nb_read(T&) is even guarded by an sc_assert😞 while( num_available() == 0 ) { sc_core::wait( m_data_written_event ); } bool read_success = sc_fifo<T>::nb_read(val_); sc_assert( read_success ); The check for num_available() is even stricter than the check in buf_read, but I can imagine that some compilers might not be able to prove this invariant. Therefore, unconditionally initializing the local variable to silence the warning might be an acceptable trade-off.
  • Create New...