Jump to content
Mat

sensitivity list

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
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...