Jump to content

running sc_run two times


jsmith125x

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.

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...