Home > Community > Blogs > System Design and Verification > how to save os boot time in your systemc virtual platform with save and restore
 
Login with a Cadence account.
Not a member yet?
Create a permanent login account to make interactions with Cadence more conveniennt.

Register | Membership benefits
Get email delivery of the System Design and Verification blog (individual posts).
 

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

How to Save OS Boot Time In Your SystemC Virtual Platform With Save and Restore

Comments(0)Filed under: System simulation and analysis, System Design and Verification, Hardware/software co-verification, Incisive, QEMU, open virtual platforms, virtual platform, QEMU virtual platform, SystemC, SystemC analysis, George FrazierOne advantage of using a virtual platform or virtual prototype over real hardware for embedded software development and testing is the ability of some simulators to save snapshots of their state. If your processor model is detailed enough, it might take several minutes (or even hours) to simulate booting the OS. If you save a snapshot of your simulation just after you’ve finished booting, each time you want to run your embedded software you can simply restore the snapshot and go. Restarting a snapshot typically takes a few seconds. This can translate into a major productivity gain, especially if you’re running a thousand short software tests on the processor.

Save and restore (or restart) has existed in HDL simulators for years, but things are trickier if SystemC is involved. For one thing, SystemC simulators use external tools for compilation and linking: i.e. gcc. They have more or less a “black box” understanding of global variables, local variables, file descriptors and heap values that make up the simulation state at any point in time. When you throw in multiple threads implemented with application-level threading packages and the fact that C++ heap objects are impractical to save programmatically, it’s easy to see why save and restore tools for HDL simulators can’t be easily extended for SystemC.

Beginning with version 6.2 of the Cadence Incisive Simulator (released in mid-2007), Incisive SystemC has supported the ability to save and restart simulation sessions for designs that include not only SystemC, but any combination of SystemC, VHDL, Verilog, and System Verilog. Currently the capability exists on Linux platforms.

Incisive implements save by storing a snapshot of the simulation state to a file. The state is restored when the saved snapshot file is used to start a new process. To save a snapshot from the command line, use the Tcl save command:ncsim> save saved_snap.

To save a snapshot from Simvision, choose "Save Checkpoint" from the simulation menu:


Saving a new snapshot

 

To restore, you can launch Incisive from the command line with the name of saved snapshot.  For example:

georgef% ncsim -input sim.tcl saved_snap

You can also use the Tcl restart command to restore a snapshot if you are using the command line interface (restart is not supported in Simvision, you should use reinvoke instead):

ncsim> restart saved_snap

This saved state is separate from the state of the simulation environment, so you can launch a new session with the saved snapshot and vary simulation parameters by passing different arguments to ncsim. This is a great way to test different scenarios from a known “safe” point before a problem occurs.

There are a few things to keep in mind with SystemC save / restart.  During restart, all internal variables inherit the same values from the process as it existed at the time of save (for example, C variables declared static). While this behavior helps assure that SystemC state information is properly saved and restored, it can also leave variables that reference the process environment (like file descriptor and sockets to other processes) in limbo.  In my next post I'll show you how to handle these kinds of issues and point out some other things you should be aware of when using SystemC save / restart.

Comments(0)

Leave a Comment


Name
E-mail (will not be published)
Comment
 I have read and agree to the Terms of use and Community Guidelines.
Community Guidelines
The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.