Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by sumit_tuwien

  1. Thanks @Bas Arts , Thanks for checking. Seems either the compiler or the system has some issues. Regards, Sumit
  2. Hi @David Black, Following is the reduced version of the class: # ifndef BLAH_H_ # define BLAH_H_ class Blah final : sc_core::sc_module { private : double ThisOneWillAlsoNotLetWrite { 0.0 } ; public : sc_core::sc_signal < double > IWillNotLetYouWrite { "IWillNotLetYouWrite" } ; SC_HAS_PROCESS (Blah) ; explicit Blah(const sc_core::sc_module_name& ModuleName_) : sc_core::sc_module { ModuleName_ } {} ~Blah() final = default ; Blah& operator=(const Blah& other) = delete ; Blah(const Blah& other) = delete ; Blah operator=(Blah&& other) = delete ; Blah(Blah&& other) = delete ; void LetsWrite() { IWillNotLetYouWrite.write(1.0); } void ThisOneFailsToo() { ThisOneWillAlsoNotLetWrite = 1.0 ; } }; # endif ~ # Yes, -Wall -Wextra was turned ON. --std=c++14. # SystemC version : 2.3.3 # Compiler gcc-9.3.0 Regards, Sumit
  3. Possibly not. It even cannot write a simple double public member variable.
  4. Hello All, I have a module, which have a public member function which when called will write some values in a signal declared within the module. I can write into the signal from within the module. But if I try to access member function from outside the module instance, I get a crash. When I am trying to debug it, I find the following message: Program received signal SIGSEGV, Segmentation fault. t0x00000000080869c6 in sc_core::sc_signal_t<double, (sc_core::sc_writer_policy)0>::write (this=0xe8, value_=@0x7ffffea1ff00: 1) at /blah/systemc-2.3.3/include/sysc/communication/sc_signal.h:292 292 bool value_changed = !( m_new_val == value_ ); I am using gcc-9.3.0. Any help will be appreciated. Regards, Sumit
  5. Hello, Is gcc 9.3.0 a version for which SystemC library has been tested? Regards, Sumit
  6. I guess SC_USE_PTHREADS needs to be defined. Regards, Sumit
  7. Hi @AmeyaVS I am not building it, rather including these in my code base. Do you have any idea how to do in this case ? Regards, Sumit
  8. Hello! If I import the SystemC library into my codebase instead of compiling it separately, then, is there any compiler define or switch I can turn on to use pthreads ? Regards, Sumit
  9. Your simulation was stuck because it was not proceeding with time ...
  10. valgrind can be used as a profiler here. the tool is callgrind. kcachegrind comes with kde is a nice viewer.
  11. Hello, Please use -fdelayed-template-parsing to bypass this bug for the time being. Regards, Sumit
  12. Hello Philipp, Would it be possible to bypass the bug by explicitly deleting the destructor [public : ~mclass() = delete;] if the the chosen c++ standard is at or above c++11 ? It started hurting now. Regards, Sumit
  13. Hello All, Using get_chil d_objects() I can traverse through hierarchy and can find any ports & instances But I cannot find how these ports are connected. All what I want to do is to create a database which I can use for visualization by post processing. Is there any way to do this ? Regards, Sumit
  14. Hello Eyck, This is an amazing pointer. I see I have created a lot of confusions by vaguely putting some code and not mentioning the intent. I will never construct this object. All I am interested is accessing const uint8_t duh { 5 } ; const uint16_t notEgal { Moeglich::Egal(duh) } ; Here is what is important for me: Sometimes, I need partial template specialization of functions which is not allowed which can be enabled if I put this function inside a template class. Your link, very clearly lays down the rule. My expectation from the compiler was wrong and my use-case cannot be understood in a special way by the compiler. Meanwhile, I also asked help from stackoverflow.com in here (I generally do not do that, because they are champions in downvoting questions). You can see how many confusing and different answers from people. Please note:: Since I always explicitly mention all 6 special member functions, it was fine. This was accidentally found when in one place I missed 4 of them and started wondering. Glad that I did that mistake, which enabled me to learn something and correct some mistakes in my understanding. Thanks for the great help. Regards, Sumit
  15. Hello David, Yes, but please note that I already applied final keyword at the end of the class and hence this class cannot be derived from. Regards, Sumit
  16. Hello All, I found out this issue while I was playing with some SystemC stuffs (During meta-programming). This is a C++ question which I separated out from the SystemC implementation. I could have gone to pure C++ forum but since I use this forum, I believe if I ask here people will be benefited more. I observed that if I explicitly delete only constructor and destructor of a class then the resultant implementation deletes copy constructor & move constructor, but the compiler still makes copy assignment and move assignment operators implicitly available! Which in turn makes assignment possible! My question is what is the rational of this? What is the use case where this can be used. Following is an example code for reference: # ifndef MOEGLICH_H_ # define MOEGLICH_H_ # include <cstdint> class Moeglich final { public : explicit Moeglich() = delete ; ~Moeglich() = delete ; /* // With explicit deletion Moeglich& operator=(const Moeglich& other) = delete ; Moeglich(const Moeglich& other) = delete ; Moeglich&& operator=(Moeglich&& other) = delete ; Moeglich(Moeglich&& other) = delete ; */ static constexpr uint16_t Egal(const uint8_t& var_) noexcept { return static_cast< uint16_t > ( var_ ) ; } }; # endif # include <cstdlib> # include <iostream> # include <type_traits> int main(int argc, char* argv[]) { std::cout << std::boolalpha << "Is constructible : " << std::is_constructible<Moeglich>::value << std::endl << "Is destructible : " << std::is_destructible<Moeglich>::value << std::endl << "Is copy constructible : " << std::is_copy_constructible<Moeglich>::value << std::endl << "Is move constructible : " << std::is_move_constructible<Moeglich>::value << std::endl << "Is copy assignable : " << std::is_copy_assignable<Moeglich>::value << std::endl << "Is move assignable : " << std::is_move_assignable<Moeglich>::value << std::endl << "Is assignable : " << std::is_assignable<Moeglich, Moeglich>::value << std::endl ; /* Following were what I wanted to bar anyway : const Moeglich mom {} ; Moeglich pop {} ; Moeglich foo {} ; foo = mom ; foo = std::move(pop) ; */ return EXIT_SUCCESS ; } Regards, Sumit
  17. Hello Eyck, If I can imagine an use case for this, it will be storing state of state machines or some enumerated values. If this is true, then storing numerical integral values will be sufficient and in the viewer, they can be mapped to respective ASCII values. If what I can imagine is correct use case, then this solution is better. Regards, Sumit
  18. Hello Anthony, I do not have any idea about CRAVE. SCV is alive and kicking. They even have released a recent version and cleaned up global namespace corruption issues. The version number is 2.0.1. We are using it under some limitation. Use scv and open the profiler and you can see how it behaves. it is extremely slow and heavy too (should not be a surprize). And hence we are using it in situations when we we need constrained randomization only. For every other case, I would suggest you to write a convenience class over c++11 random numbers - which is very clean way. Regards, Sumit Edit: Verification working group is working towards a new release, but till then please use scv-2.0.1 along with you own random helper classes for simple random numbers. Also, you might want to see this library http://randomlib.sourceforge.net/html/ meanwhile. I gave a thought about it, but I finally decided to use c++11 random numbers.
  19. Hello, I think vcd will not let you save a string (?). I am not sure if it will work, but can use string to integer conversion and save them in vcd file. And in your viewer (if there is a way, Cadence simvision has a way) you can convert these signal to ASCI. You can write to_string() which will do this job on your own. Regards, Sumit
  20. Hello All, I ran static analysis on latest SystemC library [For Fun]. clang-tidy report looks fine (I gave a very fast look). clang++ --analyze produced followed warnings which I want to point out: warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats In file included from ../src/sysc/datatypes/int/sc_int_base.cpp:66: ../src/sysc/datatypes/int/sc_int_base.h:574:22: warning: The result of the left shift is undefined because the left operand is negative m_val = ( m_val << m_ulen >> m_ulen ); ~~~~~~^~~~~~~~~ 1 warning generated. ../src/sysc/utils/sc_mempool.cpp:252:59: warning: Division by zero int which_allocator = cell_size_to_allocator[(sz - 1) / increment + 1]; ~~~~~~~~~^~~~~~~~~~~ 1 warning generated. warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats ../src/sysc/utils/sc_string.cpp:181:19: warning: Use of memory after it is freed return strlen(rep->str); ^~~~~~~~ ../src/sysc/utils/sc_string.cpp:242:9: warning: Use of memory after it is freed if (--(rep->ref_count) == 0) ^~~~~~~~~~~~~~~~~~ ../src/sysc/utils/sc_string.cpp:357:9: warning: Use of memory after it is freed if (rep->ref_count > 1) { ^~~~~~~~~~~~~~ 3 warnings generated. warning: Path diagnostic report is not generated. Current output format does not support diagnostics that cross file boundaries. Refer to --analyzer-output for valid output formats In file included from ../src/sysc/kernel/sc_simcontext.cpp:32: In file included from ../src/sysc/kernel/sc_simcontext_int.h:37: ../src/sysc/kernel/sc_runnable_int.h:464:18: warning: Called C++ object pointer is null m_methods_pop = m_methods_push_head->next_runnable(); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Even if these will not pose a problem for running simulations, I will get my sanitizer and other tools irked out. Following is the script if anybody want to try. set x = `find ../src -name "*.cpp"` foreach item ($x) /home/sumit/local/clang/bin/clang-tidy \ -checks='*' \ `echo ${item}` \ -extra-arg=-std=c++17 -- -I ../src end /home/sumit/local/clang/bin/clang++ --analyze -std=c++17 -I ../src \ `echo $x` Please let me know, if there is further questions. Regards, Sumit
  21. Hello Philip, Thanks for the pointer. I took special care during clang installation so that this does not happen. And looks like it happened. I will re install it again. Thanks a lot for the pointer - I was pretty sure this was not happening. Regards, Sumit
  22. Hello Philip, Adding some more info (All for c++17). For SystemC-2.3.2 lib compiled with gcc-6.2 and user code compiled with gcc-6.2 : Works lib compiled with clang-7 and user code compiled with clang-7 : Works lib compiled with gcc-6.2 and user code compiled with clang-7 : Fails during linking Question: Does it point some issue with my compilers ? Regards, Sumit
  23. Hello Philip, I confirm that the my clang-7 links with other libraries I built with gcc4.8.1. I just used my old systemc-2.3.1 (built with gcc-4.8.1) and it worked. Regards, Sumit
  24. Hello Philip, On :"can you please share some details on your remark that "it does not compile with -std=c++17"? For me, the SystemC 2.3.2 library and examples compile and run fine with GCC 6.3 and -std=c++17 (no 6.2 installation at hand here)." When I try to compile the library using /home/sumit/local/cmake/cmake-3.11.3-Linux-x86_64/bin/cmake ../ -DCMAKE_INSTALL_PREFIX:PATH=/home/sumit/systemc-2.3.2_cxx17 -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_EXTENSIONS=OFF the build automatically chooses -std=gnu++1z instead of -std=c++17. On "Your linker errors look like you're missing the (matching) C++ runtime libraries in your linker call. Do you configure clang to use libc++ instead of libstdc++? " Answer is no. On "Can you link any other C++ library built with GCC 6.2 to an application built with Clang 7? I would expect that this issue is not specific to SystemC and I would recommend to stick to a single compiler for all artifacts in your application, including SystemC." My understanding was, if we build a library in gcc the we cab use in clang. It has been some years we write portable code which we compile using gcc, clang and with EDA vendors of our choice. We generally compile our libraries (and they are quite a lot in number) using gcc so that we do not get any unsuspecting issues with EDA tools as they use gcc. using gcc/clang is a choice of the developer and EDA tools are used during ASIC developments mainly. We use clang tools especially clang static analysis capability here a lot. Till now with systemc-2.3.1 everything was fine. I am just trying to access how much it will make an impact - or can make in future. Regards, Sumit
  • Create New...