Effiong Posted December 4, 2015 Report Share Posted December 4, 2015 Hi all, I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ? sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data. Thanks Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted December 6, 2015 Report Share Posted December 6, 2015 Hi all, I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ? sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data. Thanks As I remember, sc_fifo does not have that. But you can create a derived class from sc_fifo with a method to pick value w/o modifying data pointers: something like: T pick() {..} Quote Link to comment Share on other sites More sharing options...
dakupoto Posted December 8, 2015 Report Share Posted December 8, 2015 Hi all, I want to be able to read an element from a "buffer-like" data structure without removing it. Is there a systemc structure for that ? sc_fifo "nb_read() and read()" methods removes the element from the buffer. I want to be able to decide when to remove or not remove the data. Thanks Hello Sir, A separate buffer nay be created, and the contents of the first buffer copied to the second for examining the contents. In fact, a remarkable core C language function "memcpy" can used to copy any number of bytes from the source to the destination. On any Linux box, type 'man memcpy' at the command prompt, for more details. Buffers may be cleared with the "memset" function. Maybe this might work for you. Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted December 8, 2015 Report Share Posted December 8, 2015 You can use tlm_fifo<T>::(nb_)peek for that, see IEEE 1666-2011 (17.3). hth, Philipp apfitch 1 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.