user456 Posted September 28, 2013 Report Share Posted September 28, 2013 Hi there , I am about implementing a directories based cache coherence protocol in systemc But when i try to use the FIFO channel i couldn't know how it works(methods,linking...) can anyone suggest a tutorial or something like I appriciate your feedback; thx in advance Annossyenudge 1 Quote Link to comment Share on other sites More sharing options...
Rahul Posted September 28, 2013 Report Share Posted September 28, 2013 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 Quote Link to comment Share on other sites More sharing options...
user456 Posted September 28, 2013 Author Report Share Posted September 28, 2013 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 Quote Link to comment Share on other sites More sharing options...
bennygato Posted November 29, 2013 Report Share Posted November 29, 2013 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. Quote Link to comment Share on other sites More sharing options...
user456 Posted December 14, 2013 Author Report Share Posted December 14, 2013 hi bennygato; In fact i advise you to download "IEEE Standard for Standard SystemC® Language Reference Manual" it help you understanding . hope it help Quote Link to comment Share on other sites More sharing options...
dakupoto Posted December 15, 2013 Report Share Posted December 15, 2013 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. 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.