Jump to content

Example from the SystemC Verification Standard Specification doesn't work


Recommended Posts

Hello everyone,
I tried to use code from the SystemC Verification Standard
Specification. It can be found on page 46 and reads:

 

class my_module : public sc_module {
public:
        scv_smart_ptr<int> fsm_state;
        SC_CTOR(my_module) {
                fsm_state->register_cb(fsm_state_callback);
        }

       void fsm_state_callback(scv_extensions_if& data, scv_extensions_if::callback_reason r) {
               if ( r == scv_extensions_if::VALUE_CHANGE) {
                       cout << "The FSM state has been changed to : " << data << endl;
                       // write_to_the_database(data);
               }
       }
};

Compiling this with the respective haeders and libraries, I get the error.
my_mod.cpp: In constructor ‘my_module::my_module(sc_core::sc_module_name)’:
my_mod.cpp:11:42: error: no matching function for call to ‘scv_extensions<int>::register_cb(<unresolved overloaded function type>)’
 fsm_state->register_cb(fsm_state_callback);
                                          ^

I already searched for a solution and found that there seems to be a problem with:

pointer-to-member-function vs pointer-to-function are different and incompatible

This seems to be the case here as the definition of the function in the API reads:

virtual callback_h register_cb(
void (*f)(scv_extensions_if&, callback_reason)
) = 0;


In the above example I try to register a pointer-to-member-function to a pointer-to-function which leads to the error (as I understand it).
So is there any known solution to the problem?

Regards,
Florian

 

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...