kimjhun310 Posted April 15, 2013 Report Share Posted April 15, 2013 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, Quote Link to comment Share on other sites More sharing options...
David Long Posted April 16, 2013 Report Share Posted April 16, 2013 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 Quote Link to comment Share on other sites More sharing options...
kimjhun310 Posted April 16, 2013 Author Report Share Posted April 16, 2013 Thanks, it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.