Jump to content
plafratt

sc_fifo data_read_event

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

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