Jump to content

sc_event_or_list compile error in systemC 2.3


kimjhun310

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,

 

Link to comment
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


 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...