Jump to content

array of pointer to sc_fifo


GUEST

Recommended Posts

Hi,

I want to create an array of pointers to sc_fifo <unsigned int> (I get the size of each fifo during the simulation).

I tried to write:

sc_vector < sc_fifo <unsigned int> *> FIFOS;

in the ctor:    FIFOS.init(5);

and in another function make a dynamic memory allocation to each sc_fifo in the vector,

but it did not work, how can I write this?

Thanks

 

Link to comment
Share on other sites

@GUESTWhen you say the size of each FIFO is an input, do you mean to say that during simulation the maximum legal size of the FIFO's is a dynamically changing input? Or is it the case that each FIFO is a different maximum size that is determined at statically at time zero before the simulation gets beyond the elaboration phase? Your answer to this has a critical impact to the response. sc_fifo is a static hardware feature and the nature of hardware is that it may not be changed after fabrication (elaboration is the simulator terminology). If you are looking to model varying software inputs, you may be using the wrong structure. Perhaps you could use a tlm_fifo or you need to use a C++ fifo or a std::queue<T>. All of these are valid modeling ideas for SystemC.

Link to comment
Share on other sites

I mean that the maximum legal size of each FIFO in the array is a dynamically changing input per simulation -

I get the inputs (sizes) once during simulation , set the FIFOS once and don't change them again during simulation.

(I need to model a structure that is managed as FIFO so sc_fifo gives me all the features I need)

Link to comment
Share on other sites

@David BlackThank you for your answer! I understood the problem.

can you help me to understand this code?

image.png.e2622c08b8c31c3b3de95d95913cb64a.png

I saw in you wrote here   :   https://forums.accellera.org/topic/10-error-e113-insert-primitive-channel-failed-simulation-running/

"Any of your module has attempted to create an instance of a primitive channel (sc_signal, sc_fifo, etc) after the start of simulation.In systemC primitive channels can only be created before the start of simulation ."

So how can it be that the given code allocates memory to FIFO in main?

Link to comment
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...