Ramarao V Posted February 18, 2019 Report Share Posted February 18, 2019 Hi, All there are 10 array of systemc events sc_event e[10]; and there is a systemc process which is sensitive above mentioned 10 events my doubt is how can i know which event triggered my process Quote Link to comment Share on other sites More sharing options...
David Black Posted February 18, 2019 Report Share Posted February 18, 2019 Simple answer: there really is no straightforward way to do this. Of course if you wanted to get into the internals of the SystemC implementation, it is possible; however, that completely violates the standard. As to why this is not allowed: performance. The desire to have efficiency overrides the desire for corner cases such as yours. How can you work around this? Several possible approaches, but here one I would use: Create a new event class that adds tracking and an API to access it. This is easy to do if you know your C++ and SystemC well enough. Trivial outline of concept:: static const sc_core::sc_process_handle NONEXISTANT; struct Tracked_Event { void notify( void ); // sets m_process_handle and notifies m_event void notify( sc_core::sc_time delay ); // same except waits for delay sc_process_handle get_trigger( void ) { return m_process_handle; } void clear( void ) { m_process_handle = NONEXISTANT; }; private: sc_core::sc_event m_event; sc_core::sc_processhandle m_process_handle; }; struct Event_array { Event_array( int depth ); void wait( void ); // clears all m_process on entry, then waits for an m_event Tracked_event operator[]( int ); sc_vector<sc_core::sc_process_handle> get_trigger_list( void ); private: sc_vector<Tracked_Event> m_event_array; sc_core::uint64 m_delta_count; }; Ramarao V 1 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted February 19, 2019 Report Share Posted February 19, 2019 SystemC 2.3.2 (and later) does support a query whether an event was triggered in the previous delta cycle (or immediately in the current evaluation cycle). This is similar to the sc_signal<>::event() function. With this, you can ask every element in your array, whether it was triggered and may have caused a wakeup of the process. Of course, multiple events can have triggered simultaneously and will only cause a single wakeup of the process. for( const auto ev& : e ) { if ( ev.triggered() ) { // ... } } Hope that helps, Philipp David Black, Ramarao V and maehne 1 2 Quote Link to comment Share on other sites More sharing options...
David Black Posted March 11, 2019 Report Share Posted March 11, 2019 Responding to Phillip: I'm guessing this is coming up for the next update of the standard and is currently under consideration. I guess I need to find more time to get synced up to the latest additions since 2.3. Quote Link to comment Share on other sites More sharing options...
R.Adiga Posted July 24, 2019 Report Share Posted July 24, 2019 On 2/19/2019 at 6:03 PM, Philipp A Hartmann said: SystemC 2.3.2 (and later) does support a query whether an event was triggered in the previous delta cycle (or immediately in the current evaluation cycle). This is similar to the sc_signal<>::event() function. With this, you can ask every element in your array, whether it was triggered and may have caused a wakeup of the process. Of course, multiple events can have triggered simultaneously and will only cause a single wakeup of the process. for( const auto ev& : e ) { if ( ev.triggered() ) { // ... } } Hope that helps, Philipp Hi Philipp, This is a great one!, How can we come to know about the new features being added in every new release? Thanks Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted July 24, 2019 Report Share Posted July 24, 2019 7 hours ago, R.Adiga said: How can we come to know about the new features being added in every new release? If your company is an Accellera member already, I encourage you to join the SystemC language working group. Otherwise, you can find some documentation about the changes in the RELEASENOTES file of each release (although this particular feature seems to miss an entry :-/). 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.