Jump to content
jsmith125x

running sc_run two times

Recommended Posts

 

Hi,
 
int main(int argc, char* argv[])
{
	int a;

	a = sc_run(argc, argv);
	a = sc_run(argc, argv);
	return a;
}

I'd like to run sc_run more than one times. Is that possible? 

After the second run the a is 1, this is possible an error code.

 

Hello Sir,

One could use the sc_start(<args>); method to achieve

one's goal even more easily. For example, the simulator

is started with a set of inputs and sc_start is invoked for

10 nanoseconds. Then the input is changed, and sc_start

is invoked for another 10 nanoseconds and so on. Hope

that helps.

Share this post


Link to post
Share on other sites

Sorry I have this for sc_run

int sc_run( int argc, char* argv[] ) 
{
 return main( argc, argv );
}

So I'd like to run the whole simulation more times, but for the second time it returns with 1, it means probably an error code.

Share this post


Link to post
Share on other sites

Sorry I have this for sc_run

int sc_run( int argc, char* argv[] ) 
{
 return main( argc, argv );
}

So I'd like to run the whole simulation more times, but for the second time it returns with 1, it means probably an error code.

 

You probably call 'sc_main' within your 'sc_run' function, otherwise you have just built an infinite recursion.

Secondly, you should try to avoid the 'sc_' prefix in your own code.

 

That said, did you look at section 4 of the IEEE 1666-2011 standard, as I suggested in my previous answer?

Your 'sc_run' function is provided by SystemC already under the name sc_elab_and_sim (see 4.3.2).

 

From the standard's perspective, your question is partly answered already there. Quoting (emphasis mine):

 

Function sc_elab_and_sim shall initiate the mechanisms for running elaboration and simulation. The application should pass the values of the parameters from function main as arguments to function sc_elab_and_sim. Whether the application may call function sc_elab_and_sim more than once is implementation-defined.

 

The Accellera proof-of-concept implementation does not support multiple calls to 'sc_elab_and_sim'.

 

/Philipp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×