Jump to content

Allen yang

Members
  • Posts

    22
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Allen yang reacted to DavidA in How to fix 'undefined reference to ... SC_DISABLE_VIRTUAL_BIND_UNDEFINED_'?   
    I am using a static library. Here is the output:


    $ nm -C /data/daldrich/systemc-2.3.3/systemc-2.3.3/build/systemc-2.3.3-install/lib64/libsystemc.a | grep
    sc_api_version
    0000000000000690 T sc_core::sc_api_version_2_3_3_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201103L(sc
    _core::sc_writer_policy)
    0000000000000690 T sc_core::sc_api_version_2_3_3_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201103L(sc
    _core::sc_writer_policy)
    0000000000000030 b sc_core::sc_api_version_2_3_3_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201103L(sc
    _core::sc_writer_policy)::default_writer_policy_config
    0000000000000040 b sc_core::sc_api_version_2_3_3_cxx201103L<&sc_core::SC_DISABLE_VIRTUAL_BIND_UNDEFINED_>::sc_api_version_2_3_3_cxx201103L(sc
    _core::sc_writer_policy)::default_writer_policy_config_seen
  2. Like
    Allen yang reacted to AmeyaVS in Why vector use at function can't caught exception in SC?   
    Hello @Allen yang,
    You could try removing the catch all block itself, so that the exceptions is thrown from the sc_main method.
    Regards,
    Ameya Vikram Singh
  3. Like
    Allen yang reacted to AmeyaVS in Why vector use at function can't caught exception in SC?   
    Hello @Allen yang,
    It is because sc_main is called within a context of a try catch block.
    See this:
    https://github.com/accellera-official/systemc/blob/bec101067d808f93bf215031dff6fa9ab7035995/src/sysc/kernel/sc_main_main.cpp#L66-L108\
    Captured the snippet from the implementation and reproduced below.
    try { pln(); // Perform initialization here sc_in_action = true; // copy array of pointers to keep allocated pointers for later release std::vector<char*> argv_call = argv_copy; status = sc_main( argc, &argv_call[0] ); // Perform cleanup here sc_in_action = false; } catch( const sc_report& x ) { sc_report_handler::get_handler() ( x, sc_report_handler::get_catch_actions() ); } catch( ... ) { // translate other escaping exceptions sc_report* err_p = sc_handle_exception(); if( err_p ) sc_report_handler::get_handler() ( *err_p, sc_report_handler::get_catch_actions() ); delete err_p; } You can see there is a broader catch( ... ) statement which is causing the exception to be handled instead of being thrown.
    You can possibly try writing you own main function but will need to take care of additional SystemC kernel initialization sequences.
    Hope this helps.
    Regards,
    Ameya Vikram Singh
  4. Like
    Allen yang reacted to David Black in How to select fitable communication methods in SC?   
    The general SystemC way of doing things is to use ports, whether builtin, TLM-2, or convenience. Prefer TLM-2 over custom solutions when possible. With respect to the selection of channels, it is highly dependent on what you are modeling. There is no one way that is "the right way". You should prefer higher levels of abstraction in general for several reasons:
    Easer to understand Higher performance Faster to code What should you avoid? Low-level communications generally (e.g., sc_signal). Signals are fine for limited applications, but too often I see folks writing RTL with SystemC. RTL should be done with SystemVerilog or VHDL, which are designed for this and have many features to enhance performance.
     
  5. Like
    Allen yang reacted to Eyck in SC_METHOD use next_tirgger() delay time once like SC_THREAD use wait()   
    When posting code it is best to show an example using https://www.edaplayground.com. I copied part of ypur code at https://www.edaplayground.com/x/NSAs
    The problem is the missing initialization of m_trigger_flag. Depending of your build settings and many more factors it might be true or false. When being false the method is only executed during the initial evalauation phase....
  6. Like
    Allen yang reacted to Eyck in Can we use smart pointer in peq_with_get?   
    One example is a APB initiator:
    https://github.com/Minres/SystemC-Components/blob/develop/src/bus_interfaces/apb/pe/apb_initiator.cpp#L40 for the notification and
    https://github.com/Minres/SystemC-Components/blob/develop/src/bus_interfaces/apb/pe/apb_initiator.cpp#L63 for pulling entries
  7. Like
    Allen yang reacted to Eyck in Can we use smart pointer in peq_with_get?   
    I don't think so. Although you call notify with a reference it internally stores the pointer to to the object. You as modeler are in charge of the lifetime of the object pointed to. So if you have a shared_ptr with local lifetime (which is the use-model of a shared_ptr) the peq has a danglng pointer once the local shared_ptr is destroyed (not the object it pointed to).
    This is one reason we wrote our own peq at https://github.com/Minres/SystemC-Components/blob/main/src/sysc/scc/peq.h
×
×
  • Create New...