Jump to content

user456

Recommended Posts

Though i am not an expert in a systemC. i can provide some information about sc_fifo and its methods and usage.

 

 
CHANNELS IN SYSTEM C
 
•A channel implements one or more interfaces, and serves as a container for communication functionality
•Different channels may implement the same interface in different ways
•A channel may implement more than one interface
•A channel may be connected to more than two modules
•A distinction is made between primitive channelsand hierarchical channels
 
Primitive channels:
 
sc_fifo is type of Primitive channels used largely in systemC
 
•A channel is primitive when it does not contain any hierarchy or process
•All primitive channels are derived from the base class called sc_prim_channel
•SystemC contains several built-in channels. The simplest are: sc_signal, sc_mutex, sc_semaphore and sc_fifo
 
sc_fifo
By default, an sc_fifo<> has a depth of 16. The data type (i.e.,typename) of the elements also needs to be specified. An sc_fifo may contain any data type including large and complex structures
 
Implements interface: sc_fifo_in_if, sc_fifo_out_if
 
Methods:
 
nb_read() Non-blocking read, returns bool, false if fifo is empty, true if read successful
 
read()  Returns current value of signal . Blocking for sc_fifo
 
read(port/signal) Returns void, current value of signal is stored in port_or_signal. Blocking for sc_fifo
 
operator=()  Assignment operator For convenience, does a write()
 
write(val) Schedules val to be written to the signal at the next update phase. Blocking for sc_fifo
 
nb_write(val) Non-blocking write, returns bool, false if fifo is full, true if write successful
 
num_free()  Returns int, number of remaining elements that can be written before fifo is full
 
num_available() Returns int, number of elements that are in the fifo
 
kind() Returns channel type (sc_buffer or sc_fifo etc)
 
 
Custom ports: sc_fifo_in<T>, sc_fifo_out<T>
 
 
Specify fifo depth in sc_main:  sc_fifo<T> f(10);  //Depth is 10
 
Specify fifo depth in a module: SC_CTOR(module_name): f(10)

 

 

 

Regards

Rahul

Link to comment
Share on other sites

thx Rahul , I appreciate that 

 

 

But one more question how should I link the ports :

 

I mean if I have N ports and want to link them to this FIFO

suppose we have:

 

SC_MODULE(module)

{

sc_out<bool> exit;

 

SC_CTOR(module)

{

...

}

~module;

}

 

in my main:

sc_fifo<int> my_fifo(N);

 

module M1;//suppose have N object type module

 

how to link the ports of the N modules to my_fifo ?

 

thx in advance

Link to comment
Share on other sites

  • 2 months later...

thx Rahul , I appreciate that 

 

 

But one more question how should I link the ports :

 

I mean if I have N ports and want to link them to this FIFO

suppose we have:

 

SC_MODULE(module)

{

sc_out<bool> exit;

 

SC_CTOR(module)

{

...

}

~module;

}

 

in my main:

sc_fifo<int> my_fifo(N);

 

module M1;//suppose have N object type module

 

how to link the ports of the N modules to my_fifo ?

 

thx in advance

 

I also have the same question. have you figure out how to do it? thanks.

Link to comment
Share on other sites

  • 3 weeks later...

thx Rahul , I appreciate that 

 

 

But one more question how should I link the ports :

 

I mean if I have N ports and want to link them to this FIFO

suppose we have:

 

SC_MODULE(module)

{

sc_out<bool> exit;

 

SC_CTOR(module)

{

...

}

~module;

}

 

in my main:

sc_fifo<int> my_fifo(N);

 

module M1;//suppose have N object type module

 

how to link the ports of the N modules to my_fifo ?

 

thx in advance

Hello Sir,

Are you trying to have a N x M FIFO ? That is,

N input ports driving data into a FIFO, with M

output ports, and N > 1, M > 1.

I am afraid the latest SystemC does not support

this FIFO structure, and you would have to

create one of your own -- create your own

FIFO, with appropriate schemes that will

prevent data overwrites in the FIFO.

Currently, only 1 x N FIFOs are available.

As you might understand, a N x M FIFO is

a complete project by itself.

Hope that helps.

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