Jump to content

what is sc_initialize()?


carter

Recommended Posts

You should not use sc_initialize().  It's deprecated and not part of the IEEE 1666 SystemC standard.

 

If you want to prepare the simulation without running it yet, your can complete the elaboration and run the initialization via

sc_start( SC_ZERO_TIME );

from within your sc_main() function. Afterwards, you can call sc_start multiple times again, e.g. with non-zero duration arguments, to perform the simulation itself.

/Philipp

Link to comment
Share on other sites

You should not use sc_initialize().  It's deprecated and not part of the IEEE 1666 SystemC standard.

 

If you want to prepare the simulation without running it yet, your can complete the elaboration and run the initialization via

sc_start( SC_ZERO_TIME );
from within your sc_main() function. Afterwards, you can call sc_start multiple times again, e.g. with non-zero duration arguments, to perform the simulation itself.

/Philipp

Thanks philipp

Link to comment
Share on other sites

You should not use sc_initialize(). It's deprecated and not part of the IEEE 1666 SystemC standard.

If you want to prepare the simulation without running it yet, your can complete the elaboration and run the initialization via

sc_start( SC_ZERO_TIME );
from within your sc_main() function. Afterwards, you can call sc_start multiple times again, e.g. with non-zero duration arguments, to perform the simulation itself.

/Philipp

Hi philipp.

I'm not sure about "If you want to prepare the simulation without running it yet".

Would you please let me know above case? I don't know the case about" to prepare the simulation without running" for what?

Link to comment
Share on other sites

See the IEEE 1666-2011 standard, chapter 4 for details about the SystemC elaboration and simulation semantics.

 

If you don't "need" to run the initialization phase separately, you don't need to worry about this detail.  The first invocation of sc_start will take care of completing the elaboration and initialization automatically.

There is an example in the SystemC standard (in section 4.5.7), which shows a simulation running in individual steps:
 

The function sc_pending_activity may return false at the end of elaboration. Therefore, care should be taken when calling sc_start in a loop conditional on any of the functions that detect pending activity.

Example:

int sc_main( int argc, char* argv[] )
{
  // Instantiate top-level module
  ...
  sc_start( SC_ZERO_TIME );        // Run the initialization phase to create pending activity
  
  while( sc_pending_activity() ) {
    sc_start( sc_time_to_pending_activity() ); // Run up to the next activity
  } 
  return 0;
}

 

In this example, you need the explicit initialization call.

/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...