Ganesan R Posted May 15, 2018 Report Share Posted May 15, 2018 I understand that an array of sc_module objects cannot be created even in a vector as sc_ctor requires a char* argument. For example suppose that fifog is defined as sc_module object. Then sc_vector<fifog>fifog("fifogarray",4) will not create an array four of fifog object as fifogarray is not a unique name. My VS2012 throws a warning that object fifogarray already exists on subsequent loops and instead names the instances as fifogarray[0], fifogarray[1] etc. Moreover if fifog contains sc_processe sc_method functions, how they can be invoked on each unique instances of object? Even if I ignore that VS2012 warning, will the sc_method operate on each object instance individually? Pl. help. Eager to go through your replies. Simple example will help as I am newbie both to C++ and SystemC. Quote Link to comment Share on other sites More sharing options...
AmeyaVS Posted May 15, 2018 Report Share Posted May 15, 2018 Hello @Ganesan R, It seems you are trying to achieve the vector of vector instance, something like this: sc_vector < sc_vector < your module > > You can find necessary discussion on this here: http://forums.accellera.org/topic/5616-initialization-of-nested-sc_vector-sc_vector/ Without sample code it is very difficult to discern the scenario you are trying to replicate. Can you provide some minimal sample code? Regards, Ameya Vikram Singh Quote Link to comment Share on other sites More sharing options...
Ganesan R Posted May 15, 2018 Author Report Share Posted May 15, 2018 Thanks Ameya Singh. I am attaching relevant code herewith. If I can get your contact details, I can get in touch with you as I need a lot of help. R. Ganesan fifog_13May2015_error.txt Quote Link to comment Share on other sites More sharing options...
Ganesan R Posted May 15, 2018 Author Report Share Posted May 15, 2018 Somehow I was able to get this work. But I have only one difficulty right now: How to access the member of individual class object in the attached file It is sc_vector of fifog elements of four. fifo_pointer should be accessible in c++ like this. What is the problem with me? fifog32[0].fifo_pointer Any help will be deeply appreciated as I am heavily struck up. R. Ganesan (Pl. ignore earlier post I was able to get new sc_vector(fifog,4) with constant size) fifog_15May_end_mod.txt Quote Link to comment Share on other sites More sharing options...
Eyck Posted May 15, 2018 Report Share Posted May 15, 2018 Hi, it seems you lack a basic understanding of C/C++ visibility of variables. As fifog32 is declared a local variable in sc_main you can only access it in sc_main, it is unknow in any other function. BR Quote Link to comment Share on other sites More sharing options...
Ganesan R Posted May 15, 2018 Author Report Share Posted May 15, 2018 Thanks Eyck that helped Suppose sc_vector<fifog>fifog32("fifog32",4) is declared in SC_main fifog constructor is called four times But fifog32[0].FIFO_pointer is not working even in SC_main How to get fifog32[0].FIFO_pointer? Eager n thanking you 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.