ankitks Posted January 19, 2017 Report Share Posted January 19, 2017 I created vector of fifos: sc_vector<sc_fifo> fifos; and in my constructor: template <unsigned S> class my_chnl : public my_chnl_if, public sc_channel { sc_vector<sc_fifo> fifos; //vectors of fifos //----------------------------------------------------------- public: //----------------------------------------------------------- //constructor //----------------------------------------------------------- explicit my_chnl(sc_module_name nm, unsigned _size = 4) : sc_channel(nm), fifos("FIFO") { fifos.init(S, _size); } ..... I am getting compile error saying that include/sysc/utils/sc_vector.h:634: error: \u2018c\u2019 cannot be used as a function If I do fifos.init(S), it works, but I get default size of 16. How do I set custom size? Any help? Thanks Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted January 20, 2017 Report Share Posted January 20, 2017 It seems you are using the sc_vector<>.init method incorrectly. As per the source from sc_vector.h you are trying to pass _size as a function pointer (Creator function). Can you make modifications from: explicit my_chnl(sc_module_name nm, unsigned _size = 4) : sc_channel(nm), fifos("FIFO") to: explicit my_chnl(sc_module_name nm, unsigned _size = 4) : sc_channel(nm), fifos("FIFO", _size) Also sc_fifo is template class what type are you specializing it to? If you are creating to a vector of sc_fifo of int datatype your declaration should be: sc_vector<sc_fifo<unsigned int> > fifos; //vectors of fifos Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
ankitks Posted January 20, 2017 Author Report Share Posted January 20, 2017 Hello, _size is not the size of sc_vector which I am already setting by passing S. _size is the size of buffer inside each sc_fifo. sc_fifo constructor takes size argument and I don't know how to pass that argument. Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted January 20, 2017 Report Share Posted January 20, 2017 Hello, Sorry for misunderstanding the problem. But your problem seems to be too similar to the topic discussed here. Specifically the comments: Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
ralph.goergen Posted January 20, 2017 Report Share Posted January 20, 2017 Hi. If you want to pass arguments to the constructor of the elements of an sc_vector, you need a custom creator. See SystemC LRM IEEE:1666 Section 8.5.5 for details and examples. A very easy way to realize custom creator by using a Lambda function is presented here: https://www.researchgate.net/publication/284731273_Automated_SystemC_Model_Instantiation_with_Modern_C_Features_and_sc_vector Greetings Ralph AmeyaVS 1 Quote Link to comment Share on other sites More sharing options...
ankitks Posted January 20, 2017 Author Report Share Posted January 20, 2017 I don't have C++11 features. Can I still go with custom creator approach. Quote Link to comment Share on other sites More sharing options...
ralph.goergen Posted January 23, 2017 Report Share Posted January 23, 2017 Yes you can. If you do not have a chance to update your compiler, you can still use one of the two methods mentioned in the IEEE1666 SystemC LRM Section 8.5.5: A creator function object or a member function. Both solutions are not as compact as the Lambda solution, but they do not require any C++11 feature. Quote Link to comment Share on other sites More sharing options...
ankitks Posted February 9, 2017 Author Report Share Posted February 9, 2017 Thanks. Got that to work! 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.