Mat Posted May 23, 2019 Report Share Posted May 23, 2019 I have recently started learning SystemC and I have got an error with sensitivity list in "SC_METHOD". I am trying to implement a fifo and the error corresponds to following part of the code: SC_MODULE(fifo){ ... sc_int<8> rd_addr, wr_addr; ... void buffer_full(); ... SC_CTOR(fifo){ SC_METHOD(buffer_full); sensitive << rd_addr << wr_addr; } }; I get error when compiling the code and it complains about sensitivity list. I would appreciate if someone could let me know what is wrong with the sensitivity list. how should I make "buffer_full" process sensitive to the changes in rd_addr and wr_addr. I also tried following syntax to see if it works with single bit sensitivity but still no success sensitive << rd_addr[0]; Many thanks Quote Link to comment Share on other sites More sharing options...
DS1701 Posted May 23, 2019 Report Share Posted May 23, 2019 sensitive<< rd_addr I think above code is illegal. You can declare event. If new value rd_addr != old value rd_addr then notify event . Quote Link to comment Share on other sites More sharing options...
David Black Posted May 23, 2019 Report Share Posted May 23, 2019 You can only specify sensitivity on objects that have events or event finders directly accessible at the time of construction. Normally this means using either a suitable channel, port or explicit event. If you wrap your int's with a channel such as sc_signal<T>, you can do it. Example - https://www.edaplayground.com/x/5vLP maehne and DS1701 2 Quote Link to comment Share on other sites More sharing options...
DS1701 Posted May 27, 2019 Report Share Posted May 27, 2019 On 5/23/2019 at 5:01 PM, David Black said: You can only specify sensitivity on objects that have events or event finders directly accessible at the time of construction. Normally this means using either a suitable channel, port or explicit event. If you wrap your int's with a channel such as sc_signal<T>, you can do it. Example - https://www.edaplayground.com/x/5vLP Hi @David Black, If I have sc_event event1; sc_event event2; ... SC_METHOD( My_method ); sensitive << event1 << event2; dont_initialize(); How to detect My_method sensitive by event1 or event2? Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted May 27, 2019 Report Share Posted May 27, 2019 53 minutes ago, TRANG said: How to detect My_method sensitive by event1 or event2? In SystemC 2.3.2 and later, you can use the sc_event::triggered() member function to query, if an event was triggered (and thus might have caused your method to run): if( event1.triggered() ) { std::cout << "event1 got triggered"; } if( event2.triggered() ) { std::cout << "event2 got triggered"; } Please note that if both events were triggered in/for the same evaluation phase, your method might well be run only once. DS1701 1 Quote Link to comment Share on other sites More sharing options...
DS1701 Posted May 27, 2019 Report Share Posted May 27, 2019 36 minutes ago, Philipp A Hartmann said: In SystemC 2.3.2 and later, you can use the sc_event::triggered() member function to query, if an event was triggered (and thus might have caused your method to run): if( event1.triggered() ){ std::cout << "event1 got triggered"; } if( event2.triggered() ){ std::cout << "event2 got triggered"; } Please note that if both events were triggered in/for the same evaluation phase, your method might well be run only once. I can't see that because my lib is 2.3.1. So, with 2.3.1, we don't have a solution. Thank Philipp. Quote Link to comment Share on other sites More sharing options...
David Black Posted May 28, 2019 Report Share Posted May 28, 2019 @TRANG you are correct re. 2.3.1 not having a built-in solution; however, you can manage it yourself prior to 2.3.2 by creating flags associated with the events and clearing them in the following delta cycle yourself. In other words, you can implement the same code as 2.3.2 with a bit of effort. 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.