KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [systemc-forum] How to pass name to hierarchy modules.
|
Message Thread:
Previous |
Next
|
- To: "Philipp A. Hartmann" <philipp.hartmann@xxxxxxxx>
- From: Smith lels <lerlssmith@xxxxxxxxx>
- Date: Fri, 15 Jul 2011 11:43:55 +0200
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to systemc-forum@lists.systemc.org:
- Send new message
- Reply to this message
|
Hi:
And I see it also works with public derive two sc_module?
So
"you are trying to inherit multiple times from sc_module. In short, this
is not allowed in SystemC"
why I still can run?
#include <iostream>
#include "systemc"
#include <vector>
using namespace std;
using namespace sc_core;
class a: public sc_module {
public:
void run(){
cout<<"I am here in a"<<endl;
};
SC_HAS_PROCESS(a);
a(sc_module_name na):sc_module ("a"){SC_THREAD(run)};
};
class b: public sc_module {
public:
void test(){
cout<<"I am here in b"<<endl;
}
SC_HAS_PROCESS(b);
b(sc_module_name na):sc_module ("b"){SC_THREAD(test);};
};
class c: public a, public b {
public:
c(sc_module_name na):a(na),b(na){};
};
int sc_main ( int argc, char **argv ) {
c m1("master1");
sc_start();
return 0;
}
Thank you very much
On 7/15/11, Smith lels <lerlssmith@xxxxxxxxx> wrote:
> Hi:
>
> Thanks. But here is the situation.
>
> class A and B are the interfaces file for C.
>
> The original code is that "class C : public A, public B...."
>
> And we are to add Systemc interface to A & B, and we do not want to
> make any changes to C since C shall be reused in other modules.
>
> So if I use the sub modules, the function calls in C need to be changed.
>
> Do you have any other idea for the structure?
>
> Thank you very much
>
> Simith.
>
>
> On 7/15/11, Philipp A. Hartmann <philipp.hartmann@xxxxxxxx> wrote:
>> On 15/07/11 10:27, Smith lels wrote:
>>>
>>> Is "Use sub-modules" means like:
>>>
>>> class c : public sc_module {
>>>
>>> a *a1;
>>> b *b1;
>>>
>>> c(sc_module_name na): sc_module (na) {
>>>
>>> a1 = new a ("master_a");
>>> b1 = new b ("master_b");
>>> }
>>
>> If you insist on using pointers and dynamic allocation, yes.
>> I usually prefer to use direct members:
>>
>> SC_MODULE(c)
>> {
>> a a1;
>> b b1;
>>
>> SC_CTOR(c)
>> : a("master_a")
>> , b("master_b")
>> {}
>> };
>>
>> Greetings from Oldenburg,
>> Philipp
>>
>>> On 7/15/11, Philipp A. Hartmann <philipp.hartmann@xxxxxxxx> wrote:
>>>> Simith,
>>>>
>>>> you are trying to inherit multiple times from sc_module. In short,
>>>> this
>>>> is not allowed in SystemC. Your naming problems are the least ugly
>>>> side-effects of this. Use sub-modules instead.
>>
>> [snip]
>>
>> --
>> Philipp A. Hartmann
>> Hardware/Software Design Methodology Group
>>
>> OFFIS Institute for Information Technology
>> R&D Division Transportation · FuE-Bereich Verkehr
>> Escherweg 2 · 26121 Oldenburg · Germany · http://offis.de/en/
>> Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · Skype: phi.har
>>
>>
>
|
|