Our forums have moved! Please go to http://forums.accellera.org for the new forums. The forums you see here will remain open for browsing, but are no longer open to new posts.
KMLM List
View email archives for the history of this mailing list.
|
|
|
|
systemc-forum - Re: [systemc-forum] Help with sc_spawn()
|
Message Thread:
Previous |
Next
|
- To: Suhas Satya <suhas.satya@xxxxxxxxx>
- From: "Philipp A. Hartmann" <philipp.hartmann@xxxxxxxx>
- Date: Sun, 19 Feb 2012 19:31:05 +0100
- Cc: "systemc-forum@xxxxxxxxxxxxxxxxxxx" <systemc-forum@xxxxxxxxxxxxxxxxxxx>
- Send Email to systemc-forum@lists.accellera.org:
- Send new message
- Reply to this message
|
Suhas,
On 19/02/12 14:27, Suhas Satya wrote:
>
> I have been trying to use sc_spawn() in my project. I could use it with
> simple examples but the problem I have been facing while using it with
> me project is:
I'm not sure if I understand your question correctly. But it seems
unrelated to sc_spawn per se. sc_spawn (or rather sc_bind) is just a
way to execute some behaviour asynchronously (i.e. in a separate SystemC
process).
> The function I am trying to spawn is a global function. One of the
> parameters to this function is the reference to an object of a template
> class.
So the global function is a function template as well?
How would you call the function directly, without using sc_spawn?
> The parameters to this template are decided within the same
> class(es) which spawn the global function. Hence the issue that I am not
> able to figure out how I can have this parameter visible to the global
> function, when the template parameter to the object is only decided
> within the same class which spawns the global function, itself.
Assuming that the global function is a template like this:
template< typename T >
void global_function( T const& );
Then you should be able to use this function with sc_spawn by explicitly
giving the template parameters in the function pointer:
sc_spawn( sc_bind( global_function<some_class>, some_object ) );
> I was wondering if there was a workaround? May be through inheritance or
Inheritance might be another option.
It depends on the signature of the global function.
> some other way to treat the function to be spawned as non-global? I
I don't know what you mean by "non-global". You can of course have a
static function within each of the spawning classes.
> request you all for your opinions and possible solutions. I can post
> some sample code, if required. Looking forward to your kind responses.
Yes, sample code would have been helpful. It's always easier to
understand the question, if you at least sketch your problem with a few
lines of code. It's even better to send a small, compilable (if
possible), and self-contained example that can then be tried by others.
Greetings from Oldenburg,
Philipp
--
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://www.offis.de/
Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · Skype: phi.har
|
|