Jump to content
Effiong

Read from buffer without removing content

Recommended Posts

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

Share this post


Link to post
Share on other sites

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() {..}

Share this post


Link to post
Share on other sites

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.

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