KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - RE: [systemc-forum] deriving module from multiple module
|
Message Thread:
Previous |
Next
|
- To: "Gagandeep Khanna" <gagandeep@xxxxxxxxxxxxxxxx>, <systemc-forum@xxxxxxxxxxxxxxxxx>
- From: "Bradley, Mike" <mike_bradley@xxxxxxxxxx>
- Date: Fri, 29 Oct 2010 07:28:54 -0600
- Send Email to systemc-forum@lists.systemc.org:
- Send new message
- Reply to this message
|
Hi,
Generally speaking, an SC_MODULE is a block of hardware. So, while
in C++ you may be tempted to do multiple inheritance from two
SC_MODULES, I don't understand the usefulness of this for hardware
modeling.
Perhaps its better to either (1) have a non-sc_module class that you
can inherent from and into sc_modules (2) instantiate the sc_modules
into higher sc_modules, which is hardware instantiation.
It's funny there was just another post, of someone trying to do a
similar task. Is there some book or professor teaching this?
-Mike
From: systemc-forum@xxxxxxxxxxxxxxxxx
[mailto:systemc-forum@xxxxxxxxxxxxxxxxx] On Behalf Of Gagandeep Khanna
Sent: Friday, October 29, 2010 5:37 AM
To: systemc-forum@xxxxxxxxxxxxxxxxx
Subject: [systemc-forum] deriving module from multiple module
hii community,
I am a new to systemC and facing a problem of deriving a module from
multiple module.
I would like to ask that " How to Derive a module from multiple module?"
Though I tried to solve my problem in following way but I got few
errors mentioned below the given program
#include<systemc.h>
class base_module: virtual public sc_module
{
public:
sc_core::sc_event ev1;
void process(void)
{
}
SC_HAS_PROCESS(base_module);
base_module(sc_module_name nm):sc_module(nm)
{
SC_METHOD(process);
sensitive<<ev1;
}
};
class base_module2: virtual public sc_module
{
public:
sc_core::sc_event ev2;
void process2(void)
{
}
SC_HAS_PROCESS(base_module2);
base_module2(sc_module_name nm):sc_module(nm)
{
SC_METHOD(process2);
sensitive<<ev2;
}
};
class derived_module : public base_module, public base_module2
{
public:
SC_HAS_PROCESS(derived_module)
;
derived_module ( sc_module_name nm
):sc_module(nm),base_module(nm),base_module2(nm)
{
SC_THREAD(proc);
}
void proc()
{
ev1.notify();
ev2.notify();
}
};
----------------------------------error------------------------------
test.cpp: In constructor
'base_module::base_module(sc_core::sc_module_name)':
test.cpp:15: error: pointer to member conversion via virtual base
'sc_core::sc_module'
test.cpp: In constructor
'base_module2::base_module2(sc_core::sc_module_name)':
test.cpp:32: error: pointer to member conversion via virtual base
'sc_core::sc_module'
test.cpp: In constructor
'derived_module::derived_module(sc_core::sc_module_name)':
test.cpp:42: error: pointer to member conversion via virtual base
'sc_core::sc_module'
Gagan
Circuitsutra Pvt Ltd.
|
|