Jump to content
Ganesan R

System C quite different from c++

Recommended Posts

I have sc_module class fifog. What I want is an array of fifog in the fashion fifog[0],fifog[1] etc.

fifog fifogarray[2]={fifog("fifog231"),fifog("fifog232")} declare in sc_main will surely work in c++, but in system c it throws up an error
1> error C2248: 'sc_core::sc_module::sc_module' : cannot access private member declared in class 'sc_core::sc_module' even though I have all member functions and elements declared as public in fifog.

If that line is commented the program quite compiles and runs.

Why so?

You can check this in attached file.

Trying how to access data members of fifog[0], fifog[1] etc. in sc_main.

Any help will be deeply appreciated.

 

 

 

accelerra.txt

Share this post


Link to post
Share on other sites

First, the title of this post is completely nonsensical. SystemC is a library written in C++ and everything about it is C++. It is much more likely that you simply are not very proficient with C++. One aspect of SystemC I always warn newbies about is that SystemC uses pretty much all of the features of C++. You really cannot get by with just thinking C++ is merely a better C. You have to really know about polymorphism, function/operator overloading, templates, exception handling, STL libraries, and all things C++. If you do not, I suggest you get some deeper learning on C++.

Your problem is that sc_module disallows copy construction. Prior to C++11, this was accomplished by declaring the copy constructor private, which is why you are getting the error.

sc_vector really is a better way of creating an array of modules, and it looks as if somebody has given you this hint.

 

Share this post


Link to post
Share on other sites

Thank you Sir.

I finally got array of fifo objects after lot of efforts using SC_vector

I apologize for the title of the post, but I meant only what worked for c++ was not working for system c in that particular line. Again sorry.

The problem with beginners like me is that if something is not working we don't know what would have gone wrong. A lot of book reading is of little assistance in tracing out the error in  debugging the error.

This is where expert help is of timely assistance like Eyck comment yesterday.

Again lot of thanks for all of you as I am getting past my major hurdle.

Will keep posting any further problems I face in my design.

 

R. Ganesan

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×