plafratt Posted May 20, 2021 Report Share Posted May 20, 2021 I am using a tlm_fifo. When I put() into it and then immediately call nb_can_get(), it is returning false. Is this an invalid use of the tlm_fifo to call put() and nb_can_get() in the same delta? Or, have I made a mistake somewhere? Quote Link to comment Share on other sites More sharing options...
Eyck Posted May 20, 2021 Report Share Posted May 20, 2021 Neither is the case. Between putting an element into the fifo and the element becoming available is at least a delta cycle. And this is by design as in hardware it takes some time for values to propagate. sc_core::sc_fifo exposes the same behavior. If you need immediate update you can use ordinary C++ containers like std::dequeue... Quote Link to comment Share on other sites More sharing options...
plafratt Posted May 20, 2021 Author Report Share Posted May 20, 2021 Well, I'm not sure something like deque will provide what is needed, because I still need process notifications when an entry is written or read. I think what I am not seeing is how to write into the fifo and then block the writer until the reader reads from it. I can write something custom based on deque or something else (or look for another class in sc_core or tlm) to provide this, but wanted to be sure that tlm_fifo didn't provide this first. Quote Link to comment Share on other sites More sharing options...
Eyck Posted May 21, 2021 Report Share Posted May 21, 2021 tlm_fifo provides a blocking read called get() as well as an event to use: ok_to_get(). To block the writer you can use ok_to_put() which is triggered when the fifo is read. plafratt 1 Quote Link to comment Share on other sites More sharing options...
plafratt Posted June 4, 2021 Author Report Share Posted June 4, 2021 Great, thank you. I was aware of ok_to_put(), but I think I had some confusion about how to use it in my situation. It looks like it should do what I need. Thanks! 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.