plafratt Posted October 24, 2019 Report Share Posted October 24, 2019 I had been using the sc_fifo with the assumption that data_read_event would get notified whenever the receiver read from the fifo. However, I am seeing cases where the receiver reads from the fifo, but the data_read_event doesn't get notified. Is this the intended behavior? Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted October 24, 2019 Report Share Posted October 24, 2019 Here is how it is specified by standard: Quote virtual const sc_event& data_read_event() const; Member function data_read_event shall return a reference to an event, the data-read event, that is notified in the delta notification phase that occurs at the end of the delta cycle in which a value is read from the fifo. So it notified after each delta cycle where fifo was read. Can it be that your receiver does nb_read from empty fifo? Quote Link to comment Share on other sites More sharing options...
plafratt Posted October 24, 2019 Author Report Share Posted October 24, 2019 I'm actually using read(), rather than nb_read(). Given the specification you posted, it seems like something unexpected is happening. I can see the fifo is getting read (I put a log statement in after the read() call), but I don't see the thread that is waiting on data_read_event getting woken up (I put a log statement there, too). The thread that is waiting on data_read_event does eventually get woken up when the last item is read off the fifo. Quote Link to comment Share on other sites More sharing options...
plafratt Posted October 24, 2019 Author Report Share Posted October 24, 2019 I looked at the implementation of sc_fifo, as I'd guessed that in the read() function, it would just notify data_read_event, but the logic surrounding the notify looks a little more complex than that. Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted October 24, 2019 Report Share Posted October 24, 2019 Quote The thread that is waiting on data_read_event does eventually get woken up when the last item is read off the fifo. Did you probably forget to add wait() into consumer thread to suspend it after first read? plafratt 1 Quote Link to comment Share on other sites More sharing options...
plafratt Posted October 24, 2019 Author Report Share Posted October 24, 2019 That is it. Thank you very much. Regards, Patrick 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.