KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [systemc-forum] sc_spawn help (passing arguments of user defined dat
|
Message Thread:
Previous |
Next
|
- To: "Philipp A. Hartmann" <philipp.hartmann@xxxxxxxx>
- From: yoman yoman <saynotosystemc@xxxxxxxxx>
- Date: Sun, 31 Oct 2010 20:43:04 -0700
- Cc: systemc-forum@xxxxxxxxxxxxxxxxx
- Send Email to systemc-forum@lists.systemc.org:
- Send new message
- Reply to this message
|
Hi Philipp
Thanks for replying.
Is there any limit on passing pointers to spawned process ?
Incase I want to send 2 or 3 member pointer variables, it it possible ?
SC_MODULE(MOD){
public :
class X *X1, *X2,
class Y *Y1, *Y2;
void my_thread(X X1, Y Y1);
SC_HAS_PROCESS(MOD);
MOD(sc_module_name name):sc_module(name){
if(condition)
sc_spawn(X1, Y1);
sc_spawn( sc_bind( &MOD::my_thread, this, X1,Y1 ) );
}
On Fri, Oct 29, 2010 at 4:56 AM, Philipp A. Hartmann <
philipp.hartmann@xxxxxxxx> wrote:
> On 29/10/10 13:49, yoman yoman wrote:
> >
> > I have a systemc module containing 2 member variables of a same user
> defined
> > data types.
> > At run time, based on some condition, my SC_THREAD (invoked dynamically
> or
> > statically) will make use only one of them.
> > Is it possible to invoke a thread passing a user defined data type as
> > argument ?
>
> Yes, you can use sc_bind for that. See below (untested).
>
> Greetings from Oldenburg,
> Philipp
>
> > SC_MODULE(MOD){
> > public :
> > class X *ptr1, *ptr2,
> > void my_thread(X ptr);
> > SC_HAS_PROCESS(MOD);
> > MOD(sc_module_name name):sc_module(name){
> > if(condition)
> > sc_spawn(ptr1);
>
> sc_spawn( sc_bind( &MOD::my_thread, this, ptr1 ) );
>
> > else
> > sc_spawn(ptr2);
> >
> > }
> > void my_thread(X ptr){
> > < use of any of of the ptr>
> > }
> >
> > };
> >
>
>
> --
> 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
> Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · http://www.offis.de/
>
>
|
|