Jump to content

sumit_tuwien

Members
  • Content Count

    112
  • Joined

  • Last visited

  • Days Won

    5

Reputation Activity

  1. Like
    sumit_tuwien reacted to maehne in Static Analyzer Report of SystemC-2.3.2   
    Thanks Sumit for reporting these issues! I have reported them to the Language Working Group so that we can try to fix them in the proof-of-concept implementation.
    Regards, Torsten
  2. Like
    sumit_tuwien reacted to Eyck in C++ class object bringing into systemC Hierarchy   
    Hi Aarthi,
    if you just need to get the currently active module when hitting a breakpoint in you C++ code you might use the following command (assuming you use gdb):
    x sc_core::sc_get_current_process_b()->get_parent()->name() (see also here: https://stackoverflow.com/questions/18078226/how-to-get-sc-module-name-of-the-current-running-module#18123785)
    What it does is it calles the SystemC kernel function sc_get_current_process_b() which returns a pointer to sc_process_b (the base class of of sc_method_process and sc_thread_process). Inheriting from sc_obejt it also has a name() method so you could also do
    x sc_core::sc_get_current_process_b()->name() which just returns the full hierarchical name of the process.
    HTH
    -Eyck
  3. Confused
    sumit_tuwien reacted to lucas1 in Communicate between a module and its submodules   
    I'm really new to SystemC and I've recently started developing a learning program where I need to comunicate between a module that has sub-modules created inside it.  The pseudo-code looks something like this:
     
    module rec { std::vector<sender *> vc; constructor(rec) { SC_THREAD(main); } main() { do_some_stuff(); wait(sender_event); do_more_stuff(); } } module sender { [...] }  
    What would be the best and simplest way to communicate between the two of them? Can I use events?
     
    Thanks in advance, Lucas
  4. Like
    sumit_tuwien reacted to Eyck in Non Constructible but Copyable !   
    Hi Sumit,
    Quoting http://en.cppreference.com:
     
    Some member functions are special: under certain circumstances they are defined by the compiler even if not defined by the user. They are:
    Default constructor Copy constructor Move constructor (since C++11) Copy assignment operator Move assignment operator (since C++11) Destructor  
    So in the code you show you just delete the default constructor and the destructor. Obviously this does not make sense as you cannot construct any object since you do not have a parameterized constructor. But if you have one this declaration makes sense: the user of this class cannot create a default object, he has to provide some parameters. Deleting the destructor prohibits the creation of an object on the stack, you can only create them on the heap (and never release the memory except you use placement new on a pre-allocated area).
    But the the standard comittee has a special section on this in the C++ core Guidelines: C.21: If you define or =delete any default operation, define or =delete them all
    BTW, if you inherit from a class having a deleted destructor the destructor of the child is also deleted
    HTH
    -Eyck
  5. Like
    sumit_tuwien got a reaction from maehne in Static Analyzer Report of SystemC-2.3.2   
    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
     
  6. Like
    sumit_tuwien got a reaction from David Black in Static Analyzer Report of SystemC-2.3.2   
    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
     
  7. Like
    sumit_tuwien reacted to Philipp A Hartmann in systemc-2.3.2 with C++17   
    For example, the missing operator delete was added in C++14 only (quoting from http://en.cppreference.com/w/cpp/memory/new/operator_delete) :
    void operator delete  ( void* ptr, std::size_t sz ); (5) (since C++14) void operator delete[]( void* ptr, std::size_t sz ); (6) (since C++14)
  8. Like
    sumit_tuwien reacted to Philipp A Hartmann in systemc-2.3.2 with C++17   
    Yes. Most likely, because your clang-7 installation uses an incompatible C++ standard library.
    /Philipp
  9. Like
    sumit_tuwien reacted to maehne in systemc-2.3.2 with C++17   
    Hello Sumit,
    for compiling SystemC using CMake for C++'17, you will have to specify the C++ language standard version through the variable CMAKE_CXX_STANDARD. The value "17" is only supported since CMake 3.8. If you are still using an older version, this might explain your compilation problems. Enable verbose output for your build system to check which flags are effectively passed to your compiler. Passing the C++ standard version via the "-std=c++17" compiler switch ist more fragile when using CMake, as the latter might add conflicting additional flags.
    Regards,
    Torsten
  10. Like
    sumit_tuwien reacted to apfitch in Weird SystemC Context   
    The error message implies that you are calling wait() in your SC_METHOD - that's not allowed, wait() can only be called in SC_THREADS,
     
    regards
    Alan
  11. Like
    sumit_tuwien reacted to maehne in SystemC with noexcept (c++11)   
    Hello Sumit,
      my advice would be to not mark member functions as noexcept that contain calls to SystemC functions or a library that does throw. Otherwise, any uncaught exception leaving the context of the function noexcept-declared will yield a call to std::terminate(). Yes, annotating functions with noexcept may enable the compiler to do additional optimization. However, many modern compilers already generate code, which doesn't has a performance penalty in the path where no exception occurs. In case an exception occurs, you won't care about the performance penalty caused by the occuring stack unwinding. However, you do usually care about being able to deal with exceptions in places, where you have enough knowledge to properly deal with problem. This is not necessarily in the function you declared noexcept. So, in many cases you probably won't gain much by declaring your member functions noexcept.   Still, there are certain places, where declaring functions as noexcept promises more advantages: in particular, move operations, swap, memory deallocation functions, and destructors. This is explained in much more detail in Item 14 of Scott Meyer's book "Effective Modern C++".   The SystemC standard still is based on C++'03 and so is the proof-of-concept implementation provided by Accellera. It will require considerable work to move SystemC to actively use C++'11/14/17 features. The topic is on the agenda of the Language Working Group, as the discussion regarding this topic showed during the SystemC Evolution Day in Munich in May. Contributions through participation in the respective working groups are certainly welcome.   Finally, to give you some more solid information regarding best practices for using noexcept, I would like to point you to: Scott Meyers "Effective Modern C++", Item 14 "Declare functions noexcept if they won't emit exceptions.", O'Reilly, 2015. Bjarne Stroustrup: "C++'11 FAQ: noexcept -- preventing exception propagation", 2015. Andrzej Krzemieński: "noexcept — what for?", Andrzej's C++ blog, 2014-04-24. Andrzej Krzemieński: "Using noexcept", Andrzej's C++ blog, 2011-06-10. Best regards,   Torsten Maehne
  12. Like
    sumit_tuwien reacted to Andreas in TSSim - Simulation framework for MPEG or DVB transport streams   
    Hey there
     
    We've developed a small simulation framework using SystemC to allow
    simulation of MPEG or DVB transport stream decoding.
    It is able to simulate the complete chain: receive -> demultiplex ->
    decode -> display (both for audio and/or video) and can be used to
    e.g. simulate behaviour based on bitrate or buffering behaviour etc.

    We decided to publish the framework and a basic 'ideal' pipeline
    (ideal as per MPEG-2 specs) as Open Source under the MIT license.

    You can find the framework in our GitHub repository:
    https://github.com/Digisoft-tv/TSSim

    Any feedback welcome!
     
    Andreas
  13. Like
    sumit_tuwien got a reaction from maehne in Any method of stopping simulation without sc_start(time) and sc_stop   
    Hi Biplab,
     
    Please consider using sc_core::sc_stop() from the place where you want to stop the simulation. 
     
    Regards,
    Sumit
  14. Like
    sumit_tuwien reacted to ralph.goergen in Naming of ports which inherits sc_signal/in/outs   
    Hi, 
     
    not sure if this is what you are searching for but how about the following:
    template < typename T > class my_sig_type : public sc_core::sc_signal<T> { typedef sc_core::sc_signal<inner_type> base_type; my_sig_type(const char * name) : base_type(name) {} }; Greetings
    Ralph
  15. Like
    sumit_tuwien reacted to ralph.goergen in Passing maps within Constructors in SystemC struct   
    Why are you using C arrays? How about vector or map?
     
    e.g.:
    std::vector< std::vector< uint64_t > >
     
    What do you mean with 'simulation stops'?
    Did the simulation end? Is there any error message?
     
    The code posted above does not show any processes. Maybe you can post a bit more (minimum working example)?
     
    Greetings
    Ralph
  16. Like
    sumit_tuwien reacted to puneet in Should UVM Analysis Interface write const objects   
    Not quite. The example in 13.5.2 applies only to arrays. Arrays in SV are value objects (do not exhibit pointer-semantics as in C/C++). So when we make an array const, the const applies to array members as well.
     
    13.5.2 has to be read along with section 6.20.6 which states:
     
     
    So, clearly const does not propagate to the object members. The example you provided on EDA Playground seems like a tool bug. The example compiles and runs fine when we select modelsim 10.1d on EDA Playground.
     
    BTW, what the OP posted is a long standing issue http://verificationguild.com/modules.php?name=Forums&file=viewtopic&t=1490
  17. Like
    sumit_tuwien reacted to ralph.goergen in Segmentation fault with signal write   
    Hi,
     
    a problem in your design is that you write to one signal from more than one process (multiple writers).
    This is not allowed in the default sc_signal.
     
    If you want to allow this, you can use the second template parameter of sc_signal to set the writer policy:
    sc_signal<in, SC_MANY_WRITERS> But you should be carefull with this. Multiple writers can lead to a number of problems and non-deterministec behaviour of the system.
     
    The fact that SystemC runs into a segmentation fault instead of giving an error message seems to be a bug in SystemC.
     
    Greetings
    Ralph
  18. Like
    sumit_tuwien reacted to maehne in Derivative using ELN constructs   
    Implementing purely derivative behavior is numerically problematic as the time-derivative of a signal at a certain point of time depends also on the future evolution of the signal. So, the best you can get is an approximation based on the past solution points. This alone may already explain your observation of "very strange values, ranging from 0 to  -1.59561833143e+47". However, in addition, you have neglected that your stimuli signal is not continuous, but changing discretely: you provide it via a DE signal, which gets sampled with a time step that is equal to the time step that you assigned to the ELN circuit or connected TDF cluster.
     
    I agree, using an sca_lsf::sca_dot primitive may be the more straightforward way to implement derivative behavior. However, you will probably encounter the same problems. For good convergence, both, ELN and LSF models, require more constraints in form of other primitives (like the resistor suggested by Sumit) to "slow down" the reaction of the system.
     
    Therefore, also implementing the derivative as an LTF equation G(s) = s in the context of a TDF module is usually not working well. In that case calculating the difference quotient m = (current_val - last_val) / t_step may provide you with a first approximation for the derivative. However, be a aware that this works best for smooth continuous signals. Any noise present on the signal will get considerably amplified.
  19. Like
    sumit_tuwien reacted to Philipp A Hartmann in Using TLM2 but not generic payload   
    Yes, it is possible to use your own payload types.  But you don't pass it at the first template parameter to the socket.  The first parameter is the BUSWIDTH, which is an integer.  Therefore, you get the error about not being allowed to pass a type there.  Instead, you need to define your own "protocol traits" and use this instead of tlm::tlm_base_protocol_types:
    struct my_protocol_types { typedef my_item tlm_payload_type; typedef tlm::tlm_phase tlm_phase_type; }; // ... tlm::tlm_target_socket<32,my_protocol_types> inp_sock; Greetings from Oldenburg,
      Philipp
  20. Like
    sumit_tuwien reacted to apfitch in error: ‘process’ is not a member of ‘host_cntrl::SC_CURRENT_USER_MODULE’   
    Or you are *not* using SC_CTOR, you've declared an SC_THREAD, and you've forgotten SC_HAS_PROCESS ?
     
    Alan
     
    P.S. As Philipp says, the code would help :-)
  21. Like
    sumit_tuwien reacted to maehne in Analog data formats used   
    Hello Thomas,
     
    Nice to hear about this evolution of features in Impulse! We are using this plugin more and more at LIP6, e.g., in SystemC trainings, where the attendees do their exercises in an Eclipse IDE. I will give the new features a try in the coming days and will provide feedback if necessary.
     
    Cheers, Torsten
  22. Like
    sumit_tuwien reacted to thomas.haber in Analog data formats used   
    Hi Torsten,
     
    Markers are now available.
    So you can add to any signal an annotation, a task or bookmark.
    If you use an annotation, the text will contain the actual value.
     
    cheers,
    thomas
  23. Like
    sumit_tuwien reacted to Philipp A Hartmann in How SC_FORK and SC_JOIN implemented ?   
    Quoting from IEEE 1666-2011, 5.5.7 (emphasis mine):
     
    Since you don't fork anything, on what do you want to join?
     
    /Philipp
  24. Like
    sumit_tuwien got a reaction from amitk3553 in Type casting and concatenation   
    Ralph, how about: 

     

    int8_t lsb;

    int16_t msb_16 = msb ;

     

    int16_t result = ( msb_16 << 8) | lsb;

     

    Greetings

    Sumit

  25. Like
    sumit_tuwien got a reaction from amitk3553 in array inside class   
    in gcc -std=c++11 option will enable it
×
×
  • Create New...