Jump to content
kimjhun310

sc_event_or_list compile error in systemC 2.3

Recommended Posts

I'm using the follwing function. but there is a compile error in systemC 2.3. How to fix it?

 

struct M: sc_module
{
  sc_port<i_f, 0> p; // Multiport

  sc_event_or_list& all_events() {
    sc_event_or_list& or_list = p[0]->event() | p[0]->event();
    for (int i = 1; i < p.size(); i++)
      or_list | p->event();
    return or_list;
  }
  ...
  wait(all_events());
  ...
 

The compile error is

"error: invalid initialization of non-const reference of type ?sc_core::sc_event_or_list&? from a temporary of type ?sc_core::sc_event_or_expr?"

 

Thanks,

 

Share this post


Link to post
Share on other sites

Hi,

 

In SystemC 2.3 you can create an object of type sc_event_or_list - it is not necessary to use the "work-around" from SystemC 2.2 that creates a reference to an event or list (and in fact, this no longer works, as you have found).

 

You could re-write your code along the following lines:

struct M: sc_module
{
  sc_port<if,0> p; // Multiport

  void end_of_elaboration() {  
    //create event list once all ports are bound
    for (int i = 0; i < p.size(); i++)
      all_p_events |= p[i]->value_changed_event();
  }

...
        wait(all_p_events);
...

private:
    sc_event_or_list all_p_events;
};
 

 

 

Regards,

Dave


 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×